Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: update output of example in AbortController #47227

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/api/globals.md
Expand Up @@ -43,7 +43,7 @@ ac.signal.addEventListener('abort', () => console.log('Aborted!'),

ac.abort();

console.log(ac.signal.aborted); // Prints True
console.log(ac.signal.aborted); // Prints true
```

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

#### `abortSignal.throwIfAborted()`
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/abort_controller.js
Expand Up @@ -163,7 +163,7 @@ class AbortSignal extends EventTarget {
}

/**
* @param {any} reason
* @param {any} [reason]
* @returns {AbortSignal}
*/
static abort(
Expand Down Expand Up @@ -326,7 +326,7 @@ class AbortController {
}

/**
* @param {any} reason
* @param {any} [reason]
*/
abort(reason = new DOMException('This operation was aborted', 'AbortError')) {
abortSignal(this.#signal ??= createAbortSignal(), reason);
Expand Down