云开发quickstart里面即时通信Demo中watch为什么没有close?

发布于 9 年前作者 huyong10429 次浏览最后编辑 9 年前来自 ask

请问该怎么关闭,因为这个watcher是在组件内,如何在页面生命周期函数onUnload中关闭?

还有如果该watch不关闭会有什么影响?

1 回复
pingsun
pingsun1 楼6 年前

初始化的时候 this.watcher = db.watch({…})

onUnload的时候 if (this.watcher) this.watcher.close()