nanodelay
v2.0.2
Published
A tiny (25 bytes) Promise wrapper around setTimeout
Downloads
58,323
Maintainers
Readme
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
})
Docs
Read full docs on GitHub.