- From: Marius Gundersen <notifications@github.com>
- Date: Mon, 30 Mar 2015 05:43:55 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
Received on Monday, 30 March 2015 12:44:17 UTC
My example was greatly simplified, it's more likely to look something like this:
```js
inputElement.onkeyup = function(){
search.autocomplete(this.value).then(updateAutocompleteListWithResult);
}
let search = {
active: null,
autocomplete: function(string){
if(this.active) this.active.cancel();
this.active = fetch(`/autocomplete?q=${string}`)
.then(r => r.json())
.then(r => (this.active = null, r), e => (this.active = null, e));
return this.active;
}
}
```
In this scenario I'm not interested in the result of the autocomplete fetch if a new key up event occurs before the results are ready. In this scenario I'm not interested in neither the resolved nor the rejected value from autocomplete; I don't want `updateAutocompleteListWithResult` to be called with anything.
---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/27#issuecomment-87663826
Received on Monday, 30 March 2015 12:44:17 UTC