A Ui component can't render other Actors.
type alias Model =
Int
type MsgIn
= Increment
| Decrement
type MsgOut
= NoMsgOut
component : Ui (Html msg) Model MsgIn MsgOut msg
component =
{ init =
\_ ->
( 0, [], Cmd.none )
, update =
\msgIn model ->
case msgIn of
Increment ->
( model + 1, [], Cmd.none )
Decrement ->
( model - 1, [], Cmd.none )
, view =
\toSelf model ->
Html.div []
[ Html.button
[ Html.Events.onClick <|
toSelf Decrement
]
[ Html.text "-"
]
, Html.text <| String.fromInt model
, Html.button
[ Html.Events.onClick <|
toSelf Increment
]
[ Html.text "+"
]
]
, subscriptions = always Sub.none
, events = System.Event.ignoreAll
}
{ init : ( System.Process.PID
, Json.Decode.Value ) -> ( componentModel
, List componentMsgOut
, Platform.Cmd.Cmd componentMsgIn )
, update : componentMsgIn -> componentModel -> ( componentModel
, List componentMsgOut
, Platform.Cmd.Cmd componentMsgIn )
, subscriptions : componentModel -> Platform.Sub.Sub componentMsgIn
, events : System.Event.ComponentEventHandlers componentMsgIn
, view : (componentMsgIn -> msg) -> componentModel -> output
}
The Type of an Ui Component
toActor : Ui output componentModel componentMsgIn componentMsgOut (System.Internal.Message.SystemMessage address actorName appMsg) -> { wrapModel : componentModel -> appModel, wrapMsg : componentMsgIn -> appMsg, mapIn : appMsg -> Maybe componentMsgIn, mapOut : System.Process.PID -> componentMsgOut -> System.Internal.Message.SystemMessage address actorName appMsg } -> System.Actor.Actor componentModel appModel output (System.Internal.Message.SystemMessage address actorName appMsg)
Create an Actor from an Ui Component