gpt4 book ai didi

storage - 在 beforeunload 上删除 indexeddb 的方法

转载 作者:行者123 更新时间:2023-12-05 05:24:29 24 4
gpt4 key购买 nike

我正在将来自用户的数据保存在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com