1.1.1 • Published 3 years ago

stopwatch-lite v1.1.1

Weekly downloads
4
License
ISC
Repository
github
Last release
3 years ago

stopwatch-lite

npm version install size npm downloads

NPM

A stopwatch for all your time-measuring needs

Installing

npm install stopwatch-lite

Usage

import stopwatch from "stopwatch-lite";

stopwatch.start();
...
stopwatch.stop();
console.log(stopwatch.read());
import sw from "stopwatch-lite";

sw.start("example");
sw.start(123);

foo().then(() => {
  sw.stop("example");
});

bar().then(() => {
  sw.stop(123);
});

console.log(`foo execution time: ${sw.read("example")} ms`);
console.log(`bar execution time: ${sw.read(123)} ms`);
import sw from "stopwatch-lite";

let totalExecutionTime = 0;

for (let i = 0; i < 42; i++) {
  sw.start();
  foo();
  totalExecutionTime += sw.read();
  sw.reset();
}

console.log(`average execution time: ${totalExecutionTime / 42} ms`);
1.1.1

3 years ago

1.1.0

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago