- From: Domenic Denicola <notifications@github.com>
- Date: Mon, 17 Aug 2020 10:15:02 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 17 August 2020 17:15:15 UTC
OK, at the risk of forking the thread and losing the fairly nice design work we've been doing so far, here's an alternate solution that involves a lot less moving parts:
```js
const controller = new AbortController();
const pipePromise = readable1.pipeTo(writable, { preventAbort: true, signal: controller.signal });
// ... some time later ...
controller.abort();
await DOMException.ignoreAborts(pipePromise);
// Start the new pipe!
readable2.pipeTo(writable);
```
It's a little rough (e.g., slightly more to type; not a huge fan of the name `ignoreAborts` but I want it to be short; it's a bit strange that a function with a generic name like "ignoreAborts" specifically operates on promise arguments...). But it's probably a cleaner separation of concerns, whereas my original suggestion mixes things up a decent bit in the name of convenience.
--
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/dom/issues/881#issuecomment-675003948
Received on Monday, 17 August 2020 17:15:15 UTC