Fork me on GitHub
#clojurescript
<
2024-04-25
>
Ray Stubbs03:04:35

Just setup testing infra for Zero (yeah, a little late)... and wow, it was surprisingly easy to get a workable setup with the https://modern-web.dev/guides/test-runner/getting-started/. I'd recommend anyone to consider it as an alternative to Karma (which has been deprecated). Link to the PR in case anyone's interested in a similar setup. https://github.com/raystubbs/zero/pull/26

👍 1
clojure 2
1
thheller06:04:38

you do not need to set :compiler-options {:optimizations :none :source-map true} in the build config

thheller06:04:04

that is what automatically happens for compile builds

👍 1
Sayed Hajaj16:04:06

I'm considering migrating my side project from Elm to Clojurescript. I have some uncertainties about the approach and performance considerations. It's a Rubik's cube timer that connects to a Bluetooth smart cube, records solves, replays them, and analyses them. Breaking down how long each stage took. And giving stats on a collection of solves and their stages. I'm looking for a good vdom library, and possibly a global state management system, but I also want to use Webgl for rendering the cube state, and I'm worried about having to recreate the Webgl context many times. What approach would you use for this? Is something like Reframe up to the task?

p-himik16:04:23

It seems like a very light-weight app, so CLJS will most definitely not be a bottleneck. And even if you happen to find an issue where CLJS makes things too slow (you won't), you can always write that particular thing in plain JS. Going the re-frame route will probably be the easiest given its docs and an active community. Reusing an existing WebGL context is not an issue at all.

Sayed Hajaj17:04:37

How would reusing a WebGL context be done? Through lifecycle methods? Reframe seems like it's more focused on global state whereas this seems more local

p-himik17:04:44

You can mix the two just fine. Re-frame deals with your app's state. WebGL is just a rendering context that you can make react to the app's state via lifecycle methods and/or via hooks. Reagent has some demos in its repo that deal with components with local state.

Sayed Hajaj17:04:35

Oh, thank you!

vraid17:04:25

If you need some inspiration, here's a re-frame + webgl project i made earlier this year https://vraid.github.io/rubik/ Code can be found here https://github.com/vraid/rubik

Sayed Hajaj21:04:15

Thanks, it's trippy but the code clears things up

vraid23:04:09

The trippiness is the point 😄

floscr17:04:19

I'm trying to access a timezones table from the "@js-jsoda/core" package. I cant seem to get the correct import. In dev I could do (.getAvailableZoneIds (.-ZoneId js/module$node_modules$$js_joda$core$dist$js_joda)) But this doesn't work in a release build of course I can't seem to get the methods either via ["@js-joda/core" :as joda]

1
thheller17:04:42

(.getAvailableZoneIds (.-ZoneId joda))?

thheller17:04:03

(.getAvailableZoneIds joda/ZoneId)

p-himik17:04:16

If that above doesn't work when you use ["@js-joda/core" :as joda], what does (js/console.log joda) output?

thheller17:04:32

never ever try to access anything via js/module$... thats just completely wrong

👍 1
floscr17:04:15

Yes that works 👍