JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 146
  • Score
    100M100P100Q79664F
  • License MIT

A modern, zero-dependency wait / timing utility toolkit for JavaScript and TypeScript.

Package Exports

  • wait-utils

Readme

wait-utils

A modern toolkit for delay, timeout, and polling utilities in JavaScript and TypeScript.

Version Maintenance License Codecov Open Bundle

Features

  • Rich error handling

    • AbortError for signal-triggered cancellation
    • TimeoutError for when an operation exceeds a given timeout
  • Versatile polling with poll()

    • Supports initialDelay, dynamic delay, and afterPoll hooks
    • Full support for AbortSignal for clean cancellation
  • Async-friendly scheduling utilities

    • setTimeoutAsync and setIntervalAsync for timed operations
  • Flexible delay helpers:

    • timeout() — rejects after a delay unless the signal triggers abort
    • wait() — resolves after the delay or rejects if cancelled
    • waitUntil() — continues until a given performance.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-utils

PNPM:

pnpm install wait-utils

Yarn:

yarn add wait-utils

JSR:

jsr add @rojas/wait-utils

License

MIT © Michael Rojas

If you find this useful, consider sponsoring on GitHub.