This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-07
Channels
- # admin-announcements (19)
- # announcements (1)
- # beginners (14)
- # boot (244)
- # cider (2)
- # clojure (23)
- # clojure-dev (23)
- # clojure-poland (55)
- # clojure-russia (118)
- # clojure-uk (4)
- # clojurescript (143)
- # core-async (31)
- # core-logic (1)
- # cursive (30)
- # datascript (2)
- # datomic (3)
- # emacs (7)
- # hoplon (40)
- # ldnclj (8)
- # off-topic (2)
- # om (64)
- # reagent (10)
- # ring (1)
- # yada (71)
@bhauman: Is it intended behavior that if a file gets reloaded but hasn’t changed that the macros don’t re-run? I’ve got a sort of unfortunate macro which reads a resource file and it’d be nice if I didn’t have to keep touching the file that calls it to make a reload occur
Actually, what would be best is if I could indicate that a file has a non-obvious dependency that needs to be watched too
for simplicity reasons we actually preserve the query from the root of the application
this has lots of benefits - you can apply local state transformations on the way down to update the component
ah, ah, I see, as state is passed down it keeps getting transformed and you’re registering these changes at the top
even if you intend to only update a single todo you will often want to pass through :todo/items part of the router (called parser in Om Next)
this is because you want some merged view of whatever the server gave you and whatever other local info you need
you see people do this in components sometimes and in general want to avoid that unless necessary
so instead of storing the actual query we store a zipper of the query where the zipper is paused on the last step
and because queries are never really big enough to be interesting this is a very clean solution w/ no performance impact of interest
gotcha, cool! that is definitely a good use case—being poised at the tip of a data structure, ready to modify
I always talk about them as being (data-structure, path)
pairs with better performance characteristics
odd question but here it goes: is there any recommended way to integrate clojurescript (om/react) code into an existing JS/react codebase cleanly?
@sjol you can use regular js react components inside om. Not sure if that’s what you’re after though?
@sjol it’s possible but that’s the direction where it’s more challenging, especially if you’re tied to JS tooling.
Might be easiest to just let om mount inside it’s own app root and handle all it’s own stuff, if you can? I don’t think you’d realise a lot of the benefits of om or reagent by just writing components in cljs.
that is queries are automatically associated with an application state, if you got back those queries modifications will reapply
@lfn3: thanks, the goals was not to have to rewrite code that was already done in clojurescript to react, but I may have to do so
@sjol: You might be able to reuse them, but it’ll depend on how much they depend on being passed or having access to global cljs primitives.
feedback welcome on this now - https://github.com/omcljs/om/wiki/Quick-Start-%28om.next%29
@dnolen: congrats on getting things this far. Part way through reading, the reconciler is a very cool idea.
The rest of it is also very awesome. Looks a lot easier to understand than om with cursors, at least to me. I'm looking forward to seeing what people can do with it.
@shaun-mahood: yeah been wanting kill of cursors for a long time. But really that's the tip of an iceberg :)
Hello All! I've been running through the cljs quickstart guide... On windows everything runs as expected. But on Ubuntu whenever I try "java -cp cljs.jar:src clojure.main repl.clj" I get "java.lang.RuntimeException: No such var: cljs.build.api/build"
this is one typo I found, going to actually work through it later
> For example to getting a todo list might look something like the following
@mcgivernsa: thanks fixed
@dnolen: Following the om next quickstart, Where [org.omcljs/om "0.9.0-SNAPSHOT"] gave a "was not found" in clojars with some notification about http proxy settings so I changed that to 0.9.0. I live in Shanghai so initially I thought it might have been the Chinese firewall at it again.
@dnolen The 'Your first component' section of the getting started guide for om-next mentions creating src/om_tutorial/core.cljs, a step the user's already done about one page prior in the 'Checkpoint' section.
@dnolen misspelled 'documentation' at ' Note: For a more detailed list of React methods that components may implement please refer to the React documetation'
@dnolen: great writeup! In one place find
is used where get
would seem simpler but other than that 👍
I am trying to do this in a cljs function: http://stackoverflow.com/questions/623172/how-to-get-image-size-height-width-using-javascript/626505#626505
how can I make it return the width and height values that are only available once the Image element's onload fires?
@cfleming: last Cursive seems to be acting weirdly, eating up all my cores to run simple REPL commands
Has anyone had any luck getting uberjars working with clojurescript? I keep getting Uncaught ReferenceError: goog is not defined
in the browser with :optimizations :none
and more cryptic errors with :optimizations :advanced
.
Here's my project.clj if anyone has a minute to take a look: https://gist.github.com/bmaddy/3109b23181afba0b13ba
@jeremyraines: are you asking how to do it in a synchronous way or what exactly are you having problems with?
yeah. Or async would be fine, but could use a little guidance there, especially b/c I'm not sure I want to pull in core.async just for this case
@bmaddy: making an uberjar with :none
is not something I would pursue. Does your project build correctly with :advanced
(ignoring uberjar for now)
@jeremyraines: There’s plenty of async stuff in that might be worth checking, also you can just swap things into an atom and add a watch, really depends on what’s already there and how complex things are (going to become)
ok, thank you. Any idea of how to make it be or seem synchronous? Something like a future maybe?
@jeremyraines: there is no way to do that
ok, thanks
I'll go with that then
@jeremyraines: but if all you’re doing is this image thing that’s probably overkill
@dnolen: I can't seem to get advanced mode to happen--I changed all instances of :optimizations
to :advanced
, but when I look at the served javascript it isn't minified. I started the app in the repl (`(run)`) and also tried lein run
(after adding a :main vk-loop-player.server
to my project.clj
) with no luck. Am I missing something silly here?
@bmaddy it’s really hard for me to say - I do not use lein profiles somebody else will have to chime in
Ok, I'll keep looking at it. Maybe I'll try removing the profiles. I appreciate your willingness to take a look--thanks!
once you get there, read this https://github.com/emezeske/lein-cljsbuild/issues/366
@bensu: The file is env/dev/cljs/vk_loop_player/main.cljs
. Thanks for taking a look at this.
Or maybe you wanted the contents of the file: https://gist.github.com/bmaddy/c9e90bed22ac03938e7c
first, I would remove all react preambles, reagent should cover this. (if that version doesn't, just use a newer version!)
@bmaddy: for :optimizations :advanced
you will probably want to have one that is exactly the same, without the figwheel/weasel references
In a mixed CLJ/CLJS project, is there any effect on CLJS compile time if I add more CLJ dependencies?
Yeah, my env/prod/cljs/vk_loop_player/main.cljs
file is exactly as you describe. It also omits the [cljs.core.async :refer [put!]]
line. I'm trying now without the preamble stuff.
@danielcompton: there should not be
@bensu: when I remove the preamble stuff the app still compiles and runs just fine, but when I view the loaded .js files in the browser they look like normal javascript, not minified (i.e. I still see function names, lots of newlines, etc.).
I'm trying to drag my brain out of promise-thinking; could someone point me to a resource or example with core.async for doing something like Q.all() in js? Example: I have a a collection of maps, which must each be updated asynchronously, and only once all updates are complete, do the next thing
@jeremyraines: do you need to use the results of the changes as well?
Yeah. I want to do something with the "updated" collection
@jeremyraines: do you have a current code sample you can share?
I don't right now because I'm away from my computer, but could in like 40 mins. Sorry. There's not much there though except the synchronous version and me setting the most basic core async loop & channel
if you share the sync version we can probably make it async Also, you might want to try putting it in #C05423W6H as the people there love a challenge
Ok, will do, thanks
do you guys recommend any Getting Started guide to testing ClojureScript?
specially making it work with Lein
I’ve seen a lot of information on using javascript libraries in clojurescript and almost nothing on using the compiled clojurescript bundle from javascript (maybe I’ve been searching for the wrong terms…). For example if I wanted to write a Flux store in clojurescript is there way I could use the resulting bundle and import it in my app?
@hugobessaa: checkout lein-doo
@danielcompton thanks!
@dnolen mies
could come with tests already. what do you think?
@hugobessaa: I don’t really work on mies anymore
@miguelb: taking something you wrote in CLJS in JS is not really that popular of a way to go if you’re not talking about Node.js, ClojureScript stuff starts around 20K gzipped and goes up from there
@dnolen: that’s unfortunate. I work on a small team and they’re bit wary of me introducing cljs. I figured start with a fairly complicated piece the app we’re working on and have it be transparent and slowly start replacing parts
@miguelb: it’s just not a supported use case and is unlikely to be. It’s definitely one of the nicer things about compile JavaScript languages with narrower scope like CoffeeScript et al.
@miguelb: I've been thinking about doing something similar. There are leaves in any dependency graph - I'm planning on starting there and moving up.
got the idea from post on Elm where they started porting over their stores to Elm while keeping the origin js app intact
@miguelb: note this is mostly a problem for JavaScript code bases that use the large and diverse ecosystem of JS tooling.
if your JS code base was Google Closure based what you’re talking about would be pretty trivial
@miguelb: I think it’s big deterrent for a lot of JS people since it’s not a very hip thing that people talk about. Thus you see ClojureScript adopting JS stuff all the time, but hardly the other way around.
I’m confused by what’s said here. Isn’t what @miguelb is asking for similar to how mori is implemented?
@dnolen: Weird, no-one else has reported anything. Let me know if it keeps happening on your home machine and I’ll take a look.
I’m thinking of writing a Meteor package that enables Meteor to compile cljs into JavaScript on the fly. someone has done a version that basically uses Leiningen to do the compilation: https://atmospherejs.com/mystor/clojurescript. My question is: with the new clojurescript compiler for clojurescript, is it possible to get rid of the Leiningen dependency?
is that possible (or at least in theory) at this stage?
@settinghead: I am not very familiar with Meteor, but it is possible to use the ClojureScript compiler without leiningen. The Quick Start tutorial doesn't use leiningen and only requires you to download a standalone ClojureScript JAR. https://github.com/clojure/clojurescript/wiki/Quick-Start
@maria thanks. i think that should work better than Leiningen. however, was thinking more along the lines of completely getting rid of JVM, like starting the compilation process in node (which is what Meteor is based on), compile cljs in node and output js. if i could achieve that it would be awesome, because you could then just use it as a regular Meteor package without external dependencies like JVM.
@settinghead: well, there is bootstrapped ClojureScript, which lets you compile ClojureScript to JavaScript without the JVM. https://github.com/clojure/clojurescript/wiki/Bootstrapping-the-Compiler
cool. i saw it. just wasn’t sure if there are any limitations
You would initially need to write a ClojureScript project which uses the cljs.js namespace and then compile it using the JVM, which would then give you JavaScript that allows you to compile cljs to js.
Similar to this project here from dnolen https://github.com/swannodette/cljs-bootstrap
ok. i’ll give it a try!
we have been using mori.js for one of our Meteor projects and we loved it. thought would be nice to have more cljs integration into Meteor ecosystem