在此示例中,我想在 firebase 数据库的父节点中创建一个名为“friend”的新节点时更改站点。我不知道如何让它等到它检测到新节点。
var friendUid;
firebase.database().ref('users/' + uid).child('friend').on('value', function(snapshot){
friendUid = snapshot.val();
})
while(!friendUid){ //I've also tried with "friendUid == null"
firebase.database().ref('users/' + uid).child('friend').on('value', function(snapshot){
friendUid = snapshot.val();
})
}
window.document.location = "whatever.html";
牧羊人nacy
相关分类