Fork me on GitHub
#hoplon
<
2016-08-20
>
onetom01:08:03

@flyboarder i was trying to make bidi work, but it's a bit too much (~600lines), especially for SPA routing. that's why i went with what hoplon ui. 1. it has one route cell 2. which has a structure like [[:path :segments ...] {:param1 "val1"}] 3. representing #/path/segments/...?param1="val1" 4. and its bidirectionally bound to js/window.location.hash

onetom01:08:14

we agreed to have a convention in our app, so the 1st path element always represents a view or screen as micha calls it and the 2nd path elem represents alternate versions of that screen, which are usually implemented as tabs visually. that's why i defined the following path-cells:

(def current-path (path-cell route [0]))
(def current-qmap (path-cell route [1]))
(def current-view (path-cell route [0 0]))
(def current-tab (path-cell route [0 1]))
so i can independently change these various bits, besides concisely writing code which depend on them

adamw05:08:56

sorry, completely wrong conf

levitanong08:08:15

@thedavidmeister: dang, my reply seems to have disappeared. I like plottable very much, but I needed to zoom-pan an ordinal axis (because I had a lot of categories) and plottable didn't support it, so I had to go back to vanilla d3.

alandipert12:08:42

unfortunately you can't easily tell which nodes in the graph correspond to which cells in the source code, but since i've made this, cljs has begun to support retaining Var metadata. so source code and def names could be available at runtime, and we could potentially then show in visualizations like this

jjttjj15:08:25

I have this timer element and i'm trying to get the timer element todisplay "0:00" before the js/alert fires off, is there an easy way to do this that i'm missing? (countdown cell is seconds remaining)

(defelem countdown [{:keys [countdown-cell] :as attrs} kids]
  (let [interval (.setInterval js/window #(swap! countdown-cell dec) 1000)]
    (cell=
     (when (zero? countdown-cell)
       (js/alert "DONE")
       (.clearInterval js/window interval)))
    (div attrs
         (cell= (pprint/cl-format nil
                                  "~2,'0d:~2,'0d"
                                  (int (/ countdown-cell 60))
                                  (mod countdown-cell 60))))))

jjttjj15:08:59

currently the alert fires while the timer displays 0:01 and only after closing the alert does it show 0:00

micha15:08:33

what about closing it at -00:01?

micha15:08:42

let the countdown go to -1

micha15:08:49

then no race condition exists

micha15:08:37

there must be some amount of time you want to show 00:00 before the alert opens

micha15:08:56

so have the alert open at that amount of time past zero

jjttjj15:08:02

cool, simple but should work, thanks!

alandipert22:08:19

@jjttjj love the cl-format action btw!