Hello, I am looking for some advices, critics or ideas to this implementation solution, thanks in advance!
I'm using also for this purpose cemerick/austin besides core.async and swansodette/om Here is a video showing the results: https://dl.dropboxusercontent.com/u/8688858/om-one.mov In the documentation page of clojurescriptone we can read "One of the main goals of this project is to provide the best possible development experience. Clojure developers expect to be able to modify code in a running application and the same should be true when working with ClojureScript." I tried to modify my OM running app code with no success and I found that the OM tendency is thinking the UI compenents as machines https://groups.google.com/forum/#!searchin/clojurescript/OM/clojurescript/QuTjNgVl7do/1ipqt6QG12oJ , so it doesn't seem to be possible to access the components downtree or uptree in other ways than shared-global-data or passing parent-child props on init component phase (but the same component remain during many and different phases) So I implemented the next channel pattern: (>! in-chan [ own-chan {next-channels} ] ) in-chan is a channel that when we build an om component with the om/build fn we pass it on the init-state map options {:init-state {:in-chan (chan (slidding-buffer 1))}} own-chan is the own channel of the om component that uses it to communicate as it's indicated on the om documentation next-channels is a map of next in-channels that the component can use to inject on other components to do the same pattern Then, in the om/IWillMount and om/IWillUpdate the component make this previous call (>! in-chan [ own-chan {next-channels} ] ) Letting the parent component receive the child-own-channel and child-next-map-in-channels. In my case i wrote a macro to use that pattern that "wait-until-ready-inject-value-and-get-next-unready-channel" (defmacro wurivagnuc "wait-until-ready-inject-value-and-get-next-unready-channel" [in out-value the-key] `(cljs.core.async.macros/go (let [[out# s#] (cljs.core.async/<! ~in)] (if (nil? out#) (throw (js/Error. "nil own-channel")) (do (.log js/console "channel available") (cljs.core.async/>! out# ~out-value) (.log js/console (str "channel written with value passed" )) (cljs.core.async/<! (cljs.core.async/timeout 120)) (if-not (nil? ~the-key) (if-let [published# (get s# ~the-key)] (do (.log js/console (str "next channel found with this id" ~the-key)) (cljs.core.async/<! published#)) (throw (js/Error. (str "the key " ~the-key " is not on available published" ))) ) out# )))))) And in my cljs page i can use this "wurivagnuc" macro as follows: (go (>! content-chan :welcome) (-> (wurivagnuc connection-in-channel :connection :connections) (wurivagnuc :tenant :tenant) (wurivagnuc {:endpoints mocks/eps :token-id "xxxxxxxx"} :next-chan) (wurivagnuc {:create-server mocks/create-server :model :create-server} :next-chan) (wurivagnuc [:server mocks/server-created] :next-chan) (close!)) ) Thanks in advance for your comments! Juan PS: This question is the continuation of a previously started question "OM:how can i mock the state of om components once the app is running?" https://groups.google.com/forum/#!searchin/clojurescript/om/clojurescript/hUgii8jSl-E/rv_bwatEKagJ -- 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.
