Skip to content

Instantly share code, notes, and snippets.

@alandipert
Created July 31, 2014 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alandipert/4b7f3d541f2d8646bf39 to your computer and use it in GitHub Desktop.
Save alandipert/4b7f3d541f2d8646bf39 to your computer and use it in GitHub Desktop.
(page "index.html")
(defn class! [elem c]
(let [asetc (cell= (aset elem "className" c))]
(specify! elem cljs.core/IMeta (-meta [_] asetc))))
(defn declass! [elem]
(destroy-cell! (meta elem)))
(defc the-class "foo")
(with-timeout 1000
(reset! the-class "bar"))
(html
(head
(link :rel "stylesheet" :type "text/css" :href "css/main.css"))
(body
(let [h1-classed (class! (h1) the-class)]
(h1-classed "Hello, World!"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment