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 6cb4ad9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/internal/abort_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ class AbortSignal extends EventTarget {
static any(signals) {
validateAbortSignalArray(signals, 'signals');
const resultSignal = createAbortSignal({ composite: true });
if (!signals.length) {
return resultSignal;
}
const resultSignalWeakRef = new WeakRef(resultSignal);
resultSignal[kSourceSignals] = new SafeSet();
for (let i = 0; i < signals.length; i++) {
Expand Down

0 comments on commit 6cb4ad9

Please sign in to comment.