Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. AVA
  3. delay

delay

MITJavaScriptv7.0.0

A promise-based utility for delaying execution with support for abort signals, random delays, and unlimited timeout lengths.

GitHubGitHub
624 stars37 forks0 contributors

What is delay?

Delay is a JavaScript library that provides promise-based utilities for delaying execution in asynchronous code. It solves the problem of managing timed operations in promise chains with features like abort signals, random delays, and support for unlimited timeout lengths that native `setTimeout` doesn't offer.

Target Audience

JavaScript developers working with async/await patterns who need reliable timing utilities for testing, web scraping, animations, or any scenario requiring controlled delays in promise-based workflows.

Value Proposition

Developers choose Delay over native timing functions because it provides a cleaner promise-based API, supports modern features like AbortSignal for cancellation, offers unlimited delay lengths, and includes utilities like random delays that are particularly useful for testing and avoiding predictable patterns.

Overview

Delay a promise a specified amount of time

Use Cases

Best For

  • Adding controlled delays in async/await workflows
  • Testing asynchronous code with predictable timing
  • Web scraping with randomized delays to avoid detection
  • Creating animations with promise-based timing control
  • Implementing timeout patterns with cancellation support
  • Simulating network latency in development environments

Not Ideal For

  • Node.js-exclusive projects where native timers/promises meet all needs
  • Performance-critical applications requiring microsecond precision or minimal promise overhead
  • Simple scripts or demos where adding a dependency for basic delays is overkill
  • Systems needing built-in interval or scheduling functionality beyond one-off delays

Pros & Cons

Pros

Promise-Native Integration

Returns promises that seamlessly work with async/await syntax, simplifying asynchronous code flow as shown in the basic usage example.

Abort Signal Cancellation

Supports standard AbortSignal for canceling delays, providing better control over asynchronous operations compared to manual clearTimeout, with clear error handling.

Random Delay Ranges

Includes rangeDelay for generating delays between min and max values, explicitly designed for testing and web scraping to avoid predictable patterns.

Unlimited Timeout Support

Allows delays longer than the native 24.8-day setTimeout limit, enabling long-term timing without workarounds.

Cons

Redundant for Node.js Natives

The README notes that Node.js users can use native timers/promises, making Delay unnecessary unless browser support or extra features like random delays are required.

No Interval Support

Focuses solely on delays without built-in methods for intervals, forcing developers to implement or use additional libraries for repeated timing tasks.

Dependency Overhead

Adds an external package where simple use cases might be handled with native setTimeout, introducing extra complexity and potential performance overhead in high-frequency scenarios.

Frequently Asked Questions

Quick Stats

Stars624
Forks37
Contributors0
Open Issues0
Last commit10 months ago
CreatedSince 2015

Tags

#async-await#promise-utilities#timing#testing#abort-controller#timeout#javascript#browser-support#node-js#delay

Built With

J
JavaScript

Included in

Node.js65.5kPromises1.7kAVA353
Auto-fetched 8 hours ago

Related Projects

execaexeca

Process execution for humans

Stars7,602
Forks263
Last commit1 month ago
More…More…

Promise packages, patterns, chat, and tutorials

Stars5,168
Forks137
Last commit2 years ago
p-queuep-queue

Promise queue with concurrency control

Stars4,266
Forks222
Last commit1 month ago
Highland.jsHighland.js

High-level streams library for Node.js and the browser

Stars3,430
Forks145
Last commit6 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub