Fork me on GitHub
#clojurescript
<
2020-05-02
>
Spaceman00:05:14

I have the following test:

Spaceman00:05:58

(deftest test-async
  (async done
         (go
 
           (let [_ (is (some? (<p! (js/Promise.resolve (see/landing!)))))
                 _ (is (nil? (<p! (js/Promise.resolve (interact/click-login-btn)))))
                 _ (is (nil? (<p! (js/Promise.resolve (interact/click-login-panel-close-btn)))))
                 ]
             (prn "done")
             (done)
             )
           )
         )
  )
and the problem is that I want to run these three statements in the let sequentially, but they aren't showing the behavior that they should if they were to run sequentially, suggesting that the promises aren't being resolved in the order in which the statements are given in the let. How do fix this and what an I doing wrong?

solf03:05:25

I can't find a comprehensive guide of the different ways of doing interop in clojurescript... What does js/foo. does? (with a point at the end), like here:

(js/CodeMirror. (reagent/dom-node comp)))

solf03:05:28

Ah, of course just after writing this I finally found it, in the clojure website (https://clojure.org/reference/java_interop#_alternative_macro_syntax)

Philipp Siegmantel06:05:07

I just upgraded the the latest ClojureScript version. Now it complains that a minified node dependency contains a duplicated binding. Does anybody know what to do about that?

mfikes13:05:31

@philipp.siegmantel If you can create a minimal repro, I'd suggest filing a JIRA https://clojurescript.org/community/reporting-issues

amalantony13:05:12

Sorry for the noob question, but how common is it in a Clojurescript project to use npm dependencies via package.json? For instance if I want to use moment.js do I import it via package.json or is there some Clojurescript dependency wrapper of it via project.clj?

dominicm14:05:08

@amalantony package.json is pretty common. Some popular libraries are packaged in for project.clj via https://cljsjs.github.io

👍 4
Alex14:05:41

Hey guys, imagine I have a seq representing a date, (2020-03-03) and I wanted to pass it to js/Date . My first try was to do (apply js/Date '(2020-03-03)) but that returned an error. So then I was wondering if there was a way to apply a set of args into a constructor?

jjttjj14:05:34

'(2020-03-03) isn't a valid clojure form so you're not going to be able to work with that representation. if you remove the dashes you could do something like this

(apply (fn [y m d] (new js/Date y m d)) '(2020 03 03))

Alex15:05:38

Yeah I meant, '(2020 03 03) 😄

Alex15:05:33

thank you

Guillermo Ithier21:05:48

Hello guys, has anyone here completed some of the exercises found in ClojureScript etude from J. David Eisenberg? If you have can you explain how you got to parse xml using (def xml (js/require "node-xml-lite"))? This is referring to Étude 4-1: Condiments

Spaceman23:05:36

I'm getting this error in my stack trace, but I can't determine its origin:

Spaceman23:05:51

Uncaught Error: conj on a map takes map entries or seqables of map entries at Object.eval [as cljs$core$ICollection$_conj$arity$2] (core.cljs:6850) at Object.cljs$core$_conj [as _conj] (core.cljs:583) at Function.eval [as cljs$core$IFn$_invoke$arity$2] (core.cljs:1779) at eval (core.cljs:9091) at eval (core.cljs:1503) at Function.eval [as cljs$core$IFn$_invoke$arity$4] (core.cljs:1503) at Object.eval [as cljs$core$IReduce$_reduce$arity$2] (core.cljs:1637) at Function.eval [as cljs$core$IFn$_invoke$arity$2] (core.cljs:2510) at Function.eval [as cljs$core$IFn$_invoke$arity$variadic] (core.cljs:9091) at eval (client.cljs:240)