javascript - Meteor - Cancelling a Server Method from the Client -


I am counting the database through a server method, the user can choose how the count should be counted and then the method Use

My problem is that counting can take some time and a user can change his mind, while the method is running and counting a different request. Is there any way that I can cancel the application process and make a new count?

I have thought that. Blocked () may work; This will allow a new method to run, but it will not cancel the old method. I also considered pre-counting and then using only one lookup, but there are too many selectors combinations.

Here's my code, it's quite easy:

  // server Meteor.methods ({getFilterCount: function selector} {return clMaBldgs.find (oFilterSelector, {}). Count ();}}); // client meteorite ('getFilterCount', opilator selector, function (error, result) {// some things}};    

It is not possible to cancel the call method made from the client.

But if your method is called multiple times in a short interval, If you care about the outcome of the call, you can use it for some time to delay execution. This will reduce the unnecessary calls to the server. Will help.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -