countdown.js
Very lightweight (0.39kb minified and gzipped), no dependencies Countdown Timer that provides a simple API to get various time formats
Install
npm install countdown-js
or clone directly from this repository
Usage
See the demo file for an example.
Create an index.js
file
var Countdown = // setup end datetime for timervar ten_days = 1000 * 60 * 60 * 24 * 10var end = + ten_days var timer = Countdown
Run uglify-js
to minify your file and browserify
on your index.js
so it can be run in the browser
npm install -g uglify-js browserifyuglifyjs ./index.js -o index.min.js -c -m | browserify -g uglifyify ./index.min.js > bundle.js
Include your bundle.js
in your code right before the closing </body>
tag so it doesn't need to wait for DOM.ready signal.
Contributing
Fork the repository and clone it
Set up the development environment
npm install
After making changes run the following from the root countdown.js folder to test the demo and ensure it still works
uglifyjs ./index.js -o dist/countdown.min.js -c -m | browserify -g uglifyify demo/js/index.js > demo/js/bundle.js
Make any changes, update test/*.js
files as appropriate.
Before committing run npm run test
to ensure all tests pass
Make a pull request! Thanks!