Header menu logo Mibo

ElmishLoop<'Model, 'Msg> Type

The shared message-processing loop used by every Mibo host (RaylibGame, HeadlessRunner, future backends).

Owns all mutable loop state: the dispatch queue, current model, active subscriptions, deferred-effect buffers, and the fixed-step accumulator. Hosts call ElmishLoop.Init once after registering backend services, then ElmishLoop.TickFrame each frame.

Instance members

Instance member Description

this.Context

Full Usage: this.Context

Returns: GameContext voption

The GameContext passed to ElmishLoop.Init, if initialized.

Returns: GameContext voption

this.Dispatch

Full Usage: this.Dispatch

Parameters:
    msg : 'Msg

Dispatch a message into the loop's queue.

msg : 'Msg

this.DisposeSubs

Full Usage: this.DisposeSubs

Dispose all active subscriptions. Hosts should call this on shutdown.

this.Init

Full Usage: this.Init

Parameters:

Initialize the loop: store the context, call the program's Init, execute startup commands, and start initial subscriptions.

Call exactly once, after the host has registered backend services.

ctx : GameContext

this.Model

Full Usage: this.Model

Returns: 'Model

The current model state.

Returns: 'Model

this.ShouldQuit

Full Usage: this.ShouldQuit

Returns: bool

Whether the loop has received a Cmd.Quit signal.

Returns: bool

this.TickFrame

Full Usage: this.TickFrame

Parameters:
    elapsed : TimeSpan - Frame delta (e.g. TimeSpan.FromMilliseconds(16) for 60fps).
    gameTime : GameTime - The current game time, supplied by the host.

Returns: bool true if any messages were processed this frame; false otherwise.

Advance the simulation by one frame: drain deferred effects, run fixed-step, dispatch the tick message, process all queued messages, and update subscriptions if any messages were processed this frame.

Subscription re-evaluation is keyed on "messages were processed" rather than "the model is structurally different", because Mibo permits in-place mutable models (e.g. a class whose fields are mutated by each system) whose Update returns the same reference every frame. Reference or structural equality would never detect a change for those models.

elapsed : TimeSpan

Frame delta (e.g. TimeSpan.FromMilliseconds(16) for 60fps).

gameTime : GameTime

The current game time, supplied by the host.

Returns: bool

true if any messages were processed this frame; false otherwise.

Type something to start searching.