JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q27755F
  • License MIT License

A Stopwatch for JavaScript.

Package Exports

  • stopwatch.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stopwatch.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

stopwatch.js

JavaScript stopwatch

Installation

In node:
npm install stopwatch.js --save

Usage

- typescript
import { Stopwatch } from 'stopwatch.js'

// string output
const stopwatch = new Stopwatch();

stopwatch.start((time) => console.log(time)); // 00:00:01:95, 00:00:02:00, 00:00:02:15, ...

stopwatch.stop();

stopwatch.reset();

stopwatch.lap(); // 00:00:02:95
import { Stopwatch, Output } from 'stopwatch.js'

// array output
const stopwatch = new Stopwatch(Output.Array);

stopwatch.start((time) => console.log(time)); // ['00', '00', '01', '95'], ['00', '00', '02', '00'], ['00', '00', '02', '15'], ...

stopwatch.stop();

stopwatch.reset();

stopwatch.lap(); // ['00', '00', '02', '95']
- javascript
const stopwatchJs = require('stopwatch.js').Stopwatch;

const stopwatch = new Stopwatch();
const stopwatchJs = require('stopwatch.js').Stopwatch;
const output = require('stopwatch.js').Output;

const stopwatch = new stopwatchJs(output.Array);
In browser:
bower install stopwatch.js --save
<script src="https://cdn.jsdelivr.net/npm/stopwatch.js@1.1.0/dist/stopwatch.min.js"></script>

Usage

var output = stopwatchJs.Output;
var stopwatch = new stopwatchJs.Stopwatch();

stopwatch.start(function(time) {
  // do something with time
})

Author

  • Rajeev Sharma

License:

MIT License

Copyright (c) 2017 Rajeev Sharma