This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-23
Channels
- # announcements (3)
- # asami (5)
- # babashka (1)
- # beginners (38)
- # biff (4)
- # calva (12)
- # cider (2)
- # clj-commons (6)
- # clj-kondo (46)
- # clj-on-windows (1)
- # clojure (50)
- # clojure-europe (41)
- # clojure-nl (3)
- # clojure-norway (2)
- # clojure-uk (16)
- # clojured (3)
- # clojurescript (49)
- # conjure (1)
- # cursive (29)
- # datahike (6)
- # datascript (4)
- # emacs (70)
- # funcool (1)
- # google-cloud (12)
- # graalvm (10)
- # graalvm-mobile (7)
- # gratitude (4)
- # hyperfiddle (1)
- # joyride (26)
- # lsp (16)
- # malli (23)
- # nbb (5)
- # off-topic (23)
- # polylith (32)
- # re-frame (23)
- # releases (3)
- # remote-jobs (1)
- # reveal (3)
- # tools-build (16)
- # xtdb (50)
When is it ok to write dotted expressions eg. js/document.alert
and when should I use (.alert js/document)
? I have a vague feeling there are situations with callbacks and this
where it matters, but possibly not otherwise. Is anyone aware of docs on this?
I personally use the js/document.alert
variant only when accessing globals. ie. only with js/*
or other namespace aliases (eg. (:require ["something" :as x]) (x/whatever.foo)
). anything involving locals (eg. this
) I only use (.whatever this)
variant, so "proper" interop that would work in clojure too.
thanks @U05224H0W!
still struggling with open layers in clojurescript, tried just about every style of import from the shadow docs but still get XYZ is not a constructor starting to wonder if the node module is even correctly included in my build is there a way to check that its correctly included in the generated javascript ?
see the answer here https://stackoverflow.com/a/72196457/8009006
"is not a constructor" likely means that it is undefined
and you are just using the wrong thing
okay thank you I will give that a try a bit later spent a few hours trying all sort tried with shadow and figwheel ended up getting no where trying all sorts of combinations of the import statements last night,
note that there may be differences in shadow and figwheel in case you use figwheel with cljsjs
also note that it is not uncommon in JS to completely change how a library is used inbetween versions. so make sure the docs you are following match the version you actually use
if you want to setup a repo with a problem I'm happy to take a look at what might be wrong
that will likely be my next step to create an example in isolation if nothing else it maybe useful to others 🙂
Okay I cloned the shadow quick start added ol and tried to create an instance of XYZ which is enough to see the error I mentioned https://gitlab.com/olymk2/open-layers-example/-/blob/master/src/main/starter/browser.cljs
see the translation examples here https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages
cloning that repo gave you a rather outdated shadow-cljs version. you should bump that. otherwise $default
won't work there
okay yeah you did say that I tried them all before but as this was a new repo I just used the layout I have seen others use, I don't think I tried the $default one though at least not in that format perhaps I misunderstood that I shall give it a try and report back
okay that does appear to work, sorry for wasting your time not sure I get $default but perhaps I need to read up on what that does, I will try on my bigger project a bit later. Thanks for taking the time to guide me 🙂
it was introduced in CLJS a little while ago https://clojurescript.org/news/2021-04-06-release#_library_property_namespaces
@U05224H0W thanks again for the help got there in the end, got a reagent component with update working here https://gitlab.com/olymk2/open-layers-example/-/blob/master/src/main/starter/browser.cljs so very pleased with that 🙂
I am using AntSlider in my clojurescript UI and applying reframe dispatch function on-change but the slider loses focus on every change this is what I am doing in my UI. What I am doing wrong in that?
[:> Slider {:min 0
:max MAX_ENGLISH_LEVEL
:value @english-scale-atom
:on-change (fn [number]
(rf/dispatch [:apply-filter-english-proficiency number]))
:tip-formatter nil}]]]
I have added this still losing focus
(rf/dispatch-sync [:apply-filter-english-proficiency number])
(r/flush)
Maybe the parent component is fully re-rendered? In any case, you can use React DevTools to help you figure out what's re-rendered and why.
Is anybody working on a non-react solution for doing ClojureScript? I'm redoing my site in Svelte using SvelteKit's Static Site Generation simply because I don't want a JavaScript bundle when I'm not even doing any DOM manipulation. I miss hiccup as my template language, and being able to use ClojureScript for any logic. The closest thing I've seen is shadow arborist, but I haven't seen any work done on it recently.
I also greatly desire this too. I think something like Svelte except done entirely through macros is going to be the next big thing
what about using Clojure and something like https://github.com/magnars/stasis?
Haven't seen this! Thanks for sharing! @U0MKRS1FX
there are probably more than a handful of static site generators for Clojure, so maybe Clojure is a better fit than clojurescript when you don't wany any JS to be involved 🙂
I believe https://jamstack.org/ is the fancy term for this sort of static site setup
The ones on the list here are super old, but I didn't look very far to find Clojure SSGs. https://jamstack.org/generators/
yeah maybe there's no thriving community here, I'm not sure. Statis has been serving my needs for the last ~decade or so 🙂
shadow-grove is working pretty well, just need to make a proper release and write documentation. https://github.com/thheller/shadow-experiments
How did you come up with the names, "arborist" and "grove"? Is it because of the DOM tree? :)
@U05224H0W are there any recent examples of what arborist components look like? Specifically wanted to look at how updating state/reactivity within components looks like
the shadow-cljs UI uses it https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/ui
there are also various docs in the main repo https://github.com/thheller/shadow-experiments/tree/master/doc
there is also the usual todomvc https://github.com/thheller/shadow-experiments/blob/master/src/dev/todomvc/split/single.cljs