Hi, I sometimes pass undefined to type when I type in the wrong actual
argument. EventEmitter does'nt complain are registers the event on
undefined, should it be allowed? A guard condition at the top of
addListener would be helpfull to prevent these kind of mistakes.
https://github.com/joyent/node/blob/master/lib/events.js#L131
Testing:
var eei = new (require('events').EventEmitter)
eei.on(undefined, function () { console.log(arguments); }
eei.emit(undefined,'test')
Suggested guard:
if (typeof undefined === 'undefined')
throw new TypeError('Attempt to register undefined event type')
Will still allow the string 'undefined' as a valid event type.
--
--
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
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.