-
Notifications
You must be signed in to change notification settings - Fork 2k
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 transformer.cancel
method to TransformStream
constructor
#25519
Add transformer.cancel
method to TransformStream
constructor
#25519
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 overall, but I'm just not sure about the subfeature name and description.
api/TransformStream.json
Outdated
"cancel": { | ||
"__compat": { | ||
"description": "`transformer.cancel` method", |
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.
Given that cancel
is the key in the parameter object passed to the TransformStream
constructor, it confuses me slightly that this is called a method (even if the spec uses this terminology). How about:
"cancel": { | |
"__compat": { | |
"description": "`transformer.cancel` method", | |
"transformer_cancel_callback": { | |
"__compat": { | |
"description": "`transformer.cancel` callback", |
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.
The MDN articles for the ReadableStream/WritableStream/TransformStream constructors as well as the streams guides also talk about "methods", so I tried to be consistent with those. Although the specification does use the name TransformerCancelCallback
for the type of that method... 😅
I think I'll stick with "method" for now. I'll make the feature name a bit more specific though, like you suggested.
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.
Thank you, LGTM!
Summary
The transformer object passed to the
TransformStream
constructor can now also have acancel
method, which is called whenever the readable side is cancelled or when the writable side is aborted. See the specification and the spec change for context.Test results and supporting details
This method is not yet supported in any browser. However, server runtimes such as Node.js and Deno already support it: