Fork me on GitHub
#shadow-cljs
<
2020-11-25
>
mkvlr07:11:38

good morning, we are using :repl {:runtime-select :latest} in our project and like it. Now I’ve added an iframe that also runs a cljs target that’s built with shadow. Is there a way to opt out of shadow considering this iframe for the repl? I’d like shadow to use the latest main window for the repl…

mkvlr07:11:20

both of these use the same build but a different module.

mkvlr08:11:16

trying to switch this manually with shadow.cljs.devtools.api I noticed that my repl-runtimes are missing the :runtime-id key that’s needed for me to switch this or am I misunderstanding the api?

(repl-runtimes :website)
;; => [{:since #inst "2020-11-25T07:44:05.319-00:00", :proc-id "68613cad-86ad-44ea-a950-32dac30914ec", :connection-info {:remote true, :websocket true}, :client-id 45, :user-agent "Chrome 537.36 [MacIntel]", :type :runtime, :lang :cljs, :build-id :website, :host :browser, :dom true} {:since #inst "2020-11-25T07:44:07.842-00:00", :proc-id "68613cad-86ad-44ea-a950-32dac30914ec", :connection-info {:remote true, :websocket true}, :client-id 46, :user-agent "Chrome 537.36 [MacIntel]", :type :runtime, :lang :cljs, :build-id :website, :host :browser, :dom true}]

thheller08:11:44

@mkvlr switching that way is currently not supported. https://github.com/thheller/shadow-cljs/issues/776

thheller08:11:35

I'll see about fixing that. not many people use it so I forgot 🙂

mkvlr08:11:48

cool, thanks a lot!

mkvlr08:11:46

do you think adding a flag to not consider a certain frame from becoming the active repl might also make sense?

mkvlr08:11:38

not likely that a lot of people run into this problem though…

thheller08:11:50

the problem is that there is no easy way to identify something

thheller08:11:03

and iframe looks just like any other normal document

mkvlr08:11:23

sure, maybe a js global to opt out?

thheller08:11:23

it does identify workers but even with multiple workers it can't identify between them

thheller08:11:24

sure that would work. must be something coming out of the document loading the JS

mkvlr08:11:40

that would work for our case

thheller09:11:17

@mkvlr in 2.11.8 you can set <script>var SHADOW_CONFIG = { repl: false };</script> in the HTML (before the actual script) to opt-out of the REPL for that page

thheller09:11:46

the actual manual REPL select logic I'll need to think about for a bit

mkvlr09:11:45

@thheller wow, thanks so much!

Carlo10:11:38

hey, I'm new to clojurescript, could you guide me in the process of adding the cytoscape-cola library to a project using shadowjs?

Carlo10:11:03

Here's what I know: I can't use cljsjs because shadow-clj doesn't support that, so I think I have to install the library via npm install cytoscape-cola

Carlo10:11:34

Then I added (:require ["cytoscape-cola" :as cyto])

Carlo10:11:24

I seem to have solved my problem now, thanks 🙂