hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
2019-07-07T13:13:42.070400Z

@flyboarder hey, any idea why shadow cljs adds things instead of replacing in the body when doing live reload?

2019-07-07T16:15:50.071900Z

hmmm got a workaround for the live reload thing in shadow cljs

2019-07-07T16:15:55.072200Z

(ns ^:dev/once index.mount
 (:require
  [hoplon.core :as h]
  [javelin.core :as j]
  [hoplon.jquery]
  concierge.mount))

(defn to-element! [el]
 (el
  [
   (h/h1 "Concierge")
   (concierge.mount/to-element (h/div))]))

(let [mountpoint (atom (h/div))]
 (defn remount! []
  ; clear out hoplon data from mountpoint div
  (h/hl! @mountpoint :hoplon/reset nil)
  ; create a new div for mountpoint
  (reset! mountpoint (h/div))
  ; flush the DOM in the document body
  (set! (.-innerHTML (h/body)) "")
  ; drop the new mountpoint into the body
  (h/html
   (h/body
    @mountpoint))
  ; rebuild everything
  (to-element! @mountpoint)))

; hook into shadow cljs
(defn ^:dev/after-load start! []
 (remount!))
(start!)

2019-07-07T16:16:29.072600Z

need to manually flush the body element with a buffer div to mount everything into