Re:Cancelable Promises: Why was this proposal withdrawn?
by jrochkind1 on Tuesday December 20, 2016 @10:59AM
(#13220943)
There's probably a (hypothetical API) way to get a _fetch_ to be cancellable, even though it returns a promise, without altering the API of general promise. Some way to get a reference to the request going on and cancel it, which would result in the promise failing (assuming it hadn't completed yet) with a FetchCancelledError or something. One could certainly imagine building such an API if one were polyfilling fetch onself built on XMLHTTPRequest (which can be cancelled).
I won't bother trying to think it through though cause it's clearly pointless except as an intellectual exersize!
I actually like that fetch returns a Promise, I find it convenient, I don't think it was a bad choice at all. To make Promise part of ES6 as a general-purpose async primitive, and to make Fetch return one. I also see how it would be nice to allow fetches to be cancelled -- although I'm not sure I've ever needed/wanted to do that, I could see how I might in the future.
It is boggling that a bunch of smart interested people haven't been able to figure out _some_ solution to this.
I won't bother trying to think it through though cause it's clearly pointless except as an intellectual exersize!
I actually like that fetch returns a Promise, I find it convenient, I don't think it was a bad choice at all. To make Promise part of ES6 as a general-purpose async primitive, and to make Fetch return one. I also see how it would be nice to allow fetches to be cancelled -- although I'm not sure I've ever needed/wanted to do that, I could see how I might in the future.
It is boggling that a bunch of smart interested people haven't been able to figure out _some_ solution to this.