sportline
strives to be like a normal sports stopwatch
How to use
npm install sportline
var sportline = ;var timer = ; timerstart;// ...do some stuffvar currentTime = timer;// currentTime: "01:12 130" (minutes, seconds, and milliseconds)var currentTimeMs = timer;// currentTimeMs: 72131 (number of elapsed milliseconds)// ...do some more stufftimer;// ...do another laptimer;timer; // this just lets you add the most recent interval to the laps array var laps = timer;// laps: ["08:23 111", "08:30 803"]var lapsMs = timer;// laps: [503111, 510803]
Constructors
var timer = ;
Functions
start
timerstart;
stop
Pauses timer. Does not trigger an addition to the laps array.
timer;
read
returns a string formatted like this: "00:00 000" (minuntes, seconds, milliseconds)
var now = timer;
readMs
returns the number of elapsed milliseconds
var nowMs = timer;
lap
inserts the most recent interval into the lap array.
timer;
getLaps
returns an array of string-formated interval times
var log = timer;
getLapsMs
returns an array of interval times in milliseconds
var logMs = timer;
Future Development Ideas (feel free to contribute)
*add finisher array *add countdown timer *add string format options *widgetize for use in browser. be able to bind divs to hrs, mins, secs, and ms (or all of them) and spin up the numbers in real time.