Closed Rumyra closed 1 year ago
Updated: OK. I have a reasonable idea of the main usage. But trying to confirm the right way to cancel a stream that is being read in this way, to handle errors, and to polyfill, in
This one is going to be tricky because I'm not great with async, iterables, or streams. This is initial research + brain dump.
The spec has normative info which says the
for await (const chunk of stream) { ... }
for await (const chunk of stream.values({ [preventCancel](https://streams.spec.whatwg.org/#dom-readablestreamiteratoroptions-preventcancel): true })) { ... }
Asynchronously iterates over the chunks in the stream’s internal queue.
Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader. The lock will be released if the async iterator’s return() method is called, e.g. by breaking out of the loop.
By default, calling the async iterator’s return() method will also cancel the stream. To prevent this, use the stream’s values() method, passing true for the preventCancel option.
async iterable<any>(optional ReadableStreamIteratorOptions options = {});
where options is an optional object that may define the boolean preventCancel
with default value false.
There are a bunch of things I am not sure of.
Status:
@Rumyra What I have done so far is enough for a release - release note, basic update to ReadableStream, and BCD.
However this is not yet done- I still need to update "Using Readable streams. I have most of my runnable test code in place, but that will be a separate PR. Anything to do with streams is a bit challenging.
OK, tried to finish this off. I'll close this if it gets through reviews.
Acceptance Criteria
For folks helping with Firefox related documentation
dev-doc-complete
Features to document
Updates to DOM streams
Related Gecko bugs
https://bugzilla.mozilla.org/show_bug.cgi?id=1734244
Other