Load traces if panel is open

This commit is contained in:
Saskia Lindner 2017-08-29 15:56:52 +02:00
parent 60f6082c67
commit 7bd773fe02
1 changed files with 7 additions and 3 deletions

View File

@ -267,6 +267,11 @@
(def ease-transition "left 0.2s ease-out, top 0.2s ease-out, width 0.2s ease-out, height 0.2s ease-out")
(defn toggle-traces [showing?]
(if @showing?
(enable-tracing!)
(disable-tracing!)))
(defn devtools []
;; Add clear button
;; Filter out different trace types
@ -286,9 +291,7 @@
(cond
(and (= key "h") (.-ctrlKey e))
(do (swap! showing? not)
(if @showing?
(enable-tracing!)
(disable-tracing!))
(toggle-traces showing?)
(.preventDefault e))))))
handle-mousemove (fn [e]
(when @dragging?
@ -306,6 +309,7 @@
(localstorage/save! "show-panel" new-state)))
(r/create-class
{:component-will-mount (fn []
(toggle-traces showing?)
(js/window.addEventListener "keydown" handle-keys)
(js/window.addEventListener "mousemove" handle-mousemove))
:component-will-unmount (fn []