This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Various events.EventEmitter issues #9105
Labels
Comments
First, true. It should use Array.isArray or util.isArray instead of util.isObject. |
Is this a proper configuration for the event emitter, zero maxListeners? Would this not prevent any listeners from being added to the event emitter? |
As mentioned in the api document, "Set to zero for unlimited" |
Never mind 🍄 |
So could EventEmitter please use Array.isArray instead of util.isObject, then? |
The events implementation has been reworked significantly within the io.js stream. Many of these issues are resolved by those commits. I suggest that we hold off making changes here and pick the io.js changes up in the converged repo. |
Great 👍 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
node@v0.13.0-pre
First, it will test for isObject while it should be testing for isArray.
Second, it will initialize _maxListeners to a default of 'undefined'
while EventEmitter.defaultMaxListeners would be the better choice. In effect the following code
could then be simplified
to just
m = this._maxListeners || EventEmitter.defaultMaxListeners;
Third,
could be simplified to
Fourth,
wouldn't
be more efficient?
Fifth, again testing for isObject while it should be testing for isArray
And, finally, in
it should be documented that list.listener refers to a once only listener and that list could be any one of a function/array/wrapper for a one time listener.
Or not so finally 😁
could be simplified by
The text was updated successfully, but these errors were encountered: