We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 72c3571 commit 1ac86b6Copy full SHA for 1ac86b6
apps/webapp/app/utils/throttle.ts
@@ -1,13 +1,13 @@
1
//From: https://kettanaito.com/blog/debounce-vs-throttle
2
3
/** A very simple throttle. Will execute the function at the end of each period and discard any other calls during that period. */
4
-export function throttle(
5
- func: (...args: any[]) => void,
+export function throttle<TArgs extends unknown[]>(
+ func: (...args: TArgs) => void,
6
durationMs: number
7
-): (...args: any[]) => void {
+): (...args: TArgs) => void {
8
let isPrimedToFire = false;
9
10
- return (...args: any[]) => {
+ return (...args: TArgs) => {
11
if (!isPrimedToFire) {
12
isPrimedToFire = true;
13
0 commit comments