0.1.1 • Published 6 years ago

node-simple-timer v0.1.1

Weekly downloads
62
License
Apache-2.0
Repository
github
Last release
6 years ago

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();