Is there any way to cancel meteor method

is there any way to manually terminate the“my_method”, function(err, res) {}); method processing from client side ?

The method gets executed twice, once on the client and once on the server.
You cannot cancel the execution of one from the other.

What exactly is your problem?


to elaborate, i am calling a method like this

$(‘loading_banner’).show();“my_method”, function(err, res) {
(!err) ? $(‘loading_banner’).hide() : null;

how the banner hides on response returned from server.

i added event to close banner on click and want to change the inputs in form and again hit the my_method.

but if i close banner the callback function executes and redirects to another page. that i dont want to do if i cancel the loading process.

thank you.

Hi, did you ever find a solution to this?

Today I faced this problem. It’s not able to cancel the method call, all we can do is just cancel the callback function execution on the client side.
This is how I do it:

onCancelMethodCall() {
    callMyMethodId: null,

onDoSomething() {
  const methodCallId = Math.random();
    callMyMethodId: methodCallId,
  });'someMethod', {}, (error, result) => {
    // check if this method call got cancelled
    const { callMyMethodId } = this.state;
    if (callMyMethodId !== methodCallId) {
    // do something normal here