Hey everyone, I've started experimenting with ClojureScript + OM for a rewrite of a medium-sized Web-App. I started in PlainJS + React/Flux but quickly found myself hacking together things already available in ClJS, so now I'm here.
May I ask for some feedback on the architecture im planning? Especially if I'm missing/violating any established practices: As in Flux, I plan to establish a single core.async channel on which every action the user triggers is published as some kind of tagged event. My first idea was to have components in the hierarchy subscribe to different tags, depending on their level of knowledge. A top-level component would then carry out the actual app-state transaction. This is a variation of the channel based communication shown in the Basic Tutorial[1] except that my approach would rely on a single shared channel and tagged events, instead of different channels for each purpose. Thinking further about the problem I came to the conclusion that separating transaction handling from the component hierarchy would be much more desirable. My rationale for this is that having components update the app-state kind of breaks the unidirectional flow paradigm. Also, I would prefer to have all logical interactions of the UI abstracted away, such that it becomes reusable (maybe for mobile applications). Flux kind of solves this by intertwining Stores with update logic (which is ok I guess, but not possible with an atom). I figured that in CLJS I would simply subscribe functions to the dispatcher channel and have them transact the app-state atom. Since I can't om/transact! on the atom directly, I would like to know if there is a way to pass cursors / create new cursors outside of the component hierarchy? Or can I use swap! instead? Would I be losing anything more than the tx-chan observability (which I really don't want to lose...)? Thank you and please feel free to completely tear apart any of this if it doesn't make sense in CLJS world (which I'm rather new to). [1] - https://github.com/swannodette/om/wiki/Basic-Tutorial#intercomponent-communication -- 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.
