Fork me on GitHub
William Steinberg03:06:30

Am looking for a guide to help me get started with ClojureScript and rapidly be productive. Will pay for the service. Need only a couple of hours of help. Anyone interested? <mailto:[email protected]|[email protected]> Need to see an example where JavaScript code calls a ClojureScript function, and a ClojureScript function calls a JavaScript library/file.

Eccentric J08:06:07

Do you write specs for your reagent view functions?

David Pham09:06:29

I think my most frequent bug is when JS interop becomes nil. I would use spec to check if the first element is not nil and if it is the interop :> check that the second element is not nil. Does it make sense? I am struggling to test views as well, I like the kamera solution but never had time to dig in into it.


Hello guys! Has somebody updated to Big Sur? I have a problem with shadow-cljs after update:

shadow-cljs - running: lein run -m shadow.cljs.cli --npm watch app
Syntax error (UnsatisfiedLinkError) compiling at (/private/var/folders/0x/d5945v_9115481gx0v74y87r0000gn/T/form-init6521250380523574093.clj:1:125).
Unable to load library 'Carbon': dlopen(libCarbon.dylib, 9): image not found


Hey @thheller! I’ve dived a little deeper here and found an interesting thing. It seems that in new macOS the Carbon.framework is broken (or most likely deleted). Its been deprecated for a while and now /System/Library/Frameworks/Carbon.framework is only 18 megabytes instead of 138mb which it was before. So, all the libraries using it are broken on Big Sur. Including shadow-cljs, figwheel-main and everything that depends on


ah doh. I'll remove that then I guess.


you can try setting :fs-watch {:hawk false} in shadow-cljs.edn. maybe it loads then? hawk should only be loaded conditionally anyways and is only used on macos

👍 1

Oh, you’ve saved my day! Thank you very much, it worked 🙂


@tim269 probably a java error. try reinstalling java?


@thheller I’ll try that, thanks

William Steinberg13:06:10

How to configure project.clj to include /path/to/undo-manager.js, and then how to access creating an instance of UndoManager and then calling hasUndo() method from ClojureScript.


otherwise working with JS files in CLJS is a bit clunky


still working on my sente client, the two sides can connect, and the server receives messages from the client if sent any, but when i try to send messages to the client, messages don’t show up unless messages have been sent before my router is started. any messages sent after my router starts never print. any ideas?

(defn event-msg-handler
  "Wraps `-event-msg-handler` with logging, error catching, etc."
  [{:as ev-msg :keys [id ?data event]}]
  (prn "here")
  (prn ev-msg))

(defonce router_ (atom nil))
(defn stop-router! [] (when-let [stop-fn @router_] (stop-fn)))
(defn start-router! []
  (reset! router_
           ch-chsk event-msg-handler)))


ultimately it seems like my async channel is not getting flushed somewhere or the channel is shutting down, i can’t tell. when i send my message server side via (chsk-send! "abc" [:notification/device-registered "abc"] {:flush? true}) and I’m not hooked up to the channel yet client-side, once i do spin up the sente router, it spits it and any other messages queued up out, but any additional messages are lost


is the router a server side thing or a client side thing?


I have one both sides but the client is the one that doesn't receive the event


the server router does


how are you seeing the messages before your router is started?


I'm running the above send from the server repl


> it spits it and any other messages queued up out, but any additional messages are lost what is "it"? are you seeing any messages on the client, or just sometimes?


sorry, my repl


how is the repl printing the messages?


that’s the top half of the block in the op


i don't see any issues


what's the client environment like?


is it on android within a browser?


or within an android app running javascript?


if possible, I would try running the javascript on your local computer in Chrome or Firefox since they have pretty good inspectors


that can give you more information about what's happening with the websocket connection itself


what’s the quickest way to spin up a browser-based repl?


it is android via rn


I haven't used a cljs repl in a while, so I'm not sure


prn will print to the browser console though


and both chrome and firefox has inspectors that show websocket connections which includes their state and the messages that have been sent/received


prn is printing to my repl though


from the browser? then it seems like you're all set


no, that’s what i mean by “it spitting out”, it works and prints to my repl, but only when i build up a queue then connect from the client


if i connect from the client, then send a message from the server, the message never shows up client side


tried it again in a browser-based repl and got the same results


i only see messages when i start the router


what do you see in the inspector?


are the messages arriving? does the connection get closed?


looks like it could be as simple as I don't know my way around aaync well enough yet. it seems like the call to send is usually inside a go block but I tried my own attempt by literally just running the same send command inside a go from the server repl but it still didn't come through


it doesn't appear the messages are arriving


if you could help me write what a call using a go block from the repl would look like, I'm stumped!


code inside a go block will just get executed in a green thread


i'm not sure if send has a return value, but you should be able to run it outside of a go block without issue


you can see more clearly the behavior of what’s happening here in the browser. the server starts talking immediately doing a handshake, and a few pings, but when i start the client router, nothing else is received from the server. it’s the same story for as long as the client’s router is up.


figured it out….it was the version of async…the sente version is seemingly incompatible with newer versions of async


that's a pretty tough bug. glad you figured out a solution!


thanks for the support @U7RJTCH6J!


Hi all! I was wondering if someone has implemented a mime-type check? Before the user uploads something to my S3 server, I would like to check if the file is valid or not. I was thinking about porting to cljs but was wondering if there’s another way. Thanks for your time!