@@ -33,7 +33,10 @@ added and `'removeListener'` when a listener is removed.
3333### emitter.addListener(event, listener)
3434### emitter.on(event, listener)
3535
36- Adds a listener to the end of the listeners array for the specified event.
36+ Adds a listener to the end of the listeners array for the specified ` event ` .
37+ No checks are made to see if the ` listener ` has already been added. Multiple
38+ calls passing the same combination of ` event ` and ` listener ` will result in the
39+ ` listener ` being added multiple times.
3740
3841 server.on('connection', function (stream) {
3942 console.log('someone connected!');
@@ -65,6 +68,11 @@ Remove a listener from the listener array for the specified event.
6568 // ...
6669 server.removeListener('connection', callback);
6770
71+ ` removeListener ` will remove, at most, one instance of a listener from the
72+ listener array. If any single listener has been added multiple times to the
73+ listener array for the specified ` event ` , then ` removeListener ` must be called
74+ multiple times to remove each instance.
75+
6876Returns emitter, so calls can be chained.
6977
7078### emitter.removeAllListeners([ event] )
@@ -135,14 +143,14 @@ Return the number of listeners for a given event.
135143* ` event ` {String} The event name
136144* ` listener ` {Function} The event handler function
137145
138- This event is emitted any time someone adds a new listener. It is unspecified
139- if ` listener ` is in the list returned by ` emitter.listeners( event) ` .
146+ This event is emitted any time a listener is added. When this event is triggered,
147+ the listener may not yet have been added to the array of listeners for the ` event ` .
140148
141149
142150### Event: 'removeListener'
143151
144152* ` event ` {String} The event name
145153* ` listener ` {Function} The event handler function
146154
147- This event is emitted any time someone removes a listener. It is unspecified
148- if ` listener ` is in the list returned by ` emitter.listeners( event) ` .
155+ This event is emitted any time someone removes a listener. When this event is triggered,
156+ the listener may not yet have been removed from the array of listeners for the ` event ` .
0 commit comments