From 24240e617184720c3bcd041837077ac6879b6a29 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Tue, 9 Jul 2024 16:24:03 -0400 Subject: [PATCH 1/6] Update endpoint pair example and fix citation --- index.bs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.bs b/index.bs index 9a7de963..e22a9c6e 100644 --- a/index.bs +++ b/index.bs @@ -7459,19 +7459,19 @@ readable and writable streams represent the two ends of a longer pipeline, with web developer code insert [=transform streams=] into the middle of them.
- Assuming we had a web-platform-provided function `createEndpointPair()`, web developers would write - code like so: + Assuming we had a web-platform-provided interface `Transformer` that had `readable` and + `writable` attributes, web developers would write code like so: - const { readable, writable } = createEndpointPair(); - readable.pipeThrough(new TransformStream(...)).pipeTo(writable); + async function handleTransformer({transformer: {readable, writable}}) { + await readable.pipeThrough(new TransformStream(...)).pipeTo(writable); + }
-

WebRTC Insertable Media using -Streams is an example of this technique, with its `sender.createEncodedStreams()` and -`receiver.createEncodedStreams()` methods. - +

WebRTC Encoded Transform +is an example of this technique, with its {{RTCRtpScriptTransformer}} interface which has +both `readable` and `writable` attributes. Despite such endpoint pairs obeying the `readable`/`writable` property contract, it never makes sense to pass them to {{ReadableStream/pipeThrough()}}. From aa5cf913b77fcb304595f1ac9db6acb722c18afd Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Tue, 9 Jul 2024 16:33:07 -0400 Subject: [PATCH 2/6] simplify example --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index e22a9c6e..2f7f6f53 100644 --- a/index.bs +++ b/index.bs @@ -7463,7 +7463,7 @@ web developer code insert [=transform streams=] into the middle of them. `writable` attributes, web developers would write code like so:

- async function handleTransformer({transformer: {readable, writable}}) { + async function handleTransformer({readable, writable}) { await readable.pipeThrough(new TransformStream(...)).pipeTo(writable); } From a745d0c07c535ca73940c6cbf550d79612c1e08b Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Wed, 10 Jul 2024 16:53:35 -0400 Subject: [PATCH 3/6] Make example look more like the API it references. --- index.bs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/index.bs b/index.bs index 2f7f6f53..49c185f7 100644 --- a/index.bs +++ b/index.bs @@ -7459,13 +7459,15 @@ readable and writable streams represent the two ends of a longer pipeline, with web developer code insert [=transform streams=] into the middle of them.
- Assuming we had a web-platform-provided interface `Transformer` that had `readable` and - `writable` attributes, web developers would write code like so: + Assuming a web-platform-fired "transform" event with a `transformer` attribute that is a + `Transformer` interface with `readable` and `writable` attributes, web developers would + write code like so: - async function handleTransformer({readable, writable}) { + addEventListener("transform", ({transformer}) => { + const {readable, writable} = transformer; await readable.pipeThrough(new TransformStream(...)).pipeTo(writable); - } + });
From a146a0e5af4c52c77aa8ad00c983e6a1f8a8c171 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 11 Jul 2024 17:09:36 -0400 Subject: [PATCH 4/6] Revert "Make example look more like the API it references." This reverts commit a745d0c07c535ca73940c6cbf550d79612c1e08b. --- index.bs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/index.bs b/index.bs index 49c185f7..2f7f6f53 100644 --- a/index.bs +++ b/index.bs @@ -7459,15 +7459,13 @@ readable and writable streams represent the two ends of a longer pipeline, with web developer code insert [=transform streams=] into the middle of them.
- Assuming a web-platform-fired "transform" event with a `transformer` attribute that is a - `Transformer` interface with `readable` and `writable` attributes, web developers would - write code like so: + Assuming we had a web-platform-provided interface `Transformer` that had `readable` and + `writable` attributes, web developers would write code like so: - addEventListener("transform", ({transformer}) => { - const {readable, writable} = transformer; + async function handleTransformer({readable, writable}) { await readable.pipeThrough(new TransformStream(...)).pipeTo(writable); - }); + }
From 85a4176e74afb0d22e710397019b8b1e729f2d99 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 11 Jul 2024 17:43:32 -0400 Subject: [PATCH 5/6] revert example. --- index.bs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 2f7f6f53..342e87f4 100644 --- a/index.bs +++ b/index.bs @@ -7463,9 +7463,8 @@ web developer code insert [=transform streams=] into the middle of them. `writable` attributes, web developers would write code like so: - async function handleTransformer({readable, writable}) { - await readable.pipeThrough(new TransformStream(...)).pipeTo(writable); - } + const { readable, writable } = createEndpointPair(); + await readable.pipeThrough(new TransformStream(...)).pipeTo(writable); From cecef0e59e05d85195179937735fb9947ddc4580 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 11 Jul 2024 17:49:28 -0400 Subject: [PATCH 6/6] Revert example prose --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 342e87f4..2266b924 100644 --- a/index.bs +++ b/index.bs @@ -7459,8 +7459,8 @@ readable and writable streams represent the two ends of a longer pipeline, with web developer code insert [=transform streams=] into the middle of them.
- Assuming we had a web-platform-provided interface `Transformer` that had `readable` and - `writable` attributes, web developers would write code like so: + Assuming we had a web-platform-provided function `createEndpointPair()`, web developers would write + code like so: const { readable, writable } = createEndpointPair();