[英]How to enable multi-tab synchronization for Firebase Web Version 9 (modular)?
I am using Firebase JavaScript Modular Web Version 9 SDK.我正在使用 Firebase JavaScript 模块化 Web 版本 9 ZF20E3C5E54C0AB3D376AZ.B660
And I have enabled offline persistence as per these docs using this: enableIndexedDbPersistence(db)
.我已经按照这些文档启用了离线持久性:
enableIndexedDbPersistence(db)
。
Now I want to keep data synced between multiple open browser tabs.现在我想在多个打开的浏览器选项卡之间保持数据同步。
I thought I could do that in the PersistenceSettings object like this: enableIndexedDbPersistence(db, { synchronizeTabs: true })
.我想我可以像这样在 PersistenceSettings object 中做到这一点:
enableIndexedDbPersistence(db, { synchronizeTabs: true })
。
But it turns out that synchronizeTabs
property does not exist on the PersistenceSettings object.但事实证明,PersistenceSettings object 上不存在
synchronizeTabs
属性。
The docs for the PersistenceSettings object do not have the synchronizeTabs
property listed, but they do have a forceOwnership
property with a description that mentions: PersistenceSettings object的文档没有列出
synchronizeTabs
属性,但它们确实有一个forceOwnership
属性,其描述中提到:
This cannot be used with multi-tab synchronization
这不能与多选项卡同步一起使用
This leads me to believe that multi-tab synchronization is possible.这让我相信多标签同步是可能的。 Because it is telling me that multi-tab synchronization cannot be used together with
forceOwnership
.因为它告诉我多选项卡同步不能与
forceOwnership
一起使用。 I do not care about forceOwnership
but I still want multi-tab synchronization.我不关心
forceOwnership
但我仍然想要多标签同步。
So how do I enable multi-tab synchronization for the JavaScript Web Version 9 SDK?那么如何为 JavaScript Web 版本 9 SDK 启用多选项卡同步?
You can directly use enablemultitabindexeddbpersistence
to achieve what you want, instead of passing the PersistenceSettings
object.您可以直接使用
enablemultitabindexeddbpersistence
来实现您想要的,而不是通过PersistenceSettings
object。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.