Skip to content

Instantly share code, notes, and snippets.

@alex-cory
Created December 16, 2021 02:33
Show Gist options
  • Save alex-cory/37ce120513fdbae8f35c311fe5f92028 to your computer and use it in GitHub Desktop.
Save alex-cory/37ce120513fdbae8f35c311fe5f92028 to your computer and use it in GitHub Desktop.
Clears out all the indexedDB databases
indexedDB.databases().then(dbs => {
var promises = dbs.map(db => {
return new Promise((resolve, reject) => {
var req = indexedDB.deleteDatabase(db.Name);
req.onsuccess = resolve;
req.onerror = reject;
req.onblocked = reject;
});
});
Promise.all(promises).then(console.log).catch(console.error);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment