-
-
Save delebash/25802fb524a792791dccb26880b4220b to your computer and use it in GitHub Desktop.
Delete all Dexie.js databases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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