This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-07-01
Channels
- # admin-announcements (1)
- # beginners (16)
- # boot (22)
- # cider (96)
- # clojure (146)
- # clojure-dev (5)
- # clojure-germany (7)
- # clojure-greece (3)
- # clojure-italy (5)
- # clojure-japan (76)
- # clojure-russia (6)
- # clojure-seattle (1)
- # clojure-sg (1)
- # clojure-uk (19)
- # clojure-ukraine (1)
- # clojurescript (114)
- # code-reviews (11)
- # datomic (42)
- # editors (4)
- # euroclojure (3)
- # jobs (18)
- # ldnclj (59)
- # off-topic (1)
- # om (17)
- # reagent (5)
- # yada (43)
Look a ClojureScript livecoding stream: https://www.livecoding.tv/wildermuthn/
which of course ends 2 minutes after posting it 😄
OK: Create a nil version in the app-state, observe that in your component, every time it changes your component will get called.
What do people use in larger ClojureScript applications for splitting the system into components and managing their startup? Any practical advice?
@jrychter: namespaces and libraries? Not quite sure what you mean
@jrychter: for handling run-time state, there is a fork of Component for clojurescript (https://github.com/quile/component-cljs), or you can roll your own with a start/stop protocol or multimethod. If you mean splitting the codebase into separate js files check out http://swannodette.github.io/2015/02/23/hello-google-closure-modules/
@jrychter: very, very early days but you could look at YoYo https://github.com/james-henderson/yoyo
Actually I just figured out they’re easy to see by cloning the repo - no compilation or anything required.
@daniel: I was thinking about something along the lines of Stuart Sierra's component.
@jeluard: cljs.core/uuid
is a fairly recent addition, so maybe.
I'm sure it's been mentioned, but @mfikes cljs ios repl is awesome! https://github.com/mfikes/replete/wiki/Beta
@petrus: if you're still looking for some humanize help, might be useful to you - http://clojurescriptmadeeasy.com/blog/how-to-humanize-text-cl-format.html
How can I pass environment info into a ClojureScript build? i.e. API URL for development vs. production
so it looks like cljs does not expose goog.dom.ASSUME_STANDARDS_MODE
as a compiler option. True? Is that a missed opportunity? The closure book indicates that setting that to true (if you can make that assumption for your app) would reduce compiled code size and improve runtime performance.
I'm puzzled about how I'm converting and sending JSON.
First, I cljs-ajax/POST with {:format :json} to the server, where I thought ring-json/wrap-json-body would convert it back to Clojure before storing in Redis with Carmine. Then, I cljs-ajax/GET with {:response-format :json}, where I thought wrap-json-response would convert back to Clojure, or something. The weird part? As you can see below, I have to use transit-cljs to convert ClojureScript map to JSON and vice versa on the client side, and then use cheshire/(generate-string) server-side.
I'm just sending and retrieving a map. Here's how I POST:
(def w (t/writer :json-verbose))
(defn json-writer [thing]
(t/write w thing))
(defn save-stuff []
(let [value (subscribe [:app-db])
jvalue (json-writer @value)]
(ajax/POST "/submit2" {:params jvalue
:handler handler
:format :json
:keywords? true})))
And here's how I GET, with (generate-string) on the server side:
(def r (t/reader :json-verbose))
(defn json-reader [json]
(t/read r json))
(defn new-merge [response]
(let [new-map (map-reader response)]
(js/console.log new-map)))
(defn get-stuff []
(ajax/GET "/submit" {:handler handler
:error-handler error-handler
:response-format :json
:keywords? true}))
Is this standard, or have I missed something?
@meow: that said the Closure book is from early in the JS engine arms race, the performance stuff may or may not apply. Code size probably, but only if you’re using goog.dom
heavily of course. Which you likely won’t be with a React binding library.
@meow: https://github.com/clojure/clojurescript/wiki/Compiler-Options is a good place to look if you’re looking for a hook for some Closure feature
@dnolen: I did look there but :closure-defines
didn't jump out at me and I guess I lost my focus by the time I got to the bottom of the page. But now I know, thanks.
And good point about the react bindings negating a lot of the goog.dom performance potential.
@meow: yes, but only if you actually use goog.dom
. goog.dom
is not something that’s required by default
so by setting goog.dom.ASSUME_STANDARDS_MODE
at compile time will allow Closure to dead-code eliminate all of its quirks mode support code.
I’d expect cljs.core and other libraries etc. to dominate your final size until your application gets very large.
ran into some issues when trying to trigger xhr events across different event handlers
Reagent with re-frame.
I'm using freagent (with an "f") because it lends itself to this app. Looking forward to om.next.
I played with re-frame a bit and enjoyed it. Looking forward to seeing om.next.
should allow us to quickly move beyond reactive rendering and onto more interesting concerns
yeah I am trying to reimagine some large system done using drupal 7 for a long time friend
I was thinking of graphing all of it first and then building it into a rest / microservices layout
(goog.userAgent/getUserAgentString)
says I'm "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36" which seems like a wild guess
@dnolen: Yep, looked there as well. I'm just picking the low-hanging fruit from the various goog namespaces. Was just surprised at the user agent string.
Im working on my first cljs project, are there any recommendations for a simple lein template with a repl?
@chriscroxton: not the shortest path, but before using a template I strongly recommend learning how to do a basic thing from scratch. It will save you an incredible amount of time later when you inevitably outgrow the template.
@chriscroxton: do you need a webserver? And what text editor are you using?
@dnolen: Working from scratch does make sense as I am new to the language. I am looking at creating a library for http://parse.com, I would need a webserver and I am using IntelliJ with Cursive plugin
same problem! and I use Cursive too
I think this is good place to start if you are going to try Om https://github.com/omcljs/om-cookbook
I will be using Om in my the app, but first I want to create a basic library for the Parse functionality
@chriscroxton: have you worked through the Quick Start?
@dnolen: I have, I was planning on working off that if a template was not recommended
@chriscroxton: good plan
I guess that is the leanest approach which is what I am after
I was asking earlier about which people use and reagent seemed to kind of be the more popular
Well, the number of respondents was rather few. If you look at, say, GitHub stars, Om seems to lead by a long shot.
(IIRC)
Om has a lot stars due to being the first of its kinda over React, there’s was a ton traffic to my blog post on it in early 2014
based on mailing list questions, Slack, and IRC I believe Reagent has a very strong following comparable, if not larger than Om.
Touché!
I haven’t done a project yet in either just read synopsis and it seems like reagent is a bit cleaner
I don’t suppose anyone has an example of injecting a CLJS repl into an arbitrary web page using a static JS script?
the main issue is just making sure the page can load the :output-dir
files from the right place
@arohner: did you want a command-line repl associated with your web page for development, or an interactive repl inside of your web page itself?
@jwm and @ivanreese: I have looked at all of the reactive tools for cljs and they all have their unique characteristics that some folks like and other folks don't. There is #C06DXGSBU for comparing and discussing alternatives.
It's pretty easy to read about each, go through their tutorials and examples, and decide for yourself. Each one helps you learn the overall concepts even better and I don't think it's really a waste of time even if you select a different tool.
Even better, the project maintainers are very mature and there isn't really any feuding or unhealthy competition in this area. If anything, a lot of good ideas are shared among all the projects.
hmm..
I am following Quick start tutorial and got an error here https://github.com/clojure/clojurescript/wiki/Quick-Start#browser-repl
after
>Require your namespace by evaluating (require '[hello-world.core :as hello]).
I got
> java.lang.IllegalArgumentException: Namespace hello-world.core does not exist
only one difference that my project is called om-test
not hello-world
but my namespace in src/om-test/core.cljs
is ns hello-world.core
can I somehow fix that issue without renaming directories?
all previous examples from tutorial work fine