Created
December 16, 2021 02:33
-
-
Save alex-cory/37ce120513fdbae8f35c311fe5f92028 to your computer and use it in GitHub Desktop.
Clears out all the indexedDB databases
This file contains 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
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