v-localforage
A plugin wrapped from localForage for Vue.js.
Installation
Install using npm
# install it via npm npm install v-localforage --save
Install using yarn
# install it via yarn yarn add v-localforage
Direct usage with html
<!-- insert the vue core before it -->
Usage
// register the plugin on vue Vue // you can also pass options, check options reference belowVue
Get item
let item = await this$localforage
Set item
await this$localforage
Remove item
await this$localforage
Clear
await this$localforageclear
Gets the length
let length = await this$localforagelength
Get the name of a key based on its ID
let k = await this$localforage
Get the list of all keys
let keys = await this$localforage
More informations on LocalForage documentation
Advanced Usage
You can register multiple instances, see below:
Vue // for instance1await this$localforageinstance1 // for instance2await this$localforageinstance2
Options
instances
(optional)
- Default:
[]
You can create multiple instances.
driver
(optional)
- Default:
[localforage.INDEXEDDB, localforage.WEBSQL, localforage.LOCALSTORAGE]
The preferred driver(s) to use.
name
(optional)
- Default:
localforage
The name of the database.
size
(optional)
- Default:
4980736
The size of the database in bytes.
storeName
(optional)
- Default:
keyvaluepairs
The name of the datastore.
version
(optional)
- Default:
1.0
The schema version of your database.
description
(optional)
- Default:
''
A description of the database.