Skip to content

Instantly share code, notes, and snippets.

@diogo149
Created April 4, 2014 18:15
Show Gist options
  • Save diogo149/9980166 to your computer and use it in GitHub Desktop.
Save diogo149/9980166 to your computer and use it in GitHub Desktop.
(ns testbug.core
(:require
[om.core :as om :include-macros true]
[om.dom :as dom]))
(enable-console-print!)
(def app-state (atom {}))
(defn foo
[app-state]
(reify
om/IShouldUpdate
(should-update [this x y] (print "Named - Get's called") false)
om/IRender
(render [this]
(prn "Named - Only called once")
(dom/div nil ""))))
(defn app
[app-state owner]
(reify
om/IRender
(render [this]
(dom/div nil
(om/build foo app-state)
(om/build
(fn
[app-state]
(reify
om/IShouldUpdate
(should-update [this x y] (print "Anonymous - Never gets called") false)
om/IRender
(render [this]
(prn "Anonymous - Updates")
(dom/div nil ""))))
app-state)
))))
(js/setInterval #(swap! app-state assoc :foo (gensym)) 500)
(om/root app app-state {:target (.getElementById js/document "content")})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment