Re: Better event listeners

As a web developer if I were to design an on function with some kind of
delegation support I would have an API like: https://gist.github.com/4463430

The exact API doesn't matter.

Emphasis being on that `.on(...)` returns some kind of token that can be
used to remove the listener so we don't have to keep a reference to the
listener ourself somewhere.

The other emphasis is that delegation filtering supports arbitrary
functions which allows people to delegate  whatever they want instead of a
limited string based DSL

I also currently use [ever][1] partially for cross-browser normalization
but mostly because I prefer writing `.on(...)` and it matches with the
other EventEmitter apis I use in the rest of my code. So there's definitely
value to having an API name that matches other conventions (and is terser).

  [1]: https://github.com/substack/ever#example

Received on Monday, 7 January 2013 17:18:56 UTC