mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 17:46:18 +08:00
9 lines
219 B
TypeScript
9 lines
219 B
TypeScript
export function debounce(fn: Function, timeout: number) {
|
|
let timeoutId: any;
|
|
|
|
return function (this: any) {
|
|
clearTimeout(timeoutId);
|
|
timeoutId = setTimeout(() => fn.apply(this, arguments), timeout);
|
|
};
|
|
}
|