Only inject panel once

This commit is contained in:
chris (daiyi) 2017-07-25 17:02:01 +02:00
parent df1f091f47
commit bc0825a558
1 changed files with 11 additions and 3 deletions

View File

@ -251,7 +251,15 @@
:subvis [subvis/render-subvis traces]
[render-traces])]]]))})))
(defn panel-div []
(let [id "--re-frame-trace--"
panel (.getElementById js/document id)]
(if panel
panel
(let [new-panel (.createElement js/document "div")]
(.setAttribute new-panel "id" id)
(.appendChild (.-body js/document) new-panel)
new-panel))))
(defn inject-devtools! []
(let [div (.createElement js/document "div")]
(.appendChild (.-body js/document) div)
(r/render [devtools] div)))
(r/render [devtools] (panel-div)))