SceneManager
Defined in: SceneManager.ts:42
Stack-based scene manager with push/pop/replace semantics.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SceneManager():
SceneManager
Returns
Section titled “Returns”SceneManager
Accessors
Section titled “Accessors”_isMutating
Section titled “_isMutating”Get Signature
Section titled “Get Signature”get _isMutating():
boolean
Defined in: SceneManager.ts:162
Internal
Whether a stack mutation (push/pop/replace/popAll) is running, including
while its lifecycle hooks execute. Lets Scene.paused detect a reentrant
write from inside a hook, which would race the transition’s pause diff.
Returns
Section titled “Returns”boolean
active
Section titled “active”Get Signature
Section titled “Get Signature”get active():
Scene|undefined
Defined in: SceneManager.ts:137
The topmost (active) scene.
Returns
Section titled “Returns”Scene | undefined
activeScenes
Section titled “activeScenes”Get Signature
Section titled “Get Signature”get activeScenes(): readonly
Scene[]
Defined in: SceneManager.ts:147
All non-paused scenes in the stack, bottom to top.
Returns
Section titled “Returns”readonly Scene[]
Get Signature
Section titled “Get Signature”get all(): readonly
Scene[]
Defined in: SceneManager.ts:142
All scenes in the stack, bottom to top.
Returns
Section titled “Returns”readonly Scene[]
autoPauseOnBlur
Section titled “autoPauseOnBlur”Get Signature
Section titled “Get Signature”get autoPauseOnBlur():
boolean
Defined in: SceneManager.ts:67
Pause all non-paused scenes when document.hidden becomes true; restore
them on focus. Default: false. Only scenes paused by this mechanism are
restored — user-paused scenes (manual scene.paused = true or pauseBelow
cascade) are never touched. Blur pause goes through the paused setter,
so affected scenes get onPause on blur and onResume on focus.
Returns
Section titled “Returns”boolean
Set Signature
Section titled “Set Signature”set autoPauseOnBlur(
value):void
Defined in: SceneManager.ts:71
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
isTransitioning
Section titled “isTransitioning”Get Signature
Section titled “Get Signature”get isTransitioning():
boolean
Defined in: SceneManager.ts:152
Whether a scene transition is currently running.
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”_destroy()
Section titled “_destroy()”_destroy():
void
Defined in: SceneManager.ts:314
Internal
Mark the manager destroyed and synchronously tear down every scene. Called by Engine.destroy(). Any queued async work short-circuits on resume; in-flight transitions’ pending promises are resolved via _cleanupRun so they don’t leak.
One-way: the destroyed state is never cleared, matching the engine’s single-use lifecycle. Later push/pop/replace/popAll calls are ignored.
Returns
Section titled “Returns”void
_flushDestroyQueues()
Section titled “_flushDestroyQueues()”_flushDestroyQueues():
void
Defined in: SceneManager.ts:340
Internal
Flush destroy queues for all active scenes. Called by the engine during endOfFrame.
Returns
Section titled “Returns”void
_handleVisibilityChange()
Section titled “_handleVisibilityChange()”_handleVisibilityChange(
hidden):void
Defined in: SceneManager.ts:112
Internal
React to a visibility change. Parameterised on hidden so unit tests can
drive it without a real document.
Parameters
Section titled “Parameters”hidden
Section titled “hidden”boolean
Returns
Section titled “Returns”void
_mountDetached()
Section titled “_mountDetached()”_mountDetached(
scene):Promise<void>
Defined in: SceneManager.ts:284
Internal
Run the full scene-enter lifecycle (beforeEnter hooks, preload, onEnter) for a scene that is NOT placed on the stack. Used by infrastructure plugins like DebugPlugin that render a scene off-stack.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<void>
_setContext()
Section titled “_setContext()”_setContext(
context):void
Defined in: SceneManager.ts:86
Internal
Set the engine context.
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”void
_tickTransition()
Section titled “_tickTransition()”_tickTransition(
dt):void
Defined in: SceneManager.ts:351
Internal
Advance the active transition by dt seconds. Called by Engine’s
earlyUpdate callback with raw (unscaled) wall-clock dt.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
_unmountDetached()
Section titled “_unmountDetached()”_unmountDetached(
scene):void
Defined in: SceneManager.ts:298
Internal
Run the scene-exit lifecycle (onExit, entity destruction, afterExit hooks, scoped-service clear) for a detached scene.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
pop(
opts?):Promise<Scene|undefined>
Defined in: SceneManager.ts:191
Pop the top scene. Scenes below may receive onResume().
Safe to call reentrantly — see push.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<Scene | undefined>
popAll()
Section titled “popAll()”popAll():
Promise<void>
Defined in: SceneManager.ts:264
Pop every scene on the stack, top to bottom. Each receives onExit(). Queued like push/pop/replace — runs after any in-flight transition. Use for “restart from menu”-style flows. Does not run transitions.
Safe to call reentrantly — see push.
Returns
Section titled “Returns”Promise<void>
push()
Section titled “push()”push(
scene,opts?):Promise<void>
Defined in: SceneManager.ts:175
Push a scene onto the stack. Scenes below may receive onPause().
If the scene declares a preload array, assets are loaded before onEnter().
Safe to call reentrantly from a lifecycle hook (e.g. onEnter): the call
is queued on the internal pending chain and runs after the current
mutation finishes. The returned promise resolves once that deferred run
completes.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<void>
replace()
Section titled “replace()”replace(
scene,opts?):Promise<void>
Defined in: SceneManager.ts:227
Replace the top scene. Without a transition the old scene exits first, then the new scene enters. With a transition the new scene is pushed first, both scenes coexist for the transition duration, then the old scene is removed at the end.
Safe to call reentrantly from a lifecycle hook (e.g. onEnter): the call
is queued on the internal pending chain and runs after the current
mutation finishes. The returned promise resolves once that deferred run
completes.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<void>