Fork me on GitHub
#shadow-cljs
<
2023-03-14
>
flowthing18:03:19

Is there a way to use the :request-notify op to notify a client when a new JavaScript runtime connects to the shadow-cljs process?

thheller18:03:58

what is the context here? you are the client that would send request-notify?

flowthing18:03:06

I’m working on editor integration. I would like to let the editor know that a there’s a new JavaScript runtime connected to the ClojureScript runtime the editor is connected to. Kinda like this: https://github.com/thheller/shadow-cljs/blob/9a36743674e7bac457c43761c2ef0cce0423862a/src/main/shadow/cljs/devtools/server/repl_impl.clj#L177 But the inverse: “A new runtime appeared”.

thheller18:03:26

but that is a runtime? you can call it client if you want but it my terminology the thing running the compiled JS code is the runtime

thheller18:03:11

so, yes you can use request-notify the same way

flowthing18:03:27

Yes, sorry for the terminology confusion. Is there an example of how I’d do that? I can’t quite figure it out by reading remote.md.

thheller18:03:05

just {:op :request-notify}

thheller18:03:12

will send you everything connecting/disconnecting. so you could do the filtering on your end

flowthing18:03:44

Oh, I see — thanks! I’ll give that a shot. 👍

thheller18:03:27

just send it and open the UI. it should show up, and disconnect/reconnect on UI reload

2
flowthing18:03:17

Yep, that works like a charm, thanks.

thheller19:03:15

you can {:op :request-supported-ops :to <runtime-id>} to find out what the runtime can do

👍 2
jhacks18:03:51

Is it possible to supply :compiler-options on the command line when calling shadow-cljs from the clojure cli? I’ve tried variations on the following with no success:

clojure -M:cljs release app :compiler-options "{:pretty-print true :source-map true :pseudo-names true :pretty-print true}"

thheller18:03:50

there is also clojure -M:cljs release app --debug or clojure -M:cljs release app --pseudo-names for exactly this

thheller18:03:04

--debug being exactly what you tried

jhacks18:03:04

clojure -M:cljs release app --debug worked great, thank you so much @U05224H0W! I was looking at the guide and totally missed section 6.9. Overriding from the CLI.