mirror of
https://github.com/status-im/reagent.git
synced 2025-01-30 13:45:23 +00:00
Now almost working
This commit is contained in:
parent
043c8b0dee
commit
6c345db29e
@ -195,7 +195,8 @@
|
|||||||
(defprotocol IComputedImpl
|
(defprotocol IComputedImpl
|
||||||
(-update-watching [this derefed])
|
(-update-watching [this derefed])
|
||||||
(-handle-change [k sender oldval newval])
|
(-handle-change [k sender oldval newval])
|
||||||
(-peek-at [this]))
|
(-peek-at [this])
|
||||||
|
(-check-clean [this]))
|
||||||
|
|
||||||
(def clean 0)
|
(def clean 0)
|
||||||
(def maybe-dirty 1)
|
(def maybe-dirty 1)
|
||||||
@ -250,8 +251,12 @@
|
|||||||
(if (identical? oldval newval)
|
(if (identical? oldval newval)
|
||||||
maybe-dirty is-dirty)))
|
maybe-dirty is-dirty)))
|
||||||
(if auto-run
|
(if auto-run
|
||||||
(when (> dirty? clean)
|
(do
|
||||||
((or auto-run run) this))
|
;; FIXME: is this correct?
|
||||||
|
(binding [*ratom-context* this]
|
||||||
|
(-check-clean this))
|
||||||
|
(when (> dirty? clean)
|
||||||
|
((or auto-run run) this)))
|
||||||
(-notify-watches this state state)))
|
(-notify-watches this state state)))
|
||||||
;; (when (and active? (not (identical? oldval newval)))
|
;; (when (and active? (not (identical? oldval newval)))
|
||||||
;; (set! dirty? is-dirty)
|
;; (set! dirty? is-dirty)
|
||||||
@ -273,6 +278,16 @@
|
|||||||
(binding [*ratom-context* nil]
|
(binding [*ratom-context* nil]
|
||||||
(-deref this))))
|
(-deref this))))
|
||||||
|
|
||||||
|
(-check-clean [this]
|
||||||
|
(when (== dirty? maybe-dirty)
|
||||||
|
(let [oldauto auto-run]
|
||||||
|
(set! auto-run nil)
|
||||||
|
(doseq [w watching]
|
||||||
|
(-deref w))
|
||||||
|
(set! auto-run oldauto))
|
||||||
|
(when (== dirty? maybe-dirty)
|
||||||
|
(set! dirty? clean))))
|
||||||
|
|
||||||
IRunnable
|
IRunnable
|
||||||
(run [this]
|
(run [this]
|
||||||
(let [oldstate state
|
(let [oldstate state
|
||||||
@ -290,14 +305,7 @@
|
|||||||
|
|
||||||
IDeref
|
IDeref
|
||||||
(-deref [this]
|
(-deref [this]
|
||||||
(when (== dirty? maybe-dirty)
|
(-check-clean this)
|
||||||
(let [oldauto auto-run]
|
|
||||||
(set! auto-run nil)
|
|
||||||
(doseq [w watching]
|
|
||||||
(-deref w))
|
|
||||||
(set! auto-run oldauto))
|
|
||||||
(when (== dirty? maybe-dirty)
|
|
||||||
(set! dirty? clean)))
|
|
||||||
(if (or auto-run (some? *ratom-context*))
|
(if (or auto-run (some? *ratom-context*))
|
||||||
(do
|
(do
|
||||||
(notify-deref-watcher! this)
|
(notify-deref-watcher! this)
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
(rv/running))
|
(rv/running))
|
||||||
(defn dispose [v] (rv/dispose! v))
|
(defn dispose [v] (rv/dispose! v))
|
||||||
|
|
||||||
(def testite 1)
|
(def testite 10)
|
||||||
|
|
||||||
(deftest basic-cursor
|
(deftest basic-cursor
|
||||||
(let [runs (running)
|
(let [runs (running)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
(set! rv/debug true)
|
(set! rv/debug true)
|
||||||
(rv/running))
|
(rv/running))
|
||||||
|
|
||||||
(def testite 1)
|
(def testite 10)
|
||||||
|
|
||||||
(defn dispose [v]
|
(defn dispose [v]
|
||||||
(rv/dispose! v))
|
(rv/dispose! v))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user