This prevents the need to use a namespacing scheme or filter out similarly named events in the listeners themselves. Components generating particular events could instead expose symbols on their constructor (or other relevant object) to allow a user to listen to an event.
Sounds like a reasonable feature. We'd need interest from implementers and support in IDL. I'd also like to hear from framework developers and major websites if they'd use this.
I'm not an implementor or a developer at a major website (just a small one!). Could you provide a brief example of how this would look in practice to understand how user-friendly it would be? I'd like to avoid using jQuery, but namespacing events is one of those things that the native event listening API doesn't seem to provide.
Something like
const eventType = Symbol(),
event = new Event(eventType);
eventTarget.addEventListener(eventType, ...);
^ Yes, that's exactly it.
@benjamingr have there been requests for this in Node.js?
It's hard to say:
Most helpful comment
Something like