Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save takahirohonda/cfd77ae26ed9725e0415a223cf65d12a to your computer and use it in GitHub Desktop.
Save takahirohonda/cfd77ae26ed9725e0415a223cf65d12a to your computer and use it in GitHub Desktop.
replacing-local-storage-with-indexeddb-3-clear-database.ts
export const clearIndexedDB = (): Promise<string> => {
const req = indexedDB.deleteDatabase('mtd')
return new Promise((resolve, reject) => {
req.onsuccess = () => {
resolve('DB deleted successfully')
}
req.onerror = (e: any) => {
reject(`Error in DB delete: ${e.target.error}`)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment