Skip to content

Instantly share code, notes, and snippets.

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 pesterhazy/245eea26b6e1ae09a1d9d3df724ddc7b to your computer and use it in GitHub Desktop.
Save pesterhazy/245eea26b6e1ae09a1d9d3df724ddc7b to your computer and use it in GitHub Desktop.
(require '[reagent.core :as r])
(defn i []
(let [dims (r/atom {})
this (r/atom nil)]
(fn [][:div
[:img {:style {:width :100%}
:src "http://www.lispcast.com/img/pre-conj/rich-hickey.jpeg"
:ref (fn [x] (reset! this x))
:on-load
(fn [x]
(reset! dims {:width (.-width @this)
:height (.-height @this)}))}]
[:div "Dimensions:" (pr-str @dims)]])))
(r/render-component [i]
(js/document.getElementById "klipse-container"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment