Package Exports
- idb-keyval
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (idb-keyval) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
IDB-Keyval
This is a super-simple-small promise-based keyval store implemented with IndexedDB, largely based on async-storage by Mozilla.
If you're looking for a more general-purpose promise-based IDB, try IDB on NPM. If you want to support older browsers with broken/absent IDB implementations, try localForage.
Usage
set:
idbKeyval.set('hello', 'world');
idbKeyval.set('foo', 'bar');Since this is IDB-backed, you can store anything structured-clonable (numbers, arrays, objects, dates, blobs etc).
All methods return promises:
idbKeyval.set('hello', 'world')
.then(() => console.log('It worked!'))
.catch(err => console.log('It failed!', err));get:
// logs: "world"
idbKeyval.get('hello').then(val => console.log(val));keys:
// logs: ["hello", "foo"]
idbKeyval.keys().then(keys => console.log(keys));delete:
idbKeyval.delete('hello');clear:
idbKeyval.clear();That's it!