Skip to content

Commit

Permalink
Simplifies old syncronous debouncing function
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeibbb committed Nov 6, 2024
1 parent 9e3445c commit 63741ed
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/system/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export function debounce<T extends (...args: any[]) => ReturnType<T>>(

function debounced(this: any, ...args: Parameters<T>) {
const time = Date.now();
const isInvoking = shouldInvoke(time);

if (aggregator != null && lastArgs) {
lastArgs = aggregator(lastArgs, args);
Expand All @@ -98,13 +97,6 @@ export function debounce<T extends (...args: any[]) => ReturnType<T>>(
lastThis = this;
lastCallTime = time;

if (isInvoking) {
if (timer == null) {
// Start the timer for the trailing edge.
timer = setTimeout(timerExpired, wait);
return result;
}
}
if (timer == null) {
timer = setTimeout(timerExpired, wait);
}
Expand Down

0 comments on commit 63741ed

Please sign in to comment.