2.0.2 • Published 4 years ago
nanodelay v2.0.2
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
delaylibrary. - 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.