Fork me on GitHub
#clojurescript
<
2018-05-23
>
martinklepsch07:05:22

I’ve been trying to reproduce an issue I had with deercreeklabs/capsule using the cljs repl:

{:deps {org.clojure/clojurescript {:mvn/version "1.10.238"}
        deercreeklabs/capsule {:mvn/version "0.3.9"}}}
$ clj --main cljs.main --repl
> (require 'deercreeklabs.capsule)
=> No such namespace: pako, could not locate pako.cljs, pako.cljc
That issue is different from the one I tried to reproduce: https://circleci.com/gh/martinklepsch/cljdoc-builder/166 Anyone an idea how to get around that? Am I doing something wrong?

thheller08:05:05

not sure how you are supposed to get them installed with cljs.main

richiardiandrea16:05:57

One alternative is not to use cljs at all for installing so :install-deps false. You still need to specify them in the :npm-deps map though, unless you are in lumo and you only target is node. Lumo uses node directly so no need for listing them.

mfikes10:05:04

To install NPM deps with cljs.main you can

clj -m cljs.main -co '{:npm-deps {:pako "1.0.6" :websocket "1.0.25"} :install-deps true}' -r

athomasoriginal14:05:00

No problem. If you're curious about cljs interop and would like some examples you can check out this repo - https://github.com/tkjone/clojurescript-30 - should be a bunch of real use case examples that you might find useful

athomasoriginal14:05:32

Very nice. Thank you!

theeternalpulse17:05:16

using the audio object I am trying to allow repeated calls of my play function to stop and replay the audio clip. The doto form does not work, but the line-by line manipulation of the same audio object. Is this some gotcha I missed

;; Doesn't work
  (doto clip
    (.pause)
    #(set! (.-currentTime %) 0.0)
    (.play)
    (add-playing!))
;;Works
  (.pause clip)
  (set! (.-currentTime clip) 0.0)
  (.play clip)
  (add-playing! clip)

dnolen17:05:54

@theeternalpulse think about doto + ->

theeternalpulse19:05:27

Ah I thought it was like the thread first but since many is objects didn't have functions that return the object it was simply passing in the top form to each body form. This makes sense.

leontalbot19:05:20

Hello guys, quick question: If you were asked to make .cljc web components packaged as a library for both reagent and server-side hiccup. What would be your strategy, especially for handling styling/css?

kurt-o-sys20:05:22

I'm not sure if I got it right, but is ^:dynamic actually doing something in cljs? I mean, I'm trying this in klipse:

(def *dyn* [2 0 1 8])

(defn add-1 []
  (map (partial + 1) *dyn*))
(println (add-1))

(binding [*dyn* [4 2]]
  (println (add-1)))

(println (add-1))

kurt-o-sys20:05:51

and the result is the same with or without ^:dynamic in defing *dyn*

kurt-o-sys20:05:19

(or I just misunderstand binding/^:dynamic)

kurt-o-sys20:05:07

(the generated code in js seems to be the same as well)

kurt-o-sys20:05:10

oh, I see it now, there's a warning, but it compiles fine.

dnolen20:05:54

@kurt-o-sys it does do something, it signals the compiler that the var should never be directly invoked as it could be rebound at runtime and perhaps something will be different then.

kurt-o-sys20:05:43

right... the warning, right? Get it, but it's intended that it compiles fine?

dnolen20:05:15

well as long as you understand how it could go wrong

dnolen20:05:40

but yes, it won’t fail compilation

kurt-o-sys20:05:51

ok... just to know (and to be sure I get it right). OK, thx a lot!