Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakschu/5858805 to your computer and use it in GitHub Desktop.
Save jakschu/5858805 to your computer and use it in GitHub Desktop.
if(Meteor.isClient){
// set Session variable in method callback
Meteor.call('myMeteorMethod', "foo", function(error, result){
Session.set('myMethodResult', result);
});
// use reactive Session variable in helper
Template.myTemplate.helpers({
myHelper: function(){
return Session.get('myMethodResult'); // "bar"
}
});
}
if(Meteor.isServer){
Meteor.method({
myMeteorMethod: function(argument){
return "bar";
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment