Fork me on GitHub
#clojurescript
<
2016-05-14
>
danielsz03:05:31

@pataprogramming: FYI, the Sente example has been added to the official System examples directory. I've also simplified it a bit. https://github.com/danielsz/system-websockets

Jon06:05:31

Is it possible to do type checking at compile time for apply f args? details of my problem http://clojure-china.org/t/type-checking-for-apply-f-args/368

tomayerst08:05:30

Is there a current favourite graphics approach for clojurescript? I am thinking of something to draw diagrams, not animate games.

odinodin08:05:34

@tomayerst I’ve used several javascript charting libraries through Clojurescript (highcharts, chartist and D3) so that is one way at least. It is somewhat cumbersome dealing with JavaScript interop, but it works

odinodin08:05:59

I would love to have a pure ClojureScript library for charting; the story for working with data in ClojureScript is so awesome so one should think it would be a great fit for a charting library as well

odinodin08:05:31

@tomayerst I wrote a short blog post on using highcharts with quiescent, maybe that can help: http://odinodin.no/2015-08-04-quiescent-chart/

madvas09:05:23

Guys, is there a way to clear chrome console after each figwheel hot reload?

anmonteiro09:05:32

@madvas running (js/console.clear) in the figwheel reload hook should work

madvas09:05:09

@anmonteiro: when I do (js/console.clear) from my app, it doesn’t work, it writes Console was cleared, but indeed it wasn't

madvas10:05:30

@anmonteiro: sorry (js/console.clear) works fine in regular web app, I was using in with React-native, it doesn’t work there

anmonteiro10:05:41

Ah not too familiar with react native

pataprogramming13:05:34

@danielsz: Thanks for the assistance. I now have things mostly working. My confusion was around system.components.endpoints and system.components.handler, which I'd missed when trying to figure out the wiring. The system-websockets example is extremely helpful, and will be a great addition to the docs.

pataprogramming13:05:10

Now just trying to trace down an NPE that keeps cropping up in my server-side event-msg-handler.

kauko13:05:18

Hmm, is [cljs-ajax] the de facto for doing http requests from cljs? I'm asking because it looks like it assumes you'll want to use callbacks, not channels

kauko13:05:11

Sente looks really good and I've used it before for websockets, but does it make sense if I just want ajax?

pataprogramming13:05:16

@kauko: I'm no expert, but from what I've seen in the examples, it looks like if you set {:type :ajax} when you make-channel-socket! (instead of the default :auto), you should be able to get all the nice semantics without introducing websockets into the equation.

kauko13:05:35

with sente or...?

pataprogramming13:05:40

Sorry, with sente.

pataprogramming13:05:23

I've been trying to sort out my sente setup in this app since yesterday, so it's my default context at the moment.

kauko13:05:10

I'm thinking whether I should try to come up with an example about core.async for the js devs I'll be talking to in a couple of weeks

kauko13:05:31

But eh, maybe I'll just mention it, or just show an example online

kauko13:05:12

I've quite a lot to go through already, and while core.async is pretty easy, it's not something you'll get much out of if you just look at it for 2 minutes

kauko13:05:14

For a really good example I'd need to implement something really complex using callbacks first, and then do the same with go channels..

pataprogramming13:05:28

In general for presentations I've done (though more for CLJ vs. Java) people seem to respond really well to an example that shows a well-known awful thing about their current language, and then a nice, clean alternative.

pataprogramming13:05:29

If somebody has ever touched Swing, for example, Seesaw is an amazing demo (particularly if you live-code it).

kauko13:05:39

Well yeah, but I'm focusing more on the workflow side of things already

kauko13:05:05

but I'll try to think of something

risto14:05:02

@kauko: You should check out [cljs-http]. It uses core.async style channels

pataprogramming15:05:36

Finally solved my NPE...I shouldn't have been setting :wrap-component? true for the sente component. My plumbing is now plumbed, and on to the next thing! Thanks very much for the assistance, @danielsz.

devth17:05:52

cljsbuild loads its cofig from project.clj. can I get that loaded config from one of cljsbuild's namespaces/functions?

darwin17:05:01

@devth: cljsbuild is a leiningen plugin, it gets the config from leiningen library, maybe you want to use leiningen to parse that config for you

devth17:05:49

runtime doesn't have access to lein, right? i was alternatively thinking of manually loading project.clj, but figured i'd see if i could pull it out of cljsbuild directly.

darwin17:05:00

right, runtime does not have access to it, even compile-time environment does not contain any lein/cljsbuild info

darwin17:05:33

depends what you want to do, you could read project.clj on your own, if you just want some simple bits from it, or you can use leiningen as a library to do full-featured parsing, unfortunately I don’t think second option is easy to do

anmonteiro17:05:33

@devth: are you trying to get the CLJS compiler options?

devth17:05:39

anmonteiro: yep

anmonteiro17:05:51

you can achieve that with cljs.analyzer.api/get-options

devth17:05:09

anmonteiro: perfect, i'll try that. thanks!

devth17:05:25

darwin: yeah 2nd option sounds hard / overkill simple_smile

devth17:05:05

hm, that gives me CompilerException java.lang.NullPointerException if I run it in my clj repl

anmonteiro17:05:16

@devth: I forgot to mention, it should be called by Clojure

anmonteiro17:05:20

e.g. in a macro

devth17:05:32

i'm running it from a clj repl (not cljs)

anmonteiro17:05:54

check the variable cljs.env/*compiler*

anmonteiro17:05:23

that’s the source of your NPE then

devth17:05:35

something i need to do in order to initialize it?

devth17:05:42

running from a plain lein repl

anmonteiro17:05:34

well you should probably be building clojurescript code for it to be initialized

devth17:05:33

ok. the purpose was to obtain the config so that I could build some clojurescript code simple_smile

anmonteiro17:05:24

in that case, you might want to use the cljs.build.api namespace

devth17:05:36

goal: store cljsbuild config in project.clj so I it can be built with standard lein, e.g. lein compile, but also have the ability to startup figwheel-sidecar from a repl for dev environment, and avoid duplication of config between project.clj and my repl namespace.

devth18:05:34

so I added :hooks [leiningen.cljsbuild] to project.clj. then when I start lein repl, it compiled a bunch of cljs – I thought that would fix the NPE, but nope, cljs.env/compiler is still nil 😕

devth18:05:59

guessing cljsbuild is doing its thing in the separate lein jvm so state wouldn't be shared between my repl and lein-cljsbuild.

devth19:05:13

appears there's a problem in cljsbuild's format detection. it tries to "fix" my build config, outputting:

:cljsbuild
{:builds
 [{:builds
  …..
which makes no sense. I'm using the new vector-of-maps format, and also trying to mixin shared properties as described in https://github.com/emezeske/lein-cljsbuild/wiki/Compilation-profiles – are these not compatible when you have multiple builds?

borkdude20:05:36

Nice blog post about re-implementing Redux-like functions in ClojureScript: http://jonase.github.io/nil-recur/