This repository has been archived by the owner on Oct 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kevin Van den Abeele
committed
Jun 2, 2020
1 parent
01c042a
commit 8f757a6
Showing
5 changed files
with
30 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export class AsyncUtils { | ||
|
||
public static debounce = <F extends (...args: any[]) => any>(func: F, waitFor: number) => { | ||
let timeout: ReturnType<typeof setTimeout> | null = null; | ||
|
||
const debounced = (...args: Parameters<F>) => { | ||
if (timeout !== null) { | ||
clearTimeout(timeout); | ||
timeout = null; | ||
} | ||
timeout = setTimeout(() => func(...args), waitFor); | ||
}; | ||
|
||
return debounced as (...args: Parameters<F>) => ReturnType<F>; | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.