src code

instance method EventEmitter#addListener

EventEmitter#addListener(eventName, listener) → this
  • eventName (String) – The name of the event that needs to be emitted in order for listener to be invoked.
  • listener (Function) – The function to call when eventName is fired. The arguments to the function are passed from EventEmitter#emit.

Adds a listener function for the specified event name. If eventName is fired using EventEmitter#emit, then listener will be invoked, with the EventEmitter instance as this. Any number of listeners may be attached to a single eventName.