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 d15f522

Browse filesBrowse files
deokjinkimdanielleadams
authored andcommitted
doc: update output of example in AbortController
Actual output of example in AbortController is mismatched. Plus, make `reason` parameter as optional in JSDoc. Refs: https://github.com/nodejs/node/blob/main/doc/api/globals.md#abortcontrollerabortreason Refs: https://github.com/nodejs/node/blob/main/doc/api/globals.md#static-method-abortsignalabortreason PR-URL: #47227 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Erick Wendel <erick.workspace@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 1f08f48 commit d15f522
Copy full SHA for d15f522

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+4
-4
lines changed
Open diff view settings
Collapse file

‎doc/api/globals.md‎

Copy file name to clipboardExpand all lines: doc/api/globals.md
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ac.signal.addEventListener('abort', () => console.log('Aborted!'),
4343

4444
ac.abort();
4545

46-
console.log(ac.signal.aborted); // Prints True
46+
console.log(ac.signal.aborted); // Prints true
4747
```
4848

4949
### `abortController.abort([reason])`
@@ -196,7 +196,7 @@ An optional reason specified when the `AbortSignal` was triggered.
196196
```js
197197
const ac = new AbortController();
198198
ac.abort(new Error('boom!'));
199-
console.log(ac.signal.reason); // Error('boom!');
199+
console.log(ac.signal.reason); // Error: boom!
200200
```
201201

202202
#### `abortSignal.throwIfAborted()`
Collapse file

‎lib/internal/abort_controller.js‎

Copy file name to clipboardExpand all lines: lib/internal/abort_controller.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class AbortSignal extends EventTarget {
163163
}
164164

165165
/**
166-
* @param {any} reason
166+
* @param {any} [reason]
167167
* @returns {AbortSignal}
168168
*/
169169
static abort(
@@ -337,7 +337,7 @@ class AbortController {
337337
}
338338

339339
/**
340-
* @param {any} reason
340+
* @param {any} [reason]
341341
*/
342342
abort(reason = new DOMException('This operation was aborted', 'AbortError')) {
343343
validateAbortController(this);

0 commit comments

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