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

@WebReflection some questions about your gist/proposal,


1. What if you've made several requests and you want to cancel them? Right now since it's not a cancellable promise it's just not cancellable - which I think is correct behavior. Should similar facilities be provided for aggregation of cancellable promises?

```js
// sync cancellation - does what I expect
var d = Promise.all([new Promise(function(resolve, reject, c){
    c(function(){
        setTimeout(alert.bind(null, "Cancel"));  
    });
    setTimeout(resolve);
})])

d.cancel();
```
 http://jsfiddle.net/uvsLgn33/

2. What happens if `cancel` is called multiple times? Are additional calls no-ops? This is the behavior [with the current gist](http://jsfiddle.net/sfosu0ka/) and it sounds correct.

3. Chaining with assimilation [works](http://jsfiddle.net/pLm9syb6/) - but how do we treat assimilation of cancellable promises? If a promise assimilates another promise - and the child promise is cancelled (before the parent resolves) - I assume it doesn't propagate (the `then` doesn't even know it assimilates the child promise yet - after all).

4. Here's a sketch of [getting the first request out of a bunch and cancelling others](http://jsfiddle.net/9z7qbpxp/) it looks nice for the common use case - I wonder if primitives should do this - users might be tempted to `.race` promises which would not cancel cancellable promises.

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

Received on Tuesday, 31 March 2015 12:55:15 UTC