Add debug? subscription

This commit is contained in:
Daniel Compton 2018-01-31 00:49:18 +13:00
parent 889bfc6a3a
commit e0dea398f4
5 changed files with 16 additions and 4 deletions

View File

@ -229,7 +229,7 @@
:debug? debug?}] (panel-div)))
(defn init-db! []
(trace.db/init-db))
(trace.db/init-db debug?))
(defn ^:export factory-reset! []
(rf/dispatch [:settings/factory-reset]))

View File

@ -2,7 +2,7 @@
(:require [mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
[day8.re-frame.trace.utils.localstorage :as localstorage]))
(defn init-db []
(defn init-db [debug?]
(let [panel-width% (localstorage/get "panel-width-ratio" 0.35)
show-panel? (localstorage/get "show-panel" false)
selected-tab (localstorage/get "selected-tab" :app-db)
@ -28,6 +28,7 @@
(rf/dispatch [:settings/set-filtered-view-trace filtered-view-trace])
(rf/dispatch [:settings/set-low-level-trace low-level-trace])
(rf/dispatch [:settings/set-number-of-retained-epochs num-epochs])
(rf/dispatch [:settings/debug? debug?])
(when external-window?
(rf/dispatch [:global/launch-external]))
(rf/dispatch [:traces/filter-items filter-items])

View File

@ -199,6 +199,11 @@
(fn [low-level [_ trace-type capture?]]
(assoc low-level trace-type capture?)))
(rf/reg-event-db
:settings/debug?
(fn [db [_ debug?]]
(assoc-in db [:settings :debug?] debug?)))
;; Global
(defn mount [popup-window popup-document]

View File

@ -61,6 +61,12 @@
(fn [settings]
(:low-level-trace settings)))
(rf/reg-sub
:settings/debug?
:<- [:settings/root]
(fn [settings]
(:debug? settings)))
;; App DB
(rf/reg-sub

View File

@ -24,8 +24,8 @@
(defn spy
([x]
(js/console.log x)
#?(:cljs (js/console.log x))
x)
([label x]
(js/console.log label x)
#?(:cljs (js/console.log label x))
x))