我们可以关闭 Firebase (JavaScript) 本地同步吗?
Can we turn off Firebase (JavaScript) local synchronization?
我正在使用 Firebase JS SDK。每当我为节点设置值(使用事务)时,该节点上的 "value" 事件就会被触发(甚至在事务回调被调用之前。
我觉得这个功能真的很烦人(尽管在其他一些情况下这可能很方便)。我可以关闭此本地同步功能吗?
您可以通过为 applyLocally
参数传入 false
来阻止 transaction
的本地事件的乐观触发。参见 https://www.firebase.com/docs/web/api/firebase/transaction.html
transaction(updateFunction, [onComplete], [applyLocally])
applyLocally Boolean *optional
By default, events are raised each time the transaction update function runs. So if it is run multiple times, you may see intermediate states. You can set this to false to suppress these intermediate states and instead wait until the transaction has completed before events are raised.
我正在使用 Firebase JS SDK。每当我为节点设置值(使用事务)时,该节点上的 "value" 事件就会被触发(甚至在事务回调被调用之前。
我觉得这个功能真的很烦人(尽管在其他一些情况下这可能很方便)。我可以关闭此本地同步功能吗?
您可以通过为 applyLocally
参数传入 false
来阻止 transaction
的本地事件的乐观触发。参见 https://www.firebase.com/docs/web/api/firebase/transaction.html
transaction(updateFunction, [onComplete], [applyLocally])
applyLocally Boolean *optional
By default, events are raised each time the transaction update function runs. So if it is run multiple times, you may see intermediate states. You can set this to false to suppress these intermediate states and instead wait until the transaction has completed before events are raised.