Skip to content

Instantly share code, notes, and snippets.

@skratchdot
Created December 15, 2015 14:11
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save skratchdot/c6788727ab7005066de9 to your computer and use it in GitHub Desktop.
Save skratchdot/c6788727ab7005066de9 to your computer and use it in GitHub Desktop.
Delete all Dexie.js databases
Dexie.getDatabaseNames(function (names, cb) {
console.log('database names: ', names);
names.forEach(function (name) {
var db = new Dexie(name);
db.delete().then(function() {
console.log('Database successfully deleted: ', name);
}).catch(function (err) {
console.error('Could not delete database: ', name, err);
}).finally(function() {
console.log('Done. Now executing callback if passed.');
if (typeof cb === 'function') {
cb();
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment