Skip to content

TickRunnerOptions

Defined in: src/tick-runner.ts:19

Wiring for the tick runner: the scheduler and source to drive, how to build the per-tick context and resolve the world/events, plus optional tick-boundary hooks.

TCtx

contextFactory: (info) => TCtx

Defined in: src/tick-runner.ts:23

Build the per-tick context. Called once at the start of every tick.

TickInfo

TCtx


optional getEvents?: (ctx) => TickFlushableEvents

Defined in: src/tick-runner.ts:29

Pull the game’s event bus off the context for post-tick flushing. Omit it only when the program has no event bus: a bus the runner is not given is never flushed, so its queued events never reach their handlers.

TCtx

TickFlushableEvents


getWorld: () => EcsWorld

Defined in: src/tick-runner.ts:35

Resolve the current world. A function (not a reference) so the runner reads the latest world when the consumer swaps worlds between ticks (e.g. level transition on the turn boundary).

EcsWorld


optional onBeforeFlush?: (ctx, info) => void

Defined in: src/tick-runner.ts:44

Optional tick-boundary hook. Fires inside the post-tick finally, before events.flush() / flushCommands() / lifecycle.flush(). Use this to emit tick-boundary events (e.g. TurnCompleted, FrameCompleted) so they drain in the same flush as events produced by systems during the tick, rather than sitting queued until the next tick.

TCtx

TickInfo

void


optional onTickComplete?: (ctx, info) => void

Defined in: src/tick-runner.ts:50

Optional post-tick hook. Fires after the full ceremony. Receives the final context so the consumer can read back per-tick state mutated by a system (e.g. pendingAction cleared by input handling).

TCtx

TickInfo

void


scheduler: Scheduler<TCtx>

Defined in: src/tick-runner.ts:20


source: TickSource

Defined in: src/tick-runner.ts:21