mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
add dashboard
This commit is contained in:
10
dashboard/utils/debounce.ts
Normal file
10
dashboard/utils/debounce.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
export const debounce = <F extends (...args: any) => any>(func: F, waitFor: number,) => {
|
||||
let timeout: any;
|
||||
const debounced = (...args: any) => {
|
||||
clearTimeout(timeout)
|
||||
timeout = setTimeout(() => func(...args), waitFor)
|
||||
}
|
||||
return debounced as (...args: Parameters<F>) => ReturnType<F>
|
||||
}
|
||||
Reference in New Issue
Block a user