This library exported as a class module.
TimeToComplete is released under the MIT license & supports modern environments.
In a browser:
<script src="TimeToComplete/index.js"></script>
Using npm:
$ npm i -g npm
$ npm i --save TimeToComplete
In Node.js:
const TimeToComplete = require('./index.js');
const time = new TimeToComplete(100);
setTimeout(() => {
time.remaining(40, true);
setTimeout(() => {
time.remaining(44, true);
setTimeout(() => {
time.remaining(48, true);
}, 1000)
}, 1000)
}, 1000)