Fork me on GitHub
#clojurescript
<
2020-09-18
>
Chris K01:09:32

I'm trying to use compojure, and clojurescript for building websites (also planning to use hiccup), but I don't know how I can use them alltogether. I know that for hiccup, I can do (include-js "file") stuff, but not sure how it will work out for clojurescript. Anyone know any good resources for linking these softwares? thanks

hoppy03:09:47

hi, working on a nodejs cljs project, that uses npm serialport. If I build this as a standalone .js with shadow-cljs, then the serial port reacts to incoming data as expected. In the repl, however, I can see data come in (via some led's) but I never get notifications of this. I'm guessing it's some odd event-loop stuff, but this is above my node pay grade. Is there something that can be done in code run in the repl to let this stuff flow?

alpox07:09:01

@hoppy are you expecting log entries in the repl? I remember shadow-cljs had some trouble showing nodejs logs in the repl a while ago

hoppy10:09:56

@alpox, guess I was expecting to see a println inside an '.on("data"')' Hadn't considered that that might not actually work - hmm

hoppy10:09:21

@alpox - you nailed it. the code is running, just not printing (in this particular case). atoms are my friend - Thank you!

hairfire14:09:49

Anyone know how to do this: document.getElementById("main-div").clientWidth in cljs?

Duck Nebuchadnezzar14:09:06

(.-clientWidth (.getElementById js/document "main-div"))
should do the trick

dpsutton14:09:15

alternatively, (.. js/document (getElementById "app") -clientWidth)

👍 9
kingcode16:09:28

My preference:

(-> js/document (.getElem..) (.-clientWidth))

hairfire15:09:49

Just got back to this. Thanks!

p-himik19:09:27

It's better to just answer your own question than to remove it some time after you posted it. :)