Based on the Quick Start guide, with little tweaks.
- Dev REPL –
clj -M --main cljs.main --compile cljs-minimal.core --repl
- Production build –
clj -M -m cljs.main --optimizations advanced -c cljs-minimal.core
- Serve production build –
clj -M -m cljs.main --serve
- Serve production build –
Equivalent JavaScript could look like the following:
function on_click(event) {
alert("Clicked!");
}
function create_button() {
var button = document.createElement("input");
button.setAttribute("type", "button");
button.setAttribute("value", "Call Alert");
button.addEventListener("click", on_click);
return button;
}
var app = document.getElementById("app");
app.appendChild(create_button());
- How do I restart REPL properly?
- (require '[cljs-minimal.core :as cljs] :reload)
- How do I properly setup REPL to watch the changes?
- How
.setAttribute
is different from!set
macro? - How does
goog.dom
andgoog.events
differ from the barebone DOM API in ClojureScript?