Skip to content

Conversation

@sindresorhus
Copy link
Owner

Fixes #96

This provides a way to wait for all currently running tasks to finish while ignoring queued tasks. Fills the gap between onEmpty() (queue size = 0) and onIdle() (queue empty + no running tasks).

A comon use case: draining in-flight tasks before mutating shared state.

@Richienb Richienb changed the title Add .onPendingZero() method Add .onPendingZero() method and pendingZero event Sep 21, 2025
@sindresorhus sindresorhus merged commit 62efb74 into main Sep 21, 2025
4 checks passed
@sindresorhus sindresorhus deleted the pendingzero branch September 21, 2025 09:01
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.

Howto: Wait for currently executing tasks to complete

3 participants