You are calling from the client where it calls meteor methods as asynchronous functions which is why you are getting the results back undefined before they are being executed.
returnStubValue is for returning the value of the stub (i.e. the client-side method code). If you define your method on the server only, there is no stub, hence an undefined returned value. For getting the returned value from the server code, see @shock’s post.
You are calling a method on a remote server.
This is asynchronous by nature.
Meteor.call sends a message to the server, and then returns immediately. It does NOT wait for the response.
So the return value of Meteor.call is undefined.
That’s why you must provide a callback.
When Meteor receive the response from the server, it calls your callback and you have the value from the server.
So you must define “var lastClick = null” before you execute Meteor.Call, and set its value INSIDE the callback with “lastClick = result”
Do synchronous server methods not block when called from the client? Then how to get a non-reactive return value from a Meteor method without resorting to session vars?