Skip to main content

Module wasm_runner

Module wasm_runner 

Source
Expand description

Step-based program runner for WASM targets.

WasmRunner drives an ftui Model without threads, blocking polls, or OS-level I/O. Instead, the host (JavaScript) delivers events via [push_event] and calls [step] / [render] from its own animation loop.

The execution model is:

JS animation frame
  → push_event(Event)        // keyboard, mouse, resize
  → step(now)                // drain events, fire ticks, run model.update
  → render()                 // if dirty: model.view → Buffer + optional Diff
  → present the output       // apply patches to WebGPU / canvas

Deterministic record/replay: all inputs go through the event queue with monotonic timestamps from the host clock (performance.now()), so replaying the same event stream produces identical frames.

Structs§

RenderedFrame
Rendered frame output from WasmRunner::render.
StepResult
Outcome of a single WasmRunner::step call.
WasmRunner
Step-based program runner for WASM (no threads, no blocking).