HeadlessRunner<'Model, 'Msg> Type
Controls execution of a headless Elmish program with explicit frame stepping.
The runner delegates message processing to a shared ElmishLoop and adds observer notification + virtual time management on top. Call Step or StepN to advance the simulation.
Constructors
| Constructor |
Description
|
Full Usage:
HeadlessRunner(program, ?width, ?height)
Parameters:
HeadlessProgram<'Model, 'Msg>
?width : int
?height : int
Returns: HeadlessRunner<'Model, 'Msg>
|
|
Instance members
| Instance member |
Description
|
Full Usage:
this.Dispatch
Parameters:
'Msg
|
Dispatch a message to the runner.
|
Full Usage:
this.DispatchMany
Parameters:
'Msg seq
|
Dispatch multiple messages at once.
|
Full Usage:
this.Dispose
|
Dispose active subscriptions, observers, and clean up resources. |
|
Total elapsed virtual time.
|
Full Usage:
this.Model
Returns: 'Model
|
The current model state.
|
Full Usage:
this.Run
Parameters:
TimeSpan
-
Tick interval (e.g. TimeSpan.FromMilliseconds(16) for 60fps).
?ct : CancellationToken
-
Optional cancellation token to stop the loop early.
Returns: (GameTime * 'Model) seq
A sequence of (GameTime * 'Model) snapshots, paced by the interval.
|
Run the simulation synchronously, yielding each frame as a sequence.
Uses a spin-wait with
This advances the runner's internal state. Do not mix with
|
Full Usage:
this.RunAsync
Parameters:
TimeSpan
-
Tick interval.
?ct : CancellationToken
-
Cancellation token to stop the loop.
Returns: IAsyncEnumerable<GameTime * 'Model>
An async sequence of (GameTime * 'Model) snapshots.
|
Run the simulation asynchronously, yielding each frame as an async enumerable.
Uses
This advances the runner's internal state. Do not mix with
|
Full Usage:
this.ShouldQuit
Returns: bool
|
Whether the runner has received a Quit signal.
|
Advance the simulation by one frame with the given delta time.
This mutates the runner's internal state (model, game time, subscriptions, deferred commands).
Do not mix
|
|
Full Usage:
this.StepN
Parameters:
int
-
Number of frames to run.
elapsed : TimeSpan
-
Frame delta per step.
|
Advance the simulation by N frames.
This mutates the runner's internal state. Do not mix with
|
Full Usage:
this.StepUntil
Parameters:
'Model -> bool
-
Condition to check after each frame.
elapsed : TimeSpan
-
Frame delta per step.
?maxFrames : int
-
Safety limit to prevent infinite loops.
Returns: bool
True if predicate was met, false if maxFrames was reached.
|
Advance until a predicate on the model returns true.
This mutates the runner's internal state. Do not mix with
|
Mibo