Skip to main content
Defined in: modules/scene/src/scenes-context.type.ts:7 Public surface of SceneLibrary, exposed on Context.scenes.

Properties

current

readonly current: Scene<never> | undefined
Defined in: modules/scene/src/scenes-context.type.ts:9 The scene loaded deepest, if any.

loaded

readonly loaded: readonly Scene<never>[]
Defined in: modules/scene/src/scenes-context.type.ts:11 The loaded scenes, root first.

vars

readonly vars: SceneVarsApi
Defined in: modules/scene/src/scenes-context.type.ts:13 Vars shared by scenes and systems.

Methods

isLoaded()

isLoaded(scene): boolean
Defined in: modules/scene/src/scenes-context.type.ts:44 Whether a scene of this class is loaded.

Parameters

scene
SceneClass

Returns

boolean

load()

load<TParams>(ctx, scene, options?): Promise<void>
Defined in: modules/scene/src/scenes-context.type.ts:30 Moves to a scene: unloads the loaded scenes up to the deepest one it shares with scene’s parents, then loads its missing parents and the scene itself.

Type Parameters

TParams
TParams

Parameters

ctx
Context Handed to the load and unload of the scenes.
scene
SceneClass<TParams> The scene to move to.
options?
LoadOptions<TParams> Its params, and the parent to load it under.

Returns

Promise<void> A promise resolved once the change is made.

Remarks

The change is queued and made when no system runs (see SceneLibrary). A scene already loaded is not loaded again: the scenes under it are unloaded.

Throws

NfSceneCycleException (through the promise) When a scene ends up among its own parents.

unload()

unload(ctx, scene): Promise<void>
Defined in: modules/scene/src/scenes-context.type.ts:42 Unloads a scene and the scenes loaded under it: a move to its parent. Nothing happens when it is not loaded.

Parameters

ctx
Context Handed to the unload of the scenes.
scene
SceneClass

Returns

Promise<void> A promise resolved once the change is made.