Refactor get object and config

This commit is contained in:
Daniel Compton 2017-11-16 12:46:41 +13:00
parent 9391d1c162
commit 19f52b49aa
1 changed files with 10 additions and 4 deletions

View File

@ -57,6 +57,12 @@
(defn cljs-devtools-body [& args] (defn cljs-devtools-body [& args]
(apply make-devtools-api-call devtools.formatters.core/body-api-call args)) (apply make-devtools-api-call devtools.formatters.core/body-api-call args))
(defn get-object [jsonml]
(.-object (get jsonml 1)))
(defn get-config [jsonml]
(.-config (get jsonml 1)))
(defn data-structure [jsonml] (defn data-structure [jsonml]
(let [expanded? (r/atom false)] (let [expanded? (r/atom false)]
(fn [jsonml] (fn [jsonml]
@ -68,11 +74,11 @@
[:button.expansion-button (if @expanded? "▼" "▶")]] [:button.expansion-button (if @expanded? "▼" "▶")]]
(jsonml->hiccup (if @expanded? (jsonml->hiccup (if @expanded?
(cljs-devtools-body (cljs-devtools-body
(.-object (get jsonml 1)) (get-object jsonml)
(.-config (get jsonml 1))) (get-config jsonml))
(cljs-devtools-header (cljs-devtools-header
(.-object (get jsonml 1)) (get-object jsonml)
(.-config (get jsonml 1)))))]))) (get-config jsonml))))])))
(defn jsonml->hiccup (defn jsonml->hiccup
"JSONML is the format used by Chrome's Custom Object Formatters. "JSONML is the format used by Chrome's Custom Object Formatters.