You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 17, 2021. It is now read-only.
Wolfy87 edited this page Nov 4, 2011
·
7 revisions
About
Adds an event listener for the specified event. When the max listener limit is exceeded you will be presented with a warning in the console, this helps to avoid memory leaks. You can raise the max listener limit with EventEmitter.setMaxListeners.
Functionlistener Function to be called when the event is fired
Objectscope Object that this should be set to when the listener is called
Booleanonce If true then the listener will be removed after the first call
Returns
Object The current EventEmitter instance to allow chaining
Notes
The once argument is mainly for internal use. If you wish to create an event that is only run one you should use EventEmitter.once. You can also use the alias of this method, EventEmitter.on.
Examples
var ee = new EventEmitter();
ee.addListener('foo', function() {
console.log('bar');
});