1.1.6 • Published 5 years ago

timer-basic v1.1.6

Weekly downloads
1
License
ISC
Repository
bitbucket
Last release
5 years ago

timer

timer-basic

A simple timer package that enables recording times(in milliseconds) between multiple events

Install

npm install --save timer-basic

Usage

Creation

const timer = require('timer-basic');

.start()

Starts the timer and creates the unique handle for a particular timer instance. Optionally, a handle argument(string) can be passed ,which will register the timer as the argument . The handle can be used in subsequent methods.

var handle = timer.start();

.pause(handle)

pauses the timer.

console.log(timer.pause(handle)) //Single integer if there was no pause/resume before this,
// otherwise array of intervals for which timer was running

.resume(handle)

resumes the timer. The module will start a new interval.

timer.resume(handle)

.isRunning(handle)

checks if the timer is running

console.log(timer.isRunning(handle)); // true

.stop(handle)

stops the timer and deletes the handle. Returns the time interval(s) for which timer was running.

var interval = timer.stop(handle);
console.log(interval)   //Single integer if there was no pause/resume,
// otherwise array of intervals for which timer was running

License

The ISC License. Full License is here

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago