@@ -201,7 +201,7 @@ added and `'removeListener'` when a listener is removed.
201
201
202
202
### Event: 'newListener'
203
203
204
- * ` event ` {String|Symbol} The event name
204
+ * ` eventName ` {String|Symbol} The name of the event being listened for
205
205
* ` listener ` {Function} The event handler function
206
206
207
207
The ` EventEmitter ` instance will emit it's own ` 'newListener' ` event * before*
@@ -237,16 +237,16 @@ myEmitter.emit('event');
237
237
238
238
### Event: 'removeListener'
239
239
240
- * ` event ` {String|Symbol} The event name
240
+ * ` eventName ` {String|Symbol} The event name
241
241
* ` listener ` {Function} The event handler function
242
242
243
243
The ` 'removeListener' ` event is emitted * after* a listener is removed.
244
244
245
- ### EventEmitter.listenerCount(emitter, event )
245
+ ### EventEmitter.listenerCount(emitter, eventName )
246
246
247
247
Stability: 0 - Deprecated: Use [`emitter.listenerCount()`][] instead.
248
248
249
- A class method that returns the number of listeners for the given ` event `
249
+ A class method that returns the number of listeners for the given ` eventName `
250
250
registered on the given ` emitter ` .
251
251
252
252
``` js
@@ -284,16 +284,17 @@ emitter.once('event', () => {
284
284
});
285
285
```
286
286
287
- ### emitter.addListener(event , listener)
287
+ ### emitter.addListener(eventName , listener)
288
288
289
- Alias for ` emitter.on(event , listener) ` .
289
+ Alias for ` emitter.on(eventName , listener) ` .
290
290
291
- ### emitter.emit(event [ , arg1] [ , arg2 ] [ , ...] )
291
+ ### emitter.emit(eventName [ , arg1] [ , arg2 ] [ , ...] )
292
292
293
- Synchronously calls each of the listeners registered for ` event ` , in the order
294
- they were registered, passing the supplied arguments to each.
293
+ Synchronously calls each of the listeners registered for the event named
294
+ ` eventName ` , in the order they were registered, passing the supplied arguments
295
+ to each.
295
296
296
- Returns ` true ` if event had listeners, ` false ` otherwise.
297
+ Returns ` true ` if the event had listeners, ` false ` otherwise.
297
298
298
299
### emitter.eventNames()
299
300
@@ -319,15 +320,15 @@ Returns the current max listener value for the `EventEmitter` which is either
319
320
set by [ ` emitter.setMaxListeners(n) ` ] [ ] or defaults to
320
321
[ ` EventEmitter.defaultMaxListeners ` ] [ ] .
321
322
322
- ### emitter.listenerCount(event )
323
+ ### emitter.listenerCount(eventName )
323
324
324
- * ` event ` {Value} The type of event
325
+ * ` eventName ` {Value} The name of the event being listened for
325
326
326
- Returns the number of listeners listening to the ` event ` type .
327
+ Returns the number of listeners listening to the event named ` eventName ` .
327
328
328
- ### emitter.listeners(event )
329
+ ### emitter.listeners(eventName )
329
330
330
- Returns a copy of the array of listeners for the specified ` event ` .
331
+ Returns a copy of the array of listeners for the event named ` eventName ` .
331
332
332
333
``` js
333
334
server .on (' connection' , (stream ) => {
@@ -337,12 +338,12 @@ console.log(util.inspect(server.listeners('connection')));
337
338
// Prints: [ [Function] ]
338
339
```
339
340
340
- ### emitter.on(event , listener)
341
+ ### emitter.on(eventName , listener)
341
342
342
343
Adds the ` listener ` function to the end of the listeners array for the
343
- specified ` event ` . No checks are made to see if the ` listener ` has already
344
- been added. Multiple calls passing the same combination of ` event ` and
345
- ` listener ` will result in the ` listener ` being added, and called, multiple
344
+ event named ` eventName ` . No checks are made to see if the ` listener ` has
345
+ already been added. Multiple calls passing the same combination of ` eventName `
346
+ and ` listener ` will result in the ` listener ` being added, and called, multiple
346
347
times.
347
348
348
349
``` js
@@ -353,10 +354,11 @@ server.on('connection', (stream) => {
353
354
354
355
Returns a reference to the ` EventEmitter ` so calls can be chained.
355
356
356
- ### emitter.once(event , listener)
357
+ ### emitter.once(eventName , listener)
357
358
358
- Adds a ** one time** ` listener ` function for the ` event ` . This listener is
359
- invoked only the next time ` event ` is triggered, after which it is removed.
359
+ Adds a ** one time** ` listener ` function for the event named ` eventName ` . This
360
+ listener is invoked only the next time ` eventName ` is triggered, after which
361
+ it is removed.
360
362
361
363
``` js
362
364
server .once (' connection' , (stream ) => {
@@ -366,20 +368,20 @@ server.once('connection', (stream) => {
366
368
367
369
Returns a reference to the ` EventEmitter ` so calls can be chained.
368
370
369
- ### emitter.removeAllListeners([ event ] )
371
+ ### emitter.removeAllListeners([ eventName ] )
370
372
371
- Removes all listeners, or those of the specified ` event ` .
373
+ Removes all listeners, or those of the specified ` eventName ` .
372
374
373
375
Note that it is bad practice to remove listeners added elsewhere in the code,
374
376
particularly when the ` EventEmitter ` instance was created by some other
375
377
component or module (e.g. sockets or file streams).
376
378
377
379
Returns a reference to the ` EventEmitter ` so calls can be chained.
378
380
379
- ### emitter.removeListener(event , listener)
381
+ ### emitter.removeListener(eventName , listener)
380
382
381
- Removes the specified ` listener ` from the listener array for the specified
382
- ` event ` .
383
+ Removes the specified ` listener ` from the listener array for the event named
384
+ ` eventName ` .
383
385
384
386
``` js
385
387
var callback = (stream ) => {
@@ -392,8 +394,8 @@ server.removeListener('connection', callback);
392
394
393
395
` removeListener ` will remove, at most, one instance of a listener from the
394
396
listener array. If any single listener has been added multiple times to the
395
- listener array for the specified ` event ` , then ` removeListener ` must be called
396
- multiple times to remove each instance.
397
+ listener array for the specified ` eventName ` , then ` removeListener ` must be
398
+ called multiple times to remove each instance.
397
399
398
400
Note that once an event has been emitted, all listeners attached to it at the
399
401
time of emitting will be called in order. This implies that any ` removeListener() `
0 commit comments