(defn
file-reloader-plugin
[opts]
(let
[ch (chan)]
(go-loop
[]
(when-let
[msg-hist' (<! ch)]
(let
[msg-hist
(focus-msgs #{:compile-warning :files-changed} msg-hist')
msg-names
(map :msg-name msg-hist)
msg
(first msg-hist)]
(if
(autoload?)
(cond
(reload-file-state? msg-names opts)
(alts! [(reloading/reload-js-files opts msg) (timeout 1000)])
(block-reload-file-state? msg-names opts)
(utils/log
:warn
(str
"Figwheel: Not loading code with warnings - "
(-> msg :files first :file))))
(do
(utils/log :warn "Figwheel: code autoloading is OFF")
(utils/log
:info
(str "Not loading: " (map :file (:files msg))))))
(recur))))
(fn [msg-hist] (put! ch msg-hist) msg-hist)))