- From: Domenic Denicola <notifications@github.com>
- Date: Mon, 25 Jan 2021 11:39:18 -0800
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/issues/1103@github.com>
Noted by @reillyeon in https://github.com/WICG/serial/issues/112#issuecomment-763936183 . For some cases it would be nice to dequeue (and possibly abort?) a given read request, without canceling the stream entirely. That is, ```js const controller = new AbortController(); // Assume "rs" contains chunks A and B. const reader = rs.getReader(); const promise1 = reader.read(); const promise2 = reader.read({ signal: controller.signal }); const promise3 = reader.read(); controller.abort(); ``` The intent here is that `promise1` gets fulfilled with chunk A, and `promise3` gets fulfilled with chunk B. Some questions: - What does this do to `promise2`? Probably reject it with an `"AbortError"` `DOMException` (like in other `AbortSignal` scenarios). - What happens if abort is signaled after the read request is already fulfilled? Probably nothing (like in other `AbortSignal` scenarios). - Does this do more than just dequeue the read request? For example, could it be communicated all the way down to the underlying source, I guess via `pull()`? I don't think this helps much, but it's worth checking... This is looking relatively straightforward to me to spec, and the use case @reillyon presents is a good one. Should we just go for it? -- 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/1103
Received on Monday, 25 January 2021 19:39:31 UTC