mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-15 22:16:35 +00:00
feat: add single tool schema rendering
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
export function debounce(
|
||||
fn: () => void,
|
||||
ms: number,
|
||||
): { (): void; cancel: () => void } {
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
const debounced = () => {
|
||||
if (timer !== undefined) clearTimeout(timer);
|
||||
timer = setTimeout(() => fn(), ms);
|
||||
};
|
||||
|
||||
debounced.cancel = () => {
|
||||
if (timer !== undefined) clearTimeout(timer);
|
||||
};
|
||||
|
||||
return debounced;
|
||||
}
|
||||
Reference in New Issue
Block a user