I'm facing an issue with my function that involves making multiple calls to an observer. I need the function to wait until all the calls are complete before returning. I attempted putting the return statement inside the subscribe method, but it resulted in an error because the function's type is void without the return being the last thing.
CheckIfReady(){
var isReady;
this.Room.subscribe(snapshot => {
if(snapshot.Ready == "true"){
console.log("Ready");
isReady = true;
}else{
console.log("Not Ready");
isReady = false;
}
});
console.log('Is the Room Ready?', isReady); //undefined
return isReady; //returns undefined
}