Overtime

Overtime is a stopwatch library that visualises time limits in 2D by using the Canvas API.
Installation
Download the minified library and include it in your project:
<script src="/js/overtime.min.js"></script>
You can also install it with npm.
$ npm install overtime
Usage
import Overtime from "overtime";
var overtime = new Overtime({
time: 5,
timeMeasure: Overtime.TimeMeasure.MINUTES,
size: [300, 300]
});
document.addEventListener("DOMContentLoaded", function init() {
document.getElementById("myContainer").appendChild(overtime.canvas);
overtime.addEventListener("elapsed", function() {
console.log("Time's up!");
});
overtime.stop();
overtime.start();
overtime.rewind();
overtime.rewindBy(Number.MAX_VALUE);
overtime.fastForwardBy(2);
overtime.prolongBy(2);
overtime.timeMeasure = Overtime.TimeMeasure.MILISECONDS;
overtime.shortenBy(100);
overtime.timeMeasure = Overtime.TimeMeasure.HOURS;
overtime.time = 1;
document.removeEventListener("DOMContentLoaded", init);
});
Example
Take a look at the demo to see how Overtime works.
Documentation
API
Contributing
Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
License
Copyright (c) 2015 Raoul van Rüschen
Licensed under the Zlib license.