Skip to content

Commit

Permalink
lib: create weakRef only if any signals provided
Browse files Browse the repository at this point in the history
  • Loading branch information
atlowChemi committed Jun 13, 2023
1 parent d4e99b1 commit 26d8fbe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/internal/abort_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,11 @@ class AbortSignal extends EventTarget {
static any(signals) {
validateAbortSignalArray(signals, 'signals');
const resultSignal = createAbortSignal({ composite: true });
const resultSignalWeakRef = new WeakRef(resultSignal);
resultSignal[kSourceSignals] = new SafeSet();
if (!signals.length) {
return resultSignal;
}
const resultSignalWeakRef = new WeakRef(resultSignal);
for (let i = 0; i < signals.length; i++) {
const signal = signals[i];
if (signal.aborted) {
Expand Down

0 comments on commit 26d8fbe

Please sign in to comment.