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.
Type Parameters
Section titled “Type Parameters”TCtx
Properties
Section titled “Properties”contextFactory
Section titled “contextFactory”contextFactory: (
info) =>TCtx
Defined in: src/tick-runner.ts:23
Build the per-tick context. Called once at the start of every tick.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”TCtx
getEvents?
Section titled “getEvents?”
optionalgetEvents?: (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.
Parameters
Section titled “Parameters”TCtx
Returns
Section titled “Returns”getWorld
Section titled “getWorld”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).
Returns
Section titled “Returns”onBeforeFlush?
Section titled “onBeforeFlush?”
optionalonBeforeFlush?: (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.
Parameters
Section titled “Parameters”TCtx
Returns
Section titled “Returns”void
onTickComplete?
Section titled “onTickComplete?”
optionalonTickComplete?: (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).
Parameters
Section titled “Parameters”TCtx
Returns
Section titled “Returns”void
scheduler
Section titled “scheduler”scheduler:
Scheduler<TCtx>
Defined in: src/tick-runner.ts:20
source
Section titled “source”source:
TickSource
Defined in: src/tick-runner.ts:21