简体   繁体   English

如何为 Firebase Web 版本 9(模块化)启用多选项卡同步?

[英]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.

相关问题 如何使用 Firebase 9(模块化 sdk)更新 Firebase 实时数据库中的数据 - How to update data in Firebase realtime database using Firebase 9 (modular sdk) Firebase 9(模块化)上的复合查询 - Compound query on Firebase 9 (modular) 如何在 flutter web 应用程序中正确添加和启用 firebase_auth? - How does one properly add and enable firebase_auth in a flutter web app? 如何在 Flutter 中使用最新版本配置 Firebase Messaging? - How to configure Firebase Messaging with latest version in Flutter? 无法读取 firebase v9 {modular} 中未定义的属性(读取“indexOf”) - Cannot read properties of undefined (reading 'indexOf') in firebase v9 {modular} firebase.firebase 版本 9 中的用户 - firebase.User in firebase version 9 为 Firebase Cloud Functions 启用 Cors - Enable Cors for Firebase Cloud Functions 新的 Google 的 Web 9“模块化”语法与以前的 Web 8“命名空间”相比发生了什么 - What is going on with new Google's Web 9 "Modular" syntax vs previous Web 8"Namespaced" 选项卡未处于焦点时的 Firebase 通知 - Firebase notification when tab is not in focus 如何使用 Firebase (JS) 在 web 上的实时数据库中的两个日期之间导航? - How to Navigate between two dates in Realtime Database on the web with Firebase (JS)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM