2016-10-28 42 views
0

我想返回從一個異步回調函數返回一個Meteor.method值,像這樣:如何從方法返回異步結果?

Meteor.method('myMethod',() => { 
    asyncFunction(result => { 
     // Meteor.method should return this result 
    }); 
}); 

我應該在哪裏把return result;聲明?

+0

結帳這一個:http://stackoverflow.com/questions/26226583/meteor-proper-use-of-meteor-wrapasync-on-server –

回答

0

你可以試試這個:

Meteor.method('myMethod',() => { 
    return asyncFunction(result => { 
     // Meteor.method should return this result 
return result; 
    }); 
});