延迟加载Geofire结果 [英] Lazy Loading Geofire results

查看:60
本文介绍了延迟加载Geofire结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Geofire和Firebase来存储用户的位置并获取附近的用户.但是,当我使用 geoQuery.on("key_entered",... 使用户接近时,我想延迟加载该数据,即获取前10个结果,然后获取下一个10个结果,等等.

I am using Geofire and Firebase to store users location and get nearby users. However, when I use geoQuery.on("key_entered", ... to get the users close by, I would like to lazy load this data. i.e. get the first 10 results, then get the next 10 results etc.

我不确定如何执行此操作,因为我看不到Geofire文档中的方法.谁能帮助我实现这一目标?

I am not sure how to do this as I don't see a way via Geofire's documentation. Can anyone assist me with achieving this?

谢谢

推荐答案

无法根据返回的数字限制密钥.

There is no way to limit the keys based on the number returned.

如果希望返回较少的键,则必须在查询中使用较小的距离.

If you want fewer keys to be returned you will have to use a smaller distance in the query.

如果您只想处理前10个键,则可以保留一个计数器并在处理完10个键后停止处理.

If you want to only process the first 10 keys, you can keep a counter and stop processing after you've handled 10.

这篇关于延迟加载Geofire结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆