wait-utils
v2.1.2
Published
A modern, zero-dependency wait / timing utility toolkit for JavaScript and TypeScript.
Maintainers
Readme
wait-utils
A modern toolkit for delay, timeout, and polling utilities in JavaScript and TypeScript.
Features
Rich error handling
AbortErrorfor signal-triggered cancellationTimeoutErrorfor when an operation exceeds a given timeout
Versatile polling with
poll()- Supports
initialDelay, dynamicdelay, andafterPollhooks - Full support for
AbortSignalfor clean cancellation
- Supports
Async-friendly scheduling utilities
setTimeoutAsyncandsetIntervalAsyncfor timed operations
Flexible delay helpers:
timeout()— rejects after a delay unless the signal triggers abortwait()— resolves after the delay or rejects if cancelledwaitUntil()— continues until a givenperformance.now()timestamp, unless cancelled
Designed TypeScript-first, zero runtime dependencies, fully tree‑shakeable
Documentation
See the API reference docs for full documentation.
Installation
NPM:
npm install wait-utilsPNPM:
pnpm install wait-utilsYarn:
yarn add wait-utilsJSR:
jsr add @rojas/wait-utilsLicense
Sponsor
If you find this useful, consider sponsoring on GitHub.
