Initial commit
This commit is contained in:
18
node_modules/react-resizable-panels/src/utils/debounce.ts
generated
vendored
Normal file
18
node_modules/react-resizable-panels/src/utils/debounce.ts
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
export default function debounce<T extends Function>(
|
||||
callback: T,
|
||||
durationMs: number = 10
|
||||
) {
|
||||
let timeoutId: NodeJS.Timeout | null = null;
|
||||
|
||||
let callable = (...args: any) => {
|
||||
if (timeoutId !== null) {
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
|
||||
timeoutId = setTimeout(() => {
|
||||
callback(...args);
|
||||
}, durationMs);
|
||||
};
|
||||
|
||||
return callable as unknown as T;
|
||||
}
|
||||
Reference in New Issue
Block a user