Files
vscode-front-matter/src/helpers/DebounceCallback.ts
T

9 lines
260 B
TypeScript

export const debounceCallback = () => {
let timeout: NodeJS.Timeout;
return (fnc: any, time: number) => {
const functionCall = (...args: any[]) => fnc.apply(args);
clearTimeout(timeout);
timeout = setTimeout(functionCall, time) as any;
};
};