Re: [whatwg/dom] once() and on() async utilities for EventTarget (Issue #1038)

If API additions along these lines become a thing, I hope its API can be devised in a way that accounts for race/all patterns.

I've used homegrown promise/async-iterable DOM event utils along these lines for a while and the most interesting thing I've learned from it has been that "race patterns" are pretty common with DOM events. These are essentially "_any_ of these events once." _Usually_ they're events dispatched by a single target, but and opts.once is unhelpful for them: if anything, it makes it harder to spot the bug if you've failed to wire things up to cause removal of the other listeners when the first event is dispatched.

-- 
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/1038#issuecomment-984258199

Received on Thursday, 2 December 2021 03:24:34 UTC