Make -deref in Reaction a little clearer

This commit is contained in:
Dan Holmsand 2015-02-11 06:47:11 +01:00
parent 526dfa61ea
commit 19a384443f
1 changed files with 7 additions and 8 deletions

View File

@ -276,20 +276,19 @@
IDeref
(-deref [this]
(if-not (or auto-run (some? *ratom-context*))
(if (or auto-run (some? *ratom-context*))
(do
(notify-deref-watcher! this)
(if dirty?
(run this)
state))
(do
(when dirty?
(let [oldstate state]
(set! state (f))
(when-not (identical? oldstate state)
(-notify-watches this oldstate state))))
state)
(do
(when (some? *ratom-context*)
(notify-deref-watcher! this))
(if dirty?
(run this)
state))))
state)))
IDisposable
(dispose! [this]