- From: Kyle Simpson <notifications@github.com>
- Date: Fri, 21 May 2021 06:17:02 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/946/845943237@github.com>
FWIW, `signal.race(..)` would serve *some* of my usages (in CAF), but I'm not sure it would serve all of them. Here are a couple of concerns: 1. CAF includes a `signalRace(..)` utility (and a `signalAll(..)`) that allow you to pass an array of multiple signals and do a race (or all) across them. I'm not sure how I would implement those utils with only a `race(..)` on each signal that only accepts a signel promise. Maybe I'm missing it, but I'm not sure how to implement these utils with `signal.race(..)`. 2. CAF "extends" abort signals in that it allows you to pass along a "reason" value for the cancellation (e.g, `token.abort("took too long")`). It uses this value to reject the `signal.pr` promise, so that any userland code doing a `catch(..)` or `try..catch` would see that abort reason. If I had a promise primitive (similar to my current `signal.pr`), then I can monkey-patch in the reason extension by adding a `catch(..)` or `finally(..)` on it that then substitutes the abort reason as a resolution value. But if all I have is a black-box `race(..)` method that hides the promise, I don't think I can accomplish that. There would be an inconsistency where the CAF mechanisms would expose this reason value, but if userland code observed the signal itself by calling their own `.race(..)`, they wouldn't see the reason come through. That's unfortunate. -- 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-845943237
Received on Friday, 21 May 2021 13:17:15 UTC