Firebase循环以订阅多个childReferences

时间:2013-12-23 18:47:30

标签: javascript firebase

好的,所以我在数组中有一堆childrefs:

var fireRef = "https://mybase.firebaseio.com/"
var baseRef = ["child1", "child2", "child3"];
for (var z = 0; i < baseRef.length; z++) {

   fireRef.child(baseRef[z]).on('child_added', function(snapshot) {
        var msgData = snapshot.val();
        console.log(msgData);
        alert(msgData);
   });
}

这是在客户端,所以很明显它会阻塞并最终使页面无响应。所以基本上我想在数组中订阅一堆子引用。最简单的方法是什么?

0 个答案:

没有答案