Re: [whatwg/streams] What the difference between ReadableStream.cancel() and ReadableStreamDefaultReader.cancel()? (#1033)

> so, is it the same bound function or maybe the `readable.cancel` is a shortcut which calls `reader.cancel` (or reverse)?

They are different functions, see the spec [here](https://streams.spec.whatwg.org/#rs-cancel) and [here](https://streams.spec.whatwg.org/#default-reader-cancel). They have different preconditions, but they have the same effect (calling the abstract operation [ReadableStreamCancel](https://streams.spec.whatwg.org/#readable-stream-cancel)).



> Also, does the workflow order matter if I do:
> 
> ```js
> reader.releaseLock();
> reader.cancel();
> ```

Yes, the order matters. You cannot call any reader methods after you've released the lock. So `releaseLock()` must always be last.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1033#issuecomment-601354179

Received on Thursday, 19 March 2020 18:48:37 UTC