我正在将来自用户的数据保存在 indexeddb 中。当用户关闭我的应用程序(即浏览器)时,我想删除此存储。但是,由于 IndexedDB 请求是异步的,因此它们不会在 beforeunload
上执行。这就是为什么我很好奇,其他人是如何解决这个问题的?有什么办法吗?
圣诞快乐!
最佳答案
来自 MDN 的答案:
The synchronous API being intended for use only with Web Workers. The synchronous version was removed from the spec because its need was questionable, however it may be reintroduced in the future if there is enough demand from web developers.
关于storage - 在 beforeunload 上删除 indexeddb 的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34454425/