This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-24
Channels
- # announcements (8)
- # aws (12)
- # babashka (84)
- # beginners (380)
- # calva (56)
- # clj-kondo (52)
- # cljdoc (4)
- # cljs-dev (327)
- # cljsrn (4)
- # clojure (154)
- # clojure-italy (5)
- # clojure-nl (3)
- # clojure-uk (21)
- # clojurescript (52)
- # conjure (133)
- # cursive (64)
- # datomic (33)
- # emacs (22)
- # fulcro (35)
- # graalvm (24)
- # graphql (1)
- # kaocha (1)
- # leiningen (1)
- # off-topic (24)
- # onyx (2)
- # pathom (10)
- # re-frame (3)
- # reagent (3)
- # reitit (3)
- # shadow-cljs (48)
- # spacemacs (12)
- # tools-deps (98)
- # xtdb (7)
If I have a javascript object that I need to call several JS methods on that mutate the object, is there a threading macro that accomplishes the job?
The other related one is essentially the threading macro ..
How do I make a seq out of (.entries (.-classList element))
, where element
is a DOM element with 1 or more CSS classes applied?I’ve tried with array-seq, but that doesn’t seem to be the right one.
if you still need a seq of tuples [idx class]
(-> element
.-classList
.entries
js/Array.from
(->> (map seq)))
correct
(seq (js/Set. #js [1 2 3]))
will work
Hi, I try to use a js-lib in a shadow-cljs project.
The doc says I've to use
(ns ...
(require ["name-of-lib" :as my-alias])
yes ...
@jerger_at_dda there's also a very active #shadow-cljs channel
(:require
["mastodon-api" :as Mastodon]
But repl says failed: Extra input spec: :clojure.core.specs.alpha/ns-form
is this shadow-cljs specific?
I use shadow-cljs node-repl
in combination with clava (there are two repl windows after connect)
that message means there was a top level form in ns
that clojure doesn't know about / understand
it wouldn't be :require, but some other key / input in ns
@thheller That's my current setup: https://github.com/DomainDrivenArchitecture/dda-masto-embed/blob/shadow-cljs/src/main/dda/masto_embed/app.cljs
looks fine but if I eval this in a CLJ REPL I get
Syntax error macroexpanding clojure.core/ns at (REPL:2:1).
((:require ["mastodon-api" :as Mastodon] [clojure.pprint :as pprint :refer [pprint]] [cljs.core.async :refer [go]] [cljs.core.async.interop :refer-macros [<p!]])) - failed: Extra input spec: :clojure.core.specs.alpha/ns-form
I know this error from clojure >1.9.0. Spec ist not allowing "mastodon-api"
okay, did try to narrow it down
@thheller Okay, found the issue. I did
sudo npm install -g shadow-cljs
npm install source-map-support --save-dev
npm install mastodon-api
Start repl results in
shadow-cljs - nREPL server started on port 35019
cljs.user=> SHADOW import error /home/jem/repo/dda/dda-masto-embed/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow.js.shim.module$ws.js
[stdin]:66
throw e;
^
Error: Cannot find module 'ws'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
Installing all modules in user-context solves the issue. Thanx for the hint 🙂new JS bundler support feature is huge! Can’t wait to experiment with this
Loved the bit echo "{}" > package.json
, no you don't have to wade through npm init lol
new massively simplified Webpack guide https://clojurescript.org/guides/webpack
@dnolen was going through the new guide, its nice but few pieces are missing. Where to include the resources files i.e index.html
which serves compiled js files, how to integrate hot code reloading via figwheel. Mentioning these in the guide would be very helpful imo
@v thanks for the feedback, but the guide is really not the place for that kind of stuff
we don't talk about other tooling in the guides, but far as I know the changes should be compatible w/ Figwheel I haven't tried myself
I did chat a bit with @bhauman and he seemed to look forward to the changes, they were made w/ minimal impact in mind
Anyone have a somewhat recent tutorial on cljs testing that doesn’t bother with frontend stuff? I want to verify my functions do what I expect, I don’t need to make sure it looks right
doesn't standard cljs.test do this out of the box, with the same api you'd expect from clojure.test?
I guess there's the details like "how to create and initialize the runner"
in the past I simply had a page that ran cljs.test/run-tests
after requiring all my test cljs namespaces
the dom would have pass/failure info, the console would have detailed test runner output
... I bet somebody has made a turnkey version of that by now