Hi - I have the below function declared on the server. I want it to finish completely before returning, hence the need for futures. But I keep getting “Future resolved more than once” … don’t know why.
Bing.web is an asynchronous function from a package.
bing_api: function( query, skip ) {
var myFuture = new Future();
Bing.web(query, {
top: 50,
skip: skip
}, function(error, res, body){
if( error ) {
myFuture.throw(error);
}
myFuture.return( {error: error, body: body });
});
return myFuture.wait();
},