This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-12
Channels
- # alda (3)
- # beginners (17)
- # boot (157)
- # cider (15)
- # cljs-dev (30)
- # cljsjs (4)
- # cljsrn (5)
- # clojure (70)
- # clojure-austin (3)
- # clojure-canada (2)
- # clojure-colombia (1)
- # clojure-czech (1)
- # clojure-dev (27)
- # clojure-greece (34)
- # clojure-japan (6)
- # clojure-russia (114)
- # clojure-sg (3)
- # clojure-uk (8)
- # clojurescript (63)
- # cursive (9)
- # datomic (40)
- # devcards (11)
- # euroclojure (4)
- # events (8)
- # hoplon (61)
- # incanter (1)
- # instaparse (16)
- # jaunt (6)
- # jobs (6)
- # jobs-discuss (52)
- # ldnclj (1)
- # leiningen (2)
- # off-topic (3)
- # om (73)
- # onyx (101)
- # overtone (25)
- # re-frame (18)
- # reagent (6)
- # ring (7)
- # ring-swagger (36)
- # spacemacs (5)
- # sydney (1)
- # untangled (41)
- # yada (6)
iwankaramazow: yeah, it seems to be just the linux build of firefox. ran fine on my mac, though I didn't try safari yet.
hey folks, using go channels for communication between components is still the way to go?
@pellegrino: not in om.next. There you use transactions (`om/transact!`) and let the components synchronize through re-rendering with the updated state.
thanks for the tip! would it make sense for a clojurescript/om newbie to jump straight to om.next then?
that’s what I’m doing, but I got to a certain point where the queries were confusing me, so I’m doing the Learn Datalog tutorial to make sure I understand them better. (http://www.learndatalogtoday.org/)
I’m also coming from having a bit more work with reagent, which is helping — it helped me unlearn jQuery-style design
@pellegrino: Definitely over learning om.now. Having the app-state represented as a graph is hard to grok initially. I suggest you get very comfortable w/ ClojureScript first and read how datomic pull queries work. Then look into https://github.com/awkay/om-tutorial
That tutorial (https://github.com/awkay/om-tutorial) hasn't been updated since Feb. Has om.next changed much in that time? I was under the impression that om.next was still in early development.
@ivanreese: for some flexible definition of “early” development
after merging in @anmonteiro PR for query updates & wrapping up error handling it will probably go beta
Cool to know a beta is impending. Since I have your attention — I'm going to start learning om.next this morning. Is the wiki the best place to start?
@ivanreese: and asking questions here
I most certainly will be.
Thanks for the warning.
Short question. I noticed that when using js/interval on transact! for changing slides in a slideshow caused my cpu usage to skyrocket. So I'm trying now to see if using local update-state and get-state for changing slides. But what happens now is that the interval time of 4secs is seemingly ignored and I get a slideshow so fast that it envokes epilepsy attack so clearly something is wrong. Maybe I post a snippet...
(defui Image-slider
Object
(componentWillMount [this]
(js/setInterval #(om/set-state! this {:index (mod (inc (om/get-state this :index)) (count (:slides @app-state)))})) 40000)
(render [this]
(let [{:keys [last-index index slides]} (om/props this)]
(create standard #js {:defaultStyle #js {:x (:width (slides last-index)) :y (:height (slides last-index))}
:style #js {:x (spring (:width (slides index)) #js {:stiffness 20 :damping 20})
:y (spring (:height (slides index)) #js {:stiffness 20 :damping 20})}}
(fn [i]
(dom/div nil
(dom/img #js {:id "image-container" :className "img-main img-responsive"
:src (:photo (slides (:index (om/get-state this)))) ;;(:photo (slides index))
:width (.-x i)
:height (.-y i)})))))))
@hlolli, is 40000 your interval? Cause it’s sitting outside the js/setInterval function call (it’s being returned for componentWillMount
.
If js/Interval
is causing your CPU to spike, it’s probably cause it was running constantly, with no interval at all.
*`setInterval`
yes @kendall.buchanan you were right. This is fixed now, cpu at 4%, not 60% like before (with transact, but then setInterval was correctly set up).
Actually, so to give a full report of this, animating jpg images is just cpu heavy (at least with react-motion), irrelevant of transact! or update-state!
http://golfhitalausnir.is/ the most intensive cpu slideshow on the internet 😜 ? (its what I mentioned above)
realizing we're still alpha... has anyone looked at updating something like https://github.com/taylorSando/om-material-ui for om.next?
although for that matter... it looks like it only uses om-tools.dom
from the om dependency, so maybe it's trivially updateable?
I picked on material-ui because that's the first one I was looking at, but the same situation applies to bootstrap-cljs
You should be able to use http://cljsjs.github.io/ to grab javascript dependencies. You can just use something like react-bootstrap.
yeah, I was just looking into how bootstrap-cljs does its thing. And there is indeed a react-mdl
on CLJSJS.
Here is how I created an input element with react-bootstrap:
(defn -input [opts & children]
(apply js/React.createElement js/ReactBootstrap.Input opts children))
opts would have to be a javascript object, so you would have to do #js or clj->js to the opts before sending, or change the -input function to make the conversion
I guess it's not strictly an om question at this point, though .. I'm just not grokking how e.g. bootstrap-cljs makes that magic happen yet.
They would just do it as a macro. You can generalize how I created that input element with a macro. The only thing that needs to change are the -input, and the js/ReatBootstrap.Input names.
The macro can define functions that are used by cljs.
Well looking at https://github.com/luxbock/bootstrap-cljs/blob/master/src/bootstrap_cljs/core.cljc, there is a macro that calls a function that makes macros.
right, that's what I was looking at, and it makes perfect sense. I just couldn't figure out why that was running when compiling the file as cljs.
my naive brain sees the reader conditionals and mentally elides the forms for cljs, that is.
The cljs calls using bootstrap/input are macro calls that get converted at compile time.
that's clear; I'm just not understanding what causes core.cljc
to run through a clj compile pass (to create the macros) before the cljs pass
Hey everyone, I thought I would share my om next app since its in a mostly working state. http://thescratchcastle.com/koeeoadi/ . Would appreciate any feedback if you have any.
Yeah looks great. What do you use for css? I'm interested in how you get all those effects...
I come from a Desktop background so css is a bit new to me. I'm using Semantic UI at the moment, which is great because no work to get things going. However I don't think it is great for building your own components. So at some point I'm thinking to go to something like basscss - or use another lightweight set like skeleton.css - when I 'get into' css. Will be interesting to see what people start to use with Om Next...
Your color picker is a component of some sort thou.. (from one of your commit messages I worked that out).
cjmurphy: yeah, chrome's native color input doesn't handle change events correctly so I had to use the color picker in the google closure library.
I was just looking over some of the closure. demos. I sometimes forget there is a bunch of ui components in the google closure library. https://google.github.io/closure-library/source/closure/goog/demos/
@hueyp: I know it’s been a few days, but I’m finally seeing how useful recursive parse
is. In fact, I’m finding myself using it a lot. Is that a sign I’m not setting up my queries correctly?
Hehe, awesome, thanks.