2017 © Pedro Peláez
 

project alo-timer

A simple countdown class when you need accuracy

image

alorel/alo-timer

A simple countdown class when you need accuracy

  • Friday, August 14, 2015
  • by Alorel
  • Repository
  • 1 Watchers
  • 0 Stars
  • 197 Installations
  • HTML
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

For most things a simple setTimeout() or setInterval() is enough - but Javascript timers get throttled when the page is minimised/tabbed out of and you will end up with imprecise timings in the long run. This is where AloTimer comes in - you set a timer and poll it with as much precision as you need - while individual polling calls might get throttled, the end result will always be accurate., (*1)

Coverage Status Build Status Deps Deps, (*2)

NPM, (*3)

Functionality

Greenkeeper badge, (*4)

  • Add or subtract any amount of miliseconds/seconds/minutes/hours/days
  • Get the amount of any of the above left individually
  • Output time left as a DD:HH:mm:ss string (customisable)
  • A simple check whether the timeout has finished
  • Pause and unpause the timer

Installation

<script src="path-to-alotimer.min.js"></script>

Or, if you prefer Node,, (*5)

npm install alo-timer --save

Usage example

var span       = document.getElementById("my-countdown"),
    timer      = new AloTimer(3600000, ["hours", "minutes", "seconds"]), // 1 hr
    intervalCb = function () {
       if (!timer.hasFinished) {
           span.innerText = timer.toString();
       } else {
           span.innerText = "YOUR SCHNITZEL IS DONE!";
           clearInterval(interval);
       }
   },
   interval   = setInterval(intervalCb, 1000);

More information:, (*6)

The Versions

14/08 2015

dev-master

9999999-dev https://github.com/Alorel/alo-timer

A simple countdown class when you need accuracy

  Sources   Download

GPL-3.0+

javascript timer standalone countdown accurate accuracy

14/08 2015

1.1

1.1.0.0 https://github.com/Alorel/alo-timer

A simple countdown class when you need accuracy

  Sources   Download

GPL-3.0+

javascript timer standalone countdown accurate accuracy

18/07 2015

1.0.1

1.0.1.0 https://github.com/Alorel/alo-timer

A simple countdown class when you need accuracy

  Sources   Download

GPL-3.0+

javascript timer standalone countdown accurate accuracy

12/07 2015

1.0

1.0.0.0 https://github.com/Alorel/alo-timer

A simple countdown class when you need accuracy

  Sources   Download

GPL-3.0+

javascript timer standalone countdown accurate accuracy