When an EventEmitter instance experiences an error, the typical action is to emit an ‘error’ event. Error events are treated as a special case in node. If there is no listener for it, then the default action is to print a stack trace and exit the program. All EventEmitters emit the event ‘newListener’ when new listeners are added.
Arguments: |
|
---|---|
Returns EventEmitter: | |
Adds a listener to the end of the listeners array for the specified event.
Arguments: |
|
---|
Execute each of the listeners in order with the supplied arguments.
Arguments: |
|
---|---|
Returns EventEmitter: | |
Instance |
Returns an array of listeners for the specified event. This array can be manipulated, e.g. to remove listeners.
Arguments: |
|
---|---|
Returns EventEmitter: | |
Instance |
Adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed.
Arguments: |
|
---|---|
Returns EventEmitter: | |
Instance |
Removes all listeners, or those of the specified event.
Arguments: |
|
---|---|
Returns EventEmitter: | |
Instance |
Remove a listener from the listener array for the specified event. Caution: changes array indices in the listener array behind the listener.
Arguments: |
|
---|
By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default which helps finding memory leaks. Obviously not all Emitters should be limited to 10. This function allows that to be increased. Set to zero for unlimited.