PieterT2000 / stopwatch.js

Tiny JS library for creating a stopwatch fast and simple! (supports all browsers)

Home Page:https://pietert2000.github.io/stopwatch.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stopwatch.js

stopwatch.js

Tiny JS library for creating a stopwatch fast and simple!

Installation

  1. Download stopwatch.js
  2. Load module into your project (please see example.js or example setup below)
HTML setup
<div class="display">
  <span class="stopwatchSpan">00:00:00</span>
</div>
<div class="buttons">
    <button data-command="start" class="btn">Start</button>
    <button data-command="stop" class="btn">Stop</button>
    <button data-command="reset" class="btn">Reset</button>
</div>
JS setup
import {Stopwatch} from './dist/stopwatch.js'

const DOM = {
  stopwatchSpan: document.querySelector('.stopwatchSpan'),
  buttons: document.querySelector('.buttons');
};

// Instantiate stopwatch (pass span, where stopwatch has to display, as parameter)
const sw = new Stopwatch(DOM.stopwatchSpan);

// Make control buttons to work
sw.configureButtons(DOM.buttons)

About

Tiny JS library for creating a stopwatch fast and simple! (supports all browsers)

https://pietert2000.github.io/stopwatch.js/

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%