title: Stopping current operation and proceed to another (new) operation
body: <pre><code>function windowResize() {
    someFunction();
    console.log("test3");
  }
  
  function someFunction(){
    console.log("test");
    longExecutingFunctionWithAsyncReq();
    console.log("test2");
  }
  
  function longExecutingFunctionWithAsyncReq() {
    // some codes here
  }
  </code></pre>
  
  <p>whenever the window is resize(zoomed out/in), this function is called.
  But if the user spams the zoom, <code>someFunction()</code> will not have the time to finish and will then cause the error.</p>
  
  <p>I'm thinking of addressing this issue by stopping the current operation and then process the new operation. Also, I've tried reading about <a href="http://joseoncode.com/2011/09/26/a-walkthrough-jquery-deferred-and-promise/" rel="nofollow">Deferred and Promise</a>, but I can't grasp the simplicity of the topic and I'm not sure if it really solves my problem. Plus, I've also checked on <a href="http://www.w3schools.com/jquery/jquery_callback.asp" rel="nofollow">callbacks</a> and was very doubtful that this will not solve my problem either.</p>
  
  <p>If my solution is not possible though, I thought of just queuing the operations, but the downside might be, the queue might overflow if not controlled. As for this solution, I've not looked any farther to this, except reading <a href="https://learn.jquery.com/effects/queue-and-dequeue-explained/" rel="nofollow">about it</a>.</p>