Skip to content

Instantly share code, notes, and snippets.

@richsilv
Last active August 29, 2015 14:13
Show Gist options
  • Save richsilv/5fe036afae71e68870f2 to your computer and use it in GitHub Desktop.
Save richsilv/5fe036afae71e68870f2 to your computer and use it in GitHub Desktop.
Demo of the difference in `this` in Meteor methods depending on whether the call was from client or server
var calledFromServer;
Meteor.methods({
'getThis': function() {
return this;
},
'getThisServer': function() {
return calledFromServer;
}
});
calledFromServer = Meteor.call('getThis');
@themeteorchef
Copy link

Could you break this into multiple pieces for me (e.g. a client file and a server file)? Having a hard time understanding what's being called where. Is calledFromServer = Meteor.call('getThis'); being called from the client? That may be a silly question considering the variable name 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment