Fork me on GitHub

If I have an atom in a web worker namespace, is there any way to inspect this value via the REPL? I’m assuming the repl is connected to the main thread as when I try to execute anything the values are all empty


Or is there some integration with insepct/tap that I can load an atom into it and inspect it at any time?


Oh my god. I can just open up all the defined atoms in a namespace? Consider my mind blown.


If there is anyway to cycle the JS runtime you connect to though, I’d still be keen to know


Or looking through the source code it looks like maybe there is some way to delegate tasks to the worker thread? :thinking_face:


I’m getting close with something like:

(->> (shadow.cljs.devtools.api/repl-runtimes :browser)
     (hash-map :proc-id)
     (shadow.cljs.devtools.api/repl :browser))
This successfully connects to a repl and I can execute arbitrary code (i.e. (+ 1 1)) but I still can’t access any context


(not sure if it’s a red herring though)


Hmm it seems proc-id is actually the same for both repl-runtimes so I’m connecting to the same instance. Can’t figure out how to print the runtime-id (it is not returned from repl-runtimes)


ahaaa so client-id is the runtime-id (small numeric number). Was able to get it working with:

(->> (shadow.cljs.devtools.api/repl-runtimes :browser)
       (hash-map :runtime-id)
       (shadow.cljs.devtools.api/repl :browser)))
With this and inspect shadow-cljs is unstoppable!


hehe yeah this API went through some unfortunate renaming cycles since I couldn't settle on a name


thus the mix of :client-id and :runtime-id


No worries, I figured I’d share my findings as I went along so this thread would have all the keywords I ran across 😂