It feels like a horror movie, honestly.
(defn radial-menu [{:keys [menu-choices pos] :as data} owner]
(reify
om/component
(rendering code)
Oh, wait a minute, the choices change (recursive menu) and the position feels
like it should live in the component rather than in the application state. Also
it needs a channel for when it's supposed to change position: Also, I need a
reference to the main application state:
(defn radial-menu [app owner]
(reify
om/IInitState
(init-state [_]
{:phase :closed
:change-position (chan)})
om/IWillMount
(will-mount [_]
(go (loop []
(let [new-pos (<! (om/get-state owner :change-position))]
(om/set-state! :pos new-pos)))))
om/IRenderState
(render-state [this {:keys [pos menu-choices]}]
.........
Hmm, that felt like a lot of boilerplate just to change the position. I should
write a macro for values local to the component that exposes a channel and
changes the value when the channel receives a message, something like
(defcomponent radial-menu
{:vals [:position]
:render-body
(bla bla bla)
}
Wait, that looks like an OBJECT.
Can someone talk me out of this, or is there no way out?
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.