npm.io
0.1.1 • Published 8 years ago

node-simple-timer

Licence
Apache-2.0
Version
0.1.1
Deps
0
Size
18 kB
Vulns
0
Weekly
0
Stars
1

node-simple-timer

A bare-bones timer for JavaScript - implemented in TypeScript.

Installation:

$ npm install node-simple-timer
or
$ yarn add node-simple-timer

Usage:


import {Timer} from 'node-simple-timer';

const timer = new Timer();
timer.start();

// Do something

let ms = timer.milliseconds();

// Do something else:

ms = timer.milliseconds();

// One last thing

timer.end();
ms = timer.milliseconds();

console.log('Total seconds: ', timer.seconds();
Start a Timer at construction time.
const timer = new Timer(true);  // Starts at construction time
Chaining methods:
const timer = new Timer();

timer.start();
const ns = timer.end().nanoseconds();