This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-29
Channels
- # announcements (6)
- # babashka (7)
- # beginners (24)
- # calva (2)
- # cider (21)
- # clj-kondo (49)
- # cljdoc (29)
- # clojure (56)
- # clojure-dev (2)
- # clojure-europe (15)
- # clojure-nl (6)
- # clojure-norway (27)
- # clojure-uk (3)
- # clojuredesign-podcast (6)
- # clojurescript (1)
- # conjure (1)
- # core-async (8)
- # cryogen (2)
- # cursive (6)
- # data-science (1)
- # datomic (12)
- # events (1)
- # fulcro (16)
- # graalvm (28)
- # hyperfiddle (2)
- # lambdaisland (4)
- # leiningen (20)
- # observability (1)
- # off-topic (24)
- # pathom (5)
- # pedestal (10)
- # portal (7)
- # practicalli (1)
- # reitit (5)
- # rewrite-clj (20)
- # shadow-cljs (18)
- # vim (8)
- # xtdb (9)
Hello! I want to call a function if a specific namespace is reloaded. Is that possible? Will it be a hook?
It would get called in situations when I don’t want it, I think? I do not usually have calls at the top level of the ns.
build-info here contains all the info that happening, and includes which namespaces were reloaded
shadow calls all after-load functions from builds that are being watched, not just those that have been reloaded/recompiled.
This works great for me, btw:
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn build-notify!
"Dev reload utility ..."
[build-info]
(when (= :build-complete (:type build-info))
(when-let [compiled (-> build-info :info :compiled)]
(when (compiled [:shadow.build.classpath/resource "a/b/c.cljs"])
#_{:clj-kondo/ignore [:unresolved-namespace]}
(x.y/do-things!)))))
I have it in my main
namespace.👍 1