IndexedDB Promises ES6 Store Wrapper
ES6 class wrapper for creating and managing IndexedDB stores, built on top of jakearchibald idb lib.
Up and Running
npm install idb-store
Usage
const schemas = create: name: 'item' options: autoIncrement: true index: name: 'myIndex' property: 'property' options: unique: false ; const DB = DB;const Store = Store; // Creates a new database.DB; const db = 'myDB' 1;const itemRepository = 'item' db; // Creates a transactions and sets some data in the store.itemRepository ;}); // Opens a new connection and logs the database name.db });
DB
Static properties:
DB.hasSupport
DB.createDatabase
DB.deleteDatabase
db
Properties:
db.name
db.version
db.objectStoreNames
Methods:
db.close()
db.transaction()
Events:
onversionchange
onabort
onerror
onclose
Stores
Methods:
db[store].get()
db[store].set()
db[store].delete()
db[store].clear()
db[store].getAllKeys()
db[store].getAll()
db[store].count()