Dexie Live查询和服务工作者

发布于 2025-01-31 04:55:08 字数 108 浏览 4 评论 0原文

我想在服务工作者中使用Dexie同步我的数据。 我也想在React Frontend中使用UseliveQuery Hook。

如果新数据写在服务工作者线程中,Dexie会自动更新查询吗?

I want to use Dexie within the service worker to sync my data.
I also want to use useLiveQuery hook in the React frontend.

Would Dexie automatically update the query if new data gets written in the service worker thread?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黎夕旧梦 2025-02-07 04:55:08

如果您的服务工作者将数据写入数据库,则将立即通知React Frontend并相应地进行更新。通过广播通道进行沟通。如果使用缺乏广播渠道支持的旧式野生动物园浏览器,Dexie会有后备,以便使用PostMessage()在服务工作者中进行的突变。这一切都是由Dexie本身照顾的。

If data is written to the database by your Service worker, the React frontend will be notified instantly and update accordingly. Communication goes via BroadcastChannel. If using a legacy Safari browser that lacks BroadcastChannel support, dexie has a fallback so that mutations done in the service worker will be communicated using postMessage(). This is all taken care of by dexie itself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文