This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-07
Channels
- # admin-announcements (69)
- # alda (8)
- # beginners (6)
- # boot (182)
- # cider (10)
- # cljs-dev (24)
- # cljsrn (17)
- # clojars (70)
- # clojure (142)
- # clojure-brasil (5)
- # clojure-czech (1)
- # clojure-poland (4)
- # clojure-russia (96)
- # clojurescript (115)
- # community-development (37)
- # component (6)
- # cursive (11)
- # datomic (32)
- # events (4)
- # funcool (6)
- # hoplon (17)
- # ldnclj (10)
- # lein-figwheel (24)
- # mount (12)
- # om (141)
- # onyx (7)
- # parinfer (48)
- # re-frame (24)
- # reagent (31)
If you expose js/React
from your foreign lib and shim cljs.react
with an empty file you should probably be good. So you can just use the one in your bundle.
At least it was the case with for e.g reagent 0.5.0
, 0.6.0
might have changed that since they updated to React 0.14
they were doing some interesting stuff in that update. looking at this commit https://github.com/reagent-project/reagent/commit/d9ad7740ecf176c0c82943898b4abb5d3c6df81b
i see. they export a manufactured “require" global that takes the string and returns the module. and then they call js/require from cljs
still some weirdness in that setup though. they’re not using UMD and not using :module-type commonjs and i don’t see how their module can :provide “cljsjs.react"
I think those are there just for Clojurescript compiler's dependency resolution mechanism so it knows the foreign lib was required when deciding what sources to output.
So it's just basically a dummy value (in that it doesn't relate to whatever the file may expose globally or not).
@yaniv @jaen yes :provides
for foreign libs is fabricated thing - foreign libs are always global imports
:provides
for foreign libs is just a key so the compiler knows what file to actually require
a thing i don't understand:
(def e (js/Error. "welp"))
(.-constructor e) ;; nil
does .-
not do normal property access (delegating to the prototype chain)?
if not, is there a way to do that?
@eyelidlessness: mhh, works for me. Where are you running this example?
mneise$ planck
cljs.user=> (def e (js/Error. "welp"))
#'cljs.user/e
cljs.user=> (.-constructor e)
#object[Error "function Error() {
[native code]
}”]
tried it on the http://clojurescript.net/ web repl to isolate it, but i'm coming back to it from earlier and i swear i encountered it in my own cljs code as well
but it works for me locally now, and in a local repl
so maybe i was just using the web repl for convenience, and it's an oddity of bootstrapped cljs?
@eyelidlessness: well, planck is also using bootstrapped cljs, so not sure what the problem is in http://clojurescript.net/
thanks for the sanity check. it's a relief that it's not a limitation of .-
yeah i noticed that, but those are direct properties, which is why i suspected it was avoiding the prototype chain somehow
cljs.user=> (.hasOwnProperty e "message")
true
cljs.user=> (.hasOwnProperty e "name")
false
but yes, could be a problem in a previous version of bootstrapped clojurescript, since http://clojurescript.net/ is most likely using an earlier version of it
interesting. i guess i didn't really pay attention to name
, which i wasn't even aware was a property on js errors
thanks again
@eyelidlessness: http://clojurescript.io is at 1.7.170 while http://clojurescript.net is at 1.7.45
did not know about http://clojurescript.io
it does appear to be a difference in behavior across versions then. (.-consctructor e)
def works on http://clojurescript.io
thanks for pointing out the other web repl
BTW http://clojurescript.io uses the last replumb which is an improved version of Joel Martin's code for http://clojurescript.net
I am now working on bundling the necessary sources so that require will work smoothly on it. It will lakely be a boot task that produces the necessary file set.
How can I limit the results of a query. I want only show the ten last items
That's rather vague (what sort of query?), but you probably could do (take-last 10 coll)
or something.
@jaen It was take
, I needed.
Are there solutions for adding version numbers to the compiled files, to prevent caching issues?
@danielgrosse: When compiling, the emitted JavaScript files have a comment at the top containing the ClojureScript version number along with other compiler options that are relevant to cache validity.
So there won't be issues, when updating files?
This handles the case where you are developing, have cached JavaScript files in your dev environment, and then change compiler options (say :static-fns
for example), or even update to a new version of ClojureScript. This will cause those cached files to become invalid.
And when I deploy the combined files on the server?
If you are using a single :advanced
file for deployment that probably makes the answer simpler.
Yes I compile to a single file.
I’m not familiar with how ClojureScript behaves in web environments… suspect many others here are intimate with that aspect.
boot eliminates the issue of stale files with their tooling structure and immutable filesets
So i will see, how I can implement boot into my workflow
@danielgrosse: if you would want try boot then this introduction is pretty good - https://github.com/magomimmo/modern-cljs/tree/master/doc/second-edition
Thank you
sent a patch to fix a hidden minor bug in the 1-arity version of js->clj
: http://dev.clojure.org/jira/browse/CLJS-1540. If you ever tried to pass {:keywordize-keys true}
and it didn't work as you expected, that's why
Yes. See the numbers section in https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure#the-reader
@kopasetik: for perf reasons we do not attempt to do anything about JS numerics
however there’s been talk of fixing this in JS itself in TC-39 - so we’ll just get it when everyone gets it
@dnolen: Fair enough. Looking forward to the day that I can do "real math" in a JS environment without a library!
does anybody know if it's possible to partially load an app with google closure modules?
Webpack w/ React Router partial app loading trough require.ensure
is all the rage these days.
Any ideas on how I could achieve this with clojurescript?
@iwankaramazow: @arohner wrote a blog post about loading only the parts that matter when you need them.
@iwankaramazow: Google Closure has supported this pattern for probably 5 years
Wow, thanks! 😀
I’m thinking about cutting a new ClojureScript release tomorrow, it’s been about 2 months since the last official one - if you have time to test master that would be great
one big new feature - parallel compilation (which still needs more tire-kicking) but I’ve been using it and it seems to work well enough
the other is much better handling by the compiler of changing dependencies - you should not have to blow away the build any more if you change a dependency
I'll check it out tomorrow, really looking forward to the parallel compilation 💪 💪
@iwankaramazow: the benefit at the moment is mostly for cold development builds
eventually would like to get it working for REPLs but I don’t want to stall this release anymore
Even in cold dev env this will be awesome
I want to create a custom build script that just compiles one namespace for nodejs that isn’t web-specific, whereas the rest of the code contains some reagent stuff
but you can use the classpath to control what does and doesn’t get lumped into your build
How about using cljsbuild and then specifying multiple :source-paths
for the web-part and only one for the nodejs-part? Does that make sense?
Dang. I wish Sussman would show up at one of my local Clojure Meetups. I gotta move to NYC where stuff's happenin' :)
wondering if I could get some repl guidance. Started an Om project using the Chestnut lein template. Everything works great except that when in the my-app.core
ns I can’t eval any form and I get this error Unable to resolve symbol: app-state in this context
I get the error from both cider and lein repl
@kingoftheknoll: sounds like you are evaluating ClojureScript as Clojure
ah well that would do it
I would think starting the cider repl from that file would start a cljs repl. Any pointers on where I can read more about this?
also @dnolen big fan of your talks they were my gateway drug
@kingoftheknoll: cool! I can’t help there I haven’t followed the cider CLJS developments closely being a Cursive person now. Somebody else might know though.
thanks I’ll keep at it!
btw I think I found the problem. Chestnut builds a template where all the dependencies are woefully outdated
that is after I got into the cljs repl I discovered this
@dnolen: as I mentioned a while ago we’ve been getting crashes with parallel compilation (probably exposing latent bugs or bad configurations), will try to look at it again on our projects when I’m back at work
@danielcompton: yeah so far only heard that from you
for sure