Maps the given Cmd suppliers to the same value. Usually used like that:
fetchUsers : Model -> Cmd Msg
sendLog : Model -> Cmd Msg
initializeAnalytics : Model -> Cmd Msg
model
|> cmdMap
[ fetchUsers
, sendLog
, initializeAnalytics
]Returns Cmd.none when argument is Nothing, maps it otherwise
fromMaybeMap Ports.log Nothing -- => Cmd.none
fromMaybeMap Ports.log (Just "hello!") -- => Ports.log "hello!" ifThenCmd True x -- => x
ifThenCmd False x -- => Cmd.none fetchUsers : Model -> Cmd Msg
model
|> ifThenCmdMap Model.usersAreNotPresent
fetchUsers ifThenCmd True cmds -- => Cmd.batch cmds
ifThenCmd False x -- => Cmd.noneLike ifThenCmdMap, but with a list of cmds
fetchUsers : Model -> Cmd Msg
serializeData : Model -> Cmd Msg
model
|> ifThenCmdsMap Model.usersAreNotPresent
[ fetchUsers
, serializeData
]Same as PrimaFunction.ifThenElseMap but for Cmds
model
|> ifThenElseMap modelHasError
(Model.toError >> Ports.logError)
(always () >> Ports.logSuccess)Like ifThenCmdMap, but for List of commands
model
|> ifThenElseMap modelHasError
[ Model.toError >> Ports.logError ]
[ always () >> Ports.logSuccess
, Ports.serializeModel
]Like ifThenElse, but batches Cmds
ifThenElseMap model.hasError
[ Ports.logError () ]
[ Ports.logSuccess () ]Create a Cmd that triggers the given msg after n milliseconds
Batches the commands returned by the given functions