Created
April 4, 2014 18:15
-
-
Save diogo149/9980166 to your computer and use it in GitHub Desktop.
This file contains 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
(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