GeezerVison is showing github.com — doc: update output of example in AbortController · nodejs/node@a21459e
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
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 number | Diff line number | Diff line change |
|---|
@@ -43,7 +43,7 @@ ac.signal.addEventListener('abort', () => console.log('Aborted!'), |
43 | 43 |
|
44 | 44 | ac.abort(); |
45 | 45 |
|
46 | | -console.log(ac.signal.aborted); // Prints True |
| 46 | +console.log(ac.signal.aborted); // Prints true |
47 | 47 | ``` |
48 | 48 |
|
49 | 49 | ### `abortController.abort([reason])` |
@@ -196,7 +196,7 @@ An optional reason specified when the `AbortSignal` was triggered. |
196 | 196 | ```js |
197 | 197 | const ac = new AbortController(); |
198 | 198 | ac.abort(new Error('boom!')); |
199 | | -console.log(ac.signal.reason); // Error('boom!'); |
| 199 | +console.log(ac.signal.reason); // Error: boom! |
200 | 200 | ``` |
201 | 201 |
|
202 | 202 | #### `abortSignal.throwIfAborted()` |
|
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/abort_controller.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -163,7 +163,7 @@ class AbortSignal extends EventTarget { |
163 | 163 | } |
164 | 164 |
|
165 | 165 | /** |
166 | | - * @param {any} reason |
| 166 | + * @param {any} [reason] |
167 | 167 | * @returns {AbortSignal} |
168 | 168 | */ |
169 | 169 | static abort( |
@@ -326,7 +326,7 @@ class AbortController { |
326 | 326 | } |
327 | 327 |
|
328 | 328 | /** |
329 | | - * @param {any} reason |
| 329 | + * @param {any} [reason] |
330 | 330 | */ |
331 | 331 | abort(reason = new DOMException('This operation was aborted', 'AbortError')) { |
332 | 332 | abortSignal(this.#signal ??= createAbortSignal(), reason); |
|