Skip to content

Commit

Permalink
[refactor] extract root containers
Browse files Browse the repository at this point in the history
  • Loading branch information
kimo-k committed Oct 12, 2023
1 parent 2741ac4 commit 14d55bc
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/day8/re_frame_10x.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,21 @@
(defn ^:export handle-keys! [handle-keys?]
(rf/dispatch [::settings.events/handle-keys? handle-keys?]))

;; --- NEW ---
(defn create-shadow-root []
(tools.shadow-dom/shadow-root js/document "--re-frame-10x--"))

(defn create-style-container [shadow-root]
[spade.react/with-style-container
(spade.dom/create-container shadow-root)
[devtools-outer
{:panel-type :inline
:debug? debug?}]])

(defn inject!
[]
(rf/clear-subscription-cache!)
(let [shadow-root (tools.shadow-dom/shadow-root js/document "--re-frame-10x--")
container (spade.dom/create-container shadow-root)]

(rdom/render
[spade.react/with-style-container container
[devtools-outer
{:panel-type :inline
:debug? debug?}]]
shadow-root)))
(let [shadow-root (create-shadow-root)]
(rdom/render (create-style-container shadow-root) shadow-root)))

(defn patch!
"Sets up any initial state that needs to be there for tracing. Does not enable tracing."
Expand Down

0 comments on commit 14d55bc

Please sign in to comment.