Promise queues?
<p>I have an application that is sending a http request that returns a promise everytime the user types. I have it debouncing every 500ms. Sometimes the api I am requesting takes a long time to respond. For example, I make a search request for <code>a</code> that takes a long time to respond but then the user continues typing to complete the query of <code>a+x</code> which resolves almost immediately but the results of <code>a+x</code> get overridden by the previous request of just <code>a</code>.</p>

<p>TL;DR: if new promise is called before current resolves, how to cancel current</p>