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

Hmm, or we could do something entirely on the Streams side. For example:

```js
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 `waitForPrevious` the default; my intuition is that that would transform too many error cases into stalled cases. But maybe it'd work...

-- 
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#issuecomment-675006710

Received on Monday, 17 August 2020 17:20:52 UTC