There was a very long and heated debate about this last year sometime. I 
can't find it right now. I believe it was split between pull request 
comments and a thread on the mailing list. Things were pretty split on 
whether we wanted to greatly expand the scope of EventEmitter, by merging 
in some of the features of EventEmitter2, or whether we wanted a very 
minimal catch all api, that would enable many other things to be layered on 
top in user land. Of course there were some that wanted neither.

I would like to have this debate again, hopefully with less arguing and 
more reason. I really like the one function parameter api. But you have to 
support the rest of the api. How do you retrieve the list of catch-all 
listeners? e.g. emitter.listeners('error'). The star syntax is handy here, 
but if we don't use that we need yet another convention. Pass nothing to 
emitter.listeners() and it'll return the list of catch-alls? I don't like 
that. emitter.globalListeners()?

Maybe it's best that we don't dredge up links to prior art as it'll just 
reignite the old arguments. I really hope that the core team is opening up 
to these types of improvements again.

:Marco

On Sunday, April 8, 2012 2:04:04 AM UTC-7, Pedro Teixeira wrote:
>
> Delegating an event emitter into another event emitter is hard.
>
> A catch-all event handler that worked like this would be of much help:
>
> eventEmitter.on(function(eventType, args) {
>   console.log('got event type %s and args %j', eventType, args);
> });
>
> Do you know if something like this is on the works? If not, is this a 
> desirable feature?
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to