On Wednesday, October 12, 2016 at 4:57:45 PM UTC+1, Rupert Smith wrote:
>
> I think though it might make letting the consumer of the video component 
> customize its control bar difficult. I might like to do something like this
>
> video [ src "http://myvids.com/cute_cats.mpg"; ]
> [ videoControl [] [ button [ onclick Pause ] [ text "pause" ] ] ]
>
> Now how does the Pause action tell the video to pause?
>

Perhaps creating the video component needs to be done by first getting some 
kind of id to reference it by, then passing that id around:

In the model:

init = {
  videoComponent = Video.component
}

In the view:

let
 vidId = model.videoComponent
in
 video vidId [ src "http://myvids.com/cute_cats.mpg"; ]
[ videoControl [] [ button [ onclick Pause vidId ] [ text "pause" ] ] ]

in the update
 
  Pause vidId -> (model, Video.pause vidId)

with 

Video.pause : ComponentId -> Cmd msg

The ComponentId can be an opaque type that has to get passed around and 
through every port call communicating with the component.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to