timedjs
v1.0.7
Published
A Node.js library for timing tasks.
Downloads
5
Readme
Timedjs
Timedjs is a Node.js module that seamlessly combines the functionalities of the console timing system with the accessibility of the built-in performance timing system.
NPM module page Github Repository
Installation
Install Timedjs using npm:
npm install timedjs
Setup
- Object instantiation :
const TimedJS = require("timedjs");
const Timer = new TimedJS();
Documentation
Starting a timer [with callback]
const TimedJS = require("timedjs"); const Timer = new TimedJS(); Timer.start('myTimer',function(){ console.log("Timer Started!"); })
Starting a timer [without callback]
const TimedJS = require("timedjs"); const Timer = new TimedJS(); Timer.start('myTimer');
Stop a timer and obtain elapsed time [callback method]
Timer.stop('myTimer',function(timeElapsed){ console.log('Timer stopped! Time elapsed: ',timeElapsed); })
Stop a timer and obtain elapsed time [return method]
let elapsedTime = Timer.stop('myTimer') console.log(Timer stopped! Time elapsed: ',timeElapsed);
Obtain amount of elapsed time for a timer (without stopping) [callback method]
Timer.get('myTimer',function(timeElapsed){ console.log('Time elapsed: ',timeElapsed); })
Obtain amount of elapsed time for a timer (without stopping) [return method]
let elapsedTime = Timer.get('myTimer'); console.log('Time elapsed: ',timeElapsed);
Timedjs is an open-source project released under the MIT License. Contributions are welcome! If you have suggestions, bug reports, or want to contribute to the project, please visit the GitHub repository or the NPM module page
Made by [email protected]