simple-stopwatch
install
Load the script from the browser:
Or install using npm:
$ npm install simple-stopwatch
usage
Use from the window:
start;
Or use a CommonJS module loader and namespace it:
var stopwatch = ; start;
Start a basic count:
start;
Start a count and stop after 10 seconds:
start;
Format the time as seconds:milliseconds:
start;
Format the time as a countdown to the duration:
start;
formats
For formatting times, use printf-style strings:
%h /* hours */
%m /* minutes */
%s /* seconds */
%ms /* milliseconds */
%dh /* hours until duration */
%dm /* minutes until duration */
%ds /* seconds until duration */
%dms /* milliseconds until duration */
Note that, in order to use countdown formatting, you need to have set a duration for the stopwatch.