This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-08
Channels
- # admin-announcements (7)
- # aws (5)
- # beginners (37)
- # boot (39)
- # cider (4)
- # clara (2)
- # cljs-dev (32)
- # cljsjs (1)
- # cljsrn (12)
- # clojure (235)
- # clojure-austin (3)
- # clojure-belgium (7)
- # clojure-berlin (11)
- # clojure-dev (36)
- # clojure-france (10)
- # clojure-japan (10)
- # clojure-poland (2)
- # clojure-russia (39)
- # clojure-uk (4)
- # clojurescript (81)
- # code-reviews (9)
- # core-async (6)
- # core-logic (1)
- # datomic (32)
- # editors (7)
- # emacs (1)
- # hoplon (191)
- # jobs-discuss (14)
- # juxt (4)
- # lein-figwheel (4)
- # leiningen (3)
- # off-topic (7)
- # om (49)
- # onyx (34)
- # other-lisps (1)
- # overtone (11)
- # parinfer (1)
- # proton (5)
- # re-frame (11)
- # reagent (12)
- # spacemacs (2)
- # untangled (90)
- # yada (15)
@bpicolo: interesting, have you noticed performance issues?
@bpicolo: we have three src folders, src, dev-src, prod-src. Dev tools only gets required in dev-src.
@bpicolo: agree I was just curious :)
I'd like to develop a client side only SPA that is pre rendered for download speed and user experience. Wondering what option would be best Om or Reagent.
@grounded_sage: this is like car-choosing process? what you prefer honda or toyota? reagent is easier to start, btw, so may be critical if it really first app using clojure.
@rmuslimov: I've built a few different static sites using a few libs. Currently venturing into the CLJS side of things a bit more. Been contributing to Braid chat which uses Om Now. Just wondering what would be better. Primarily for server side rendering story and handling the data. Not afraid of a little slow to get started (investing in learning) if it pays off.
@grounded_sage: apart from the cosmetic difference the main differentiator is how they manage state. Read up on om cursors and reagent atoms and om next transactor and take your pick
however om.cursor and om.next is opposite right? is that true that om.next is best for new projects, or people still consider using previous Om?
@plexus: cheers. I am leaning more towards Reagent at present. Despite being very interested in Om Next.
I'm betting on React so focusing my efforts towards using something that uses it. I'd go straight for Om Next if it wasn't for such a huge divide in the community with heaps saying Reagent is better.
I dunno...I'm using Om.prev and considering whether to upgrade to Om.next or switch to Reagent...Om.next looks heavy but I'm not sure I like Reagent's pattern of distributing state over many atoms, and I don't like seeing derefs in functions
@octo221: you can start out with one global state atom in Reagent. We did that. Currently we have a few components that maintain their own state atom, usually when they maintain some transient state, or when they wrap a stateful JS-component (like Openlayers).
We went from Om.prev to Reagent, and the whole team really like the data-first approach.
Is there a cljs function akin to clojure.core/format
that allows for specifying positions, like (format "%2$s %1$s" a b)
?
goog.string/format
doesn't seem to include this functionality
https://closure-library.googlecode.com/git-history/docs/class_goog_i18n_MessageFormat.html is neat though
@grav: my app has global undo (not through Om, just using a normal vector to store states), how easy is it to get global undo with Reagent ?
and all the child atoms will be updated accordingly ?
and do the states of child atoms derive from that of the parent always ?
Are there any known issues with cjs/es6 modules used as foreign libs? Doesn’t seem to work for me 😞
anyone got React.addons.TransitionGroup working with Reagent (not the CSSTransitionGroup) ?
Has anyone managed to get a remote clojurescript browser repl to run when developing in cordova/mobile?
@bpicolo: https://github.com/binaryage/cljs-devtools/blob/master/docs/faq.md#how-do-i-elide-the-library-in-my-advanced-builds
It looks like it’s not possible to require a function from cjs/es6 module if that function is a default export. Meaning that the namespace becomes a function itself. Is there a way around? I could re-export default export as named export from another module, but maybe there’s a better way.
@roman01la: seems like a generic question about ES6 module support, probably something you can ask on the Closure mailing list if you don’t get an answer here
@dnolen: Sorry, I don’t think it’s a problem of GCC. The problem that I described is more about CommonJS modules and it seems like there’s no really way around it. Because that’s how CJS exports work. But there’s a weird thing is going on with ES6 default exports. Let’s say I have the following ES6 module:
function a() { return 1;}
export default a;
When compiled, a value of var a
will be assigned to default
property of a namespace object. But when I try to require that namespace in ClojureScript and call default
var from it (`(lib/default)`), in compiled JS output it looks something like this: module$lib$default$.call()
. Notice that a symbol $
was appended to default
, but it should be just default
, because that’s where the var is assigned.Not sure I’m explaining this well...
@roman01la: oh hrm this may be something we want to tweak in munging then
currently we munge based on ECMA-262, we should probably respect the language settings
@jonathandale: nice to see you on a cljs thread!
@jamieorc Yep, almost finished a side-project in re-frame, and started to work on a cljs project at work. Enjoying it.
I have a single function which doesn't use any clojure specific stuff. How would I build a js lib out of it, so I can call it in js? It's in a clojure backend, but I need to use it for another project in the front end
@base698: I don’t quite understand how exporting clojurescript function to be visible from javascript can potentially have anything to do with words “clojure”, “backend” and “own directory”. If you have clojurescript function and you want it to be visible from javascript under :advanced optimzations use ^:export metadata to tell compiler to preserve its name
I have a clojure function, it's in a clojure project. the algorithm in said clojure function needs to be run from javascript, so i need to have some way to take just that one function, compile it to JS and run it from another app
so options are: make a cljs build separately, with another dir structure and when I run that copy just the one function into it, do the build, import that build from another project
right now I ship the clojure jar to artifactory, i'd make a separate deploy job that shipped the js somewhere else
then you have three tasks at hand: 1) turn that clojure function into clojurescript function (even if it means just renaming the file extension from .clj to .cljs) 2) compile clojurescript project using your favorite tooling and produce javascript file(s) 3) make sure that selected clojurescript functions are exported as javascript API
this will open a possibility to write platform-dependent parts using reader conditional (if ever needed in the future)
hello all, what is the diff from '(defn contact [c] [:li [:span (display-name c)] [:button {:on-click #(remove-contact! c)} "Delete"]])' and '(defn contact [c] [:li [:span (display-name c)] [:button {:on-click (remove-contact! c)} "Delete"]])' What is the use of #?
The hash # creates another function. The first version means function () { remove-contact! c} and the second means run remove-contact! c
now.
You can see the difference when the code is expanded
user=> (macroexpand-1 '#(remove-contact! c))
(fn* [] (remove-contact! c))
user=> (macroexpand-1 '(remove-contact! c))
(remove-contact! c)
Has anyone come up with a way to provide a convenient console.log
fn? I have this…
(defn log [& args]
(.log js/console (clj->js args)))
But it has the downside of not mapping properly to the invoker, so I can’t inspect the source and find who is doing the logging.@lwhorton: I guess a macro could help here
@dnolen: Regarding CLJS-1620, can you give any context on where to start? I’m pretty new to ClojureScript compiler. I guess :module-type
information could be used to control munging.
@base698: I'm not certain I understand, but it sounds like you are talking about cljc. If you have a namespace in a cljc file, both clojure and clojurescript can require it. You can use the conditional reader to add code specific to the target language.