Use these functions to configure your program to run procedures.
Procedure.Internal.Msg msg
Represents the internal Msg
values used to track the state of a procedure.
The type variable refers to the Msg
type used by your application.
You should provide a message type that wraps these values like so:
type AppMsg
= ProcMsg (Procedure.Program.Msg AppMsg)
Represents the internal state used to track running procedures.
You should store this in your application's model like so:
type alias AppModel =
{ procModel : Procedure.Program.Model AppMsg
}
init : Model msg
Generate the model used to track procedures.
update : Msg msg -> Model msg -> ( Model msg, Platform.Cmd.Cmd msg )
Update the state of running procedures.
You should add this to your application's update function like so:
update : AppMsg -> AppModel -> (AppModel, Cmd AppMsg)
update appMsg appModel =
case appMsg of
ProcedureTagger procMsg ->
Procedure.Program.update procMsg appModel.procModel
|> Tuple.mapFirst (\updated -> { appModel | procModel = updated })
subscriptions : Model msg -> Platform.Sub.Sub msg
Get any subscriptions necessary for running procedures.
Add this to your application's subscriptions function like so:
appSubscriptions : AppModel -> Sub AppMsg
appSubscriptions appModel =
Procedure.Program.subscriptions appModel.procModel
Note: You only need to use this function if you are using procedures with channels, i.e. if you have subscriptions in your procedures.