This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-07
Channels
- # 100-days-of-code (1)
- # announcements (10)
- # aws (2)
- # beginners (134)
- # calva (25)
- # cider (29)
- # cljs-dev (43)
- # clojure (130)
- # clojure-dusseldorf (3)
- # clojure-italy (27)
- # clojure-nl (48)
- # clojure-spec (32)
- # clojure-uk (63)
- # clojurescript (75)
- # core-logic (5)
- # cursive (18)
- # datascript (2)
- # datomic (37)
- # emacs (5)
- # figwheel (13)
- # figwheel-main (55)
- # graphql (1)
- # java (7)
- # jobs (11)
- # jobs-discuss (19)
- # juxt (1)
- # leiningen (16)
- # luminus (10)
- # mount (3)
- # off-topic (40)
- # om (1)
- # onyx (1)
- # pedestal (7)
- # re-frame (40)
- # reagent (81)
- # ring (2)
- # shadow-cljs (32)
- # spacemacs (5)
- # testing (1)
- # tools-deps (48)
Anyone know a lightweight/good lib for doing modals in cljs (im using rum)?
@marcin.k.chmiel do you mean lower cased attributes?
is there a framework or tool to build webapps and mobile app from a single code base (using react.js)
reactnative
For those curious about Matrix, I discovered one more intro piece (for lifecycle stuff ala Component) was integral to the whole Matrix idea. Never really thought about it as special, but looking at Component made me realize a carveout intro was mertited: https://github.com/kennytilton/matrix/tree/master/cljs/fluxchallenge
Now mebbe I can start on some formal doc.
Thanks. So a website front-end written with reagent, could be compiled to a native/mobile app (using re-natal)?
Is there a way to get a cause
of an ex-info
out in cljs? Or you would usually use gobj/get
?
Ok so field access - no helpers like ex-data
, just wanted to make sure I wasn't missing anything
Thanks a lot as usual ;)
If I have a global var in a Javascript file that is imported at the top of a Clojurescript file, how come I can't see that global var in clojurescript? It says it's not defined.
I need to convert uint16array to js array with js objects, basically #js ["a" "b" "c"] => #js [ #js {:value "a" :index 0} #js {:value "b" :index 1}], there's a plotter library I'm using that needs the data this way. With reduce I get the uint array is not seqable. Maybe loop
is a good tool for this?
How come Object.keys(jsonObj) is returning "0", "1", ..., "5", rather than the keys of the JSON object?
@john you should have been 2 min quickler, good to know about areduce, probably more perfomant than what I did here
(defn arraybuffer-to-data [arrbuf]
(let [length (.-length arrbuf)]
(loop [index 0
out-arr []]
(if (< index length)
(recur (inc index)
(conj out-arr #js {:value (aget arrbuf index)
:index index}))
(clj->js out-arr)))))
ok, then I grab the reader macro in the last step there. Just can't think of good conj
alternetive in js, of course muteable fluff like push, which I'd avoid like fire in cljs.
But if you're going from js arrays to js arrays, it'll probably be hard to beat the speed of just using some interop, instead of converting back and forth.
areduce and amap don't convert things, so they'll be pretty fast. But there's plenty of native interop fns to accomplish that too
yes, I guess this version is bit faster
(defn arraybuffer-to-data [arrbuf]
(let [length (.-length arrbuf)
out-arr #js []]
(loop [index 0]
(if (< index length)
(do
(.push out-arr #js {:value (aget arrbuf index)
:index index})
(recur (inc index)))
out-arr))))
areduce high on the list to try out@hlolli try banging on this:
(defn ab->data [ab]
(let [na #js []]
(areduce ab i _ na
(.push na
#js {:value (aget ab i) :index i}))))
This is what worked in my repl I think
(defn ab->data [ab]
(let [na #js []]
(areduce ab i _ na
(.push na
#js {:value (aget ab i) :index i}))
na))
There was some chatter that areduce
could beat JS's native .reduce
in some situations, but that was a long time ago. Not sure about these days.
@richiardiandrea ex-cause
oh cool I have never seen that thank you!
if you’re not doing that much pulling in lots of other components probably 70-80K gzipped
clojurescript itself I think is slightly smaller than jquery (?)
saw that in a talk but that might be old/incorrect
but honestly given how people use React components it’s hard for me to even believe people care anything about size anymore
pulling even one serious standalone React component seems to really balloon the payload
@john @hlolli A tidbit slower, but amap
looks simpler
(amap #js [1 2] i a #js {:value (aget a i) :index i})
I am upset that I cannot convince Chrome to display an application/edn
content type
But there's lots of ways to do it. You can do it on the JS side too, then just access it from cljs using js/hi
Be mindful of name clobbering in advanced compilation though. It's sometimes safer to set with (goog.object/set obj "foo" "bar")
I have a javascript file called myGrid.js. In it it has a function which is supposed to retrieve data from the database. I would like for this function to work with a variable called page, and that this variable would get set on every page that loads.
When I define a global var in my myGrid.js file, it is undefined when I try to see it from my Clojurescript file.
Yeah, I'm not sure anyone here is going to be familiar with that grid thing. But, worst case, you could build a repro of the problem you're having, put it up on youtube github (lol), and then others will have more context about what you're trying to do. If you dump too much code in the repro though, folks might not have time to review it, so if you can boil it down to the most minimal repro possible, it may get looked at.
Everything was just working, and now it's not, and i dont know what changed. I tried undoing but it's not returning to a working state. 😞
It's like, I'm including a js file at the top of my cljs file, but none of the printlns are coming out. When they were before. I dont know what changed.
Not sure what it means to include a js file at the top of your cljs file. Could mean a number of things. For others to know, you'd either have to be pedantically specific about what you mean, or toss up a repro. Once you get more used to the environment, you'll have a better handle on what is and isn't implicit knowledge to the community.
What's the reason we need a "runner" ns in ? https://clojurescript.org/tools/testing#running-tests
We don't need that for
doo
also needs a runner ns: https://github.com/bensu/doo#plugin
@xiongtx I think it's a matter of convenience. From what I understand, the latest figwheel.main actually finds your tests for you, without a runner