This is a small web application computing time remaining between events, intended to learn and play with recent features of the JavaScript Web APIs.
Simply try the demo at https://astorije.github.io/cantwait/, or clone the repository and open the index page in your browser.
Add timed events in the numbered fields. Click on Compute
and see the magic happen.
For example, try these well-known values.
Not really. Something cool was going to happen soon. Every day I was counting how much time was remaining until then as well as the current progress. I used this as an excuse to play with some of the recent JavaScript APIs for the web and other stuff like:
- History API
- Date manipulation in JavaScript
- Bootstrap 3
- Latest CSS Selectors
- Functional programming principles applied in JavaScript
- JSDoc
- Testing in JavaScript
This was also a way to refresh my JavaScript. All of this was done in Vanilla JS.
Open test/index.html
in your browser (or https://astorije.github.io/cantwait/test/) and look at all these tests gracefully pass.
If they don't, please report a bug.
Run the following:
npm install
npm test
This is also used for continuous integration.
Caveat: Since a headless WebKit is used for this, tests may pass in the console but fail in your actual browser.
It is a good idea to update the test libraries from time to time, since they are not part of the package.json
file
(automating this part with Grunt or similar would be overkill...).
To do so, run the following, and then commit the changes:
npm install mocha chai
cp node_modules/{mocha/mocha.{js,css},chai/chai.js} test/
npm uninstall mocha chai
The API documentation can be seen when opening doc/global.html
in your browser, or at https://astorije.github.io/cantwait/doc/global.html.
To generate the documentation, run the following, and then commit the changes:
npm install
npm run doc
Because I used the experimental ChildNode.remove()
, browser compatibility of Can't Wait! is limited.
As far as I know, it looks like this:
- Chrome 23 and up is compatible
- Firefox 23.0 and up is compatible
- Opera 10.0 and up is compatible
- Internet Explorer is not compatible
- Safari is not compatible
Because I do not plan to use Internet Explorer or Safari anytime soon and, let's face it, nobody else will actually use Can't Wait!, I will not try to fix this.