GitShow/sindresorhus/delay
sindresorhus

delay

Delay a promise a specified amount of time

by sindresorhus
Star on GitHubForknpm

JavaScript

624 stars38 forks16 contributorsQuiet · 8mo agoSince 2015v7.0.0MIT

Meet the team

See all 16 on GitHub →
sindresorhus
sindresorhus46 contributions
SamVerschueren
SamVerschueren3 contributions
jamestalmage
jamestalmage3 contributions
ariporad
ariporad2 contributions
felixfbecker
felixfbecker2 contributions
novemberborn
novemberborn2 contributions
Richienb
Richienb2 contributions
timdp
timdp2 contributions

Languages

View on GitHub →
JavaScript84.5%
TypeScript15.5%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
theluckystrike
docs(index.js): add JSDoc comments to delay functionsMergedPR

What Adds comprehensive JSDoc documentation to the delay module. Why Improves developer experience by providing clear documentation for the API surface. JSDoc comments help IDEs provide autocomplete and make the codebase more maintainable. How Added module-level @module documentation Added JSDoc to createDelay function with @param descriptions Added JSDoc to default delay function with @param, @returns, and @example Added JSDoc to rangeDelay function with @param descriptions Added JSDoc to clearDelay function with @param description Testing All 9 existing tests pass ✅

theluckystrike · 4mo ago
cdellacqua
Delaying for more than ~24.8 days causes TimeoutOverflowWarning and immediate promise resolutionClosedIssue

The default implementation of setTimeout can only accept values within the range of positive signed 32-bit integers. Passing a timeout greater than (2^31)-1 milliseconds (0x7FFFFFFF) yields a TimeoutOverflowWarning and causes the runtime to ignore the specified timeout, assuming a value of 1ms (which by the way seems a dangerous default, I would have opted for using the maximum supported value or straight out throw an error). This unexpected behavior is not documented in the README, but rather than documenting this quirk of the runtime I'd like to propose a solution: instead of relying on the bare setTimeout, could use a wrapped version of it. Something like this: The timeoutContext is passed by reference, therefore each time gets called the timeout id gets updated, so that can always access the most recent value.

cdellacqua · 8mo ago
damartripamungkas
Add support for CommonJsClosedIssue

please add for support commonJs

damartripamungkas · 2y ago
Structured data for AI agents

Repository: sindresorhus/delay. Description: Delay a promise a specified amount of time Stars: 624, Forks: 38. Primary language: JavaScript. Languages: JavaScript (84.5%), TypeScript (15.5%). License: MIT. Latest release: v7.0.0 (8mo ago). Open PRs: 0, open issues: 0. Last activity: 8mo ago. Community health: 85%. Top contributors: sindresorhus, SamVerschueren, jamestalmage, ariporad, felixfbecker, novemberborn, Richienb, timdp, olsonpm, Torgen and others.

·@ofershap

Replace github.com with gitshow.dev