I'm trying to pass a function as an argument but for some reason this doesn't work. While debugging I end up with this situation:
with a server/twitter.js:
Meteor.methods({
mytweets: function(callback){
//someday I'll asynchronously get some tweets, then callback.
console.log("server got callback=",callback)
}
})
This works:
in /client/views/twitter.js:
Template.twitter.created = function(){
Meteor.call("mytweets",123);
}
this properly logs server got callback=123
and at this point everything is ok. However the following won't work:
This won't work. Why?
Meteor.call('mytweets', function(){
return 123;
})
when passing a function, the output is server got callback= undefined
Any idea why ?
note: I'm new with both meteor and javascript so I don't really know (yet) if that's more a javascript or a meteor-related issue. I'll tag both just in case.
Thanks in advance !!