Re: [streams] Getting errored/closed reader, Auto-releasing reader, Forcible cancel() on a stream (#297)

OK, let me summarize the cancellable promise approach.

```
const fetchPromise = fetch(request);
```

- [Plan A] `fetchPromise.cancel()` works only while the `Response` is not yet available
    - returns **true** if the `fetchPromise` is not yet fulfilled
    - returns **false** if the `fetchPromise` is already fulfilled
        - to terminate the fetch algorithm, we need to call some method on the `Response` (fulfillment value of `fetchPromise`) that terminates HTTP body receiving
- [Plan B] `fetchPromise.cancel()` works for terminating the fetch algorithm at any stage
    - return type of fetchPromise.cancel() is void.
    - fetchPromise may be already fulfilled and there's already a microtask to run the fulfillment callback.
        - even in such situation, `fetchPromise.cancel()` can be used for stopping HTTP body receiving

Is your idea described well in [Plan B]?

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/297#issuecomment-81418080

Received on Monday, 16 March 2015 06:04:17 UTC