Cmd Module
Functions for creating and composing Elmish commands.
Commands encapsulate side effects and allow message dispatch back to the update loop. Use commands for async operations, timer callbacks, or any impure work.
Functions and values
| Function or value |
Description
|
|
|
|
|
|
|
|
Defer command execution until the next frame.
In the runtime, deferred commands are executed at the start of the next frame,
before
|
Map a command producing messages of type 'A into a command producing messages of type 'Msg. This is the command equivalent of Sub.map and is required for parent-child composition in nested Elmish architectures where child modules have their own message types.
|
|
An empty command that does nothing. Use when no side effects are needed.
|
|
|
Creates a command from an F# async workflow. The async is started immediately and the result is mapped to a message. If the async throws, the error handler is invoked instead. ## Example ```fsharp Cmd.ofAsync (loadDataAsync url) DataLoaded LoadError ```
|
|
|
Creates a command that immediately dispatches the given message. Useful for triggering follow-up messages from within the update cycle.
|
|
|
Creates a command from a .NET Task. The task result is awaited and mapped to a message. If the task throws, the error handler is invoked instead.
Example
|
Mibo