- From: Mattias Buelens <notifications@github.com>
- Date: Fri, 12 Jul 2019 14:57:48 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 12 July 2019 21:58:10 UTC
One more thing: since we're _aborting_ the pipe, the pipe promise will reject with an `AbortError` instead of resolving. So we need to use `.catch()` instead of `.then()`:
```js
document.querySelector("#switch").onclick = () => {
controller.abort();
pipePromise.catch(() => {
rsA.pipeTo(wsB);
});
};
```
(You should probably check whether the rejection reason was actually an `AbortError`, but this should be good enough for demo purposes. 😛)
--
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/issues/1004#issuecomment-511046429
Received on Friday, 12 July 2019 21:58:10 UTC