跳转到内容

App

此内容尚不支持你的语言。

Defined in: app/app.ts:156

get compiledSystemCount(): number

Defined in: app/app.ts:1072

How many compiled twins this App runs. Zero unless a build installed some, which is the whole of the mode policy — and the one number that tells a shipped AOT build apart from a shipped interpreted one from outside.

number


get compiledSystems(): object

Defined in: app/app.ts:819

Which systems this App is running compiled, and how many twin calls have happened. installed without calls rising means the module loaded and nothing dispatched to it — which no differential can report, because the closure it replaced computes the same answer.

object

readonly calls: number

readonly installed: readonly string[]


get isPhysicsReady(): boolean

Defined in: app/app.ts:708

boolean


get pipeline(): RenderPipeline | null

Defined in: app/app.ts:683

RenderPipeline | null


get sideModules(): SideModuleHost | null

Defined in: app/app.ts:269

The realm’s optional-native-module acquirer (physics, spine). Physics and spine pull their wasm from here, so a realm wires its transport once (fetch / inlined / WeChat) and every subsystem follows.

SideModuleHost | null


get spineInitPromise(): Promise<unknown> | undefined

Defined in: app/app.ts:691

Promise<unknown> | undefined

set spineInitPromise(p): void

Defined in: app/app.ts:695

Promise<unknown> | undefined

void


get subsystems(): SubsystemRegistry

Defined in: app/app.ts:262

Subsystem lifecycle registry (“which modules loaded/ready/stepping/errored”). Named plugins auto-register in addPlugin; async plugins (physics) drive their own initializing→ready/error transitions.

SubsystemRegistry


get world(): World

Defined in: app/app.ts:717

World

addEvent<T>(event): this

Defined in: app/app.ts:368

T

EventDef<T>

this


addPlugin(plugin): this

Defined in: app/app.ts:285

Plugin

this


addPlugins(plugins): this

Defined in: app/app.ts:277

Plugin[]

this


addStartupSystem(system): this

Defined in: app/app.ts:487

SystemDef

this


addSystem(system): this

Defined in: app/app.ts:457

SystemDef

this


addSystemSet(set): this

Defined in: app/app.ts:611

Shortcut for addSystemSetToSchedule(Schedule.Update, set).

SystemSet

this


addSystemSetToSchedule(schedule, set): this

Defined in: app/app.ts:573

Register every system in set onto schedule. Each member gets the set’s runIf, and the set’s runBefore / runAfter edges on top of any it declared itself; members keep the order they were listed in. Other systems may reference the set’s name in their own ordering, and the scheduler expands those references to every member.

Schedule

SystemSet

this


addSystemToSchedule(schedule, system, options?): this

Defined in: app/app.ts:416

Register system onto schedule, adding ordering to its declared edges. profileDomain attributes systems registered after an async plugin build returns; otherwise the current build context supplies it.

Schedule

SystemDef

string

string[]

string[]

RunCondition

this


enableStats(): this

Defined in: app/app.ts:899

this


getEntityCount(): number

Defined in: app/app.ts:1002

number


getFixedTimestep(): number

Defined in: app/app.ts:836

The fixed-update timestep (seconds) — the FixedUpdate / physics cadence.

number


getFrameCosts(): FrameCosts | null

Defined in: app/app.ts:938

This frame’s costs with the attribution a profile tree needs: which domain owns each system, which system each scope ran inside. Null when stats are off. Feed to buildFrameProfile, which is where the tree is derived.

FrameCosts | null


getFrameScopes(): ReadonlyMap<string, number> | null

Defined in: app/app.ts:926

Sub-frame CPU scopes recorded this frame via measureFrameScope — the finer breakdown within a single system, keyed by scope name. Null when stats aren’t enabled. Sibling of getSystemTimings / getPhaseTimings; surfaces as the profiler’s js.* rows.

ReadonlyMap<string, number> | null


getFrameTiming(): Readonly<{ frameMs: number; seq: number; }> | null

Defined in: app/app.ts:916

Completed frame interval before simulation speed or delta clamping.

Readonly<{ frameMs: number; seq: number; }> | null


getPhaseTimings(): ReadonlyMap<string, number> | null

Defined in: app/app.ts:911

ReadonlyMap<string, number> | null


getPlaySpeed(): number

Defined in: app/app.ts:891

number


getPlugin<T>(ctor): T | undefined

Defined in: app/app.ts:255

T extends Plugin

new (…args) => T

T | undefined


getRegisteredResourceNames(): string[]

Defined in: app/app.ts:1036

string[]


getResource<T>(resource): T

Defined in: app/app.ts:1015

T

ResourceDef<T>

T


getResourceByName(name): unknown

Defined in: app/app.ts:1023

string

unknown


getResourceChangeTick(name): number

Defined in: app/app.ts:1031

string

number


getResourceEntries(): [string, unknown][]

Defined in: app/app.ts:1045

Every resource this app holds, as [name, value] — what an inspector shows. Includes the slots only a read has materialised, which getRegisteredResourceNames (insert-only) does not.

[string, unknown][]


getSystemTimings(): ReadonlyMap<string, number> | null

Defined in: app/app.ts:907

ReadonlyMap<string, number> | null


getTargetFrameRate(): number

Defined in: app/app.ts:887

number


hasResource<T>(resource): boolean

Defined in: app/app.ts:1019

T

ResourceDef<T>

boolean


holdExecution(): () => void

Defined in: app/app.ts:1186

Hold frame execution without changing the game’s own pause state.

() => void


hotSwapSystems(incoming): boolean

Defined in: app/app.ts:504

Hot-swap the project’s (user-authored) system function bodies in place, keeping the live World/Registry/entities — the state-preserving hot-reload fast path (RC10 P3). incoming is the freshly re-imported bundle’s drained systems.

Returns false when the structure changed — a user system was added, removed, or renamed, or a schedule’s user-system count differs — because the running systems then no longer line up with the new code, so the caller must full-reload instead. Builtin/plugin systems (those with an owning subsystem) are never touched. The match validates fully before mutating, so a rejected swap leaves the scheduler untouched (no torn half-swap). Component identity is stable by name (see component.ts), so the new functions’ queries resolve to the live storage.

readonly object[]

boolean


insertResource<T>(resource, value): this

Defined in: app/app.ts:1010

T

ResourceDef<T>

T

this


installCompiledSystems(source, manifest): Promise<number>

Defined in: app/app.ts:1082

Install the compiled twins a build produced, and answer how many (docs/REARCH_AOT.md §9). Call it BEFORE any component exists — a twin reads rows in the ENGINE’s memory, and refuses rather than move rows already allocated elsewhere, or trust a module built for other offsets.

string | BufferSource

AotManifest

Promise<number>


isExecutionHeld(): boolean

Defined in: app/app.ts:1213

boolean


isPaused(): boolean

Defined in: app/app.ts:869

boolean


measureFrameScope<T>(name, fn, options?): T

Defined in: app/app.ts:969

Time fn as a named sub-frame scope (accumulated if the name repeats in a frame). A no-op passthrough when stats are off, so shipped games pay only a single branch. Use it to split a heavy system into attributable pieces.

remainder: 'wait' declares that whatever time is left under this scope once its native scopes are subtracted is CPU blocked, not work — the swapchain block a GPU submit absorbs, or an await. The profiler keeps such time out of every cost total instead of reporting it as a hotspot.

T

string

() => T

ScopeRemainder

T


onError(handler): this

Defined in: app/app.ts:850

(error, systemName) => void

this


onExecutionChange(callback): () => void

Defined in: app/app.ts:1216

Observe execution holds, including the initial state. Media/timer owners can cooperate here.

(held) => void

() => void


onFrameEnd(fn): () => void

Defined in: app/app.ts:994

Observe the end of every frame, once its systems have run and its timings are final. Returns a disposer.

A broadcast, not a slot: a recorder and a game’s own budget alarm both watch without either taking the hook from the other.

(dtMs) => void

() => void


onSystemError(handler): this

Defined in: app/app.ts:855

(error, systemName?) => "pause" | "continue"

this


onWasmError(handler): this

Defined in: app/app.ts:860

(error, context) => void

this


quit(options?): void

Defined in: app/app.ts:1374

boolean

void


registerScene(config): this

Defined in: app/app.ts:1053

SceneConfig

this


removeSystem(systemId): boolean

Defined in: app/app.ts:615

symbol

boolean


run(): Promise<void>

Defined in: app/app.ts:1290

Promise<void>


scheduleAmbiguities(schedule): Ambiguity[]

Defined in: app/app.ts:1692

Pairs of systems in schedule that touch the same data with nothing saying which runs first, so their order is whatever registration and the sort happened to produce.

Schedule

Ambiguity[]


scheduleBatches(schedule): string[][]

Defined in: app/app.ts:1704

schedule grouped into batches that could run at the same time — how much of it is inherently sequential. A measurement: the schedule starts systems in sorted order, overlapping only what awaits. See parallelBatches.

Schedule

string[][]


setFixedTimestep(timestep): this

Defined in: app/app.ts:830

number

this


setInitialScene(name): this

Defined in: app/app.ts:1058

string

this


setMaxDeltaTime(v): this

Defined in: app/app.ts:840

number

this


setMaxFixedSteps(v): this

Defined in: app/app.ts:845

number

this


setPaused(paused): void

Defined in: app/app.ts:865

boolean

void


setPipeline(pipeline): void

Defined in: app/app.ts:687

RenderPipeline

void


setPlaySpeed(speed): void

Defined in: app/app.ts:878

number

void


setSideModules(host): void

Defined in: app/app.ts:273

SideModuleHost

void


setTargetFrameRate(fps): void

Defined in: app/app.ts:882

number

void


stepFrame(): void

Defined in: app/app.ts:873

void


stepFrames(frames?, dt?): Promise<void>

Defined in: app/app.ts:1254

Advance exactly frames frames of exactly dt seconds, with the rAF loop held off for the duration — “let the game run a bit”, made reproducible.

The loop it replaces is wall-clock and browser-scheduled: a backgrounded tab is throttled to about one frame a second, so an observer that steps by waiting sees a frozen game and concludes the game is broken. Worse, there was no other door — a driver that needed the next 30 frames of simulation had to reach for runFrame_, and reaching for a private method is a thing that keeps working until the day it doesn’t.

A PAUSED app still steps here: advancing frame by frame is exactly what stepping a paused game means. The pause (and the loop) are restored afterwards, with the clock re-based so the first resumed frame is not handed the whole excursion as its delta.

number = 1

number = ...

Promise<void>


tick(delta): Promise<void>

Defined in: app/app.ts:1174

number

Promise<void>


useCompiledSystems(opts): Promise<void>

Defined in: app/app.ts:729

Run the compiled twins a build produced instead of the systems’ closures. Call it BEFORE the world has any pooled component: the rows must be in the memory the module reads. Refuses rather than degrades — a module built for other offsets reads a different field, which is not an error.

AotHost

AotManifest

BufferSource

Promise<void>


waitForPhysics(): Promise<void>

Defined in: app/app.ts:699

Promise<void>


static new(): App

Defined in: app/app.ts:247

App