Skip to content

SystemScheduler

Defined in: SystemScheduler.ts:17

Manages ordered execution of systems within each phase, and owns the registration lifecycle: once started, a system added here receives the engine context and its onRegister immediately, and remove calls onUnregister.

Each phase list is replaced, never mutated in place, so a run in progress iterates the array it started with: a system added while its own phase is running first runs at that phase’s next run, and a system removed while its phase is running does not run again.

new SystemScheduler(): SystemScheduler

SystemScheduler

get currentPhase(): Phase | null

Defined in: SystemScheduler.ts:31

Phase whose systems are executing right now, or null outside any phase. Lets code reachable from several phases (input queries, shared helpers) resolve behavior against its calling context instead of assuming one.

Phase | null


get fixedStepIndex(): number

Defined in: SystemScheduler.ts:41

Monotonic count of fixed steps started. During Phase.FixedUpdate it identifies the running step — a frame can run several steps, or none — and between steps it holds the last started step’s number. 0 before the first step.

number

_destroy(): void

Defined in: SystemScheduler.ts:70

Internal

Unregister all registered systems (in reverse, for clean teardown) and detach the context. Called by Engine on destroy. Owns only the registration lifecycle — phase-list membership stays with whoever added the system.

void


_start(context): void

Defined in: SystemScheduler.ts:56

Internal

Attach the engine context and register every system added so far. Called by Engine at startup; systems added afterwards are registered directly by add.

EngineContext

void


add(system): void

Defined in: SystemScheduler.ts:88

Add a system. Sorted by priority within its phase; ties keep add order. On a started engine the system receives the context and its onRegister before it enters the phase list, so a throwing onRegister leaves it unscheduled and unregistered. Added during its own phase, the system first runs at that phase’s next run.

System

void


getAllSystems(): System[]

Defined in: SystemScheduler.ts:144

Get all systems across all phases.

System[]


getSystems(phase): readonly System[]

Defined in: SystemScheduler.ts:139

Get all systems registered for a phase.

Phase

readonly System[]


remove(system): void

Defined in: SystemScheduler.ts:101

Remove a system, calling its onUnregister if it was registered. Removed during its own phase, the system does not run again.

System

void


run(phase, dt): void

Defined in: SystemScheduler.ts:117

Run all enabled systems in a given phase, in the order the phase had when the run started. Wraps each in ErrorBoundary if available.

Phase

number

void


setErrorBoundary(boundary): void

Defined in: SystemScheduler.ts:46

Set the error boundary for wrapping system execution.

ErrorBoundary

void

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/core.md.