Fork me on GitHub
#shadow-cljs
<
2023-07-24
>
mjmeintjes01:07:54

Is there a way to determine client-side whether the browser tab is the current active runtime? I want to mark the tab title to indicate that it is currently being used to execute code.

thheller05:07:49

as far as shadow-cljs is concerned all of them are active, it is your REPL client that is selecting which one to talk to

thheller05:07:59

You can eval (set! js/document.title "EVAL HERE") or so 😛

thheller08:07:28

I don't think that is what he meant

2
mjmeintjes00:07:58

Thanks. Is there a way to get the current :client-id from the browser side? On the server side, I can call (shadow/repl-runtimes BUILD) and get a list of the current runtimes, and each of them has a :client-id that I can use to select the current run-time using (shadow/repl-runtime-select BUILD CLIENT-ID) Can I access that client-id from the browser side? So for example if I wanted to include the client-id in the title of the page.

mjmeintjes00:07:38

I think I figured it out. I can just require shadow.cljs.devtools.client.env client side to get access to this information.

thheller05:07:14

correct, the information is all there, set via :closure-defines for watch builds

thheller05:07:30

be careful with requiring that ns though, should avoid getting it into the release build

thheller05:07:56

the runtime id is also logged when the page first loads, the shadow-cljs - #<id> ready! message