Is there a way to know the number of modifications of the dom emited by om when
rendering?
I've make an snake game based on om and I wonder if om only modifies the two
cells (head and tail) at each movement or repaints the whole world at each
step.
The two relevant components are:
(defn cell [[[x y] type] _]
(reify
om/IRender
(render [_]
(dom/rect #js {:x (* x size) :y (* y size) :height size :width size
:className type}))))
(defn world [{:keys [food snake dead]} _]
(reify
om/IRender
(render [_]
(let [foodcell [food "food"]
snakestyle (if dead "dead" "alive")
snakecells (map #(vector % snakestyle) snake)
allcells (cons foodcell snakecells)]
(apply dom/svg #js {:width (* width size) :height (* height size)}
(om/build-all cell allcells))))))
The project is at https://github.com/jmgimeno/om-snake
Thanks!
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.