Re: [whatwg/streams] reader.cancel([ reason ]) "behaves the same as stream.cancel(reason)" is confusing (Issue #1287)

I suppose it would be more accurate to say that `stream.cancel()` behaves like `const reader = stream.getReader(); reader.cancel(); reader.releaseLock()`, where `reader` is a temporary reader. But that still wouldn't be a *good* explanation.

In essence, you use `stream.cancel()` to cancel a stream if you haven't locked it. If you have, you should use `reader.cancel()` instead, which requires that your `reader` still has the *active* lock on the stream.

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

Message ID: <whatwg/streams/issues/1287/1627368451@github.com>

Received on Saturday, 8 July 2023 14:51:56 UTC