javascript - 关于firestore实时监听器数量的概念问题
问题描述
当我对数据进行分页时,我试图尽量减少 Firestore 侦听器的数量。我使用的是firestore webv9,但这并不重要。我的问题是..
每次我调用这个函数时,我不是在创建一个新的监听器吗?如果是这样,我如何组合或重用侦听器或快照,这样即使我调用此函数 1000 次,我也只有一个侦听器?!
async getPaginatedData_RTL(queryParams: TQueryParams, onChange: Function){
let collectionReference = collection(firestore, queryParams.pathToDataInCollection);
const unsubscribe = onSnapshot(collectionReferenceQuery, (snapshot: QuerySnapshot) => {
onChange(snapshot);
})
this.unsubscriptions.push(unsubscribe)
}
解决方案
推荐阅读
- css - 如何在 CSS 中设置单选按钮的样式?
- javascript - 如何通过 id 或 class 区分 popover
- json - 尝试使用 firebase 获取我的颤振应用程序的请求并出现错误
- python - 如何在 Python 中以行列表的形式从图像中获取数据
- angular - Firebase将令牌传递给角度参数
- python - python中的低峰
- swift - 取消预定的后台活动
- python-2.7 - AWS Schedule Batch-Job 通过 Boto3 SDK 传递一些环境变量
- javascript - Wallpaper Engine,关于自定义 Audio Visualizer 渲染的见解
- python - 如何将偶数行的数据附加到上面的奇数行?