# basic-stopwatch

> really BASIC.

Latest version **0.0.2** (published 2021-06-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install basic-stopwatch
pnpm add basic-stopwatch
yarn add basic-stopwatch
bun add basic-stopwatch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2021-06-29 |
| First published | 2019-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | alanlucian |
| Maintainers | reytuty, alanlucian |
| Keywords | stopwatch, basic, simple, fast |

## Links

- npm: https://www.npmjs.com/package/basic-stopwatch
- Repository: https://github.com/alanlucian/node-basic-stopwatch
- Homepage: https://github.com/alanlucian/node-basic-stopwatch#readme
- Issues: https://github.com/alanlucian/node-basic-stopwatch/issues
- npm.io page: https://npm.io/package/basic-stopwatch

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2021-06-29
- 0.0.1 — 2019-05-20

## README

# 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 :

```js
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:

```js
var bStopWatch = new BasicStopWatch();
```
You can also pass a custon output function on the cosntructor:
```js
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 
```js
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;

---
_Source: https://npm.io/package/basic-stopwatch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
