Yeah, I just can't find an easy way to point to that specific element, this
is what my parent component look like:

(defn player [data owner]
  (reify
    om/IDisplayName
    (display-name [_] "MusicoucherPlayer")

    om/IInitState
    (init-state [_] {:position 0 :playing false :yt-state
yt/YT_PLAYER_STATE_UNSTARTED})

    om/IRenderState
    (render-state [_ {:keys [position] :as state}]
      (dom/div nil
        (dom/div nil "STATE: " (:yt-state state))
        (if (playing? state)
          (dom/div nil position)
          (dom/div nil "Paused"))
        (dom/button #js {:onClick #(play owner)} "Play")
        (dom/div nil
          (om/build youtube-player (assoc (select-keys data #{:width
:height :video-id})
                                     :player-vars {:controls 0}
                                     :on-state-change
#(player-state-changed owner %)
                                     :on-time-update #(player-time-update
owner %))))))))

So, since I have a bunch of elements, how do I target that youtube-player
specifically? I could use the findRenderedDOMComponentWithClass from
TestUtils (although I'm not even sure what to pass as the class here), and
that doesn't sound a good solution (also I think would be very slow).

So, I don't see how the parent owner can help me on this issue, can you
please clarify?

Thanks.

On Mon, Jun 8, 2015 at 2:09 PM David Nolen <dnolen.li...@gmail.com> wrote:

> You can always use the React component API directly through `owner` if you
> must.
>
> David
>
> On Mon, Jun 8, 2015 at 12:54 PM, Wilker <wilkerlu...@gmail.com> wrote:
>
>> Hi
>>
>> I'm creating a video player that wraps the Youtube player API, and I'm
>> creating it in 2 layers (one layer just does with Youtube internals, and
>> this one is used by another one that has the controls).
>>
>> On the parent component (the one with the controls) I need to access the
>> owner of the youtube player component, I just can't figure out how to add a
>> ref using om/build
>>
>> (om/build youtube-player {:video-id "abcd..." :ref "player"})
>>
>> The code above doesn't work (since that map is a data and not the props
>> of the component).
>>
>> There is anyway to reference a component built with om/build? I really
>> need that in order to control the player (so I can call the Youtube api to
>> do play/pause/stop/etc...)
>>
>> Thanks.
>>
>  --
>> 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 clojurescript+unsubscr...@googlegroups.com.
>> To post to this group, send email to clojurescript@googlegroups.com.
>> Visit this group at http://groups.google.com/group/clojurescript.
>>
>
>  --
> 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 clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to