Skip to content

feat: debounce async functions and return the result (debounceAsync) - #1920

Open
hazrid93 wants to merge 1 commit into
toss:mainfrom
hazrid93:hazrid93/74_898
Open

feat: debounce async functions and return the result (debounceAsync)#1920
hazrid93 wants to merge 1 commit into
toss:mainfrom
hazrid93:hazrid93/74_898

Conversation

@hazrid93

Copy link
Copy Markdown

Closes #898.

Add debounceAsync(func, debounceMs, { signal? }): multiple rapid calls within the window coalesce: func is invoked ONCE with the latest arguments, and every coalesced caller's Promise resolves with that single result (or rejects with its error). Exposes .cancel() (clears the timer and rejects pending Promises with "Cancelled") and honours an AbortSignal.

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
es-toolkit Ready Ready Preview, Comment Jul 20, 2026 11:16am

Request Review

Closes toss#898.

Add debounceAsync(func, debounceMs, { signal? }): multiple rapid calls within the window coalesce: func is invoked ONCE with the latest arguments, and every coalesced caller's Promise resolves with that single result (or rejects with its error). Exposes .cancel() (clears the timer and rejects pending Promises with "Cancelled") and honours an AbortSignal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debounce async functions

1 participant