feat: align with upstream 1.5.9.9

This commit is contained in:
2026-09-12 18:21:11 +08:00
commit 34f0679117
805 changed files with 376275 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
export function debounce<T extends (...args: any[]) => void>(
func: T,
wait: number
): (...args: Parameters<T>) => void {
let timeout: ReturnType<typeof setTimeout> | undefined;
return function (this: any, ...args: Parameters<T>) {
const context = this;
const later = () => {
timeout = undefined;
func.apply(context, args);
};
if (timeout !== undefined) {
clearTimeout(timeout);
}
timeout = setTimeout(later, wait);
};
}