Cancel a previouse event-triggered operation when a new event is triggered

Or in other words: Cancel a click-triggered REST-Call, when the user clicks again. This is a very neat recipe, that is used pretty often in our daily workflow, imagine you would have to achive the following usecase either with Promises or Callbacks:
  1. Your requirement is to have a refresh-feature(e.g. auto-search), that is triggered whenever some input is made by a user
  2. BUT: The REST-Call for this can at times take longer then the next user-input
  3. In this case the previouse REST-call should be scrapped and only the latest call should be considered
And here is a real-world-example

Leave a Reply