Skip to content

Commit

Permalink
Remove redundant check
Browse files Browse the repository at this point in the history
  • Loading branch information
hanquliu authored and hanquliu committed May 28, 2024
1 parent 082d65a commit 46553e4
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,15 @@ export default function pThrottle({limit, interval, strict, signal, onDelay}) {
};

signal?.throwIfAborted();
if (signal && !signal.aborted) {
signal.addEventListener('abort', () => {
for (const timeout of queue.keys()) {
clearTimeout(timeout);
queue.get(timeout)(signal.reason);
}
signal?.addEventListener('abort', () => {
for (const timeout of queue.keys()) {
clearTimeout(timeout);
queue.get(timeout)(signal.reason);
}

queue.clear();
strictTicks.splice(0, strictTicks.length);
}, {once: true});
}
queue.clear();
strictTicks.splice(0, strictTicks.length);
}, {once: true});

throttled.isEnabled = true;

Expand Down

0 comments on commit 46553e4

Please sign in to comment.