The question is a bit old, but my 2 cents:
As Molda stated in a comment, the future main goal is to make async work synchronously.
futureAn instance has 3 methods:
future.wait() basically tells your thread to basically pause until it is prompted to resume.future.return(value), future, , , , , , const ret = future.wait(), ret - .future.throw(error), , .
javascript , . Meteor , Meteor.method , . Promises, Meteor , , , .
:
Meteor.methods({
foo: function() {
const future = new Future();
someAsyncCall(foo, function bar(error, result) {
if (error) future.throw(error);
future.return(result);
});
const ret = future.wait();
return ret;
}
});