speed-beat
Speed counter made easy
Install
npm i speed-beat
Usage as interval Beat
Start to track many resource and, every timer
second execute the chrono
function!
const speedBeat =
Usage as counter
You will handle when execute the chrono
function.
const speedBeat =
API
speedBeat(options)
: create aspeedBeat
instance.chrono(id, function): EventEmitter
: add a speed element to track.lap(id[, value]): EventEmitter
: increment the speed value for the elementid
. If the id doesn't exist nothing happen.driver(id): EventEmitter
: return the speedid
element.timer()
: return thetimer
in millisec.finish()
: stop the call to the chrono functions
The chrono
function will have 4 parameters:
id
: the name of the speed elementcounter
: the summation of thelap
values since the last beat was triggertotal
: the total amount oflap
valuesdeltaBeat
: the time in millisec that has passed away since last beat
Options
timer
: the beat of chrono functions. It can be expressed in milliseconds or as a string in the ms format
License
Copyright Manuel Spigolon, Licensed under MIT.