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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SystemScheduler():
SystemScheduler
Returns
Section titled “Returns”SystemScheduler
Accessors
Section titled “Accessors”currentPhase
Section titled “currentPhase”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”Phase | null
fixedStepIndex
Section titled “fixedStepIndex”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”_destroy()
Section titled “_destroy()”_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.
Returns
Section titled “Returns”void
_start()
Section titled “_start()”_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.
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”system
Section titled “system”Returns
Section titled “Returns”void
getAllSystems()
Section titled “getAllSystems()”getAllSystems():
System[]
Defined in: SystemScheduler.ts:144
Get all systems across all phases.
Returns
Section titled “Returns”System[]
getSystems()
Section titled “getSystems()”getSystems(
phase): readonlySystem[]
Defined in: SystemScheduler.ts:139
Get all systems registered for a phase.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”readonly System[]
remove()
Section titled “remove()”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.
Parameters
Section titled “Parameters”system
Section titled “system”Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
setErrorBoundary()
Section titled “setErrorBoundary()”setErrorBoundary(
boundary):void
Defined in: SystemScheduler.ts:46
Set the error boundary for wrapping system execution.
Parameters
Section titled “Parameters”boundary
Section titled “boundary”Returns
Section titled “Returns”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.