@queso/sleep
v0.3.0
Published
Sleeps for a specified duration.
Downloads
15
Maintainers
Readme
@queso/sleep
Part of a library of zero-dependency npm modules that do just one thing.
- 100% TypeScript support.
- It's not a party without
Queso
!
min + gzip | 93 bytes
Sleeps for a specified duration
.
Usage
import sleep from '@queso/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>