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 e36af49

Browse filesBrowse files
deokjinkimRafaelGSS
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 1869559 commit e36af49
Copy full SHA for e36af49

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
@@ -2318,7 +2317,7 @@ added: v14.5.0
23182317
The `NodeEventTarget` is a Node.js-specific extension to `EventTarget`
23192318
that emulates a subset of the `EventEmitter` API.
23202319

2321-
#### `nodeEventTarget.addListener(type, listener[, options])`
2320+
#### `nodeEventTarget.addListener(type, listener)`
23222321

23232322
<!-- YAML
23242323
added: v14.5.0
@@ -2328,9 +2327,6 @@ added: v14.5.0
23282327

23292328
* `listener` {Function|EventListener}
23302329

2331-
* `options` {Object}
2332-
* `once` {boolean}
2333-
23342330
* Returns: {EventTarget} this
23352331

23362332
Node.js-specific extension to the `EventTarget` class that emulates the
@@ -2362,7 +2358,29 @@ added: v14.5.0
23622358
Node.js-specific extension to the `EventTarget` class that returns the number
23632359
of event listeners registered for the `type`.
23642360

2365-
#### `nodeEventTarget.off(type, listener)`
2361+
#### `nodeEventTarget.setMaxListeners(n)`
2362+
2363+
<!-- YAML
2364+
added: v14.5.0
2365+
-->
2366+
2367+
* `n` {number}
2368+
2369+
Node.js-specific extension to the `EventTarget` class that sets the number
2370+
of max event listeners as `n`.
2371+
2372+
#### `nodeEventTarget.getMaxListeners()`
2373+
2374+
<!-- YAML
2375+
added: v14.5.0
2376+
-->
2377+
2378+
* Returns: {number}
2379+
2380+
Node.js-specific extension to the `EventTarget` class that returns the number
2381+
of max event listeners.
2382+
2383+
#### `nodeEventTarget.off(type, listener[, options])`
23662384

23672385
<!-- YAML
23682386
added: v14.5.0
@@ -2372,11 +2390,14 @@ added: v14.5.0
23722390

23732391
* `listener` {Function|EventListener}
23742392

2393+
* `options` {Object}
2394+
* `capture` {boolean}
2395+
23752396
* Returns: {EventTarget} this
23762397

23772398
Node.js-specific alias for `eventTarget.removeListener()`.
23782399

2379-
#### `nodeEventTarget.on(type, listener[, options])`
2400+
#### `nodeEventTarget.on(type, listener)`
23802401

23812402
<!-- YAML
23822403
added: v14.5.0
@@ -2386,14 +2407,11 @@ added: v14.5.0
23862407

23872408
* `listener` {Function|EventListener}
23882409

2389-
* `options` {Object}
2390-
* `once` {boolean}
2391-
23922410
* Returns: {EventTarget} this
23932411

23942412
Node.js-specific alias for `eventTarget.addListener()`.
23952413

2396-
#### `nodeEventTarget.once(type, listener[, options])`
2414+
#### `nodeEventTarget.once(type, listener)`
23972415

23982416
<!-- YAML
23992417
added: v14.5.0
@@ -2403,8 +2421,6 @@ added: v14.5.0
24032421

24042422
* `listener` {Function|EventListener}
24052423

2406-
* `options` {Object}
2407-
24082424
* Returns: {EventTarget} this
24092425

24102426
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,
24252441
removes all registered listeners for `type`, otherwise removes all registered
24262442
listeners.
24272443

2428-
#### `nodeEventTarget.removeListener(type, listener)`
2444+
#### `nodeEventTarget.removeListener(type, listener[, options])`
24292445

24302446
<!-- YAML
24312447
added: v14.5.0
@@ -2435,6 +2451,9 @@ added: v14.5.0
24352451

24362452
* `listener` {Function|EventListener}
24372453

2454+
* `options` {Object}
2455+
* `capture` {boolean}
2456+
24382457
* Returns: {EventTarget} this
24392458

24402459
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
@@ -843,7 +843,7 @@ class NodeEventTarget extends EventTarget {
843843
}
844844

845845
/**
846-
* @param {string} [type]
846+
* @param {string} type
847847
* @returns {number}
848848
*/
849849
listenerCount(type) {

0 commit comments

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