npm install --save indexeddb-wrapper
import indexeddbWrapper from 'indexeddb-wrapper'
const { myStore } = createIndexeDBWrapper({ stores: ['myStore'] })
myStore.set('key', 'value')
.then(() => store.get('key'))
.then(console.log)
Use proper promise error handling to catch common errors like this:
store.get('key').then(console.log).catch(error => {
if (error.name === 'QuotaExceededError') {
alert('Failed to save. Not enough storage.');
}
throw error;
})
• stores: object
Defined in index.ts:12
• destroy: function
Defined in index.ts:8
▸ (): Promise‹void›
• get: function
Defined in index.ts:3
▸ (key
: string): Promise‹any›
Parameters:
Name | Type |
---|---|
key |
string |
• keys: function
Defined in index.ts:4
▸ (): Promise‹string[]›
• purge: function
Defined in index.ts:6
▸ (): Promise‹void›
• remove: function
Defined in index.ts:7
▸ (key
: string): Promise‹void›
Parameters:
Name | Type |
---|---|
key |
string |
• set: function
Defined in index.ts:5
▸ (key
: string, value
: any): Promise‹void›
Parameters:
Name | Type |
---|---|
key |
string |
value |
any |