Skip to content
Super simple countdowns.
JavaScript
Find file
Latest commit 9ddcd60 @kn kn Update README.md
Failed to load latest commit information.
lib Add Math.round to support floats
test Add test coverage for floats
.gitignore added Jakefile
.travis.yml
Jakefile wrote tests
LICENSE Version 1.0.0
README.md Update README.md
bower.json Support bower
package.json Version 1.1.0

README.md

Countdown.js Build Status

Countdown.js is a library that allows developers to set countdowns for any kind of interaction. For example, if you would like to submit a form, Countdown.js allows you to set a 5 second countdown and give the user a chance to cancel the submission. You can see it in action here.

Installation

If you use bower:

bower install countdown.js

Otherwise, you can download it from here.

API

new Countdown(duration, onTick, onComplete)

Begins a countdown. After duration time has passed, the function onCompletewill be executed. Every second, the onTick function will be executed.

Example:

var countdown = new Countdown(5, function(seconds) {
  console.log(seconds); //log the number of seconds that have passed
}, function() {
   console.log("Countdown complete!") //log that the countdown has complete
});

abort()

Terminates countdown.

Example:

countdown.abort();

getRemainingTime()

Returns remaining time in seconds.

Example:

countdown.getRemainingTime(); //=> 4

Example

http://gumroad.github.io/countdown.js/

Contribute

Install development dependencies

npm install

Test

npm test
Something went wrong with that request. Please try again.