在此示例中,我想在 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";
等到在 Firebase 數據庫(網絡)中檢測到新數據
慕無忌1623718
2022-05-26 14:15:46