Fork me on GitHub
#clojurescript
<
2017-11-25
>
qqq00:11:22

I need a way to handle 'flick' events, these are events of the form: 1. user touches screen 2. user moves finger up/down/left/right 3. user removes finger from sreen so there is a "event down" + a movement event + a "event up"

zarkone04:11:18

Hi! I want to compile cljs to both nodejs and browser env. I've got it to work, but I also need to define env (nodejs or browser) in compile time. Is it possible to somehow define it? .cljc has reader conditionals: #?(:cljs ...). Could I define the similar conditional, something like #?(:cljs-node ...)? thanks!

thheller10:11:28

@zarkone in shadow-cljs you can define :reader-features #{:cljs-node} for per build but the feature was refected from core so beware. https://dev.clojure.org/jira/browse/CLJS-2396

thheller10:11:16

another option might be using goog-define

p-himik15:11:08

Is my understanding that CLJS does not support typed JS arrays correct? If so, what would be the best way to implement a custom js->clj? Using postwalk?

gklijs15:11:24

@qqq I used hammertime, a js library, and bound it to a component to get this kind of events

mfikes16:11:37

@p-himik Assuming you had some suitable way to detect typed arrays, like an expansion of

(defn typed-array? [x]
  (or (instance? js/Int16Array x)
      (instance? js/Float32Array x)))
perhaps you could just first convert using js->clj and then postwalk that result, applying array-seq to the typed arrays. For example
(let [int16 (doto (js/Int16Array. 2) (aset 1 3))
      o     #js {:foo int16}]
  (clojure.walk/postwalk
    (fn [x] (cond-> x (typed-array? x) array-seq))
    (js->clj o :keywordize-keys true)))

mfikes16:11:21

If you want vectors in the result instead of sequences, perhaps compose vec with array-seq

p-himik16:11:17

Yup, exactly what I was thinking about, thanks.

mfikes16:11:10

Perhaps prim-seq is more appropriate than array-seq (former works on JavaScript Array-like, later works on JavaScript array)

athomasoriginal17:11:34

Any suggestions regarding popular libraries for CLJS tests?

noisesmith17:11:20

cljs.test works, and I hear doo is good for running them

noisesmith17:11:01

I set up my tests as a seperate build - using the same source files but the top level loads up the test namespaces and runs thetests

noisesmith17:11:40

so I build the test cljs, then load the test shell in the browser to run the tests

athomasoriginal17:11:14

Awesome! That seems straightforward. Any suggestions regarding coverage reports for CLJS?

noisesmith18:11:59

I don't know about coverage tools, but I also haven't looked

hmaurer20:11:39

Hi! I am getting a cryptic error (to me) when attempting to build my ClojureScript project for production (with advanced opts). Could someone please take a look? https://gist.github.com/hmaurer/1d30b39c8e28e646ebdfa524cbcdedb6

noisesmith20:11:36

@hmaurer iirc that was caused by updating cljs but not tools.reader

noisesmith20:11:07

or, more generally, if something is pulling in an outdated version of tools.reader, and it can be fixed by explicitly asking for the newer one

hmaurer20:11:08

@noisesmith yep, problem solved. I had updated Clojure to 1.9.0-RC1 but not clojurescript

hmaurer20:11:20

I updated clojurescript and I only get a warning for something else now

hmaurer20:11:22

thanks 🙂