Keeps track of the elapsed time in miliseconds.
$ npm install minimal-timer --save
const delay = require('delay')
const timer = require('minimal-timer')
const time = timer() // instantiates the timer
time.start()
await delay(500)
console.log(time.elapsedTime()) // => 500 +-
time.stop()
await delay(500)
console.log(time.elapsedTime()) // => 500 +-
time.resume()
await delay(500)
console.log(time.elapsedTime()) // => 1000 +-
Creates a new instance
Starts/Restart the timer
customStartDate Date
[optional]
Resumes the timer.
Stops the timer
Returns the elapsed time in miliseconds
Returns the elapased between the start time and the current time in miliseconds
Returns true if the timer is running otherwise false
MIT © Alvaro Bernal