Fork me on GitHub
#clojurescript
<
2017-11-28
>
souenzzo01:11:20

There is some how to get the function from spec registry in cljs? On clj I can resolve from symbo.

max03:11:49

Web Development With Clojure, by by Dmitri Sotnikov: Still a good choice to get started?

qqq04:11:53

is https://github.com/jiangts/webrtcljs (last commit 2015) the gest for cljs / web rtc? I'm mainly looking for a library to take camera capture and stream it to a div/canvas on the webpage

Jakub Holý (HolyJak)08:11:32

Hello folks! Could you be so kind and correct my perception of server-side rendering in cljs&React? From what I have read: - Om has a hack to do this, foam, but it hasnt developed beyond hack since 2016 - Reagent - run it on Node or use JVM's JS engine - Rum - supports it natively So Rum seems the best (easiest) choice if server-side rendering is important. Or? Thanks!

Roman Liutikov08:11:16

afaik Om.next supports SSR out of the box

gklijs09:11:45

here’s a demo, https://github.com/anmonteiro/om-next-fullstack next pet project I do I gonna use Om.next

gklijs08:11:24

@holyjak It depends on your project, for me server-side rendering was a reason to stay with closure and use hiccup to generate html, this way I can use the same functions to generate html client and server-side, but it has some disadvantages like not having a nice way to handle state. But since it’s more a static site with a minimal cms instead of an spa it worked out ok.

Jakub Holý (HolyJak)09:11:58

Thanks! My app is quite "rich" so React wrapper + good SSR story is necessary.

iGEL09:11:47

@p-himik & @mfikes Thank you for the replies. 👍 For now the lib doesn't do currency conversion, it will instead error out if you try to calculate with different currencies (unless the amount is zero). 🙂

mfikes13:11:26

That sounds fine. As an analog, if you define + for matrices, it will have to fail if the lhs and rhs are of different dimensions.

dominicm10:11:29

I'm trying to use npm-deps with react-three-renderer npm package, and I've run into Undefined nameToPath for react_three_renderer. Any pointers?

Roman Liutikov10:11:22

I’m getting this as well with npm-deps on subsequent cold runs. lein clean helps usually. I believe it’s compiler’s issue (was reported here multiple times already)

dominicm11:11:29

I restarted and got a compile error this time, thanks!

dominicm10:11:48

Might be to do with externs, but I didn't think you needed those for npm-deps.

dottedmag16:11:55

Is there a tool to calculate code coverage for clojurescript?

juhoteperi16:11:03

@dottedmag I think not, but Doo has open PR about this (https://github.com/bensu/doo/pull/125)

sundbp16:11:42

Hi. I’m using core.async in cljs and it’s early days. I’m wondering how/if I can wait for a go block to finish and get its return value, or what a reasonable pattern for solving a similar issue is?

sundbp16:11:09

(defn list-containers
  "TODO: write"
  ([] (list-containers {}))
  ([opts]
   (pprint @instances)
   (go
     (->> @instances
          (map (fn [[node-name instance]]
                 [node-name (<<< list-node-containers instance opts)]))
          (map (fn [[node-name c]]
                 [node-name (<! c)]))
          (into {})))))

sundbp16:11:42

i would like some other fn to be able to work on the resulting map coming out of this block - what’s best way to do so?

dpsutton17:11:39

go blocks immediately return a channel. shouldn't you just take from that channel?

dpsutton17:11:20

also, your types across arities don't look good. the zero arity calls the single arity with an empty map which you dereference

sundbp17:11:58

i don’t deref the map. @instances is a mount defstate var in the NS.

dpsutton17:11:12

ah yes i misread

sundbp17:11:03

(defn zombie-instances
  []
  (println "let's go hunt for zombies!")
  (async/go
    (let [containers (async/<! (docker/list-containers))]
      (pprint (count containers))
      (pprint (first containers)))))

sundbp17:11:26

if i call that fn like this, then I get:

sundbp17:11:32

Error: <! used not in (go ...) block
    at Object.cljs$core$async$_LT__BANG_ [as _LT__BANG_] (/Users/sundbp/dev/bi/permafrost/target/shadow-cljs/builds/pf/dev/out/cljs-runtime/cljs.core.async.js:253:8)
    at /Users/sundbp/dev/bi/permafrost/target/shadow-cljs/builds/pf/dev/out/cljs-runtime/permafrost/docker.cljs:32:4

sundbp17:11:17

which seems inherently incorrect, as line 32 there is the go line in list-containers..

sundbp17:11:03

hm. ok. got it worked by re-arranging and not nesting go-blocks

sundbp17:11:11

are nested go-blocks a no-no?

sundbp17:11:19

ah, it’s the “stop translating at fn boundaries” and my use of map there. starting to get it.

bronsa17:11:31

avoid nested go blocks anyway

bronsa17:11:33

esp in cljs

bronsa17:11:47

go's cljs impl has some bugs around that

sundbp17:11:52

so if i have a structure {:foo1 chan1, :foo2 chan2}, and I like to take a value from each and concat them, my inclination would be to (mapcat (fn [[_ c] (<! c)) the-map-of-chans), but I can’t do that. any tips for how I can combine the results in that fashion by other constructs?

sundbp17:11:30

i guess the general question is how do I get a value from N channels, and and produce 1 value that is a fn of the N values.

sundbp17:11:08

doseq+atom+swap! I can think of, but seems uggly

sundbp17:11:01

ah. async/merge + async/reduce

thheller17:11:46

also check alt! and alts!!

val_waeselynck17:11:00

And beware of lazy sequences

sundbp18:11:03

yeah. starting to get the hang of it. quite different way to think in cljs+core.async world compared to clj+manifold.streams that I usually wrangle.

sundbp01:11:24

yeah, the single-threadedness and nothing blocking is the main mind adjustment. I’m aware of vadim’s port - it’s cool!

tbaldridge16:11:33

Also take a look at async/map, it's useful when you want to join the results of channels together

tbaldridge16:11:17

(async/map vector [ch1 ch2 ch3]) takes items from each channel and puts them into a vector

sova-soars-the-sora21:11:32

🙏:skin-tone-6: Halp

sova-soars-the-sora21:11:01

Between updating project.clj version numbers with lein ancient and trying to connect to a database instance... chaos erupted lol

sova-soars-the-sora21:11:21

Aha, it was encore (part of taoensso/sente). All better now.

sova-soars-the-sora21:11:08

spoke waaay too soon, looks lke it's datomic & guava dependency

hmaurer23:11:43

Hello! What is the state-of-the-art router to use in Clojurescript with something like Om or Reagent?

hmaurer23:11:46

A maintained project