The IndexedDB method close is synchronous, how can I wait until close has finished? My usecase is that I close IndexedDB after automated tests and then before the next test, delete the database and re-open it.
The problem I'm seeing is that sometimes indexedDB.deleteDatabase fires the blocked event because the database hasn't yet been closed asynchronously (as you can see from deleteDatabase's documentation that I linked to). What I'm not entirely sure about is if the database will still be deleted in this case, despite the blocked event being fired.
You don't need to wait for close completed events, just close, delete the database and re-open it.
As you can see in IndexedDB API doc, close method does not dispatch completed event, but database delete method does. Anyways you don't need to listen these events.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With