chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:34:48 +08:00
commit 77bb5bf71f
3762 changed files with 353249 additions and 0 deletions
@@ -0,0 +1,17 @@
export const debounceAsync = <TArgs extends unknown[], TReturn>(
fn: (...args: TArgs) => Promise<TReturn>,
ms: number
): ((...args: TArgs) => Promise<TReturn>) => {
let timeout: NodeJS.Timeout | null = null
return async function (this: unknown, ...args: TArgs): Promise<TReturn> {
if (timeout) {
clearTimeout(timeout)
}
return new Promise<TReturn>((resolve, reject) => {
timeout = setTimeout(() => {
fn.apply(this, args).then(resolve, reject)
}, ms)
})
}
}