mirror of
https://github.com/penpot/penpot.git
synced 2025-05-17 06:46:10 +02:00
✨ Add public function for enable event stream debugging.
This commit is contained in:
parent
5e91f05a7b
commit
8f2e31cafa
2 changed files with 15 additions and 7 deletions
|
@ -84,3 +84,8 @@
|
||||||
[]
|
[]
|
||||||
(when (= "main" (unchecked-get js/window app-sym))
|
(when (= "main" (unchecked-get js/window app-sym))
|
||||||
(reinit)))
|
(reinit)))
|
||||||
|
|
||||||
|
(defn ^:export toggle-debug
|
||||||
|
[]
|
||||||
|
(swap! st/*debug* not))
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
(defonce store (ptk/store {:on-error #(*on-error* %)}))
|
(defonce store (ptk/store {:on-error #(*on-error* %)}))
|
||||||
(defonce stream (ptk/input-stream store))
|
(defonce stream (ptk/input-stream store))
|
||||||
|
|
||||||
(defn repr-event
|
(defn- repr-event
|
||||||
[event]
|
[event]
|
||||||
(cond
|
(cond
|
||||||
(satisfies? ptk/Event event)
|
(satisfies? ptk/Event event)
|
||||||
|
@ -34,12 +34,15 @@
|
||||||
:else
|
:else
|
||||||
(str "unk: " (pr-str event))))
|
(str "unk: " (pr-str event))))
|
||||||
|
|
||||||
(defonce debug (as-> stream $
|
(defonce ^:dynamic *debug* (atom false))
|
||||||
|
|
||||||
|
(when *assert*
|
||||||
|
(defonce debug-subscription
|
||||||
|
(as-> stream $
|
||||||
(rx/filter ptk/event? $)
|
(rx/filter ptk/event? $)
|
||||||
;; Comment this line if you want full debug.
|
(rx/filter (fn [s] (deref *debug*)) $)
|
||||||
(rx/ignore $)
|
|
||||||
(rx/subscribe $ (fn [event]
|
(rx/subscribe $ (fn [event]
|
||||||
(println "[stream]: " (repr-event event))))))
|
(println "[stream]: " (repr-event event)))))))
|
||||||
|
|
||||||
(def auth-ref
|
(def auth-ref
|
||||||
(-> (l/key :auth)
|
(-> (l/key :auth)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue