From 75fcf53173bef218b05e05f91b8289149aee4daa Mon Sep 17 00:00:00 2001 From: Amelia Clarke Date: Sat, 11 Mar 2017 00:15:20 -0800 Subject: [PATCH] doc: missing argument types for events methods Refs: https://github.com/nodejs/node/issues/9399 PR-URL: https://github.com/nodejs/node/pull/11802 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Brian White --- doc/api/events.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index 7c72245ced..5c0614b68b 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -185,7 +185,7 @@ added and `'removeListener'` when existing listeners are removed. added: v0.1.26 --> -* `eventName` {string|symbol} The name of the event being listened for +* `eventName` {any} The name of the event being listened for * `listener` {Function} The event handler function The `EventEmitter` instance will emit its own `'newListener'` event *before* @@ -229,7 +229,7 @@ changes: now yields the original listener function. --> -* `eventName` {string|symbol} The event name +* `eventName` {any} The event name * `listener` {Function} The event handler function The `'removeListener'` event is emitted *after* the `listener` is removed. @@ -296,6 +296,8 @@ Its `name` property is set to `'MaxListenersExceededWarning'`. +- `eventName` {any} +- `listener` {Function} Alias for `emitter.on(eventName, listener)`. @@ -303,6 +305,8 @@ Alias for `emitter.on(eventName, listener)`. +- `eventName` {any} +- `...args` {any} Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments @@ -345,7 +349,7 @@ set by [`emitter.setMaxListeners(n)`][] or defaults to added: v3.2.0 --> -* `eventName` {string|symbol} The name of the event being listened for +* `eventName` {any} The name of the event being listened for Returns the number of listeners listening to the event named `eventName`. @@ -358,6 +362,7 @@ changes: description: For listeners attached using `.once()` this returns the original listeners instead of wrapper functions now. --> +- `eventName` {any} Returns a copy of the array of listeners for the event named `eventName`. @@ -374,7 +379,7 @@ console.log(util.inspect(server.listeners('connection'))); added: v0.1.101 --> -* `eventName` {string|symbol} The name of the event. +* `eventName` {any} The name of the event. * `listener` {Function} The callback function Adds the `listener` function to the end of the listeners array for the @@ -410,7 +415,7 @@ myEE.emit('foo'); added: v0.3.0 --> -* `eventName` {string|symbol} The name of the event. +* `eventName` {any} The name of the event. * `listener` {Function} The callback function Adds a **one time** `listener` function for the event named `eventName`. The @@ -443,7 +448,7 @@ myEE.emit('foo'); added: v6.0.0 --> -* `eventName` {string|symbol} The name of the event. +* `eventName` {any} The name of the event. * `listener` {Function} The callback function Adds the `listener` function to the *beginning* of the listeners array for the @@ -465,7 +470,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. added: v6.0.0 --> -* `eventName` {string|symbol} The name of the event. +* `eventName` {any} The name of the event. * `listener` {Function} The callback function Adds a **one time** `listener` function for the event named `eventName` to the @@ -484,6 +489,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. +- `eventName` {any} Removes all listeners, or those of the specified `eventName`. @@ -497,6 +503,8 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. +- `eventName` {any} +- `listener` {Function} Removes the specified `listener` from the listener array for the event named `eventName`. @@ -564,6 +572,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. +- `n` {integer} By default EventEmitters will print a warning if more than `10` listeners are added for a particular event. This is a useful default that helps finding