I am confused about the role of the owner in om and how I can make the following component reusable.
I have this component that renders two textboxes: https://gist.github.com/dagda1/b8a04c7516b62ea0eb46 On line 23 https://gist.github.com/dagda1/b8a04c7516b62ea0eb46#file-dash-cljs-L23 I render an input of type text that gets updated when an async call completes in IWillMount and works as I expect. I tried to abstract this into a component https://gist.github.com/dagda1/0eed04662a90db2e4a66. One thing I have noticed which confuses me when calling om/build, is that you never pass the owner in, for example I am calling it like this: (om/build ui/text-box data {:opts {:value :title}}) But the component func has a signature like this: (defn text-box [state owner {:keys [value]}] So the framework must be supplying the owner, the docs say that the owner is the backing Om component so would that be the text-box in this case? Also this line will never resolve https://gist.github.com/dagda1/0eed04662a90db2e4a66#file-component-cljs-L13 because I am guessing the owner is different. So what is the best way of making this component reusable and updating when the property resolves from the calling component? Would I need to set up a core.async channel and listen for events and update the node's value? That seems a bit verbose for a simple case, is there a way of binding the two values together? Is there one-way binding in om that could accomplish this in a neater fashion? I am coming to om from workign with ember a lot and I'm probably still thinking in terms of bindingings. Can anyone suggest a way to keep this as reusable as possible or how to approach this seemingly common problem in om? -- 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.
