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