clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
2021-04-06T13:23:28.481600Z

Hi. What does the :default mean?

p-himik 2021-04-06T13:29:16.481700Z

It means a keyword name "default". If you want to learn about why that keyword is there, you need to tell us what exactly that "there" is.

p-himik 2021-04-06T13:29:22.481900Z

I.e. we need context.

p-himik 2021-04-06T13:30:10.482100Z

If it's in the ns form and the project uses shadow-cljs, then it's explained in this section: https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages

bartuka 2021-04-06T13:51:29.483400Z

interesting, do I need to define something to make goog.isDefAndNotNull to work? Currently receiving this error from bide

Execution error (TypeError) at (<cljs repl>:1).
goog.isDefAndNotNull is not a function
and if I try to require this function it is not present

bartuka 2021-04-06T13:51:58.483600Z

I am using shadow-cljs

2021-04-06T13:53:16.483700Z

Thanks. That’s the answer.

p-himik 2021-04-06T14:00:47.484Z

What's "bide"?

p-himik 2021-04-06T14:01:00.484200Z

And what's the full stack trace?

bartuka 2021-04-06T14:31:35.484400Z

sorry, bide is a routing library https://github.com/funcool/bide and internally it is using goog.isDefAndNotNull call

bartuka 2021-04-06T14:32:32.484700Z

this error is the whole

TypeError: goog.isDefAndNotNull is not a function
    at Object.insert (router.js:61)
    at eval (core.cljs:117)
    at eval (core.cljs:5655)
    at eval (core.cljs:5655)
    at Object.eval [as cljs$core$IReduce$_reduce$arity$3] (core.cljs:5659)
    at Function.eval [as cljs$core$IFn$_invoke$arity$3] (core.cljs:2554)
    at Object.bide$core$router [as router] (core.cljs:116)
    at eval (router.cljs:6)
    at eval (<anonymous>)
    at Object.goog.globalEval (main.js:497)

p-himik 2021-04-06T14:37:07.484900Z

Oh wow! We have bidi and bide, and both are routing libraries - not confusing at all. :D But no clue for why you'd see that behavior. If you don't get an answer here, might be worth asking in #shadow-cljs

1πŸ‘
bartuka 2021-04-06T14:39:34.485100Z

yeah! thank you!

Jakob Durstberger 2021-04-06T15:10:55.486300Z

Does anyone know how I can do something like this with hiccup? <section data-auto-animate> [:section ???]

thheller 2021-04-06T15:13:07.486600Z

[:section {:data-auto-animate true}]

1πŸ‘
Jakob Durstberger 2021-04-06T15:16:19.486900Z

Thank you πŸ™‚

bastilla 2021-04-06T15:20:10.490200Z

Regarding nodejs (respectively, electron), does anyone know how to access global vars? I tried js/... but failed. I'd like to get hold of electron's app (or win object, etc.)

const {app} = require('electron');
app.getPath('home');
but so far, no success. Javascript ppl get this in a heartbeat, so it should be easy with Clojurescript as well, shouldn't it?

bastilla 2021-04-06T15:46:09.490500Z

Ok, I just figured out

(defonce home-folder (.-env.HOME (js/require "process")))
gets me the data.

Franco Gasperino 2021-04-06T21:00:24.492600Z

Hello - what is the recommended library for http client calls from clojurescript?

Franco Gasperino 2021-04-06T22:30:54.493900Z

Thanks

Franco Gasperino 2021-04-06T22:33:49.494100Z

the advantage over using JS interop instead of something akin to cljs-http?

athomasoriginal 2021-04-06T22:37:32.497Z

Native api, no deps, aligning with current "best practices", possibly less code because your using only what you need.

2
Franco Gasperino 2021-04-06T23:52:32.498500Z

alright