From de2b7a964027a02a99a9ccef99a1c1bddd07c673 Mon Sep 17 00:00:00 2001 From: Deokjin Kim Date: Thu, 19 Jan 2023 18:41:09 +0900 Subject: [PATCH] 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 Reviewed-By: James M Snell --- doc/api/events.md | 51 +++++++++++++++++++++++++----------- lib/internal/event_target.js | 2 +- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index 104f2e22f2d541..7fe87d037e76ea 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -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 @@ -2298,7 +2297,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)` + +* `n` {number} + +Node.js-specific extension to the `EventTarget` class that sets the number +of max event listeners as `n`. + +#### `nodeEventTarget.getMaxListeners()` + + + +* Returns: {number} + +Node.js-specific extension to the `EventTarget` class that returns the number +of max event listeners. + +#### `nodeEventTarget.off(type, listener[, options])`