Skip to content

Commit

Permalink
doc: missing argument types for events methods
Browse files Browse the repository at this point in the history
Refs: nodejs#9399
PR-URL: nodejs#11802
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
  • Loading branch information
ameliavoncat authored and jungx098 committed Mar 21, 2017
1 parent 83a59e1 commit 3b7c9e0
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -296,13 +296,17 @@ Its `name` property is set to `'MaxListenersExceededWarning'`.
<!-- YAML
added: v0.1.26
-->
- `eventName` {any}
- `listener` {Function}

Alias for `emitter.on(eventName, listener)`.

### emitter.emit(eventName[, ...args])
<!-- YAML
added: v0.1.26
-->
- `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
Expand Down Expand Up @@ -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`.

Expand All @@ -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`.

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -484,6 +489,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
<!-- YAML
added: v0.1.26
-->
- `eventName` {any}

Removes all listeners, or those of the specified `eventName`.

Expand All @@ -497,6 +503,8 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
<!-- YAML
added: v0.1.26
-->
- `eventName` {any}
- `listener` {Function}

Removes the specified `listener` from the listener array for the event named
`eventName`.
Expand Down Expand Up @@ -564,6 +572,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
<!-- YAML
added: v0.3.5
-->
- `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
Expand Down

0 comments on commit 3b7c9e0

Please sign in to comment.