Something Fun with Clojure-Script
This repo has the results of our group dojo hack-around as part of the uSwitch Clojure Dojo held on 11/01/2016.
The project is based on a lein template provided by @jarohen. The base project can be regenerated by running
lein new bounce-webapp [your-project-name]
To start the project running simply run the following:
This will download the project dependencies, start a repl server on port
7888 and a figwheel server on
localhost:3449. The server can be reached on
You can connect to the running repl by running
lein repl ::connect 7888 from the terminal.
Reload everything in the project by running
(bounce.core/reload!) from the repl. From here you can connect to a clojure-script repl by running
(bounce.figwheel/cljs-repl (bounce.core/ask :cljs-compiler)) from the repl.
Once connected to the clojure-script repl you can run code and see the impact in the browser. Examples are as follows:
(swap! (bounce.core/ask :!app) update :my-counter inc)-> Increment the
(set! (.-backgroundColor js/document.body.style) "green")-> Change the page background to
There are three components on display as part of this wonderful feat of engineering.
- Button counter -> simple button to increment a counter on the page.
- Basic palindrome checker -> Check if the input string is a valid palindrome. Update a result string text & colour based on the result (true/false)
- Rest thingy -> Send a value to the server and then render the response on the page.