Firebase,只会得到新的孩子 [英] Firebase, only get new children

查看:58
本文介绍了Firebase,只会得到新的孩子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

var firebase = new Firebase("....");
firebaseRef.on('child_added', function(snapshot) {
     ...
}

这将收到所有元素,有没有办法在创建新的Firebase参考时不接收所有孩子?只有新的?

This will receive all elements, is there a way to not receive all children when creating a new Firebase reference? Only get new?

谢谢提前

推荐答案

回答问题:
来源: Firebase child_added仅添加子项
指出: @ Bernherd Hoffman

var firebaseRef = new Firebase("...");

firebaseRef.endAt().limit(1).on('child_added', function(snapshot){
//Do your stuff
});

注意:您将获得1条记录,您可以将其过滤掉。

Note: you will get 1 previous record, you you can filter that out.

这篇关于Firebase,只会得到新的孩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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