Inspector
Defined in: Inspector.ts:401
Programmatic runtime control and state queries for testing and debugging.
Exposed on window.__yage__ in debug mode.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Inspector(
engine):Inspector
Defined in: Inspector.ts:711
Parameters
Section titled “Parameters”engine
Section titled “engine”EngineRef
Returns
Section titled “Returns”Inspector
Properties
Section titled “Properties”capture
Section titled “capture”
readonlycapture:object
Defined in: Inspector.ts:687
dataURL
Section titled “dataURL”dataURL: () =>
Promise<string>
Returns
Section titled “Returns”Promise<string>
png: () =>
Promise<Uint8Array<ArrayBufferLike>>
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
pngBase64
Section titled “pngBase64”pngBase64: () =>
Promise<string>
Returns
Section titled “Returns”Promise<string>
events
Section titled “events”
readonlyevents:object
Defined in: Inspector.ts:621
clearLog
Section titled “clearLog”clearLog: () =>
void
Returns
Section titled “Returns”void
getLog
Section titled “getLog”getLog: () =>
EventLogEntry[]
Returns
Section titled “Returns”isEnabled
Section titled “isEnabled”isEnabled: () =>
boolean
Returns
Section titled “Returns”boolean
setCapacity
Section titled “setCapacity”setCapacity: (
n) =>void
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
setEnabled
Section titled “setEnabled”setEnabled: (
enabled) =>void
Turn event-log recording on/off at runtime. Off means zero per-event
allocation: the EventBus tap detaches and recordBusEvent is never
called. DebugConfig.eventLog controls the startup default; this is
the runtime switch for toggling mid-session.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”void
waitFor
Section titled “waitFor”waitFor: (
pattern,options?) =>Promise<EventLogEntry>
Parameters
Section titled “Parameters”pattern
Section titled “pattern”string | RegExp
options?
Section titled “options?”source?
Section titled “source?”"entity" | "bus"
withinFrames?
Section titled “withinFrames?”number
Returns
Section titled “Returns”Promise<EventLogEntry>
readonlyinput:object
Defined in: Inspector.ts:531
clearAll
Section titled “clearAll”clearAll: () =>
void
Returns
Section titled “Returns”void
fireAction
Section titled “fireAction”fireAction: (
name,frames) =>void
Parameters
Section titled “Parameters”string
frames?
Section titled “frames?”number = 1
Returns
Section titled “Returns”void
gamepadAxis
Section titled “gamepadAxis”gamepadAxis: (
side,value) =>void
Parameters
Section titled “Parameters”InspectorGamepadAxisKey
number
Returns
Section titled “Returns”void
gamepadButton
Section titled “gamepadButton”gamepadButton: (
code,pressed) =>void
Parameters
Section titled “Parameters”string
pressed
Section titled “pressed”boolean
Returns
Section titled “Returns”void
hold: (
code,frames) =>void
Parameters
Section titled “Parameters”string
frames
Section titled “frames”number
Returns
Section titled “Returns”void
keyDown
Section titled “keyDown”keyDown: (
code) =>void
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
keyUp: (
code) =>void
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
mouseDown
Section titled “mouseDown”mouseDown: (
button) =>void
Parameters
Section titled “Parameters”button?
Section titled “button?”0 | 1 | 2
Returns
Section titled “Returns”void
mouseMove
Section titled “mouseMove”mouseMove: (
x,y) =>void
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”void
mouseUp
Section titled “mouseUp”mouseUp: (
button) =>void
Parameters
Section titled “Parameters”button?
Section titled “button?”0 | 1 | 2
Returns
Section titled “Returns”void
pointerDown
Section titled “pointerDown”pointerDown: (
button,opts?) =>void
Inject a synthetic pointer-down. With opts.id and opts.type: "touch"
this drives a multi-touch contact, exercising getPointers(),
per-pointer event hooks, and the any-pointer aggregate for MouseLeft.
Parameters
Section titled “Parameters”button?
Section titled “button?”0 | 1 | 2
InspectorPointerOpts
Returns
Section titled “Returns”void
pointerMove
Section titled “pointerMove”pointerMove: (
x,y,opts?) =>void
Inject a synthetic pointer-move with full pointer addressing. Pass opts
with id / type: "touch" to drive a specific finger; defaults match
the primary mouse pointer (same as mouseMove).
Parameters
Section titled “Parameters”number
number
InspectorPointerOpts
Returns
Section titled “Returns”void
pointerUp
Section titled “pointerUp”pointerUp: (
button,opts?) =>void
Parameters
Section titled “Parameters”button?
Section titled “button?”0 | 1 | 2
number
Returns
Section titled “Returns”void
tap: (
code,frames) =>void
Parameters
Section titled “Parameters”string
frames?
Section titled “frames?”number = 1
Returns
Section titled “Returns”void
readonlytime:object
Defined in: Inspector.ts:439
freeze
Section titled “freeze”freeze: () =>
void
Returns
Section titled “Returns”void
getFrame
Section titled “getFrame”getFrame: () =>
number
Returns
Section titled “Returns”number
isAdvancing
Section titled “isAdvancing”isAdvancing: (
withinMs) =>boolean
True if a real GameLoop.tick() happened within the last withinMs
(default 250) milliseconds of wall-clock time. Independent of
isFrozen(): a frozen clock that isn’t being stepped reads false
(nothing is ticking), but a manual step/stepUntil/stepAsync fires a
real tick, so this reads true for withinMs after one. A
stalled-but-not-frozen game — a hung await, a runaway synchronous loop —
also reads false, the case this method exists to tell apart from
“frozen on purpose”.
Parameters
Section titled “Parameters”withinMs?
Section titled “withinMs?”number = 250
Returns
Section titled “Returns”boolean
isFrozen
Section titled “isFrozen”isFrozen: () =>
boolean
Returns
Section titled “Returns”boolean
setDelta
Section titled “setDelta”setDelta: (
ms) =>void
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
step: (
frames) =>void
Parameters
Section titled “Parameters”frames?
Section titled “frames?”number = 1
Returns
Section titled “Returns”void
stepAsync
Section titled “stepAsync”stepAsync: (
frames,opts?) =>Promise<void>
Advance a fixed number of frames, yielding a real macrotask between each so the same async draining as stepUntil applies — for call sites that already know how many frames they need.
Parameters
Section titled “Parameters”frames?
Section titled “frames?”number = 1
number
Returns
Section titled “Returns”Promise<void>
stepUntil
Section titled “stepUntil”stepUntil: (
predicate,opts?) =>Promise<number>
Advance frame-by-frame until predicate() returns true, yielding a real
macrotask between frames so async work parked on the microtask queue —
a scene transition’s await, a dialogue runner’s promise chain — gets a
chance to settle before the next frame steps. Checks predicate before
the first frame (resolves 0 if already satisfied) and after each
subsequent frame. Throws if predicate is still false after
opts.maxFrames (default 600, i.e. 10s at 60fps).
Parameters
Section titled “Parameters”predicate
Section titled “predicate”() => boolean
number
maxFrames?
Section titled “maxFrames?”number
Returns
Section titled “Returns”Promise<number>
thaw: () =>
void
Returns
Section titled “Returns”void
Methods
Section titled “Methods”addExtension()
Section titled “addExtension()”addExtension<
T>(namespace,api):T
Defined in: Inspector.ts:716
Register a namespaced extension API for plugin-specific debug helpers.
Type Parameters
Section titled “Type Parameters”T extends object
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
T
Returns
Section titled “Returns”T
attachSceneEventObserver()
Section titled “attachSceneEventObserver()”attachSceneEventObserver(
scene):void
Defined in: Inspector.ts:963
Internal
Install entity-event observation for one scene. No-op if disabled.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
attachTimeController()
Section titled “attachTimeController()”attachTimeController(
controller):void
Defined in: Inspector.ts:928
Internal
DebugPlugin attaches the frozen-time controller through this hook.
Parameters
Section titled “Parameters”controller
Section titled “controller”Returns
Section titled “Returns”void
createSceneRandom()
Section titled “createSceneRandom()”createSceneRandom():
RandomService
Defined in: Inspector.ts:894
Create a new scene-scoped RNG instance using the current inspector seed policy.
Returns
Section titled “Returns”detachSceneEventObserver()
Section titled “detachSceneEventObserver()”detachSceneEventObserver(
scene):void
Defined in: Inspector.ts:969
Internal
Clear entity-event observation for one scene.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
detachTimeController()
Section titled “detachTimeController()”detachTimeController(
controller?):void
Defined in: Inspector.ts:933
Internal
Clear a previously attached time controller.
Parameters
Section titled “Parameters”controller?
Section titled “controller?”Returns
Section titled “Returns”void
dispose()
Section titled “dispose()”dispose():
void
Defined in: Inspector.ts:990
Internal
Engine teardown releases the event-bus tap through this hook.
Returns
Section titled “Returns”void
getComponentData()
Section titled “getComponentData()”getComponentData(
entityName,componentClass):unknown
Defined in: Inspector.ts:845
Get component data (serializable subset) by class name string.
Parameters
Section titled “Parameters”entityName
Section titled “entityName”string
componentClass
Section titled “componentClass”string
Returns
Section titled “Returns”unknown
getEntities()
Section titled “getEntities()”getEntities():
EntitySnapshot[]
Defined in: Inspector.ts:852
Get all entities in the active scene as lightweight snapshots.
Returns
Section titled “Returns”getEntityByName()
Section titled “getEntityByName()”getEntityByName(
name):EntitySnapshot|undefined
Defined in: Inspector.ts:824
Find entity by name in the active scene.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”EntitySnapshot | undefined
getEntityPosition()
Section titled “getEntityPosition()”getEntityPosition(
name): {x:number;y:number; } |undefined
Defined in: Inspector.ts:831
Get entity position (from Transform component).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”{ x: number; y: number; } | undefined
getErrors()
Section titled “getErrors()”getErrors():
ErrorSnapshot
Defined in: Inspector.ts:887
Get recorded failures from the error boundary.
Returns
Section titled “Returns”getExtension()
Section titled “getExtension()”getExtension<
T>(namespace):T|undefined
Defined in: Inspector.ts:734
Look up a previously registered extension API by namespace.
Type Parameters
Section titled “Type Parameters”T extends object
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
Returns
Section titled “Returns”T | undefined
getSceneStack()
Section titled “getSceneStack()”getSceneStack():
SceneSnapshot[]
Defined in: Inspector.ts:865
Get scene stack info.
Returns
Section titled “Returns”getSystems()
Section titled “getSystems()”getSystems():
SystemSnapshot[]
Defined in: Inspector.ts:875
Get active system info.
Returns
Section titled “Returns”hasComponent()
Section titled “hasComponent()”hasComponent(
entityName,componentClass):boolean
Defined in: Inspector.ts:840
Check if an entity has a component by class name string.
Parameters
Section titled “Parameters”entityName
Section titled “entityName”string
componentClass
Section titled “componentClass”string
Returns
Section titled “Returns”boolean
recordEntityEvent()
Section titled “recordEntityEvent()”recordEntityEvent(
eventName,data,entity):void
Defined in: Inspector.ts:974
Internal
Scene hooks forward entity events through this method.
Parameters
Section titled “Parameters”eventName
Section titled “eventName”string
unknown
entity
Section titled “entity”Returns
Section titled “Returns”void
registerFacetContributor()
Section titled “registerFacetContributor()”registerFacetContributor(
contributor): () =>void
Defined in: Inspector.ts:758
Register an InspectorFacetContributor so a plugin can augment
component/entity snapshots with a namespaced facet (e.g. the renderer’s
render geometry). Returns an unregister function; call it on plugin
teardown. Re-registering a namespace replaces the prior contributor
(mirrors save’s registerSnapshotExtra).
Parameters
Section titled “Parameters”contributor
Section titled “contributor”Returns
Section titled “Returns”() => void
removeExtension()
Section titled “removeExtension()”removeExtension(
namespace):void
Defined in: Inspector.ts:743
Remove a previously registered extension namespace.
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
Returns
Section titled “Returns”void
setDefaultSceneSeed()
Section titled “setDefaultSceneSeed()”setDefaultSceneSeed(
seed):void
Defined in: Inspector.ts:910
Internal
DebugPlugin installs a deterministic default seed through this hook.
Parameters
Section titled “Parameters”number | undefined
Returns
Section titled “Returns”void
setEventLogEnabled()
Section titled “setEventLogEnabled()”setEventLogEnabled(
enabled):void
Defined in: Inspector.ts:940
Internal
Enable or disable event log recording.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”void
setSeed()
Section titled “setSeed()”setSeed(
seed):void
Defined in: Inspector.ts:901
Force every current and future scene RNG to the provided seed.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
snapshot()
Section titled “snapshot()”snapshot():
EngineSnapshot
Defined in: Inspector.ts:772
Full deterministic state snapshot (stable ordering, serializable).
Returns
Section titled “Returns”snapshotJSON()
Section titled “snapshotJSON()”snapshotJSON():
string
Defined in: Inspector.ts:790
Stable JSON form of snapshot.
Returns
Section titled “Returns”string
snapshotScene()
Section titled “snapshotScene()”snapshotScene(
nameOrId):WorldSceneSnapshot
Defined in: Inspector.ts:800
Snapshot one scene by its public scene.name or its inspector-assigned
id (snapshot().scenes[].id). Name is tried first. If more than one
active scene shares that name, throws rather than guessing — pass the id
instead. Falls back to an id match when no scene has that name.
Parameters
Section titled “Parameters”nameOrId
Section titled “nameOrId”string