New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add examples for stopping pipes #1059
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
controller.abort(); | ||
</xmp> | ||
|
||
(The above omits error handling for the promise returned by {{ReadableStream/pipeTo()}}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having two sentences inside "()" looks a little odd to me. I think you could just omit the "()" characters here without changing the meaning too much. If you like. I don't have really strong feelings about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, on balance I like it, as a way of deemphasizing these sentences. I'll keep it. Thanks for weighing in though.
FYI folks might be interested in the discussion I'm having over in whatwg/dom#881 on making this pattern less terrible. |
Hmm, or we could do something entirely on the Streams side. For example: const controller = new AbortController();
readable1.pipeTo(writable, { preventAbort: true, signal: controller.signal });
// ... some time later ...
controller.abort();
// Start the new pipe, when ready:
readable2.pipeTo(writable, { waitForPrevious: true }); with the same semantics. (That would require storing the previous pipe promise while it is not settled, but that seems OK.) I don't think we could make |
Closes #1055.
Preview | Diff