This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-13
Channels
- # admin-announcements (1)
- # beginners (53)
- # boot (355)
- # braid-chat (4)
- # cider (15)
- # cljsjs (3)
- # clojure (88)
- # clojure-austin (1)
- # clojure-new-zealand (4)
- # clojure-russia (46)
- # clojure-uk (7)
- # clojurescript (61)
- # component (2)
- # cursive (3)
- # data-science (5)
- # datomic (6)
- # dirac (49)
- # editors (8)
- # emacs (15)
- # funcool (15)
- # jobs (1)
- # ldnclj (10)
- # melbourne (1)
- # off-topic (14)
- # om (61)
- # om-next (2)
- # onyx (32)
- # re-frame (28)
- # reagent (19)
- # test200 (1)
- # vim (3)
@amacdougall: I think you won't have that problem if you setPathPrefix
in goog.Html5History
I cant remember if it should be set to "/"
or ""
, but one of them solved this problem before
I can't tell which side client/server my problem is originating, but when trying to get json from my server the value is saved as a string of the response. Anyone have a suggestion as to where to look first? I'm using cljs-ajax. The request looks like (GET "/titles" {:handler pieces-handler :format :json})
The raw response from the server looks like {:id 2, :title "foo"}{:id 4, :title "bar"}
.
@bronsa: are there any plans to include tools.analyzer in clojurescript, or you think it is very unlikely?
hiya... has anyone ever run into the compiler producing the ns dependency order? i'm having a ns with only constants and made sure it's :require
d from everywhere needed. the ns shows up in the final .js file, but only much later after where it's needed first. tried to build a smaller example to reproduce, but w/o success. is there a way to dump out the dependency graph built by the cljs compiler?
@vmarcinko: highly unlikely -- tools.analyzer.js is now really out of date with the current cljs version and I don't really have time anymore to update it. And even if somebody were to do that work, integrating t.a with cljs is really not my call, but @dnolen's
I'm trying to iterate over a sorted-set set with loop. i'm getting the xs with rest and it's returning a list. I need it to stay a sorted-set
@base698: is there a specific reason you're using loop?
i could probably do it in some kind of reduce. it's just handling events sequentially
event more concise: (map do-event events) though do-even can return another even, is there like a map until done?
I'm not 100% certain this is what's happening in your case, but generally when you iterate over collections they are turned into sequences, which are represented as lists internally.
Are you just interested in the side-effect of applying a function to every element in your set?
Or are you trying to convert from "data structure A" to "data structure B"?
seems like you have two things happening: 1) you want something to happen with every item in your set 2) you want to keep your set a set. Is that accurate?
I would recommend using doseq
to "run" your do-event
function
if do-event
needs to "change" your set, then I would separate that "change" into a reduce
does that make sense?
I’m building an sdk browser library that I want other to be able to consume with JS, but I don’t always want to convert js->clj and clj->js on the api. So my current thought is using something like David Nolen’s Mori library to surface an api for cljs datastructures. But I want to avoid having basically two copies of cljs on the browser. Wondering if I can require Mori and forward the API’s through my library thus only compiling one copy of the underlying clojurescript.
@kingoftheknoll: not really sure you can get around this problem like you described
What is the JS API that you are exposing? Would it be natural for a JS developer to pass Objects / Arrays to it?
It would be a CLJS api that I’m exposing, that is a wrapper around a REST api. The product I’m working on allows for plugin type extensibility. I am going to be using the base CLJS library for more CLJS layers on top of it. Like a Reagent app, etc. This part is just the data layer
So a plugin developer could tie into my sdk and build their own pages on mount points I surface to them. And they could use the same data layer that I use for our internal stuff.
So I’m incentivized to keep the date structures cljs.
So that's the "cljs consumed" case, right? And there is a separate, "js consumed" case?
yup, so if someone loads some js code to say run an angular app on a div tag I provide, they may want to get a preprocessed version of “group info” func that does some transforms and coorelates data from several api endpoints. It would return a PersistentHashMap. It would be a bit weird similar to how using ImmutableJS vs literals is weird but they could get all the benefits of clojure and I don’t have to convert at the interface.
Only other options in my mind are surfacing clj->js and js->clj function and/or adding a flag to those functions specifying what format they want
If I were a JS developer writing an Angular app, I'm not sure I would want to have to deal with PersistentHashMap 😉
😃 no doubt. oh if only “extensible everything” wasn’t such a big requirement with our platform.
This is probably more of an API design question than a CLJS question.
What I would do: export JS functions that take and return JS Objects and Arrays
And make them be in camelCase, all that jazz. Make them look like they were written in JS.
I would probably use goog.exportSymbol
and just have them mirror the CLJS functions
that’s a good idea, thanks!
no problem
Here's a conundrum for you, not specifically ClojureScript, but it's something most CLJS webapp devs will confront... let's say I have a single-page app which uses client-side routing. The server-side is set up to interpret <domain>/path/to/app/*
by rendering the app template; anything beyond the wildcard, such as /path/to/app/entries/10
, is handled by the client-side routing. So far, so good.
So what if /entries/10
does not exist? If the client side has to load the CLJS app, then make an API request, then report the results in an error page, that means we return 200 from the original request long before we realize that it's really a 404.
I see two obvious possibilities: I could interpret the route on the server side first, and return a 404 if I have reason to believe the client side would not be able to render it. This involves a fair bit of extra work, and essentially duplicates the routing table. Or I could just... not worry about it. Which is fine for this hobby app, but offends my sensibilities.
With isomorphic/universal apps, I think you’d do what you suggest, eg return a 404 from the server. In this case the front and backend share the routing table.
Package cljsjs/react{,-dom,-dom-server,-with-addons} versions {0.14.{4,5,6,7},15.0.0-rc.1}-0 are now available in Clojars!
React 15 should be mostly non-breaking change for wrappers which work with 0.14 and one interesting change is that it should finally support all SVG tags and attributes: https://facebook.github.io/react/blog/2016/03/07/react-v15-rc1.html
@bpicolo: reagent/re-frame
Yes, frontend moves fast but both Om and Reagent have been around since December 2013 😄
@juhoteperi: what sort do you prefer?
@bpicolo: Re-frame readme is the best documentation even for pure Reagent
@bpicolo: I prefer Reagent.