Re: [whatwg/dom] Expose an `aborted` promise on AbortSignal? (#946)

> Maybe I'm missing it, but I'm not sure how to implement these utils with signal.race(..).

Yeah, it wouldn’t account for multiple-signal cases on its own. In our utils, that pattern ends up being `race(coalesce(..signals), promise)`, where coalesce is a function which maps n signals to a single signal. For us this “coalesce” step happens up front at the start of an op that might receive multiple signals (including “no signals”, so that subsequent logic doesn’t have to branch for it).

(A native `coalesce` would be useful regardless because native APIs that take signals like `fetch` only take one).

Re: custom reasons — I haven’t used / thought about that before but I suspect you are correct that the pattern I suggested is not friendly to it.

-- 
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/946#issuecomment-845949144

Received on Friday, 21 May 2021 13:27:02 UTC