Socket
Book a DemoInstallSign in
Socket

basic-stopwatch

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic-stopwatch

really BASIC.

0.0.2
latest
Source
npmnpm
Version published
Weekly downloads
1
-97.67%
Maintainers
2
Weekly downloads
 
Created
Source

BasicStopwatch

BasicStopwatch is built using node. It's a basic stopwatch - you can start / stop / restart / pause and check how much time has elapsed with custom output

Install using:

npm install basic-stopwatch

Simple usage :

var  BasicStopWatch  =  require("basic-stopwatch") ;
bStopWatch  =  new  basicStopWatch();
bStopWatch.start();
setTimeout(()=>{
	console.log(bStopWatch.getElapsed());
},500);

Usage

Instantiate

This is a constructor function. You MUST call it with the new keyword:

var bStopWatch = new BasicStopWatch();

You can also pass a custon output function on the cosntructor:

var bStopWatch  =  new  BasicStopWatch({outputFunc:(time)=>{
	//time is HH:MM:SS.mmm
	return  time.slice(0,11);
}});

BasicStopWatch.start()

Starts the stopwatch.

Stopwatch.getElapsed()

The time elapsed parsed by custom function or default HH:MM:SS.mmm format

BasicStopWatch.pause()

Pause the stopwatch. can be called how many times you need

BasicStopWatch.stop()

Stops the stopwatch, if start called after, it will starts from 0

BasicStopWatch.restart()

Clears current start time and restarts the stopwatch, you must call start with true as parameter

bStopWatch.start( true );

BasicStopWatch.getStopedAt()

The time the stopwatch was stopped (in date object).

BasicStopWatch.getStartedAt()

The time the stopwatch was started (in date object).

Stopwatch.isRunning()

Returns boolean if is running;

Keywords

stopwatch

FAQs

Package last updated on 29 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.