This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-28
Channels
- # aatree (1)
- # admin-announcements (5)
- # beginners (5)
- # braid-chat (2)
- # cbus (2)
- # cljs-dev (8)
- # cljsrn (13)
- # clojure (101)
- # clojure-chicago (1)
- # clojure-greece (11)
- # clojure-russia (77)
- # clojure-taiwan (1)
- # clojure-uk (5)
- # clojurescript (73)
- # core-async (5)
- # core-matrix (1)
- # cursive (5)
- # datomic (10)
- # devcards (44)
- # emacs (16)
- # hoplon (207)
- # keechma (5)
- # lein-figwheel (1)
- # leiningen (5)
- # liberator (3)
- # melbourne (1)
- # om (171)
- # onyx (25)
- # parinfer (1)
- # proton (2)
- # re-frame (28)
- # reagent (50)
- # untangled (7)
- # yada (4)
seems like defelem+
accepts cells with kids
and attrs
that will get propagated into DOM through modified appendChild
, etc
@thedavidmeister: have you read my today's ramblings?
@dm3: yeah i saw you mention it ^^ so i put an issue up, because i’ve wondered what they are before
(defc items ["one" "two" "three"])
(defc colors (cycle ["red" "blue"]))
(defc= color (first colors))
(with-interval 1000 (swap! colors rest))
(with-timeout 1000 (swap! items conj "four"))
(defelem+ foo
[{:keys [color]} kids]
(ul
:css (cell= {:color color})
(loop-tpl :bindings [kid kids]
(li kid))))
(html
(body
(div
(h1 "hello world")
(foo
:color color
(p "this is the beginning")
(loop-tpl :bindings [item items]
(p :text item))
(p "this is the end")))))
when you make a defelem+ you basically implement appendChild specially for that element
this is another step toward the ultimate goal of being alble to make custom elements that are equal to native elements in every way
so what's missing from your goal of "being alble to make custom elements that are equal to native elements in every way"?
(defelem text-input
[{:keys [state] :as attr} _]
(let [attr (dissoc attr :state)]
(input :value state :keyup #(reset! state @%))))
but then again when you have 2-way data binding, you only want to establish that at construction time
so when hoplon boots up it reuses the prerendered element rather than creating a new one
could you also take a look at https://github.com/hoplon/hoplon/issues/106 if you have the time?
@levitanong: how's d3 coming?
haven't been checking out hoplon for some time now... So quick question - hoplon prefers things to be set up in static way, but these *-tpl forms are basically adding dynamics, right?
(if-tpl pred?
(do (.log js/console "making div 1") (div "one"))
(do (.log js/console "making div 2") (div "two")))
@micha: that is an amazing summary, should cell conditionals get their own wiki page?
ill throw that on my todo list for today
https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node162.html <-- alan found that
the idea of having a pool of things, some of which are cached and not "visible" at the moment
except for the part that each item in the pool updates according to the mad hatter tea party "everyone move down one" type of thing
like the table is set with the same dishes, but the people move one space to the left or whatever
right sorta like array pop push
where the data just cycles through the positions
gotchya
> It is important to note that vector elements not in the active region are still considered part of the vector.
> An implication of this rule is that vector elements outside the active region may not be garbage-collected.
@micha d3 interop is seamless now. Working beautifully! Thanks man :D
@levitanong: wow that's great news!
Allows me to use more of the built-in d3 stuff. Such a time saver!
Yup! Scales are currently what I'm interested in. Instead of specifying all the arguments in one go, d3 has you call functions to set the parameters. Pretty weird.
I'm thinking of making a defrecord
should be more or less straightforward to hook cell watches up to the hooks that make d3 rerender, right?
Right now I've been using do-watch
a lot
And in cases where I want to watch multiple things for one thing, then I just (do-watch (cell= [a b c]) ...)
Many approaches one could take. Could componentize everything, each encapsulated in a with-let and do-watch, or have one huge do-watch doing more d3-like stuff
@micha im working with firebase promises and im finding that chained promises are not seeing cell changes
@flyboarder: how do you mean?
well for example lets say i have something like...
.then
fires once the previous promise is complete
but after that threading macro if i print user it is there
my problem being i need to create more promises which are not getting the updated values
depending on what type of promise implementation they provide, there may not be any guarantees of the order
it’s supposed to be A+ compliant but who knows
i will double check that
i think i might be better off going to the callback signatures instead
@micha ok i figured it out, so it seems if i intercept the promises with a callback the callback cannot see the cell changes, but other promises can
and a simple test works
i imagine the callback is set when the promise is constructed so at that time the cell has not been modified by the promise yet
hm, not sure, some trickery at play tho 😛