This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-05
Channels
- # announcements (2)
- # babashka (23)
- # beginners (67)
- # biff (4)
- # calva (19)
- # cider (6)
- # clj-kondo (40)
- # clj-yaml (14)
- # clojure (3)
- # clojure-austin (13)
- # clojure-europe (18)
- # clojure-nl (1)
- # clojure-norway (26)
- # clojure-uk (5)
- # clojurescript (42)
- # datascript (2)
- # datomic (6)
- # emacs (32)
- # graalvm (8)
- # humbleui (12)
- # hyperfiddle (13)
- # jobs (5)
- # lambdaisland (1)
- # lsp (18)
- # malli (15)
- # off-topic (20)
- # overtone (1)
- # pathom (5)
- # pedestal (15)
- # portal (3)
- # reitit (13)
- # releases (1)
- # remote-jobs (1)
- # yamlscript (4)
Not getting clarity while running WWRD (What would Rich do?) regarding the use of Google Closure Library in new CLJS projects. Is it prudent, given that it's transitioned into maintenance mode? If not, are there recommended alternatives? https://clojurians.slack.com/archives/C07UQ678E/p1698353101153739
If the functionality you need from the library works, it'll continue to work just fine. With that being said, a lot from that library is either not needed with modern browsers or a bit questionable (like the UI stuff).
Thanks! I'm interested in goog.net.Cookies
in particular, after seeing its use in https://github.com/reagent-project/reagent-utils/blob/master/src/reagent/cookies.cljs as part of https://github.com/reagent-project/reagent-utils.
Do you consider goog.net.Cookies
unnecessary or questionable in the context of modern browsers?
This one from npm will probably do the job: https://www.npmjs.com/package/js-cookie
i found some of the most particularly useful goog.*
to be around the stateful session-related stuff in the browser. they have really good activity tracking [of course they do, it's google] and expose very reliable interfaces for things like: "if the user hasnt been active in 5m, do a thing". because browsers bend over backwards to maintain existing compatibility, i think you'll be fine using it for a long while.
GCL is relatively stable, and most of its usage in your code is likely from third party CLJS libraries wrapping around it. If you fear the library having unfixed bugs or security bugs, then I recommend ditching those wrapper libraries and using the JS standard library, which likely has what you want.
e.g. goog.crypt.base64
is unnecessary nowadays and likely slower than simply using btoa
and atob
similarly, goog.crypt.stringToByteArray
and related functions can be replaced with TextEncoder
and TextDecoder
from the JS standard library
goog.net.XhrIo
isnt really needed unless you have a hard requirement of supporting XHR quirks in ancient browsers like Internet Explorer 8.
so on, so forth
Hello everybody. I'm fairly new to ClojureScript (not so much with Clojure), so please be patient. I'm currently playing with core.async and I've found a behaviour that is baffling me:
c.user> (require '[clojure.core.async :refer [<!! go]])
nil
c.user> (def c (go (/ 4 3)))
#'cljs.user/c
c.user> c
#object[cljs.core.async.impl.channels.ManyToManyChannel]
c.user> (<!! c)
Execution error (TypeError) at (<cljs repl>:1).
Cannot read properties of undefined (reading 'call')
:repl/exception!
This exact same code works in Clojure. Could anybody give a hint about what I'm doing wrong? Thanks in advance!JS is non-blocking, so <!!
cannot be implemented there.
Also, unless you really need to manage communicating processes, there's little reason to use core.async
with CLJS. There are more downsides than upsides.
Thanks a lot for your answer. I'm currently studying an example app which uses core.async. But then, how is one supposed to read a channel outside a go block? Can it be done?
so this is probably the wrong place to ask, but does anyone know of any prismatic/schema, spec, or malli-like lib that's implemented in native js? i've looked at options like zod, yup, joi, and typebox. im not overly impressed with any of them. i think ajv is probably the most data oriented, but it's coupled tightly to the jsonschema spec. i ask because i'm currently unable to sneak clj/cljs into the tech stack, but i still want to build a resilient system in the meantime. i'd love some advice if anyone knows of particularly useful tools in js-land.
I explored this a few years ago and at least back then json-schema + ajv was the closest.
I guess the trend is to lean on Typescript typings in js-land and thereâs not that much push for data driven schemas
there seems to be a whole lot of options, but ajv is the only thing i've found that uses data literals for some reason. every other tool is really invested in().the().builder().pattern() which seems really hard to compose and build other tooling around
Some convincing might be needed to make others write schemas instead of TS types. đ You can generate TS type declarations from json-schema though
One point for data driven schemas is that if you have a highly dynamic system and it would be good to be able to construct or modify schemas dynamically. With types you end up with a generics-nightmare if you try to achieve that.
i agree. we're in the fortunate(?) position of not relying on TS right now. i'm trying to slowly introduce the team to some opt-in data-driven specifications. from the little bit of exploration i've done, i think i might be forced to use ajv just to maintain the data-first properties we're talking about
Of course the dev-experience is subpar to what youâre used to with schema/malli + the REPL
it's so strange how seemingly noone else thought a data literal based spec tool was worth it. they jumped right into stateful javascript functions/prototype/class constructs. and yea, i'm already feeling the pain of no more repl. it's kind of like one hand tied behind my back đ
I tried mimicking repl-driven development with node-js repl but it was not great. Fine for small experiments though⌠as long as you remember to erase all const
definitions before sending to repl đ
Depends what youâre building but if itâs anything âhigh-levelâ I recommend json-schema over protobuf
CORS question time! đ I was practicing CLJS by way of putting together a custom "new page page." Hoping I could just drop it as static files and use file://
for access. That seems to work for referencing the css and js files, but my script I try to fetch a list of URLs and icons so the page can be a bit configurable. But I ran into CORS request not HTTP
.
Is there some more clever way to achieve this without putting the files on an http sever? Something I'm not thinking of?
browsers restrict direct file access for security reasons, so no it requires http for good reasons
Sure. But is there some way to make the url/icon config available in some other way? Include a link the the HTML?
It's a list of URLs and icons to show in the page for quick links. Right now it's an edn
file. I left it in a separate file so it would be easy to update the list as needed.