This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-12
Channels
- # announcements (1)
- # babashka (79)
- # beginners (165)
- # calva (29)
- # cider (20)
- # clara (3)
- # cljdoc (1)
- # cljs-dev (52)
- # clojure (42)
- # clojure-chicago (5)
- # clojure-europe (48)
- # clojure-germany (1)
- # clojure-italy (4)
- # clojure-nl (2)
- # clojure-spec (10)
- # clojure-uk (19)
- # clojurescript (50)
- # clojureverse-ops (5)
- # conjure (8)
- # datomic (16)
- # depstar (2)
- # events (1)
- # figwheel-main (23)
- # fulcro (26)
- # girouette (41)
- # graalvm (9)
- # heroku (3)
- # honeysql (10)
- # jackdaw (20)
- # lambdaisland (6)
- # lein-figwheel (1)
- # lsp (34)
- # malli (7)
- # meander (3)
- # music (1)
- # off-topic (14)
- # polylith (7)
- # re-frame (14)
- # reitit (8)
- # reveal (15)
- # ring (3)
- # schema (1)
- # sci (15)
- # shadow-cljs (42)
- # spacemacs (1)
- # startup-in-a-month (12)
- # tools-deps (59)
- # vim (1)
- # xtdb (27)
Hi there. I am pretty sure you pros can answer this. Regarding electron, this is about the project.clj :externs
mechanism. I successfully wrote and prod-build an electron app. Next step was: using nodejs functions (to access local files, etc.) All of a sudden, my app's prod build doesn't run any longer. Electron comes up, blanks, and Console tells me:
Uncaught TypeError: (intermediate value)(intermediate value)(intermediate value).Xd is not a function at xr (helper.cljs:24
And that particular line is using nodejs:
(let [fs (nodejs/require "fs")] (.writeFile fs location content "utf8" err-report)))
So I figured, the :optimizations :advanced
build disconnects code from library. If my assumption is correct, how can I include nodejs? (via externs) I'd also appreciate a link (couldn't find something helpful so far). Thanks!
(Sry for using this channel. #electron seems to be dead.)
aaaand as so often, right after posting a question, I stumple over a solution. Just adding
:dependencies [cljsjs/nodejs-externs "1.0.4-1"]
is one solution. Sorry! And thanks for just being there. This is an awesome community.
Hi š
Just starting out with transit. In cljs what is a correct way of handling uris? I.e. clj backend sends
as transit, be default itās read as "[TaggedValue: r,
tagged value, whatās the recommended way of getting str
out of that? just asking for .-rep
field? whatās a good way to config the reader to do it automatically?
Hello, I am searching for info how does browser routing work. Like Reagent router or Reitit frontend. I want to understand on how does it work with browser in low level...
I have personally never been a fan of most routing framework approaches; IMO they make things way too complicated for what they provide; If you want āroutingā, it doesnāt take much to set it up yourself based on, say, anchor hash value https://www.w3schools.com/jsref/prop_anchor_hash.asp ; now if you want to parse parameters, etc, etc you might want to consider a library
Modern browsers can help avoid using hash fragments and just use regular URL path for that. This is the API: https://developer.mozilla.org/en-US/docs/Web/API/History_API
For how browser routing works at a low level I highly recommend JS talks by any of the people who wrote the big JS routing libraries. They will explain the problem space context nicely. Then come back to cljs land with that knowledge and take a look at reitit and secretary to see how they handle the problem.
Note that you don't need secretary to use reitit. I highlight those as libraries which are solving similar problem in different ways
@U6GNVEWQG Could you please recommend some library like that? I am new in this...
I keep forgettingā¦ is something like this considered āsafeā under :advanced or should we explicitly add an extern for it?
#js {:opacity 0}
(I think itās safe but I thought I saw a discussion at some point about certain gotchas around interop, I could be mistaken)
If it's some name that doesn't have an extern, how to prevent it from being mangled, without having to write explicit externs? Is there a way to do it with ^js
?
Hmm so if itās a custom name, unlike :opacity, itās not considered safe?
So something like https://github.com/raspasov/alexandria-clj/blob/main/src/ss/react/core.cljs#L63 would not be safe? :_cljs
At the same time, Iāve been compiling this for a long time with :advanced and not run into problemsā¦ I guess it might be a problem if you try to access it like (.-_cljs my-js-obj) ?
Aha! And because I have thisā¦ https://github.com/raspasov/alexandria-clj/blob/main/src/ss/react/core.cljs#L95 Itās safeā¦
(defn props-class āGet props for class componentsā [^js/Object this] (.. this -props -_cljs))
Yeah, maybe something like
(defn ^:export -dummy [^js x]
(.-_cljs x))
would work. It can even be used to "externalize" multiple properties, in case you don't use them anywhere else in the CLJS code.From the doc, it seems to me re-frame-10x doesnāt work with along react native. Is that the case?
Is there any advantage of doing :refer [thing1 thing2]
over :refer (thing1 thing)
inside the ns
form, or does it not make a difference either way?
clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.844"}}}' \
-m cljs.main -re node
Similar:
clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "RELEASE"}}}' -M -m cljs.repl.node
clj -Sdeps '{:deps {thheller/shadow-cljs$aot {:mvn/version "RELEASE"}}}' -M -m shadow.cljs.devtools.cli node-repl
š