@jrc03c/pause
v0.0.12
Published
a simple async pause function
Readme
Intro
An asynchronous pause function
Installation
npm install --save @jrc03c/pauseUsage
import { pause } from "@jrc03c/pause"
pause(1000).then(elapsed => {
console.log(`${elapsed} milliseconds have elapsed!`)
})API
pause(ms)
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.
pauseSync(ms)
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.
