a simple async pause function
npm install @jrc03c/pauseAn asynchronous pause function
``bash`
npm install --save @jrc03c/pause
`js
import { pause } from "@jrc03c/pause"
pause(1000).then(elapsed => {
console.log(${elapsed} milliseconds have elapsed!)`
})
Given a number of milliseconds, ms, for which to pause, returns a Promise that resolves to a number indicating how many milliseconds have actually elapsed since the function was called.
Given a number of milliseconds, ms`, for which to pause, returns a number indicating how many milliseconds have actually elapsed since the function was called.
> WARNING: Because this function is synchronous, it completely blocks its thread while running! Therefore, you should probably almost never use this in production. I provide it mainly because it's useful in some testing contexts.