Meteor.wrapAsync doesn't return value



I cannot get the wrapAsync method working, following a very simple code that doesn’t work, anybody can tell what is wrong ?

testMethod: function (var1) {
var syncFunc = Meteor.wrapAsync(testAsync);
var result = syncFunc(var1);



function testAsync(myVar){
return 'Var is: ’ + myVar;



An async function must have a callback with a signature of (error, result) for this to work. So if your “async” function looked like this it should work:

function testAsync(myVar, callback) {
  callback(null, 'Var is: ' + myVar);

In which null means “no error”.


Awesome, thank you very much !!!