Fork me on GitHub
#re-frame
<
2017-05-05
>
mikepence00:05:05

welcome @jeffmad. I am a few weeks past the re-frame decision and enjoying it more as I go.

Oliver George03:05:57

Can someone point me at code to generate a graph of the subs currently in use? I think the active sub cache (`re-frame.subs/query->reaction`) should have the necessary data... feels like it would be a nice way to visualise the plumbing in my app.

mikethompson03:05:46

@olivergeorge Daniel did some work on that with re-frame-trace and the result kinda worked. We used a force directed D3 graph to represent the signal graph from app-db to leaf views. But, to be useful, we realised the graph had to be well organised for it to be helpful. Ie. app-db has to be on the left and all the leaf views on the right (or some other known arrangement) otherwise it was confusing. In the end we ran out of time to make it work. But mid this year, there'll be another attempt.

jfntn04:05:02

Been experimenting with the proposed solutions for https://github.com/Day8/re-frame/issues/255, snippets at the bottom

gamecubate14:05:35

Writing a “thing” that combines re-frame, planck js (physics engine), and SVG rendering. Good performance thus far, though only with 100+ objects. I’ll share on github when refactoring complete, a few days from now. See http://alexr.ca/pages/tests/re-frame-physics/. Rigs are defined with maps, e.g.,

(defn rig-spinner
  "2 discs, joined by a revolute joint"
  [w h]
  (let [hw (/ w 2)
        hh (/ h 2)]
    [{:type "disc"
      :id "rs-d1"
      :cx hw
      :cy hh
      :r 5
      :body-opts {:type "static"}}
     {:type "disc"
      :id "rs-d2"
      :cx (* w 0.7)
      :cy hh
      :r (* w 0.15)
      :body-opts {:angle (u/radians -90)}
      :fixt-opts {:restitution 0.8}
      :view-opts {:eye true}}
     {:type "rev-joint"
      :id "rs-j1"
      :b1-id "rs-d1"
      :b2-id "rs-d2"
      :cx hw :cy hh
      :joint-opts {:enableMotor true
                   :motorSpeed 5
                   :maxMotorTorque 100000}}]))
and are then assembled —
(pl/assemble-in! (rigs/rig-spinner w h) world) 
— and injected into a physics simulation run with re-frame event dispatches and rendered with subs & views. So far, so fun.

gamecubate17:05:06

One thing I need to figure out is the specifying of dispatches & handlers from within a rig specification. That would help turn this experiment into a mini-framework for re-frame driven (game engine) physics sims.

gamecubate17:05:19

(defn my-rig [w h] [{:type "disc" :id "d1" :cx 100 :cy 100 :r 5 :handlers [{:tweet #(tweet! cx cy)}])

mac19:05:33

@gamecubate Very, very nice. The link to your github, does not work, perhaps due to the overlay.

gamecubate19:05:10

Thanks @mac! The link is disabled until the end of the current refactoring. I’ll post when done. Thinking about weekend (lots of rain here) or by Monday.

mac19:05:07

@gamecubate Great stuff, really nice performance.

gamecubate19:05:32

I was a bit surprised too; was expecting SVG + reactive rendering combination performance hits.