Better event listeners
ecmascript at marcosc.com
Mon Jan 7 13:50:18 PST 2013
On Monday, 7 January 2013 at 19:15, Rick Waldron wrote:
> I wonder if this is the moment where redemption can happen... Instead of trying to invent some kind of new approach, why not standardize on the massive, 16 lane, mega-highway cow-path just waiting to be paved:
> on => addEventListener
> off => removeEventListener
> emit => dispatchEvent
> I'd suggest Node's EventEmitter (and EventEmitter2) as a reasonable starting point for an ideal, "subclassable" EventTarget-like system.
The above are great options, but I'd cry tears of joy for just having a constructor on EventTarget. I guess if we can fix a whole bunch of issues in one go (...man, that leveraging selectors for choosing targets is so nice...), that would be great, but I'm worried about getting bogged down.
More information about the es-discuss