Name: localforage-module
Owner: Nuxt Community
Description: Localforage module for Nuxt.js
Created: 2018-02-21 09:18:50.0
Updated: 2018-05-02 04:13:35.0
Pushed: 2018-02-21 15:18:25.0
Homepage: null
Size: 134
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
@nuxtjs/localforage
dependency using yarn or npm to your project@nuxtjs/localforage
to modules
section of nuxt.config.js
dules: [
// Simple usage
'@nuxtjs/localforage'
nuxt.config.js
You can pass options in modules
dules: [
// With options
['@nuxtjs/localforage', {
driver : localforage.WEBSQL, // Force WebSQL; same as using setDriver()
name : 'myApp',
version : 1.0,
size : 4980736, // Size of database, in bytes. WebSQL-only for now.
storeName : 'keyvaluepairs', // Should be alphanumeric, with underscores.
description : 'some description'
}],
OR localforage object
calforage: {
driver : localforage.WEBSQL, // Force WebSQL; same as using setDriver()
name : 'myApp',
version : 1.0,
size : 4980736, // Size of database, in bytes. WebSQL-only for now.
storeName : 'keyvaluepairs', // Should be alphanumeric, with underscores.
description : 'some description'
The preferred driver(s) to use. Same format as what is passed to setStorageDriver()
, above.
Default: [localforage.INDEXEDDB, localforage.WEBSQL, localforage.LOCALSTORAGE]
The name of the database. May appear during storage limit prompts. Useful to use the name of your app here. In localStorage, this is used as a key prefix for all keys stored in localStorage.
Default: 'localforage'
The size of the database in bytes. Used only in WebSQL for now.
Default: 4980736
The name of the datastore. In IndexedDB this is the dataStore, in WebSQL this is the name of the key/value table in the database. Must be alphanumeric, with underscores. Any non-alphanumeric characters will be converted to underscores.
Default: 'keyvaluepairs'
The version of your database. May be used for upgrades in the future; currently unused.
Default: 1.0
A description of the database, essentially for developer usage.
Default: ''
More informations on LocalForage documentation
item = await this.$localForage.getItem(key)
t this.$localForage.setItem(key, value)
t this.$localForage.removeItem(key)
t this.$localForage.clear
length = await this.$localForage.length
k = await this.$localForage.key(keyIndex)
keys = await this.$localForage.keys()
.$localForage.setDriver(localforage.LOCALSTORAGE)
By default, localForage selects backend drivers for the datastore in this order:
If you would like to force usage of a particular driver you can use $setStorageDriver() with one or more of the following parameters.
localforage.INDEXEDDB
localforage.WEBSQL
localforage.LOCALSTORAGE
yarn install
or npm install
npm run dev