mirror of
https://github.com/status-im/re-frame-10x.git
synced 2025-01-27 06:34:59 +00:00
Add enable and disable-tracing functions
Hard coded at the moment to disable/enable when showing the panel. Will be eventually made configurable. Fixes #7
This commit is contained in:
parent
91d8715584
commit
44429f981c
@ -103,10 +103,17 @@
|
||||
#_(if-let [comp-p (get-in trace [:tags :component-path])]
|
||||
(println comp-p))))
|
||||
|
||||
(defn init-tracing! []
|
||||
(defn disable-tracing! []
|
||||
(re-frame.trace/remove-trace-cb ::cb))
|
||||
|
||||
(defn enable-tracing! []
|
||||
(re-frame.trace/register-trace-cb ::cb (fn [new-traces]
|
||||
(let [new-traces (filter log-trace? new-traces)]
|
||||
(swap! traces #(reduce conj % new-traces)))))
|
||||
(swap! traces #(reduce conj % new-traces))))))
|
||||
|
||||
(defn init-tracing!
|
||||
"Sets up any intial state that needs to be there for tracing. Does not enable tracing."
|
||||
[]
|
||||
(monkey-patch-reagent)
|
||||
)
|
||||
|
||||
@ -206,6 +213,9 @@
|
||||
(cond
|
||||
(and (= key "h") (.-ctrlKey e))
|
||||
(do (swap! showing? not)
|
||||
(if @showing?
|
||||
(enable-tracing!)
|
||||
(disable-tracing!))
|
||||
(.preventDefault e))))))]
|
||||
(r/create-class
|
||||
{:component-will-mount #(js/window.addEventListener "keydown" handle-keys)
|
||||
|
Loading…
x
Reference in New Issue
Block a user