Re: [whatwg/streams] TransformStream cleanup using "Transformer.cancel" (PR #1283)

@saschanaz requested changes on this pull request.



> @@ -5558,6 +5560,25 @@ callback TransformerTransformCallback = Promise<undefined> (any chunk, Transform
    {{Transformer/flush|flush()}}; the stream is already in the process of successfully closing down,
    and terminating it would be counterproductive.)
 
+  <dt><dfn dict-member for="Transformer" lt="cancel">cancel(<var ignore>reason</var>)</dfn></dt>
+  <dd>
+   <p>A function called when the [=writable side=] is aborted, or when the [=readable side=] is
+   cancelled.
+
+   <p>Typically this is used to clean up underlying transformer resources when the  stream is

```suggestion
   <p>Typically this is used to clean up underlying transformer resources when the stream is
```

> @@ -5558,6 +5560,25 @@ callback TransformerTransformCallback = Promise<undefined> (any chunk, Transform
    {{Transformer/flush|flush()}}; the stream is already in the process of successfully closing down,
    and terminating it would be counterproductive.)
 
+  <dt><dfn dict-member for="Transformer" lt="cancel">cancel(<var ignore>reason</var>)</dfn></dt>
+  <dd>
+   <p>A function called when the [=writable side=] is aborted, or when the [=readable side=] is

Maybe mention the readable side first as that's the general order in the spec. 

> +   <p>(Note that there is no need to call
+   {{TransformStreamDefaultController/terminate()|controller.terminate()}} inside
+   {{Transformer/cancel|cancel()}}; the stream is already in the process of cancelling/aborting, and
+   terminating it would be counterproductive.)
+

```suggestion
```

This part is redundant after 1c65d61bfed17c117f9c34a577a713b4d1a1c640.

> @@ -5570,9 +5591,9 @@ callback TransformerTransformCallback = Promise<undefined> (any chunk, Transform
 </dl>
 
 The <code>controller</code> object passed to {{Transformer/start|start()}},
-{{Transformer/transform|transform()}}, and {{Transformer/flush|flush()}} is an instance of
-{{TransformStreamDefaultController}}, and has the ability to enqueue [=chunks=] to the [=readable
-side=], or to terminate or error the stream.
+{{Transformer/transform|transform()}}, {{Transformer/flush|flush()}}, and
+{{Transformer/cancel|cancel()}} is an instance of {{TransformStreamDefaultController}}, and has the
+ability to enqueue [=chunks=] to the [=readable side=], or to terminate or error the stream.

Same after 1c65d61bfed17c117f9c34a577a713b4d1a1c640.

> @@ -7106,9 +7175,11 @@ reason.
 <div algorithm="create a TransformStream">
  To <dfn export for="TransformStream" lt="set up|setting up">set up</dfn> a
  newly-[=new|created-via-Web IDL=] {{TransformStream}} |stream| given an algorithm <dfn export
- for="TransformStream/set up"><var>transformAlgorithm</var></dfn> and an optional algorithm <dfn
- export for="TransformStream/set up"><var>flushAlgorithm</var></dfn>, perform the following steps.
- |transformAlgorithm| and, if given, |flushAlgorithm|, may return a promise.
+ for="TransformStream/set up"><var>transformAlgorithm</var></dfn>, an optional algorithm <dfn
+ export for="TransformStream/set up"><var>flushAlgorithm</var></dfn>, and an optional algorithm <dfn
+ export for="TransformStream/set up"><var>cancelAlgorithm</var></dfn>, perform the following steps.
+ |transformAlgorithm|, if given, |flushAlgorithm|, and, if given, |cancelAlgorithm|, may return a

Can we say "if given, |flushAlgorithm| and |cancelAlgorithm|"?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1283#pullrequestreview-1475149598
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/pull/1283/review/1475149598@github.com>

Received on Monday, 12 June 2023 15:49:38 UTC