Fork me on GitHub

there's a really nice clojurescript book, I read a while back hosted on a subdomain but haven't been able to find it for a while because I don't remember its name. does anyone here know which book I might be talking about?


thanks, I didn't know about this either! been digging my teeth in, I'm sure it'll help.


Hello, friends! As you might know, is the VS Code extension for Clojure/ClojureScript development. And it ships with an interactive tutorials on Clojure, which helps drive exposure and adoption of the language, seeing how popular VS Code has become. It lowers the barrier to entry significantly for a lot of people. Currently, 64% of Calva is written in TypeScript. There are some significant advantages to having more of this code (and future code) written in ClojureScript, instead of TypeScript. To that end, @brandon.ringe and @pez have made some valiant efforts, and stumbled upon some difficult problems. summarizes the efforts made so far, and the specific problems discovered along the way. If you have some time to spare, we would greatly appreciate some extra eyeballs on these problems, so that we can improve Calva and make the Clojure/ClojureScript development experience in VS Code even better. Please leave your input in the GitHub discussion.

calva 3
❤️ 1
🙌 1

probably a dumb question, but I guess cljs devs are more or less expected to know javascript? or at least some rudimentary knowledge of the runtime platform? I have experience with plain clojure, had hoped to carry most of my knowledge over (and, indeed, have), but I suspect due to differences between the runtimes there's a whole bunch of missing stuff that i'm looking for that probably will require a build-it-yourself approach, at which point js is probably needed? maybe I am just not looking in the right places, or am lacking some knowledge. an example is: I am trying to build a cljsrn web radio player. my understanding is that html audio tags, while they work out of the box for playing streams, will likely keep the entire stream in memory(?), so are unsuitable for things like infinite streams. so another plan is to fetch the upstream data, and have it be chunked into arrays, to be fed into some web audio api stuff, so that i can discard listened-to data and not have memory usage balloon. I seem to fall at the first hurdle though. none of the cljs http clients i've looked at return anything like aleph's streams; instead i came across and and some light wrappers on top of it, but working with this stuff definitely i'd say qualifies as runtime/js knowledge and is akin to java lib interop i suppose (something i rarely have to do for things myself, due to the already-existing rich ecosystem) is it just a fact that cljs is still very much greenfield for a lot of stuff? cos the web apis are new? just so i adjust my expectations. probably did not pick an easy first project.


Methinks that ClojureScript requires knowing only the minimal JavaScript necessary to be comfortable using JavaScript APIs. And of course, yes, as you say, the "rudimentary knowledge" of the runtime platform.


I would say ClojureScript isn't any different from Clojure for non-trivial projects - you're probably going to have to integrate some platform stuff - there won't be libraries for everything (and there probably should not be, wrapping trivial stuff is non-productive), if you're going to use it in anger for years on a project probably getting familiar with JVM tooling is a very good idea


All this stuff applies to ClojureScript - whatever JS target you're looking at - you need to know something about it, or be comfortable with learning something about it


yep, fair. I guess I was "blessed" that I already knew something about the JVM before touching Clojure, whereas I have completely avoided javascript my entire life. cljs just probably sets a faster on-ramp... it took me a year until i was wrangling with endianness, bytebuffers, network sockets (netty) and idiosyncrasies of the JVM (oh how I cursed... -- nowhere is it clear that arrays have a maximum size, and that overflows can happen, so i got negative sized arrays rarely, and underruns most of the time, which made it especially insidious to debug. coming from CL, where you can just go ahead and make a 20GB in-memory array without hassle). whereas this is my first real cljs project, and i am already looking to construct a http client for something that is just "for free" on the other runtime & with nice libraries. will end up knowing the entire ecosystem to get to the end goal, when all i really wanted was a nice end-user UI. at least it's interesting! (or else i wouldn't do it. this is a free-time side project after all.) -- so I am not complaining. just curious how deep I have to expect to go, so I don't underestimate. thanks for the input


This is so interesting to me since I was the opposite: had a lot of JS knowledge acquired in anger, but zero Java when I came to clj/cljs. Five years in, I'm finding both CLJ and CLJS a comfortable home base to keep coming back to as I inevitably end up having to figure out a lot more about the underpinnings when things break. If nothing else, I love them for paving over the host language syntaxes, leaving me free to pay closer attention to the actual semantic differences.

👍 1

Having trouble with goog.dom.classListadd and remove work fine, but addAll and removeAll do not. I have tried using [some-string other-string] and (js-obj [some-string other-string]) as arguments and neither have worked. Am I missing something? EDIT: Got it working with (clj->js [some-string other-string]) but I feel like this shouldn’t be necessary. What is the proper way to do this?


#js [...].

Ngoc Khuat16:01:51

I have jetty server and a front-end using clojurescript. Now I want to start my jetty server to server both the APIs and my clojure-script project. Could anybody guide me how to do it?


Your UI is likely to be just a single HTML file and a single JS file, maybe with some CSS files. In the simplest case, you just put all those files in a single directory without anything else and serve that directory via some static route in Jetty.

👍 1

I have a that does it At dev-time, it means when you are running in the REPL, you need add the dir where you output your cljs in your HTTP server The http serving files at target/classes/public: The cljs builder generating files at target/classes/public : The extra /atemoia path will be added to your script tag: main.js exists because it is the :main module of shadow-cljs: For "prod", it means when running in a jar, it will access directly from

Ngoc Khuat16:01:40

@U2J4FRT2T that looks great, lemme try it out

Ngoc Khuat16:01:11

I don’t see any html in there. does it get generated by shadow-cljs?