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 was archived by the owner on May 17, 2021. It is now read-only.
Passes every listener for a specified event to a function one at a time.
Warning: The plain function is not passed to your callback, an instance of the Event class is. This class is not documented here but helps the internal code manage events. You can find it in the source if you wish to know more. You can find the plain function in the listener variable of the passed object. See the example if you do not understand.
Arguments
EventEmitter.eachListener(type, callback);
Stringtype Event type name
Functioncallback Function to pass each listener to
Returns
Object The current EventEmitter instance to allow chaining
Notes
Please bear in mind that this method is not part of the node API. It is mainly used for internal code. If you use it then it will make porting to the node environment more difficult. You can alternatively use EventEmitter.listeners to get an array of listeners to loop over them manually.
Examples
var ee = new EventEmitter();
ee.on('foo', function() {
return 'bar';
});
ee.eachListener('foo', function(event) {
console.log(event.listener()); // The actual function is held in Event.listener
// The plain function is not passed, an Event instance is
// The Event instance encapsulates the listener
});