Skip to content

Commit

Permalink
lib: improve transferable abort controller exec
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Nov 19, 2022
1 parent 48b1a7b commit bef645b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/abort_controller.js
Expand Up @@ -309,7 +309,7 @@ function abortSignal(signal, reason) {
}

class AbortController {
#signal = undefined;
#signal;

/**
* @type {AbortSignal}
Expand All @@ -323,7 +323,7 @@ class AbortController {
* @param {any} reason
*/
abort(reason = new DOMException('This operation was aborted', 'AbortError')) {
abortSignal(this.signal, reason);
abortSignal(this.#signal ?? createAbortSignal(), reason);
}

[customInspectSymbol](depth, options) {
Expand All @@ -334,7 +334,7 @@ class AbortController {

static [kMakeTransferable]() {
const controller = new AbortController();
controller.#signal = transferableAbortSignal(controller.#signal);
controller.#signal = createAbortSignal({ transferable: true });
return controller;
}
}
Expand Down

0 comments on commit bef645b

Please sign in to comment.