This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-13
Channels
- # announcements (27)
- # beginners (184)
- # boot (4)
- # cider (9)
- # cljdoc (1)
- # cljsrn (2)
- # clojure (208)
- # clojure-austin (1)
- # clojure-conj (4)
- # clojure-dev (20)
- # clojure-europe (15)
- # clojure-italy (66)
- # clojure-losangeles (2)
- # clojure-nl (32)
- # clojure-spec (64)
- # clojure-uk (80)
- # clojurescript (50)
- # cursive (2)
- # data-science (3)
- # datomic (17)
- # emacs (1)
- # events (6)
- # fulcro (3)
- # jobs (15)
- # juxt (5)
- # klipse (2)
- # leiningen (31)
- # nyc (3)
- # off-topic (34)
- # re-frame (2)
- # reagent (9)
- # schema (1)
- # shadow-cljs (52)
- # specter (5)
- # sql (3)
is there a way to start a shadow-cljs repl on the browser-side in an existing js-project?
what I wish to do is something akin to:
let wish = require('shadow-cljs.wishful-repl');
wish.startRepl();
and then be able to connect to it using e.g. cider-mode or inf-clojure-mode, and eval cljs-code in the context of the browser page 🙂 I hope I'm making senseoh, I guess that makes sense. I was hoping to do something akin to what you can do in jvm/clr, where you can start clojure and poke at the classes etc
yeah but you are much better of poking at those variables using the browser devtools
I generally feel very comfortable playing around with stuff using the repl, but maybe I should get more used to the devtools
I don't want to stand in the way of your ideas so you could just make a regular :browser
build and load that normally alongside your JS project
one of the things I had in mind is when Sean Cornfield used clojure to generate tests for java-classes/functions by speccing them. I really like spec/generation, so I figured that could be one way to do it 🙂
but I'm not sure how feasible it is to do it "from the outside", as you're saying, the js-world might be too walled off 😕
do you think it'd be more feasible to do it the other way around, create a shadow-cljs browser-project, and require all js-libs through cljs? or would they be equally opaque?
ah, I see. maybe it'd make more sense to just use a testing library built for js then
you might reaaaaly like this too https://github.com/mfikes/cljs-bean
Oh, I'm not sure exactly, that's also a good library. But if you want an easy way to print JS objects as Clojure data structures cljs-bean should help a lot. I think it does some magic around the conversion so you can use regular CLJS data functions then convert it back to JS objects without sacrificing performance. Depends on your usecase I guess.
Yep, so you can either go down the route of "leave it as JS and use functions that are aware of that fact" or the other route of "wrap it in a thin layer that lets you use all other ClojureScript functions you'd use with normal data". Honestly depends on your preference. You might find cljs-interop faster for all I know.
I've used it before and enjoyed it, I do like the idea of only having to learn like 1-3 functions though, then I get to use all of the cljs.core functions.
yeah, I really appreciate the suggestion 🙂 was just curious about the differences. being able to use "standard" functions sure sounds nice
If you've got something that works, might as well stick with it. If I was starting fresh and had to do a lot of JS interop I'd be tempted by both. Just have to try it out I guess.
I'm currently just dabbling with cljs, so I'm not really into any big project 😄 so trying different things out sounds fine
Experimenting with functions and tools at the REPL is one of my favourite things about the ecosystem, playing with stuff is good 👍
Is my problem relative to shadow-cljs? My chrome format cljs data like this, but I want the following way
Hello, does anyone know if the loader code works with re-frame events ? https://shadow-cljs.github.io/docs/UsersGuide.html#_loading_code_dynamically
It doesn't seem to work to load a module dynamically and then try to dispatch a re-frame event defined in that module (for my case, calling re-frame/dispatch
in the fn-to-call-on-load
callback)