0.5.0 • Published 2 years ago
@enjoyjs/stopwatch v0.5.0
stopwatch
A stopwatch utility
Install
npm i @enjoyjs/stopwatch
Then import this:
import { Stopwatch } from '@enjoyjs/stopwatch';
API
class: Stopwatch
const stopwatch = new Stopwatch();
Alternatively, you can use the current high resolution millisecond timestamp:
import { performance } from 'perf_hooks';
const stopwatch = new Stopwatch(performance.now);
stopwatch.start()
stopwatch.pause()
stopwatch.reset()
stopwatch.isRunning()
stopwatch.getTime()
stopwatch.lap()
stopwatch.getLapTimes()
License
This package is licensed under the MIT License.