Re: [whatwg/streams] Add examples for stopping pipes (#1059)

@domenic commented on this pull request.



> @@ -868,6 +868,49 @@ option. If {{UnderlyingSource/type}} is set to undefined (including via omission
     |options|["{{StreamPipeOptions/preventClose}}"],
     |options|["{{StreamPipeOptions/preventAbort}}"],
     |options|["{{StreamPipeOptions/preventCancel}}"], |signal|).
+
+ <div class="example" id="example-pipe-abortsignal">
+  An ongoing [=pipe=] operation can be stopped using an {{AbortSignal}}, as follows:
+
+  <xmp highlight="js">
+   const controller = new AbortController();
+   readable.pipeTo(writable, { signal: controller.signal });
+
+   // ... some time later ...
+   controller.abort();
+  </xmp>
+
+  (The above omits error handling for the promise returned by {{ReadableStream/pipeTo()}}.

Eh, on balance I like it, as a way of deemphasizing these sentences. I'll keep it. Thanks for weighing in though.

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

Received on Monday, 27 July 2020 17:13:14 UTC