Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save pesterhazy/245eea26b6e1ae09a1d9d3df724ddc7b to your computer and use it in GitHub Desktop.

Select an option

Save pesterhazy/245eea26b6e1ae09a1d9d3df724ddc7b to your computer and use it in GitHub Desktop.

Revisions

  1. pesterhazy revised this gist Jan 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@
    (fn [x]
    (reset! dims {:width (.-width @this)
    :height (.-height @this)}))}]
    [:div (pr-str @dims)]])))
    [:div "Dimensions:" (pr-str @dims)]])))

    (r/render-component [i]
    (js/document.getElementById "klipse-container"))
  2. @pbaille pbaille revised this gist Jan 12, 2017. 1 changed file with 5 additions and 6 deletions.
    11 changes: 5 additions & 6 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,16 @@
    (require '[reagent.core :as r])

    (defn i []
    (let [dims (r/atom {})]
    (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]
    (this-as this
    (js/console.log x)
    (js/console.log this)
    (reset! dims {:width (.-width this)
    :height (.-height this)})))}]
    (reset! dims {:width (.-width @this)
    :height (.-height @this)}))}]
    [:div (pr-str @dims)]])))

    (r/render-component [i]
  3. @pbaille pbaille revised this gist Jan 12, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -14,4 +14,5 @@
    :height (.-height this)})))}]
    [:div (pr-str @dims)]])))

    [i]
    (r/render-component [i]
    (js/document.getElementById "klipse-container"))
  4. @pbaille pbaille created this gist Jan 12, 2017.
    17 changes: 17 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    (require '[reagent.core :as r])

    (defn i []
    (let [dims (r/atom {})]
    (fn [][:div
    [:img {:style {:width :100%}
    :src "http://www.lispcast.com/img/pre-conj/rich-hickey.jpeg"
    :on-load
    (fn [x]
    (this-as this
    (js/console.log x)
    (js/console.log this)
    (reset! dims {:width (.-width this)
    :height (.-height this)})))}]
    [:div (pr-str @dims)]])))

    [i]