@sharyn/util.wait
v1.0.7
Published
<!-- This file is auto-generated, don't modify it. Modify the JSDoc instead. -->
Downloads
11
Readme
🌹 wait
wait
: A Promise
-based delay.
Installation
npm i @sharyn/util.wait
# or
yarn add @sharyn/util.wait
You can alternatively install the @sharyn/util package, or the entire sharyn library.
Arguments
[milliseconds=1000] (number): The duration of the wait.
Returns
Promise
Example
const main = async () => {
console.log('Legen - wait for it...')
await wait(3000)
console.log('...dary!')
}
main()
Imports
Depending on the package you are using, you can import
or require
wait
in the following ways:
// If you installed @sharyn/util.wait
import wait from '@sharyn/util.wait' // smaller size, better for client bundles
// If you installed @sharyn/util
import wait from '@sharyn/util/wait' // smaller size, better for client bundles
import { wait } from '@sharyn/util' // more convenient in Node environments
// If you installed sharyn
import wait from 'sharyn/util/wait' // smaller size, better for client bundles
import { wait } from 'sharyn/util' // more convenient in Node environments