nanodelay
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

Nano Delay

A tiny Promise wrapper around setTimeout for JavaScript. Returns a Promise and resolve it after a specific amount of time.

  • Only 40 bytes (minified and gzipped), 10 times smaller than delay library.
  • Has good ES modules and TypeScript support.
import { delay } from 'nanodelay'

async function foo () {
  await delay(300)
  // Executed after 300 milliseconds
}

delay(300).then(() => {
  // Executed after 300 milliseconds
})
Sponsored by Evil Martians

Docs

Read full docs on GitHub.

Package Sidebar

Install

npm i nanodelay

Weekly Downloads

1,055

Version

2.0.2

License

MIT

Unpacked Size

3.04 kB

Total Files

5

Last publish

Collaborators

  • ai