This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-16
Channels
- # babashka (17)
- # calva (35)
- # clerk (31)
- # cljs-dev (3)
- # clojars (1)
- # clojure (16)
- # clojure-europe (4)
- # clojurescript (38)
- # clojutre (2)
- # cursive (8)
- # datomic (16)
- # exercism (5)
- # fulcro (5)
- # gratitude (3)
- # hyperfiddle (55)
- # joyride (1)
- # lsp (40)
- # off-topic (6)
- # portal (64)
- # practicalli (1)
- # reitit (3)
- # releases (1)
- # shadow-cljs (38)
- # sql (1)
- # tools-deps (8)
- # xtdb (9)
Usually I have the shadow-cljs watch
process in a window which is not visible. I would like to play a sound, when there is a compilation error/warning. And then another sound when the error/warning is gone again. Any ideas how this could be achieved? Thank you.
if this is for a browser and you have the browser also open you can use :devtools {:custom-notify a.namespace/your-function}
basically it gets all the messages that the hot-reload/repl stuff also gets, so there is a :build-complete
and :build-failure
and if you want a more involved version you can do a plugin, but its not documented so you have to do some digging. I can give you the barebones if you want
(ns demo.dummy-plugin
(:require
[clojure.core.async :as async]
[shadow.jvm-log :as log]
[shadow.cljs.model :as m]
[shadow.cljs.devtools.server.system-bus :as sys-bus]))
(def plugin
{:requires-server true
:depends-on [:system-bus]
:start
(fn [system-bus]
(let [chan (async/chan (async/sliding-buffer 10))]
(sys-bus/sub system-bus ::m/worker-broadcast chan)
(async/thread
(loop []
(when-some [msg (async/<!! chan)]
(tap> [:plugin msg])
(recur))))
chan))
:stop
(fn [chan]
(log/debug ::stop)
(async/close! chan)
::done)})
look in the http://localhost:9630/inspect ui to see what kind of messages you get
ok, I got it. First I had a simple namespace myplugin
. This did not work. It must be like tools.myplugin
.
I get the messages :build-start
and :build-complete
but there is no message for a build failure...
this is how you can get all the warnings for example, thats how the client HUD displays them