Skip to content

Commit

Permalink
Disable hotreload if not at configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
gmsvalente committed Apr 15, 2024
1 parent 25e12a0 commit 3320590
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/xiana/hotreload.clj
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@ Accepts the following options:
:restart-fn \"the function to restart the system\" if none 'user/start-dev-system
:tracker {:dirs \"the directories vector list to search for changes\" :reload-compile-errors? \"true\"}."
[cfg]
(let [{:keys [restart-fn tracker]} (:xiana/hotreload cfg {:restart-fn 'user/start-dev-system})
(let [{:keys [restart-fn tracker]} (:xiana/hotreload cfg)
dirs (:dirs tracker ["src"])
retry? (:reload-compile-errors? tracker true)
track-fn (ns-tracker dirs)
reload! (reloader dirs retry?)
restart-fn (resolve restart-fn)]
(go-loop []
(<! (timeout 1000))
(if (track-fn)
(do
(reload!)
(restart-fn))
(recur)))
restart-fn (when restart-fn (resolve restart-fn))]
(when restart-fn
(go-loop []
(<! (timeout 1000))
(println "hotreload!")
(if (track-fn)
(do
(reload!)
(restart-fn))
(recur))))
cfg))

0 comments on commit 3320590

Please sign in to comment.