Fork me on GitHub
#clojurescript
<
2015-06-16
>
shaunlebron00:06:07

@meow: thanks, just fixed the typo

shaunlebron00:06:17

I wrote that a year ago, but it’s missing a quite a few of things. hope to have a more complete version on the website...

shaunlebron01:06:46

@meow: for a more complete look, you can use the syntax table here: https://github.com/cljsinfo/api-refs/tree/catalog#syntax-api

shaunlebron01:06:46

it doesn’t have description text for each yet, but you can click clj or edn icons next to each one for external docs

aengelberg01:06:42

@shaunlebron "Let's go Nolen!" (clap, clap, clap clap clap)

shaunlebron01:06:15

👏 👏 👏

chris01:06:03

No joke, thank you @dnolen. 👏

robert-stuttaford06:06:10

@dnolen @maria @mfikes i’m struggling with a cljs compilation issue

robert-stuttaford07:06:00

how would i debug this? i’ve narrowed it down this dep being on the classpath when the compiler runs: [io.pedestal/pedestal.service "0.4.0”]

robert-stuttaford07:06:28

i’d like to avoid splitting class paths for clj / cljs / cljc, but this issue is preventing me from doing so

robert-stuttaford07:06:52

ok. tracked it down to mismatched tools.reader

thomasdeutsch07:06:18

i would like to use cljsjs/google-maps, so i added [cljsjs/google-maps "3.18-1"] to my project dependencies. But i am not able to require it in my ns with (:require cljsjs.google-maps) and i get an error that the compiler could not locate cljsjs/google_maps.cljs !

sander07:06:39

@thomasdeutsch: try requiring google.maps instead. not sure if that's even needed before using it, maybe just refer to js/google.maps in your code

sander07:06:01

@thomasdeutsch: "The jar only provides an extern file required for advanced compilation."

acron08:06:15

Is there a trick to getting source maps working? 😮

acron08:06:21

I'm using a chestnut template, it's clearly present in the :cljsbuild config

sander08:06:26

acron: are they not compiling or not shown in your browser? i'm having better experiences with chrome than with firefox here

acron08:06:52

Well, project.clj references "resources/public/js/out.js.map" but this file doesn't exist

acron08:06:59

so presumably it's not compiling

acron08:06:41

Ahh, do I need optimizations to use source maps?

acron08:06:21

Apparently not

thomasdeutsch08:06:22

I `(let [service (new js/google.maps.places.AutocompleteService) request #js {:input "Hannover"}] (. service getPlacePredictions request cb-fn)))`

thomasdeutsch08:06:27

I try to call the function getPlacePredictions with 2 arguments, but fail to do so. How can i write this in clojurescript: service.getPlacePredictions(request, cb-fn); ?

thomasdeutsch08:06:40

it was this: (. service (getPlacePredictions request cb-fn))

gerrit09:06:01

(.getPlacePredictions service request cb-fn) should also work

jrychter10:06:30

Any hints on how to debug cljsjs packages not getting included with advanced compilation? I added [cljsjs/jquery "1.9.1-0"] and jQuery isnt't there in the resulting app.js file. At the same time, [cljsjs/moment "2.9.0-0"] works just fine. Where do I start looking?

dnolen10:06:41

just because you add a dep doesn’t mean it will appear, you need an explicit require. I’m assuming you do?

jrychter10:06:04

@dnolen: I didn't have a require! Thanks, that was exactly my problem.

jrychter10:06:38

[the app still doesn't work in advanced compilation mode, but I'm making progress :)]

jrychter10:06:14

Hmm, it seems that cljsbuild doesn't warn about if an externs file I specified cannot be opened… it's kind of hard to even debug this, as I have no idea where it's looking for it. And it seems other people had the same problem: https://github.com/clojure/clojurescript/pull/44 http://dev.clojure.org/jira/browse/CLJS-994

dnolen10:06:19

@jrychter: there’s a downstream bug in cljsbuild, we cannot supply a warning without breaking all cljsbuild users.

dnolen10:06:47

added a Tip & Tricks section to the Wiki with an entry on Advanced Compilation https://github.com/clojure/clojurescript/wiki/Advanced-Compilation

dnolen10:06:22

externs file just needs to be on the classpath. it’s easy to test that it will work by copy and pasting your path into a regular Clojure REPL

dnolen10:06:44

(io/resource “path/to/externs.js”)

jrychter10:06:58

@dnolen: thanks, I discovered that a couple of minutes ago when I got a warning for a duplicate extern. Now trying to figure out how to include external js with :libs. Same problem: option gets quietly ignored, I have no idea what lein is trying to do for me and why it doesn't work. Life would be much easier if every bit of software included a "verbose" option that printed what the software is trying to do.

dnolen10:06:50

there is a :verbose mode in ClojureScript though we could probably do something more wrt to externs

dnolen10:06:16

:libs is for Google Closure compatible libraries not provided by Closure itself, do you have those?

jrychter11:06:03

I am trying to add Semantic-UI — what I have is semantic.js and a tiny externs that I wrote myself. I thought :libs ["resources/public/semantic"] in my :compiler section was supposed to pick up the .js files that are in that directory and include them in the output being compiled. I guess there is more to it.

dnolen11:06:24

@jrychter: that’s not what :libs is for

dnolen11:06:43

:libs only works with JS files that are Google Closure namespaces.

zoldar11:06:20

is there an easy way to rewrite urls server-side in figwheel? or do I have to provide the whole ring handler? I need to serve app page under every url except those related to assets. I've found 'rewrite-urls' but it's client-side option from what I see.

jrychter11:06:20

@dnolen: how did I not find this page… I've been googling this for at least an hour now. Thanks, will read carefully now.

dnolen11:06:41

@jrychter: Google has indexed old and out of date and incomplete stuff

dnolen11:06:47

@jrychter: just goto the Wiki simple_smile

jrychter11:06:16

(I did discover :foreign-libs in the meantime and managed to include the js, although it doesn't get compiled, just included)

jrychter11:06:46

@dnolen: I never thought of looking into the cljs wiki. I thought this is entirely a leins-cljsbuild thing.

dnolen11:06:24

@jrychter: cljsbuild is just out-of-date sugar over the actual ClojureScript compiler

dnolen11:06:35

it doesn’t do anything special other than provide lein integration

jrychter11:06:00

@dnolen: and that's what I've been missing. Ok, thanks for your help, I'll read the wiki now.

dnolen11:06:30

feedback on the wiki is always welcome, happy to see it become the source of truth https://github.com/clojure/clojurescript/wiki

dnolen11:06:49

especially on things like the sidebar which includes only essential information

dnolen12:06:37

works under ClojureScript master simple_smile, still more work to do around macros but color me impressed that the core bits of ClojureScript require so few changes to compile itself.

angusiguess12:06:43

That's fantastic 😄

dnolen12:06:22

try it yourself

jrychter12:06:49

@dnolen: so, to prove I really did read the wiki docs now, I suggest s/ClosureScript/ClojureScript on the Dependencies page.

jrychter12:06:29

Oh, wait, it's a wiki. Right. I'll just do it.

nikolap12:06:56

yay for bootstrapping!

keeds12:06:06

@dnolen: 👏 👏 👏

jrychter14:06:36

Half a day later, and I still haven't gotten externs to work. This is frustrating.

dnolen14:06:45

@jrychter: yeah if you’re going to use a random library it really cannot be done as an after thought

dnolen14:06:58

you need to build production periodically as you develop otherwise you end up where you are.

dnolen14:06:09

did you try the debugging technique I suggested in the wiki?

jrychter14:06:42

@dnolen: no, my problems are much more basic than that. I'm finally getting somewhere, but I've wasted I'd say about two hours today on silly mistakes like pointing :externs to non-existent files (which there is no warning about). The second problem was that if one places the externs.js file in src dir, the compiler will abort with "SEVERE: ERROR - Duplicate extern input" — which would seem to indicate that one can place externs in src dir and they will be automatically read.

jrychter14:06:05

@dnolen: so, it was really all about moving files around and pointing to them 😄

dnolen14:06:23

right because anything in the source-path will get included in your build

dnolen14:06:27

can’t fix the cljsbuild thing

dnolen14:06:43

cljsbuild is broken, and it’s one of many ways in which it is broken.

dnolen14:06:25

sadly everybody uses it, so not much to do

dnolen14:06:06

well someone could submit a patch, but I’m not holding my breath at this point simple_smile

jeluard14:06:59

@jrychter: Have you seen this: https://github.com/cljsjs/packages/issues/3 ? That might give you some pointer.

nullptr14:06:32

I use it because I want lein's declarative deps -- what's the recommendation going forward?

jrychter14:06:38

@jeluard: yes, I actually grabbed their externs file finally (it's almost complete), thanks

martinklepsch14:06:21

> cljsbuild is broken, and it’s one of many ways in which it is broken. I’m pretty happy with my boot-cljs setup but also Figwheel is probably an alternative

jrychter14:06:16

@dnolen: well, I guess for now I should write the experience up somewhere, so that at least it's googlable. And I did finally get this to work — by moving externs out of src dir and getting the path in :externs right. I'd say that the lack of warning/error for nonexistent extern files is the major culprit here, but I understand this isn't easily fixable.

bhauman14:06:25

@zoldar: yes you would have to provide a ring handler. But I'm really trying to steer folks away from using that option. I know its convenient but the sooner you are on your own server the better.

dnolen14:06:10

@nullptr: people submitting patches to cljsbuild is the fix simple_smile

dnolen14:06:25

I would do this myself but my hands are pretty full these days.

jeluard14:06:18

@jrychter: Packaging a JS lib as a CLJSJS package is probably the best option if you don't want to rely on lein-cljsbuild conf.

nullptr14:06:24

Good - I would rather fix cljsbuild than rebuild my entire build stack

nullptr14:06:09

jeluard: good point, helps others too, but raises the bar on the quality of externs

dnolen14:06:12

fix this ^

dnolen14:06:40

and fix this ^

dnolen14:06:48

this would solve 90% of the issues.

jrychter14:06:41

Perhaps I should switch to boot. Now I'm still getting ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input, even though the file is out of the src dir, and I have only one.

martinklepsch14:06:37

(be aware that boot also won’t magically solve problems simple_smile )

martinklepsch14:06:24

@jrychter: btw, you can build cljsjs packages very easy on your own machine using the tooling that is part of the cljsjs project

jrychter14:06:07

@martin: yes, I realize that (about boot), we're using it in another project. I think the problem is systemic, and not specific to cljsbuild. Our software systems get more and more complex, and we spend more and more time setting up files/dirs for them. Software should tell us more about what it is doing, without resorting to tools like strace/truss. Can't find a file? Tell the user. Looking for a file? Tell the user where you're looking.

jrychter14:06:16

I think ClojureScript could also do more — with :verbose, I'd like to see which extern paths are provided to the Closure compiler, for example.

jeluard14:06:00

Also you can use CLJSJS packages with lein. Having all JS related plumbing in CLJSJS packages helps reducing the complexity of your lein conf.

dnolen14:06:52

@jrychter: I’m definitely happy to see ClojureScript do more under :verbose

dnolen14:06:00

I always use :verbose now and happy to see it improved

jrychter14:06:16

I'd kill for Semantic-UI in CLJSJS, but until it's there (and it isn't obvious how to get it there, as Semantic normally requires configuration and building), I have to make do.

jrychter14:06:33

@dnolen: yes, I'll try to find a moment and look at it. Perhaps I'll be able to contribute an improvement.

jeluard14:06:59

@jrychter: it's not that much work really plus it might be almost there https://github.com/exicon/hoplon-semantic-ui/blob/master/build.boot

ul15:06:09

weird question with low context, but... what could be the reason that Om does not update component implementing IRenderState after om/set-state! even should-update is not called. I guess I've done smth bad in my app provoking this behavior, but can't understand where to look

teslanick15:06:18

What's the code around set-state! look like?

ul15:06:38

it is match clause, and I've tested it right now — yes, it is the problem

ul15:06:47

set-state is not called

ul15:06:19

hmmm... the same code worked well earlier. may be core.match is not compatible with the latest cljs?

ul15:06:26

i'll test and report back

ul16:06:07

okay, i'm too rapid making my assumptions

ul16:06:12

match clause work fine

ul16:06:36

set-state! is called from go-loop

ul16:06:43

but i had no problems earlier with setting state from go block, including exactly this code which is doesn't work now

ul16:06:21

@dnolen: excuse me, but how could om/set-state! fail being called from go-loop? where to look at to fix/workaround it?

dnolen16:06:49

@ul sorry can't help you with this issue at the moment

nullptr16:06:01

@ul: printlns can be helpful -- make sure errors aren't being thrown -- have a peek at the generated js perhaps

ul16:06:03

@nullptr: thanks, will go into sources. no errors thrown, any other function placed instead of set-state! (e.g. print) is called in normal way

nullptr16:06:55

i had an issue once where set-state was called successfully but didn't update due to raf issues (now fixed) -- esoteric issue, but see https://github.com/omcljs/om/issues/253

mfikes17:06:29

@maria: I've attempted to create a minimal setup to try CommonJS, but get a failure. I put it here: https://github.com/mfikes/test-commonjs

maria17:06:16

@mfikes: Thank you, I will have a look at it ;)

mfikes17:06:48

@maria: I fixed one silly thing (passing :foreign-libs) to REPL but got a different error. Updated that repo. Thanks for helping! I bet I'm close to getting it working. (Take your time, I'm just messing around with it. :) )

maria18:06:21

@mfikes: thank you for putting the repo together, but not sure yet, what the problem is. Will need to investigate this now 😉

mfikes18:06:36

@maria: Thanks! I may be able to look at in more detail myself later on as well.

maria18:06:24

@mfikes: I will let you know, when I find anything.

erichmond19:06:04

If I want to use core.async with CLJS, is it best to use lein to manage the dependencies?

edbond19:06:00

@erichmond: yes, lein will work.

ul19:06:34

@dnolen: does Om component update after set-state! rely on assumption that (swap! app-state identity) will trigger watches?

dnolen19:06:03

@ul I don’t know what you are asking

edbond19:06:22

I think all updates in om depends on add-watch

dnolen19:06:56

oh if that’s what being suggested, no

dnolen19:06:50

set-state! only updates the targeted component

dnolen19:06:11

semantics are more or less the same as React here

ul20:06:19

i see that -set-state! calls -queue-render!, which implementation adds component to render-queue https://github.com/omcljs/om/blob/master/src/om/core.cljs#L1065 but render-queue is local to setup, and accessed in outside world through -get-queue, which is used only here https://github.com/omcljs/om/blob/master/src/om/core.cljs#L1163 and that place is inside rootf which is called only being added to refresh-set inside state watcher thus i suppose that update goes in that way: when state trigger its watchers, rootf is added to refresh-set and render-all is scheduled on next animation frame, where rootf is executed and, particularly, updates components in render-queue

ul20:06:54

i don't understand how component will be updated if only its state has been changed

ul20:06:13

and it is placed in queue, but not in refresh-set

ul20:06:24

sorry if i'm missing smth obvious

aengelberg20:06:52

#C06DT2YSY channel? 😉

ul20:06:49

@aengelberg: thank you, missed it, it was created today

dnolen20:06:10

@ul you’re getting into the nitty gritty details of Om which are likely to change, but I answered in the #C06DT2YSY channel.

bhauman20:06:14

Just posted some simple thoughts on composable build scripts for cljs to see what folks think: https://gist.github.com/bhauman/5c50a25f28598d954eba

gonzih20:06:15

@bhauman: having more generalized watch function would be nice, but I like it a lot! Go go boot!

martinklepsch20:06:53

> This system would not require buy-in just adhearance to a simple interface. Doesn’t “adhereance to a simple interface” lead to the same “buy-in” requirement?

martinklepsch20:06:21

A message based approach is definitely interesting I think, esp. for parallelism.

dnolen20:06:54

I think buy-in is referring to a different problem in the Clojure(Script) build tool space (and I may be inaccurate here), but people don’t often supply Lein plugins and Boot plugins as a l carte reusable bits separate from the integration bits.

dnolen20:06:27

while deps.cljs is not a generic mechanism for what’s described here, the fact that anyone can use it is a plus over something that works with a specific build tool.

dnolen20:06:08

that said I have no brilliant ideas about this stuff simple_smile

dnolen20:06:26

observing how things have gone in the JS world, seems like declarative or imperative … you might not end up some place good

martinklepsch21:06:16

> as a l carte reusable bits separate from the integration bits. Could you elaborate?

dnolen21:06:02

people don’t always ship the reusable parts of their plugin

dnolen21:06:25

as @bhauman has already alluded, even when they do the interface is ad-hoc and not necessarily composable w/ anything else.

dnolen21:06:03

and by “ship" I mean design & document beyond lein or boot usage.

martinklepsch21:06:13

In my experience Boot provides such interface (the Fileset) and almost all tasks use it, thus they are easily composable. Have you made any contrary experiences?

meow21:06:42

I think some really good points are being made here. I recently learned boot and started using it on a couple of projects. While boot is quite composable and was definitely designed with that in mind, most of the boot-based tools that I found "in the wild" took advantage of that composability but were themselves monolithic tools that made far too many assumptions about what combination of "stuff" I wanted to use in my project. So what did I do? I learned from their examples but ended up using boot at a low-level, composing all my own boot tasks. If I'm not alone then that seems to indicate that something in this realm could be improved. And if the guy who wrote figwheel (a tool that appears to be universally loved by all) has something to say about it that certainly gets my attention. simple_smile

danielcompton21:06:23

Which browser versions does ClojureScript support? I had a look and couldn’t see anything specific for ClojureScript. Does it just follow Closure browser support?

dnolen21:06:26

@danielcompton: we generate the same JS that was shipped in 2001 browsers

dnolen21:06:38

as far as browser quirk support Closure gives us >= IE6

michaelr22:06:29

figwheel reloads my changes but it doesn't cause the Om or Reagent UI to refresh automatically, am I missing something? It used to refresh automatically in an older version..