Last active
August 29, 2015 14:13
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var calledFromServer; | |
Meteor.methods({ | |
'getThis': function() { | |
return this; | |
}, | |
'getThisServer': function() { | |
return calledFromServer; | |
} | |
}); | |
calledFromServer = Meteor.call('getThis'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 theclient
? That may be a silly question considering the variable name 😀