This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-02
Channels
- # admin-announcements (33)
- # announcements (2)
- # beginners (75)
- # boot (340)
- # braid-chat (6)
- # cider (30)
- # cljsrn (44)
- # clojars (19)
- # clojure (169)
- # clojure-austin (12)
- # clojure-czech (1)
- # clojure-japan (6)
- # clojure-miami (1)
- # clojure-poland (7)
- # clojure-russia (83)
- # clojurebridge (4)
- # clojurescript (166)
- # community-development (55)
- # component (2)
- # core-async (39)
- # core-matrix (3)
- # cursive (32)
- # data-science (3)
- # datavis (3)
- # datomic (58)
- # dirac (28)
- # emacs (4)
- # events (7)
- # hoplon (254)
- # immutant (29)
- # jobs (2)
- # jobs-discuss (4)
- # ldnclj (35)
- # lein-figwheel (3)
- # mount (202)
- # off-topic (9)
- # om (123)
- # onyx (22)
- # parinfer (112)
- # proton (11)
- # re-frame (6)
- # reagent (43)
- # ring (3)
- # spacemacs (2)
@danielcompton: you can setup a custom warning handler, example of one that turns warnings into errors here: http://jakemccrary.com/blog/2015/12/19/clojurescript-treat-warnings-as-errors/
@jakemcc: perfect, thanks!
I'm curious why http://todomvc.com/ doesn't link directly to an Om or Reagent implementation. Did I miss that? Anyone know why not?
@ion i put it under reagent to allow for Om and other libs to be added (and not steal the parent name of clojurescript for just reagent)
I didn't notice it at first, and even screen didn't help immediately. But then I may just be blind P ;
I definitely think itd get more traffic with clojurescript in the name. As an aside, there is an open bug with chrome relating to that example. So if it looks like the example doesnt work... https://github.com/tastejs/todomvc/issues/1546
Anyone have any suggestion for a way to do js/setInterval
and js/setTimeout
in a Reagent webapp?
The simplest answer seems like doing a Form3 and creating it in the mount callback and removing in the unmount callback.
@jaen: I need to repeatedly call a function to check if two separate inputs on a server are the same.
@trancehime: this kind of machine may be easier to program if you have core.async
@jaen: It just occur on one view.
@val_waeselynck: Hmm... Would take me too much time to rewrite using core.async sadly, since I'm expected to pull something off in about an hour or so
It wouldn't be hard with core.async
, really, but if it only happens in one view, then just using a Form3 will be simpler
Form3 component it is?
(defn thing-with-interval [callback interval]
(let [interval-id (reagent/atom nil)]
(reagent/create-class
{:component-did-mount (fn [component]
(swap! interval-id #(js/setInterval callback interval)))
:component-will-unmount (fn [component]
(js/clearInterval @interval-id))}))
Hmm. Okay
And I guess the callback
is the function I want to do every interval
.
Same concept if I want to use setTimeout
?
(also you can probably lose #(...)
in that example and it'll probably still work; I did it that way because I was not 100% sure about semantics of js/whatever
)
anyone know how to declare multiple values for the same attribute in Garden ?
Is there ClojureScript documentation somewhere, in the style of the Clojure docs, function-by-function?
Most of it is the same, but there are a few differences, and I'm not sure where they're best documented
For instance, is there a documentation set that includes clj->js
? I only know it from wiki pages and blog posts.
Zeal has support for cljs too, if you want offline docs
Really how do you import cljs docs in Zeal? I haven't been able to figure that out.
would requite a little bit of work to make Tom Falhauber’s autdoc work for CLJS - JIRA ticket for that
is anyone integrating datascript with reagent/re-frame? is it possible to 'outsource' part of the app state atom to a datascript instance?
anybody else notices slower re-compile times with .cljc? I'm not sure that's the problem, but I moved half of my codebase from .cljs to .cljc and compile times went from 0.3-0.5 to 5s...
@peeja there is also http://clojurescript.io if you want to try your code right away as well (not all are documented in the main panel but doc
works for the others)
@richiardiandrea: Ooh, neat!
@rm: I haven't used it, but I'm imagining filling it with some data and being able to update re-frame's app state db with the results of different queries, hopefully reactively so that when a certain query's results change, the app state db key would be updated
@spinningtopsofdoom: I think you can download the latest docset from https://github.com/cljsinfo/cljs-api-docs/releases , and unzip it into ~/.local/share/Zeal/Zeal/docsets/
thanks!
@pandeiro: you can definitely achieve something like that, but datascript queries are not themselves reactive. I.e. you’d have to re-run all your queries after each change to find out which ones changed. For simpler use-cases you can pattern match transactions (via listen!
)
much appreciated @jthomson -- still lacking fundamental understanding of datascript here
this is more of a react question than a clojurescript question, but is there any reason i can't mount my entire reagent application into my <html>
element? then i can mess about with tags in the <head>
and stuff
A Linode outage is affecting Clojars: http://status.clojars.org/incidents/pdpppjllmjff
@jaredly: duh, of course; because swap!
will pass the current value as the first argument and mess up the call. Thanks for being vigilant, lack of sleep doesn't do correctness any good : V
Compensating for lack of social life ;' ) But in all seriousness - why not help out if I can? I don't lose nothing on that, someone might gain some knowsledge (unless I mess something up like here), slack fulfils it's purpose.
If you need to use library the has CommonJS modules (or other kinds of modules) you need to use webpack/browserify/something else like that to compile the modules out and using the resulting file as a foreign lib.
@frank: this blogpost sounds like it could help you - https://rasterize.io/blog/cljs-dynamic-module-loading.html
unfortunately I don't think closure modules will help here 😕 I'm trying to write a macro that conditionally requires a namespace
can Om now render seqs of components?
I remember it not working before
@ericnormand: there’s an #C06DT2YSY channel - and yes it can
oh, sorry!
I'm traveling the next couple of days so I'll hopefully get a bunch of time to read it. Good timing!
@dnolen: have you heard any reports that sizeable codebases in .cljc take much more time to compile than in .cljs? I'm not sure what's happening to my code...
does anyone know of a good resource for getting started with npm module / cljs interop?
@asolovyov: haven’t heard anything like that
@asolovyov: and would have seen that in self hosting anyways
I'm in the middle of converting my codebase to .cljc and incremental compile time is 5s now
hmm... well, I did to rum what this guy at clojure/conj did with foam, and now am converting my site to .cljc so I can render it server-side in clojure
but... well, my compile time skyrocketed and it seems like it picks up more stuff to recompile than it needs to
@venantius: I guess so!
might be worth trying out a pure compilation process, as @dnolen seems to be suggesting
@asolovyov: just make make a tiny build script only using the standard auto watch feature
@asolovyov: Are you planning to open source your foam-rum library at some point? Aside from the compile time, how's the rest of it going?
@shaun-mahood: https://github.com/tonsky/rum/pull/56 - that's just a pull request!
you can even try it out for yourself by adding this to dependencies: https://clojars.org/ua.modnakasta/rum
Really cool that it's just a PR. I'll have to take a look at it!
@shaun-mahood: so far I'm quite happy, it seems I can generate html necessary for react to pick up on small apps and now I'm converting all my code so that I can validate idea against my main app
the only thing that bothers me is that sizeable page generates html data structure in 0.8ms, but then my (hiccup-based) html renderer takes 20-40ms to convert that to a string 😕
I've tried hiccup then (because I thought that maybe I failed something) and it turns out that it's slow like that... And it's fast only when it can pre-compile stuff with macros, so maybe that's the way to go... Ideally I see modifying sablono to render this stuff on the server should be the way to go. Not sure if that will speed anything up though :))
Does 40 ms make a big difference to your site? Seems like it's still pretty fast compared to most websites I visit.
Thanks so much for the stickers @chrisoakman!
@shaun-mahood: well, I guess I can live with that! 1) it'll still be faster than just rendering in the browser; 2) node.js rendering takes about the same; 3) if I skip user-related components on the server I can cache so hard it'll scream
@asolovyov: You should do a blog post (or talk) at some point on the real world application of it - seemed like a great idea but I'm not sure anyone else has put it into production on a large site yet.
@asolovyov: Are you coming over for Clojure/West or the Conj again this year?
@shaun-mahood: I don't know, it costs quite a bit of time and money for me to come there So yeah, depends. I'll surely go to Polyconf, but I guess that will cost quite a bit of money for you
last year's trip was close to 2k$ in budget for a week in USA... I liked the experience but not sure I'll repeat this year
Yeah it's definitely a long way for you - that's not that bad for cost though. Mine was about $1500 (flight, hotel and meals) for 5 days, so you must have gotten a pretty good deal.
I did, actually. Flight was really cheap (a bit less than 500$), and hotel we've found was on some promotion, so yeah, it was very cheap
Crazy, you paid less for the flight than I did.
😄 when I told my friends how much I've paid they practically murdered me, usually it costs ~800-900 if you're buying in advance. I don't know why it was that cheap, that was the reason I've came to clojure/conj though: couldn't skip when the flight is that cheap
@slester: you're welcome!
shaun-mahood: I gave a talk about doing server-side rendering at the conj: https://www.youtube.com/watch?v=fICC26GGBpg
@arohner: I was in the audience, it was really interesting! I'm hoping that at some point in the future it will become a fully baked part of Om.Next (or Om.Next.Next).
I don't fully understand if this is potentially a duplicate of http://dev.clojure.org/jira/browse/CLJS-884, or maybe a unique issue.
I was trying to come up with a repro that does not involve core.async
(as per the instructions at https://github.com/clojure/clojurescript/wiki/Reporting-Issues), but I am getting a little lost in the core.async
macros.
using with-redefs
with core.async doesn’t make a whole lot of sense to me - though I suppose it could be made to work
@asolovyov: We’ve been working on that as well. Server renders the initial HTML for fast first paint and then the browser takes over rendering if/when react boots up. That allows for offline and every other page load is only 2k instead of 200k to send HTML. https://medium.com/@puppybits/letting-people-in-the-door-how-and-why-to-get-page-loads-under-2-seconds-340c487bd81d#f653
@peeja - no. You can use javascript’s promises, or use a wrapper library such as promesa
I guess you can’t have/shouldn’t have the same semantics, since you’re not supposed to block in javascript …
Yep, Clojurescript is light on the state/multithreading part due to differing semantics between JVM/JS VMs
@peeja: incidentally - using React? If so which wrapper? I imagine with reagent you could use a ratom for values that will be evaluated in the future.