Actually, the one function parameter api idea I got from @hij1nx some time after the EventEmitter -> Core debate. Many times I've had the need for something like this, so I think this should be something that others may find an interest on.
I think I'll start by doing a pull request to Node Core, it should be fairly simple to get the discussion going - some time this week. If the core team is reluctant or present fair arguments I'll just roll out my module or extend Oleic's caevents (which is a great start, thanks Oliver). -Pedro On Mon, Apr 9, 2012 at 11:24 PM, Marco Rogers <[email protected]>wrote: > 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 > -- -Pedro -- 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
