Skip to content

Commit

Permalink
hide interop in lib.dom
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin committed Feb 3, 2020
1 parent afe9407 commit e4a7c90
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/src/app/react_three_fiber/examples/index.cljs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
(ns react-three-fiber.examples.index
(:require [shadow.loader :as shadow-loader]
[applied-science.js-interop :as j]
[react-three-fiber.examples.lib.ui :as ui :refer [defnc $]]
[react-three-fiber.examples.lib.react-router-dom :refer [<router>]]
[react-three-fiber.examples.lib.dom :refer [get-element-by-id]]
[react-three-fiber.examples.lib.dom :refer [get-element-by-id
get-window-location-origin
get-window-location-pathname]]
[react-three-fiber.examples.pages.intro :refer [<intro>]]
[react-three-fiber.core :refer [use-frame <canvas>]]
[react-three-fiber.examples.styles :refer [<global-styles>]]
Expand All @@ -25,8 +26,8 @@

(defn init-module-loader! []
; https://github.com/thheller/shadow-cljs/pull/646
(let [origin (j/get-in goog/global [:window :location :origin])
pathname (j/get-in goog/global [:window :location :pathname])
(let [origin (get-window-location-origin)
pathname (get-window-location-pathname)
prefix (remove-trailing-slashes (str origin pathname))]
(shadow-loader/init prefix)))

Expand Down
6 changes: 6 additions & 0 deletions examples/src/app/react_three_fiber/examples/lib/dom.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@

(defn get-element-by-id [id]
(js/document.getElementById id))

(defn get-window-location-origin []
js/window.location.origin)

(defn get-window-location-pathname []
js/window.location.pathname)

0 comments on commit e4a7c90

Please sign in to comment.