I know that using java (android) you can execute code after the get method is finished, is that also possible when using javascript?
Here is my code:
mColRef.get().then(function(querySnapshot){
querySnapshot.forEach(function(doc) {
console.log(doc.id);
});
});
Can I do something like this? Or how would you code something like this for web (javascript)?
mColRef.get().then(function(querySnapshot){
querySnapshot.forEach(function(doc) {
console.log(doc.id);
});
}).OnCompleteListener(new OncompleteListener ....
Thanks for your help!
It looks like you're overcomplicating things. The use of
then()on a promise in JavaScript serves the same purpose as the use of anOnCompleteListeneron aTaskobject in Android. Just put the code you want to execute afterget()completes inside the function you're already passing tothen()in your code sample.