doc: fix mismatched arguments of NodeEventTarget

Arguments of some APIs are mismatched and 2 APIs are not as
described.

PR-URL: https://github.com/nodejs/node/pull/45678
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Deokjin Kim authored and GitHub committed 2023-01-19 10:41:09 +01:00
1 parent 9a50c6d93d
commit b8043998db
2 files changed
+36 -17

No files matched your search

+35 -16
View File
@@ -1911,9 +1911,8 @@ and cannot be used in place of an `EventEmitter` in most cases.
ignored.
2. The `NodeEventTarget` does not emulate the full `EventEmitter` API.
Specifically the `prependListener()`, `prependOnceListener()`,
`rawListeners()`, `setMaxListeners()`, `getMaxListeners()`, and
`errorMonitor` APIs are not emulated. The `'newListener'` and
`'removeListener'` events will also not be emitted.
`rawListeners()`, and `errorMonitor` APIs are not emulated.
The `'newListener'` and `'removeListener'` events will also not be emitted.
3. The `NodeEventTarget` does not implement any special default behavior
for events with type `'error'`.
4. The `NodeEventTarget` supports `EventListener` objects as well as
@@ -2318,7 +2317,7 @@ added: v14.5.0
The `NodeEventTarget` is a Node.js-specific extension to `EventTarget`
that emulates a subset of the `EventEmitter` API.
#### `nodeEventTarget.addListener(type, listener[, options])`
#### `nodeEventTarget.addListener(type, listener)`
<!-- YAML
added: v14.5.0
@@ -2328,9 +2327,6 @@ added: v14.5.0
* `listener` {Function|EventListener}
* `options` {Object}
* `once` {boolean}
* Returns: {EventTarget} this
Node.js-specific extension to the `EventTarget` class that emulates the
@@ -2362,7 +2358,29 @@ added: v14.5.0
Node.js-specific extension to the `EventTarget` class that returns the number
of event listeners registered for the `type`.
#### `nodeEventTarget.off(type, listener)`
#### `nodeEventTarget.setMaxListeners(n)`
<!-- YAML
added: v14.5.0
-->
* `n` {number}
Node.js-specific extension to the `EventTarget` class that sets the number
of max event listeners as `n`.
#### `nodeEventTarget.getMaxListeners()`
<!-- YAML
added: v14.5.0
-->
* Returns: {number}
Node.js-specific extension to the `EventTarget` class that returns the number
of max event listeners.
#### `nodeEventTarget.off(type, listener[, options])`
<!-- YAML
added: v14.5.0
@@ -2372,11 +2390,14 @@ added: v14.5.0
* `listener` {Function|EventListener}
* `options` {Object}
* `capture` {boolean}
* Returns: {EventTarget} this
Node.js-specific alias for `eventTarget.removeListener()`.
#### `nodeEventTarget.on(type, listener[, options])`
#### `nodeEventTarget.on(type, listener)`
<!-- YAML
added: v14.5.0
@@ -2386,14 +2407,11 @@ added: v14.5.0
* `listener` {Function|EventListener}
* `options` {Object}
* `once` {boolean}
* Returns: {EventTarget} this
Node.js-specific alias for `eventTarget.addListener()`.
#### `nodeEventTarget.once(type, listener[, options])`
#### `nodeEventTarget.once(type, listener)`
<!-- YAML
added: v14.5.0
@@ -2403,8 +2421,6 @@ added: v14.5.0
* `listener` {Function|EventListener}
* `options` {Object}
* Returns: {EventTarget} this
Node.js-specific extension to the `EventTarget` class that adds a `once`
@@ -2425,7 +2441,7 @@ Node.js-specific extension to the `EventTarget` class. If `type` is specified,
removes all registered listeners for `type`, otherwise removes all registered
listeners.
#### `nodeEventTarget.removeListener(type, listener)`
#### `nodeEventTarget.removeListener(type, listener[, options])`
<!-- YAML
added: v14.5.0
@@ -2435,6 +2451,9 @@ added: v14.5.0
* `listener` {Function|EventListener}
* `options` {Object}
* `capture` {boolean}
* Returns: {EventTarget} this
Node.js-specific extension to the `EventTarget` class that removes the
+1 -1
View File
@@ -843,7 +843,7 @@ class NodeEventTarget extends EventTarget {
}
/**
* @param {string} [type]
* @param {string} type
* @returns {number}
*/
listenerCount(type) {