Migrate to a monorepo structure (#2909)
This commit is contained in:
12
packages/twenty-front/src/utils/debounce.ts
Normal file
12
packages/twenty-front/src/utils/debounce.ts
Normal file
@ -0,0 +1,12 @@
|
||||
export const debounce = <FuncArgs extends any[]>(
|
||||
func: (...args: FuncArgs) => void,
|
||||
delay: number,
|
||||
) => {
|
||||
let timeoutId: ReturnType<typeof setTimeout>;
|
||||
return (...args: FuncArgs) => {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = setTimeout(() => {
|
||||
func(...args);
|
||||
}, delay);
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user