refactor: commands from menu
This commit is contained in:
@@ -76,3 +76,15 @@ export const createStreamResponse = () => {
|
||||
enqueue,
|
||||
};
|
||||
};
|
||||
|
||||
export function debounce<T extends (...args: Parameters<T>) => void>(
|
||||
this: ThisParameterType<T>,
|
||||
fn: T,
|
||||
delay = 300,
|
||||
) {
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
return (...args: Parameters<T>) => {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => fn.apply(this, args), delay);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user