diff --git a/doc/api/globals.md b/doc/api/globals.md index ebabf82bc03121..1bf2babb72745c 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -127,6 +127,8 @@ Returns a new `AbortSignal` which will be aborted in `delay` milliseconds. added: REPLACEME --> +> Stability: 1 - Experimental + * `signals` {AbortSignal\[]} The `AbortSignal`s of which to compose a new `AbortSignal`. Returns a new `AbortSignal` which will be aborted if any of the provided diff --git a/lib/internal/abort_controller.js b/lib/internal/abort_controller.js index b427a928469a88..6e47cea4b5a445 100644 --- a/lib/internal/abort_controller.js +++ b/lib/internal/abort_controller.js @@ -28,6 +28,7 @@ const { const { createDeferredPromise, customInspectSymbol, + emitExperimentalWarning, kEmptyObject, kEnumerableProperty, } = require('internal/util'); @@ -195,6 +196,7 @@ class AbortSignal extends EventTarget { * @returns {AbortSignal} */ static any(signals) { + emitExperimentalWarning('AbortSignal.any'); validateAbortSignalArray(signals, 'signals'); const resultSignal = createAbortSignal({ composite: true }); const resultSignalWeakRef = new WeakRef(resultSignal); @@ -365,8 +367,7 @@ function abortSignal(signal, reason) { signal.dispatchEvent(event); signal[kDependantSignals]?.forEach((s) => { const signalRef = s.deref(); - if (!signalRef) return; - abortSignal(signalRef, reason); + if (signalRef) abortSignal(signalRef, reason); }); }