Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit de2b7a9

Browse filesBrowse files
deokjinkimjuanarbol
authored andcommitted
doc: fix mismatched arguments of NodeEventTarget
Arguments of some APIs are mismatched and 2 APIs are not as described. PR-URL: #45678 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent a87963d commit de2b7a9
Copy full SHA for de2b7a9

File tree

Expand file treeCollapse file tree

2 files changed

+36
-17
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+36
-17
lines changed
Open diff view settings
Collapse file

‎doc/api/events.md‎

Copy file name to clipboardExpand all lines: doc/api/events.md
+35-16Lines changed: 35 additions & 16 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1911,9 +1911,8 @@ and cannot be used in place of an `EventEmitter` in most cases.
19111911
ignored.
19121912
2. The `NodeEventTarget` does not emulate the full `EventEmitter` API.
19131913
Specifically the `prependListener()`, `prependOnceListener()`,
1914-
`rawListeners()`, `setMaxListeners()`, `getMaxListeners()`, and
1915-
`errorMonitor` APIs are not emulated. The `'newListener'` and
1916-
`'removeListener'` events will also not be emitted.
1914+
`rawListeners()`, and `errorMonitor` APIs are not emulated.
1915+
The `'newListener'` and `'removeListener'` events will also not be emitted.
19171916
3. The `NodeEventTarget` does not implement any special default behavior
19181917
for events with type `'error'`.
19191918
4. The `NodeEventTarget` supports `EventListener` objects as well as
@@ -2298,7 +2297,7 @@ added: v14.5.0
22982297
The `NodeEventTarget` is a Node.js-specific extension to `EventTarget`
22992298
that emulates a subset of the `EventEmitter` API.
23002299

2301-
#### `nodeEventTarget.addListener(type, listener[, options])`
2300+
#### `nodeEventTarget.addListener(type, listener)`
23022301

23032302
<!-- YAML
23042303
added: v14.5.0
@@ -2308,9 +2307,6 @@ added: v14.5.0
23082307

23092308
* `listener` {Function|EventListener}
23102309

2311-
* `options` {Object}
2312-
* `once` {boolean}
2313-
23142310
* Returns: {EventTarget} this
23152311

23162312
Node.js-specific extension to the `EventTarget` class that emulates the
@@ -2342,7 +2338,29 @@ added: v14.5.0
23422338
Node.js-specific extension to the `EventTarget` class that returns the number
23432339
of event listeners registered for the `type`.
23442340

2345-
#### `nodeEventTarget.off(type, listener)`
2341+
#### `nodeEventTarget.setMaxListeners(n)`
2342+
2343+
<!-- YAML
2344+
added: v14.5.0
2345+
-->
2346+
2347+
* `n` {number}
2348+
2349+
Node.js-specific extension to the `EventTarget` class that sets the number
2350+
of max event listeners as `n`.
2351+
2352+
#### `nodeEventTarget.getMaxListeners()`
2353+
2354+
<!-- YAML
2355+
added: v14.5.0
2356+
-->
2357+
2358+
* Returns: {number}
2359+
2360+
Node.js-specific extension to the `EventTarget` class that returns the number
2361+
of max event listeners.
2362+
2363+
#### `nodeEventTarget.off(type, listener[, options])`
23462364

23472365
<!-- YAML
23482366
added: v14.5.0
@@ -2352,11 +2370,14 @@ added: v14.5.0
23522370

23532371
* `listener` {Function|EventListener}
23542372

2373+
* `options` {Object}
2374+
* `capture` {boolean}
2375+
23552376
* Returns: {EventTarget} this
23562377

23572378
Node.js-specific alias for `eventTarget.removeListener()`.
23582379

2359-
#### `nodeEventTarget.on(type, listener[, options])`
2380+
#### `nodeEventTarget.on(type, listener)`
23602381

23612382
<!-- YAML
23622383
added: v14.5.0
@@ -2366,14 +2387,11 @@ added: v14.5.0
23662387

23672388
* `listener` {Function|EventListener}
23682389

2369-
* `options` {Object}
2370-
* `once` {boolean}
2371-
23722390
* Returns: {EventTarget} this
23732391

23742392
Node.js-specific alias for `eventTarget.addListener()`.
23752393

2376-
#### `nodeEventTarget.once(type, listener[, options])`
2394+
#### `nodeEventTarget.once(type, listener)`
23772395

23782396
<!-- YAML
23792397
added: v14.5.0
@@ -2383,8 +2401,6 @@ added: v14.5.0
23832401

23842402
* `listener` {Function|EventListener}
23852403

2386-
* `options` {Object}
2387-
23882404
* Returns: {EventTarget} this
23892405

23902406
Node.js-specific extension to the `EventTarget` class that adds a `once`
@@ -2405,7 +2421,7 @@ Node.js-specific extension to the `EventTarget` class. If `type` is specified,
24052421
removes all registered listeners for `type`, otherwise removes all registered
24062422
listeners.
24072423

2408-
#### `nodeEventTarget.removeListener(type, listener)`
2424+
#### `nodeEventTarget.removeListener(type, listener[, options])`
24092425

24102426
<!-- YAML
24112427
added: v14.5.0
@@ -2415,6 +2431,9 @@ added: v14.5.0
24152431

24162432
* `listener` {Function|EventListener}
24172433

2434+
* `options` {Object}
2435+
* `capture` {boolean}
2436+
24182437
* Returns: {EventTarget} this
24192438

24202439
Node.js-specific extension to the `EventTarget` class that removes the
Collapse file

‎lib/internal/event_target.js‎

Copy file name to clipboardExpand all lines: lib/internal/event_target.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ class NodeEventTarget extends EventTarget {
822822
}
823823

824824
/**
825-
* @param {string} [type]
825+
* @param {string} type
826826
* @returns {number}
827827
*/
828828
listenerCount(type) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.