stopwatsch
v1.4.3
Published
[![npm version](https://badge.fury.io/js/stopwatsch.svg)](https://badge.fury.io/js/stopwatsch)
Downloads
20
Readme
Stopwatsch
A simple light weight JavaScript Stopwatch
Installation
To install and set up the library, run:
$ npm install stopwatsch
Getting Started
import stopwatsh from 'stopwatsch';
stopwatsh.start()
setTimeout(() => console.log(stopwatsh.time), 1000) // ≈ 1000
methods
#start()
stopwatsh.start()
Starts the stopwatch
#stop()
stopwatsh.stop()
stopwatsh.pause()
Stops the stopwatch
#restart()
stopwatsh.restart()
Restarts the stopwatch
properties
#milliseconds
stopwatsh.time
stopwatsh.ms
stopwatsh.milliseconds
The elapsed time in milliseconds
#seconds
stopwatsh.s
stopwatsh.sec
stopwatsh.seconds
The elapsed time in seconds
#minutes
stopwatsh.m
stopwatsh.min
stopwatsh.minutes
The elapsed time in minutes
#hours
stopwatsh.h
stopwatsh.hours
The elapsed time in hours