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

This seems like a nice addition, although it might be worth bikeshedding on the name and API surface. E.g. I'd personally do something more like `eventTarget.next("foo")` and `eventTarget.toAsyncIterator("foo")`; this style of static-methods-that-are-really-instance-methods is not something we generally do on the web platform.

If I recall, previous discussions in this vein have raised the worry that any developer code using such helpers would get access to the `Event` object too late to call `preventDefault()` or anything else that needs to work during the dispatch phase. That is kinda sad.

As some background, we've historically been "saving" `EventTarget.prototype.on()` for some "nicer" version of the EventTarget API. The latest attempt was https://github.com/whatwg/dom/issues/544 and I briefly floated https://glitch.com/edit/#!/angry-wound. It's been many years though.

-- 
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-984063001

Received on Wednesday, 1 December 2021 21:18:28 UTC