summaryrefslogtreecommitdiff
path: root/doc/api/events.md
diff options
context:
space:
mode:
authorVse Mozhet Byt <vsemozhetbyt@gmail.com>2018-04-11 21:07:14 +0300
committerJames M Snell <jasnell@gmail.com>2018-04-16 16:05:53 -0700
commit31b5ed49e04d89449c54637edd5fffb7603d9a2b (patch)
tree83970afaa89bf7328b7491a680a62e2acf988a40 /doc/api/events.md
parent0be14def2c0c97a33dcade499b4dd8c50dd76d0e (diff)
downloadnode-new-31b5ed49e04d89449c54637edd5fffb7603d9a2b.tar.gz
doc: add and unify even more return values
PR-URL: https://github.com/nodejs/node/pull/19955 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/events.md')
-rw-r--r--doc/api/events.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/api/events.md b/doc/api/events.md
index afea4f443c..5cb7b90b8d 100644
--- a/doc/api/events.md
+++ b/doc/api/events.md
@@ -298,6 +298,7 @@ added: v0.1.26
-->
- `eventName` {string|symbol}
- `...args` {any}
+- Returns: {boolean}
Synchronously calls each of the listeners registered for the event named
`eventName`, in the order they were registered, passing the supplied arguments
@@ -310,6 +311,8 @@ Returns `true` if the event had listeners, `false` otherwise.
added: v6.0.0
-->
+- Returns: {Array}
+
Returns an array listing the events for which the emitter has registered
listeners. The values in the array will be strings or Symbols.
@@ -331,6 +334,8 @@ console.log(myEE.eventNames());
added: v1.0.0
-->
+- Returns: {integer}
+
Returns the current max listener value for the `EventEmitter` which is either
set by [`emitter.setMaxListeners(n)`][] or defaults to
[`EventEmitter.defaultMaxListeners`][].
@@ -341,6 +346,7 @@ added: v3.2.0
-->
* `eventName` {string|symbol} The name of the event being listened for
+* Returns: {integer}
Returns the number of listeners listening to the event named `eventName`.
@@ -354,6 +360,7 @@ changes:
original listeners instead of wrapper functions now.
-->
- `eventName` {string|symbol}
+- Returns: {Function[]}
Returns a copy of the array of listeners for the event named `eventName`.
@@ -372,6 +379,7 @@ added: v0.1.101
* `eventName` {string|symbol} The name of the event.
* `listener` {Function} The callback function
+* Returns: {EventEmitter}
Adds the `listener` function to the end of the listeners array for the
event named `eventName`. No checks are made to see if the `listener` has
@@ -408,6 +416,7 @@ added: v0.3.0
* `eventName` {string|symbol} The name of the event.
* `listener` {Function} The callback function
+* Returns: {EventEmitter}
Adds a **one-time** `listener` function for the event named `eventName`. The
next time `eventName` is triggered, this listener is removed and then invoked.
@@ -441,6 +450,7 @@ added: v6.0.0
* `eventName` {string|symbol} The name of the event.
* `listener` {Function} The callback function
+* Returns: {EventEmitter}
Adds the `listener` function to the *beginning* of the listeners array for the
event named `eventName`. No checks are made to see if the `listener` has
@@ -463,6 +473,7 @@ added: v6.0.0
* `eventName` {string|symbol} The name of the event.
* `listener` {Function} The callback function
+* Returns: {EventEmitter}
Adds a **one-time** `listener` function for the event named `eventName` to the
*beginning* of the listeners array. The next time `eventName` is triggered, this
@@ -481,6 +492,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
added: v0.1.26
-->
- `eventName` {string|symbol}
+- Returns: {EventEmitter}
Removes all listeners, or those of the specified `eventName`.
@@ -496,6 +508,7 @@ added: v0.1.26
-->
- `eventName` {string|symbol}
- `listener` {Function}
+- Returns: {EventEmitter}
Removes the specified `listener` from the listener array for the event named
`eventName`.
@@ -564,6 +577,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
added: v0.3.5
-->
- `n` {integer}
+- Returns: {EventEmitter}
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
@@ -579,6 +593,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
added: v9.4.0
-->
- `eventName` {string|symbol}
+- Returns: {Function[]}
Returns a copy of the array of listeners for the event named `eventName`,
including any wrappers (such as those created by `.once`).