Oh, my bad, you meant send action to the child. I misunderstood.
I prefer a different pattern for that.
In Callout.elm create a function that takes the message and does the
update.
notify: Notification -> Model -> (Model, Cmd Msg)
notify notification model =
update (Message notification) model
and in the parent call it like
(callout', cmd) = Callout.notify notification model.callout
This way you don't need to expose the tags of your Callout.Msg
Alternatively you can go the React route and prop the view
In Callout.elm have
type alias Props =
{ notification : Notification
...
}
viewWithProps : Props -> Model -> Html Msg
viewWithProps props =
...
It depends a lot on what you want to do with the notification.
If it's just a CSS animated thing that doesn't change, you can go the props
route, if you need to start an animation when the Notification arrive, you
need the first version.
On Wed, May 25, 2016 at 4:16 PM, TheGryzor123 <[email protected]> wrote:
> Isn't this example a child to parent communication example instead?
>
> What I did for my parent to child communication issue is simple: In the
> main update I called the child update function like this:
>
> callout', cmd) = Callout.update (Callout.Message notification)
> model.callout
>
> It does the job and is pretty clean I think.
>
> --
> 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.
>
--
There is NO FATE, we are the creators.
blog: http://damoc.ro/
--
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.