Fork me on GitHub
#clojurescript
<
2016-06-03
>
mathpunk00:06:41

@pat: where result is bound to…? I thought you might have meant, as a callback inside cljs.eval(… but that’s not it

fasiha02:06:52

Ought I use Clojure 1.9.x with ClojureScript "1.9.14"? I remember reading somewhere that the cljs major.minor versions ought to match Clojure's?

fasiha02:06:05

Answer: yes 🙂 1.9.0-alpha3

shriphani07:06:38

hi. has anyone shipped an npm module in cljs here? I have some cljs code I would like to use from other javascript libs (browser or node). My concern is primarily the cljs overhead.

alqvist08:06:45

I have trouble understanding how I would use Secretary to hook routing to a SPA. Does anyone have a good example?

alqvist08:06:37

Part of my problem is with Sente and not sending on closed channels

alqvist08:06:04

Hmm... just figured out a workaround. But feel free to impart your wisdom still

liuzhen09:06:55

hi, how to get current locale?

liuzhen09:06:52

(.-language js/window.navigator) works

delaguardo09:06:02

(or (first (.-languages js/window.navigator) (.-language js/window.navigator))

delaguardo09:06:15

in favore IE, Safari etc

liuzhen09:06:22

delaguardo: cool, thanks

nipperstick12:06:05

I'm struggling with aws lambda using cljs (trying to learn the ins and outs, so avoiding the popular frameworks atm). Lambdas are passed a callback function in javascript that I just can't seem to execute. When I print it, it's clearly a function, but when I call it, it's undefined. What would you test to drill in?

dnolen13:06:49

@fasiha: you don’t have to use Clojure 1.9, however if you don’t you won't get macro checking support (via clojure.spec)

kenny18:06:47

Is there a reason requires like this don't compile?

(ns foo.bar.abc
  (:require [foo.bar
             [myns :as m]]))

javazquez19:06:16

does clojurescript support destructuring JSON Objects?

kenny19:06:00

@javazquez: Use js->clj, then you can destructure it.

richiardiandrea19:06:11

Just include the first arg to require in a vector or remove the vector straight:

(ns foo.bar.abc
  (:require [foo.bar]
              [myns :as m]))

(ns foo.bar.abc
  (:require foo.bar
              [myns :as m]))

richiardiandrea19:06:41

lol cannot align 😄

kenny19:06:10

That's not how it works in Clojure though

javazquez19:06:36

@kenny: Thanks, that was the approach I was taking, was making sure I didn't miss an obvious choice 😳

anmonteiro19:06:02

@kennethkalmer: yes it is. every ns that you require must be inside its own vector

anmonteiro19:06:29

i.e. (:require [foo.bar] [other.ns]) instead of (:require [[foo.bar] [other.ns]])

kennethkalmer19:06:28

wrong Kenny 🙂

kenny19:06:32

@anmonteiro: Look at the example I linked in clojure docs. That works in Clojure. We are using it all over our code base but it does not work in cljs 😞

anmonteiro19:06:16

apologies, I didn’t look at the right example

kenny19:06:30

It's all good 🙂

dnolen19:06:02

faster REPL start times coming

dnolen19:06:46

for medium - larger projects seeing half the time reported by Figwheel to get the prompt

dnolen19:06:42

basically if you included transit-clj as a dependency in your project ClojureScript will write out analysis caches as .json instead of edn

dnolen19:06:55

reading analysis caches was eating into start time significantly

dnolen19:06:23

requires no configuration beyond just including transit-clj as a dep

plexus19:06:07

That'll be a neat party trick

mfikes19:06:11

Yes, Transit hauls. (An order-of-magnitude “hauls” for the very same use case of loading compiler analysis cache on mobile Replete. Transit effectively saved Replete from being an app that takes half a minute to launch.)

dnolen19:06:01

yeah I would have shipped this sooner but I didn’t have a good idea about doing this without requiring Transit as a hard dep or adding more configuration

dnolen19:06:03

boo to both

mfikes19:06:28

(This was probably due to using JavaScriptCore’s JSON.parse rather than edn parsing in ClojureScript.)

mfikes19:06:12

I suppose learning how to soft-depend on test.check made things easier.

richiardiandrea19:06:14

so the trick will be just to include transit-clj ?

mfikes19:06:13

We now have 3 such things. Transit, Clojure 1.9, and test.check which will magically bring goodness simply if there. 🙂

richiardiandrea20:06:56

can't wait for figwheel/improved error messages as well, testing the new repl against http://clojurescript.io

jballanc20:06:18

is cljs version still tracking clj version?

dnolen20:06:30

ClojureScript 1.9.36 released

dnolen20:06:58

@jballanc: yes, when final releases go out we bump

jballanc20:06:42

ok, just slightly confusing as clj v0.9 is still in alpha

fasiha20:06:03

Between bumping the cljs version & depending on clj-transit, at least my figwheel compile times went from 11.5 seconds to 2.2 seconds. I can live with this 😄 🙌

jballanc20:06:32

(s/v0.9/v1.9/)

dnolen20:06:26

@jballanc: hrm does it say that somewhere?

dnolen20:06:18

oh if you’re talking about 1.9.0-alpha4, we don’t depend on it right now anyway

dnolen20:06:26

but we will when it gets released

dnolen20:06:48

@fasiha: ok that’s interesting

jballanc20:06:12

@dnolen: yeah, I was just wondering if, for example, I'm using clj v1.8, should I also be using cljs v1.8.XX? is that line still maintained? or should I be on cljs v1.9.XX

dnolen20:06:56

@jballanc: you can just refer to the dependency information

dnolen20:06:59

it’s always been that way

dnolen21:06:12

right now ClojureScript declares a dependency on 1.8, but you can use 1.9 if you like and you’ll get more leverage out of clojure.spec

jballanc21:06:42

ok, so then cljs is just running a bit ahead of clj...I can dig that

dnolen21:06:13

well not really

dnolen21:06:22

people use the alphas all the time

dnolen21:06:54

the only difference is that people think the naming convention of Clojure matters somehow

dnolen21:06:59

it doesn't

pataprogramming21:06:32

So, re-frame question. I just converted some working reagent stuff over to re-frame, and events are handled, components are rendered, etc. I'm using boot's reload task. Before switching to re-frame, everything would smoothly update in the browser page after a save. After, it's no longer working. I have to manually reload the page in the browser to get it to pick up and changes to the CLJS at all. Any ideas for what I've most likely missed?

dnolen23:06:37

wrote up some of my own thoughts on clojure.spec http://swannodette.github.io/2016/06/03/tools-for-thought