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

@martinthomson elaborating on your idea, why not simply:

    let abortFetch;
    let p = new Promise(resolve => abortFetch = resolve);
    fetch(url, p).then(success, failure);
    // on error
    abortFetch();

causing fetch to reject with `CancelledError`?

Simple on the implementation end as well, little more than:

    Promise.race([operation, p.then(() => { throw DOMException("", "CancelledError"); },
                                    () => { throw DOMException("", "CancelledError"); })]);


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

Received on Monday, 27 April 2015 14:55:43 UTC