am trying path an html container from firebase,. all data should be stack according, this is my code:
firebase.database().ref('message/' + user.uid).on('value', function (snap) {
console.log('at the first position');
firebase.database().ref('chat/today').on('value', function (message) {
console.log('at the second position');
firebase.database().ref('day/tuesday').on('value', function (snap) {
console.log('at the third position');
firebase.database().ref('scores/' + user.uid).on('value', function (snap) {
console.log('at the fourth position');
});
console.log('at the fifth position');
firebase.database().ref('user/friends').on('value', function (snap) {
console.log('at the six position');
});
console.log('at the seventh position');;
});
console.log('at the eight position');
});
console.log('at the nineth position');
});
I want to know if I use async / wait
on all firebase.database()
calls would it run synchronously?
I am expecting this console output:
//at the first position
//at the second position
//at the third position
//at the fourth position
//at the fifth position
//at the six position
//at the seventh position
//at the eight position
//at the nineth position
but am getting this :
//at the first position
//at the nineth position
//at the second position
//at the eight position
//at the third position
//at the fifth position
//at the seventh position
//at the fourth position
//at the six position