dev.cljs 814 B

1234567891011121314151617181920212223
  1. (ns example.dev
  2. (:require [example.core :as core]
  3. [com.stuartsierra.component :as component]))
  4. (defonce _ (.warn js/console "Dev mode loaded -- hack responsibly."))
  5. (defrecord DevMode []
  6. component/Lifecycle
  7. (start [component]
  8. (.info js/console "Dev mode on. :)")
  9. component)
  10. (stop [component]
  11. (.info js/console "Dev mode off.")
  12. component))
  13. (swap! core/system update :dev #(or % (component/using (map->DevMode {})
  14. {:app :app})))
  15. (defn reload! [& _]
  16. (.info js/console (str "Dev Reload. system=" @core/system))
  17. (swap! core/system #(-> %
  18. component/stop
  19. component/start)))