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

Ok so my current playground does not work and my concern was concrete. I
have better code that if a is resolved and b is not yet and c is cancelled,
b gets cancelled. Right now even if b hasn't done yet c.cancel tries to
cancel a as root of the chain. Will update the playground soon. Cheers
On Mar 31, 2015 5:10 PM, "Marius Gundersen" <notifications@github.com>
wrote:

> should silently keep going because there was nothing to cancel ... right ?
>
> Yes, since all the promises in the array are fulfilled the promise
> returned by Promise.all() will also be fulfilled, so it is too late to
> cancel it. Maybe the cancel() could return a pending promise:
>
> var p = Promise.all([Promise.resolve()]);//p.@state = "fulfilled" var q = p.cancel();//p.@state = "fulfilled"//q.@state = "pending"
>
>  if a cancelable Promise returns inside a then another cancelable
> Promise, should the last cancel eventually cancel this one, instead of the
> original one that generated the chain?
>
> The promise returned by then(func) is not the promise returned by the
> function func:
>
> var innerP;var outerP = Promise.resolve().then(r => (innerP = new Promise(r => r()));
> outerP === innerP //false
>
> When calling c = a.then(() => b), then c is a promise that is only ever
> waiting for one other promise to resolve, either the previous one in the
> chain (a) or the promise returned by the function passed to it (b). This
> means that calling cancel on c will only cancel the one it is waiting
> for. If a hasn't resolved yet, then a will be cancelled and nothing will
> happen to b, since it hasn't been started yet. If a has resolved, then a
> will not be cancelled (since it is resolved), and b will be cancelled. If
> b has resolved, then c has resolved, and cancelling c will be a no-op. It
> will be too late.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/whatwg/fetch/issues/27#issuecomment-88126830>.
>


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

Received on Tuesday, 31 March 2015 15:17:01 UTC