Re: [whatwg/streams] Make read requests abortable (#1103)

Correct, #1168 fixes this issue. Closing.

Instead of adding a new API, we changed the behavior of the existing `releaseLock()` method. So the use case in the original question would now look like this:
```javascript
const reader = rs.getReader();

const promise1 = reader.read();
const promise2 = reader.read();
const promise3 = reader.read();

reader.releaseLock();
// This is now always allowed, even if one or more read() promises are still pending.
// For example, if rs only contains 2 chunks, then promise1 and promise2 are resolved,
// but promise3 will reject with a TypeError.
```
If you want to use an `AbortController`, you can do that manually:
```javascript
const controller = new AbortController();
const reader = rs.getReader();
controller.signal.addEventListener("abort", () => {
  reader.releaseLock();
});

const promise1 = reader.read();

controller.abort();
```

> What is the status of implementation of this behavior in browsers?

This spec change is hot off the press, so no browser has implemented it yet. We've filed issues with all major browsers, you can have a look at the "implementation bugs" listed in #1168 to track their progress.

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

Message ID: <whatwg/streams/issues/1103/1012844365@github.com>

Received on Friday, 14 January 2022 07:31:01 UTC