https://github.com/web-mech/stopwatch-stream
A streaming human readable stopwatch
https://github.com/web-mech/stopwatch-stream
Last synced: about 2 months ago
JSON representation
A streaming human readable stopwatch
- Host: GitHub
- URL: https://github.com/web-mech/stopwatch-stream
- Owner: web-mech
- License: mit
- Created: 2017-05-08T00:06:31.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-08T04:56:46.000Z (about 8 years ago)
- Last Synced: 2025-03-07T20:38:22.735Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# stopwatch-stream
A streaming human readable stopwatch.
[](https://travis-ci.org/web-mech/stopwatch-stream)
Exposes an RxJS [Observable](http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html)
## Default Format
```
00:00:00
```## Usage;
```
const stopWatch = require('stopwatch-stream');
const sw = stopWatch();
```### Basic
```
sw.stream.subscribe((s) => {
console.log(s); //00:00:00 ...
});
sw.start();
```### Pausing
```
sw.stream.subscribe((s) => {
console.log(s);
});sw.start();
sw.stop();
```### Current
```
sw.current(); // 00:00:00
```### Cleanup
```
sw.stream.subscribe((s) => {
console.log(s);
});sw.start();
sw.stop();
sw.complete();
```### Options
#### Stream on init
```
const sw = stopWatch({
on: true
});sw.stream.subscribe((s) => {
console.log(s);
});```
#### Stopwatch format
```
const sw = stopWatch({
format: '000',
delimiter: '.'
});
sw.current(); // '00:00.000'```