How to use the idb/with-async-ittr-cjs.openDB function in idb

To help you get started, we’ve selected a few idb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bkniffler / debe / src / idb / index.ts View on Github external
async initialize(collections: ICollections) {
    this.db = await idb.openDB(this.name, 1, {
      upgrade(db: IDBPDatabase) {
        for (var key in collections) {
          const collection = collections[key];
          const store = db.createObjectStore(collection.name, {
            keyPath: collection.specialFields.id,
            autoIncrement: false
          });
          for (var key in collection.index) {
            store.createIndex(key, key);
          }
        }
      }
    });
  }
  async insert(collection: ICollection, items: any[], options: IInsert) {

idb

A small wrapper that makes IndexedDB usable

ISC
Latest version published 6 months ago

Package Health Score

83 / 100
Full package analysis