Re: [fetch] Aborting a fetch (#27)

My code will not invoke that indeed if canceled. My code silently resolve,
without invoking. Your example will work without problems.
On Mar 30, 2015 2:43 PM, "Marius Gundersen" <notifications@github.com>
wrote:

> My example was greatly simplified, it's more likely to look something like
> this:
>
> 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>.
>


---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/27#issuecomment-87666744

Received on Monday, 30 March 2015 12:55:44 UTC