I've got a function that take a data from firebase db and it must return it from the function:
function f(){
var adr = window.residentInstance.address;
var ref = window.db.ref().child('SwapQueries').child(adr);
var res;
ref.once('value', function(snapshot){res = snapshot.val()});
return res;
}
The problem is js is totally asynchronous and I've found no way to wait until promise is done, so how am I supposed to solve this problem?
via Keltar Helviett
No comments:
Post a Comment