Fork me on GitHub
#clojurescript
<
2016-03-23
>
ag00:03:00

oh wow… it seems commonjs pattern is not yet supported by clojurescript compiler 😞 so I can’t use anything that can’t work in browser out of the box

mfikes00:03:56

@anmonteiro: I don't think there is anything else you'd need to do. That is native ClojureScript code which should be OK with :advanced AFAIK.

mfikes00:03:19

@ag Some CommonJS module support exists.

ag00:03:25

@mfikes: so how do I use that component then from my cljs namespace? I can’t find a way 😞

mfikes00:03:11

@ag see :module-type :commonjs

mfikes00:03:49

Bet it won't work with npm modules

mfikes00:03:14

But it may be worth checking out

ag00:03:48

but that’s not yet available is it?

mfikes00:03:14

It has been there since last summer (northern hemisphere. :) )

ag00:03:37

so which version should I put in dependencies?

ag00:03:05

I added that now seeing bunch of

WARNING: JSC_INVALID_ES3_PROP_NAME. Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option. at node_modules/react-datepicker/dist/react-datepicker.js line 1001 : 20

ag00:03:14

how do I fix that?

mfikes00:03:49

@ag which version of ClojureScript are you using? I'd recommend the latest unless you need to conservatively move to the minimal version where CommonJS was introduced.

mfikes00:03:15

@ag so, that is coming from Google Closure. Perhaps it doesn't grok the input JavaScript as being CommonJS.

mfikes00:03:32

@ag I wonder what is on line 1001 of that file :)

maria01:03:24

@ag as the warning suggests, you could also try setting the :language_in option to something newer than ES3

dimovich09:03:35

hello everyone

dimovich09:03:53

could you recommend some UI prototyping tool? sth I can use later with clojurescript

dimovich09:03:03

for web sites

doddenino09:03:46

https://precursorapp.com/ I think it's written in clojure/clojurescript too simple_smile

grav09:03:02

lein doo suddenly hangs for me. No idea where to start looking

grav09:03:45

okay, seems it started by itself if I just waited a couple of minutes ...

darwin10:03:55

is there any tool which would show me unused stuff from ns :requires? something like https://github.com/jonase/eastwood but for cljs

dnolen13:03:29

@ag Node.js is not real CommonJS

dnolen13:03:35

another approach is to just build your Node.js deps into a single module and require just that instead.

rauh13:03:31

On this one project incremental compilation seem to not work at all. Initial compile is ~4s and all further compiles (figwheel) are also around 4s. Nothing big, just 2 files and all standard config. Can't seem to isolate the problem. Has anybody had such a problem?

dnolen13:03:03

@rauh what version of ClojureScript?

anmonteiro13:03:12

@rauh: are there .cljc files in that project?

dnolen13:03:26

just 2 files doesn’t tell us much - the actually full dependency graph matters

rauh13:03:27

Nope, no cljc

dnolen13:03:47

I didn’t see that behavior in Figwheel while developing Om using 228

dnolen13:03:57

@rauh are you using :verbose compiler option?

rauh13:03:40

I checked cljs_deps but there is literally only core.asycn, core and figwheel (and my 2 files). I removed all other deps.

rauh13:03:48

@dnolen: No, no :verbose

dnolen13:03:02

@rauh I would enable that

dnolen13:03:06

then you can see what the compiler is doing

rauh13:03:32

@dnolen: Just found it. I somehow had :dependencies [clojuresciript ... :classifier "aot" ...] in there

rauh13:03:48

Removing it did the job.

rauh13:03:57

I must've had it in there from like >1 year ago.

rauh13:03:20

:verbose is nice. I think I'll leave it on actually.

dnolen13:03:51

yeah I can’t get Leiningen to work with AOTed ClojureScript and I haven’t had time to look into it

anmonteiro14:03:40

@mfikes: FWIW, wrt. yesterday's bug, I've discovered it doesn't need a macro to repro

anmonteiro14:03:44

updated my gist

fasiha14:03:07

(Sorry, moved my Clojure-related Transit question to #C03S1KBA2)

not-much-io14:03:16

Fully qualified name in this expression: (.play (goog.fx.dom.Scroll. el (clj->js start) (clj->js end) time)))` Error: Cannot read property 'dom' of undefined

not-much-io14:03:22

If it matters, using figwheel live, so not advanced optimized,though I'd think closure itself would be safe against that 😄

bhauman14:03:56

@not-much-io: are you requiring the goog.fx namespace?

not-much-io14:03:40

@bhauman: I did try, but same problem, with this expr, in a file:

(ns bla
  (:require [goog.fx :as fx]))
(fx.dom.Scroll. ...)
Or how should I require it for the fully qualified name? :O

bhauman14:03:35

@not-much-io: I'm not that familiar with this but I would do (:require [goog.fx.dom]) (goog.fx.dom/Scroll. ...)

not-much-io14:03:21

@bhauman It worked, makes sense also. I was looking at an example and didn't think to question that I was calling a module/namespace as a function. 😅

bhauman14:03:01

yeah require the namespace and then qualify symbol use by that namespace

not-much-io14:03:48

@bhauman Thnx, also figwheel rocks, just saying. simple_smile

bhauman14:03:02

really glad you like it simple_smile

fasiha14:03:30

@bhauman: the only problem I have with figwheel is that, now that I'm using it daily (`lein figwheel dev`), I keep finding figwheels in my cart when I go to Costco… I've eaten more figs in the last couple of months than in my entire life

bhauman14:03:52

@fasiha: well just watch out for the fig flavored Vodka, thats a bulk Costco purchase you may want to avoid ...

fasiha14:03:42

@bhauman: does it improve or degrade one's Clojure abilities?

bhauman14:03:34

all abilities degraded except that rate of progress is unchanged for when working with core.logic

bhauman14:03:03

well that was an awkward sentence

bhauman14:03:35

but all in all I like figs, especially fresh ones

amacdougall16:03:36

Perhaps a question better suited for #C0B22RS2Y... or the philosophy department.

bhauman16:03:03

making a note of "pan de higo" for future lbrary names

hugobessaa16:03:25

anyone using bidi for routing? having a hard time trying to do redirects client-side

martinklepsch16:03:27

@hugobessaa: using bidi, yes — what's the problem?

hugobessaa16:03:40

@martinklepsch: I can't find a way to do redirects client-side. ->Redirect is available just for clj

martinklepsch16:03:52

@hugobessaa: redirecting isn't really a thing in JS no? You can always do stuff like (set! js/location.href "/abc") if you want to navigate to another page

hugobessaa16:03:44

I wanted to declare that a route should be redirected to another

hugobessaa16:03:13

this is perfectly possible. would in practice just change the navbar browser url to the correct one

hugobessaa16:03:24

not really reloading the page

martinklepsch16:03:29

ah I see what you mean

martinklepsch16:03:01

like you had /some-page earlier and now it's /another and so you want to "redirect the first to the latter"?

martinklepsch16:03:07

I assume this is mostly important when the user opens the page for the first time?

martinklepsch16:03:48

I think I'd keep the old paths in the routing tree, and whenever the path matches any of these trigger a new navigation event

martinklepsch16:03:04

Don't think there's a built-in bidi thing for that

hugobessaa16:03:13

thanks for the help!

hugobessaa16:03:32

I will probably keep two routing trees

hugobessaa16:03:02

match on the first (older routes) and go to the second (current routes)

martinklepsch16:03:18

yeah, that should also work simple_smile

mrchrisadams17:03:07

hi there, I’m trying to learn how to build devcards that have leaflet maps inside them. Has anyone here come across any recent code examples of using leaflet in a clojurescript app, that I could look over, and learn from?

mrchrisadams17:03:30

cjmurphy: ah, thanks!

base69821:03:05

I have some event handling code in a game I'm building. It's a multimethod called do-event. I have a handler that just does a (keep do-event events). If the event returns another event, like say it needs to throw a damage event in the case of hit detection I just rerun that recursively until empty. Is that a good approach? Should I look into doing it with cljs.async? If with cljs.async, how do you pass the channel around to the other handlers? Use a global?

weavejester22:03:23

base698: I’ve written a library called Ittyon that handles game events in JS. It’s very opinionated, but the way I handled it was to split event handling into three parts

weavejester22:03:18

I had multimethods -valid? -react and -index. The reactions are a little like what you describe - a damage event thrown as a reaction to hit detection for example.

weavejester22:03:33

I recursively ran through the reactions for each event

weavejester22:03:43

So far I haven’t had a need to limit that.

martinklepsch22:03:41

@francoiswirion: there's also an #C06DT2YSY channel