Created
December 15, 2015 14:11
-
-
Save skratchdot/c6788727ab7005066de9 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