mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-20 00:24:24 +01:00
Dir sync filesystem watching
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function debounce(fn: (...args: any[]) => void, delay = 500) {
|
||||
let timer: ReturnType<typeof setTimeout>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const result = function (...args: any[]) {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => fn(...args), delay);
|
||||
};
|
||||
result.cancel = function () {
|
||||
clearTimeout(timer);
|
||||
};
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user