A little cleanup

This commit is contained in:
Dan Holmsand 2014-02-11 00:15:01 +01:00
parent 805264ea61
commit a1ea281fc5
1 changed files with 6 additions and 6 deletions

View File

@ -11,20 +11,20 @@
(defn running [] @-running) (defn running [] @-running)
(defn capture-derefed [f obj] (defn capture-derefed [f obj]
(set! (.-captured obj) nil) (set! (.-cljsCaptured obj) nil)
(binding [*ratom-context* obj] (binding [*ratom-context* obj]
(f))) (f)))
(defn captured [obj] (defn captured [obj]
(let [c (.-captured obj)] (let [c (.-cljsCaptured obj)]
(set! (.-captured obj) nil) (set! (.-cljsCaptured obj) nil)
c)) c))
(defn- notify-deref-watcher! [derefable] (defn- notify-deref-watcher! [derefable]
(let [obj *ratom-context*] (let [obj *ratom-context*]
(when-not (nil? obj) (when-not (nil? obj)
(let [captured (.-captured obj)] (let [captured (.-cljsCaptured obj)]
(set! (.-captured obj) (set! (.-cljsCaptured obj)
(conj (if (nil? captured) #{} captured) (conj (if (nil? captured) #{} captured)
derefable)))))) derefable))))))
@ -118,7 +118,7 @@
(run [this] (run [this]
(let [oldstate state (let [oldstate state
res (capture-derefed f this) res (capture-derefed f this)
derefed (.-captured this)] derefed (captured this)]
(when (not= derefed watching) (when (not= derefed watching)
(-update-watching this derefed)) (-update-watching this derefed))
(when-not active? (when-not active?