@lavadrop/sleep
v0.5.1
Published
Sleeps for a specified duration.
Downloads
8
Maintainers
Readme
@lavadrop/sleep
Part of a library of zero-dependency npm modules that do just one thing.
- 100% TypeScript support.
- It's not a party without
Lavadrop
!
min + gzip | 93 bytes
Sleeps for a specified duration
.
Usage
import sleep from '@lavadrop/sleep'
async function brb() {
console.log('Be back in 42 seconds...')
await sleep(42000)
console.log("OK, I'm back!")
}
Parameters
| Name | Type | Description |
| :--------- | :------- | :----------------------------- |
| duration
| number
| Time in milliseconds to sleep. |
Returns
A Promise
that resolves when the specified duration
has ellapsed.
Return type
Promise<void>