Forked from pbaille/gist:342e82365b28166f1ad7111029c2c641
Created
January 12, 2017 11:39
-
-
Save pesterhazy/245eea26b6e1ae09a1d9d3df724ddc7b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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