@@ -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,32 +284,33 @@ 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.getMaxListeners()
299
300
300
301
Returns the current max listener value for the ` EventEmitter ` which is either
301
302
set by [ ` emitter.setMaxListeners(n) ` ] [ ] or defaults to
302
303
[ ` EventEmitter.defaultMaxListeners ` ] [ ] .
303
304
304
- ### emitter.listenerCount(event )
305
+ ### emitter.listenerCount(eventName )
305
306
306
- * ` event ` {Value} The type of event
307
+ * ` eventName ` {Value} The name of the event being listened for
307
308
308
- Returns the number of listeners listening to the ` event ` type .
309
+ Returns the number of listeners listening to the event named ` eventName ` .
309
310
310
- ### emitter.listeners(event )
311
+ ### emitter.listeners(eventName )
311
312
312
- Returns a copy of the array of listeners for the specified ` event ` .
313
+ Returns a copy of the array of listeners for the event named ` eventName ` .
313
314
314
315
``` js
315
316
server .on (' connection' , (stream ) => {
@@ -319,12 +320,12 @@ console.log(util.inspect(server.listeners('connection')));
319
320
// Prints: [ [Function] ]
320
321
```
321
322
322
- ### emitter.on(event , listener)
323
+ ### emitter.on(eventName , listener)
323
324
324
325
Adds the ` listener ` function to the end of the listeners array for the
325
- specified ` event ` . No checks are made to see if the ` listener ` has already
326
- been added. Multiple calls passing the same combination of ` event ` and
327
- ` listener ` will result in the ` listener ` being added, and called, multiple
326
+ event named ` eventName ` . No checks are made to see if the ` listener ` has
327
+ already been added. Multiple calls passing the same combination of ` eventName `
328
+ and ` listener ` will result in the ` listener ` being added, and called, multiple
328
329
times.
329
330
330
331
``` js
@@ -335,10 +336,11 @@ server.on('connection', (stream) => {
335
336
336
337
Returns a reference to the ` EventEmitter ` so calls can be chained.
337
338
338
- ### emitter.once(event , listener)
339
+ ### emitter.once(eventName , listener)
339
340
340
- Adds a ** one time** ` listener ` function for the ` event ` . This listener is
341
- invoked only the next time ` event ` is triggered, after which it is removed.
341
+ Adds a ** one time** ` listener ` function for the event named ` eventName ` . This
342
+ listener is invoked only the next time ` eventName ` is triggered, after which
343
+ it is removed.
342
344
343
345
``` js
344
346
server .once (' connection' , (stream ) => {
@@ -348,20 +350,20 @@ server.once('connection', (stream) => {
348
350
349
351
Returns a reference to the ` EventEmitter ` so calls can be chained.
350
352
351
- ### emitter.removeAllListeners([ event ] )
353
+ ### emitter.removeAllListeners([ eventName ] )
352
354
353
- Removes all listeners, or those of the specified ` event ` .
355
+ Removes all listeners, or those of the specified ` eventName ` .
354
356
355
357
Note that it is bad practice to remove listeners added elsewhere in the code,
356
358
particularly when the ` EventEmitter ` instance was created by some other
357
359
component or module (e.g. sockets or file streams).
358
360
359
361
Returns a reference to the ` EventEmitter ` so calls can be chained.
360
362
361
- ### emitter.removeListener(event , listener)
363
+ ### emitter.removeListener(eventName , listener)
362
364
363
- Removes the specified ` listener ` from the listener array for the specified
364
- ` event ` .
365
+ Removes the specified ` listener ` from the listener array for the event named
366
+ ` eventName ` .
365
367
366
368
``` js
367
369
var callback = (stream ) => {
@@ -374,8 +376,8 @@ server.removeListener('connection', callback);
374
376
375
377
` removeListener ` will remove, at most, one instance of a listener from the
376
378
listener array. If any single listener has been added multiple times to the
377
- listener array for the specified ` event ` , then ` removeListener ` must be called
378
- multiple times to remove each instance.
379
+ listener array for the specified ` eventName ` , then ` removeListener ` must be
380
+ called multiple times to remove each instance.
379
381
380
382
Note that once an event has been emitted, all listeners attached to it at the
381
383
time of emitting will be called in order. This implies that any ` removeListener() `
0 commit comments