This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.0 1.0.1
Extension to the OutMessage package to deal with nested scenarios
version 1.0.2
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.2
Committed At 2018-02-15 16:48:12 UTC
folkertdev/outmessage 1.0.0 <= v < 2.0.0 1.1.1
folkertdev/elm-state 3.0.0 <= v < 4.0.0 3.0.1
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1

README

Extension to OutMessage for nested components

This package is a simple extension to OutMessage for nested components, that is scenarios where the child returns a ChildOutMsg and the parent returns a ParentOutMsg.

This package is meant to function in exactly the same way as OutMessage while handling the transformation of child message to parent message:

-- in update : Msg -> Model -> (Model, Cmd Msg, ParentOutMsg)
-- assuming interpretOutMsg : ChildOutMsg -> Model -> (Model, Cmd Msg, ParentOutMsg)
ChildComponentMessageWrapper childMsg ->
    ChildComponentModule.update childMsg model.child
        -- update the model with the new child component
        |> OutMessage.Nested.mapComponent
            (\newChild -> { model | child = newChild }
        -- convert child cmd to parent cmd
        |> OutMessage.Nested.mapCmd ChildComponentMessageWrapper
        -- apply outmsg changes
        |> OutMessage.Nested.evaluate interpretOutMsg

Health warning

Having nested child modules is a sign that your Elm application is complex and potentially over-engineered. There are perfectly valid reasons for doing so and this package will help you when this is the case. However, you may also consider re-factoring your application to get rid of the nesting and simplify your design.

Thanks

Thanks to folkertdev for the great OutMessage library.