File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,13 +140,16 @@ Syntax :
140140Returns the current state of current continuous flow `cf`.
141141" [& flows] `(join (r/fixed-signals ~@flows)))
142142
143+ (cc/defn watchable! [ref]
144+ (ca/is ref #?(:clj #(instance? clojure.lang.IRef %) :cljs #(satisfies? IWatchable %)) (str " Not watchable: " ref)))
145+
143146(defmacro watch "
144147Syntax :
145148```clojure
146149(watch !ref)
147150```
148151Returns the current state of current reference `!ref`.
149- " [ref] `(check-electric watch (input (m/watch ~ref))))
152+ " [ref] `(check-electric watch (input (m/watch ( watchable! ~ref) ))))
150153
151154(defmacro diff-by "
152155Syntax :
Original file line number Diff line number Diff line change 29002900 % := [_ 1 ]
29012901 (hash (first *1)) := (hash (first *3)) ; not the same hash – pure got rebuilt
29022902 )))
2903+
2904+ (tests
2905+ " nice error message on non-watchable `e/watch` call"
2906+ (with ((l/single {} (e/watch :foo )) tap tap)
2907+ (str/includes? (ex-message %) " Not watchable: :foo" ) := true ))
You can’t perform that action at this time.
0 commit comments