How to use the dexie.getDatabaseNames function in dexie

To help you get started, we’ve selected a few dexie 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 dfahlander / Dexie.js / test / tests-open.js View on Github external
asyncTest("Dexie.getDatabaseNames", 13, function () {
    var defaultDatabases = [];
    var db1, db2;
    Dexie.getDatabaseNames(function (names) {
        defaultDatabases = [].slice.call(names, 0);
        ok(true, "Current databases: " + (defaultDatabases.length ? defaultDatabases.join(',') : "(none)"));
        db1 = new Dexie("TestDB1");
        db1.version(1).stores({});
        return db1.open();
    }).then(function () {
        // One DB created
        ok(true, "TestDB1 successfully created");
        return Dexie.getDatabaseNames();
    }).then(function (names) {
        equal(names.length, defaultDatabases.length + 1, "Another DB has been created");
        ok(names.indexOf("TestDB1") !== -1, "Database names now contains TestDB1");
        db2 = new Dexie("TestDB2");
        db2.version(1).stores({});
        return db2.open();
    }).then(function () {
github imolorhe / altair / src / app / services / storage / storage.service.ts View on Github external
clearAllLocalData() {
    // Clear indexedDb
    Dexie.getDatabaseNames()
      .then(names => {
        names.forEach(name => {
          const db = new Dexie(name);
          db.delete().catch(() => {});
        });
      });

    localStorage.clear();
  }
github dfahlander / Dexie.js / test / tests-open.js View on Github external
}).then(function () {
        return Dexie.getDatabaseNames();
    }).then(function(names){
        equal(names.length, defaultDatabases.length + 1, "A database has been deleted");
github DaanBroekhof / JoroDox / app / utils / JdxDatabase.js View on Github external
static async clearProjectDatabases() {
    const dbNames = new Set(await Dexie.getDatabaseNames());
    const projects = await (await JdxDatabase.getProjects()).toArray();

    dbNames.delete(JdxDatabase.GLOBAL_DB_NAME);
    projects.forEach(project => {
      dbNames.delete(this.projectToDbName(project));
    });

    dbNames.forEach(dbName => {
      console.log('Deleting ' + dbName);
      Dexie.delete(dbName);
    });
  }
github WarsawLO / warsawlo / src / utils / manage / users.js View on Github external
export const getUsernames = async () => {
    let dbs = await Dexie.getDatabaseNames()
    return dbs.filter(dbname => dbname.startsWith('userdata_')).map(dbname => dbname.replace('userdata_', ''))
}
github DaanBroekhof / JoroDox / app / utils / JdxDatabase.js View on Github external
static async getAllDatabases() {
    return Dexie.getDatabaseNames();
  }