This demo is made using Bacon.js, a functional reactive programming library for JavaScript. Check out the annotated source code (written in CoffeeScript) for more information.