lundi 23 mars 2015

Meteor client side asynchronous callback


How to get value return by the asynchronous call back in the client side of meteor before stack continue to execute? something like :



var result=function(str){
Meteor.call("getSearch",str,function(err,res){
if (err)
throw new Error(err.message);
else
return res
});
};

var final=result(text);
console.log(final);


How can I get the value of final before it print out? Thanks.





Aucun commentaire:

Enregistrer un commentaire