feat: track images with git lfs
This commit is contained in:
20
app/src/lib/helpers/throttle.ts
Normal file
20
app/src/lib/helpers/throttle.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export default <R, A extends any[]>(
|
||||
fn: (...args: A) => R,
|
||||
delay: number
|
||||
): ((...args: A) => R) => {
|
||||
let wait = false;
|
||||
|
||||
return (...args: A) => {
|
||||
if (wait) return undefined;
|
||||
|
||||
const val = fn(...args);
|
||||
|
||||
wait = true;
|
||||
|
||||
setTimeout(() => {
|
||||
wait = false;
|
||||
}, delay);
|
||||
|
||||
return val;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user