跳转到内容

BuiltinBridge

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

Defined in: ecs/BuiltinBridge.ts:312

get hasCpp(): boolean

Defined in: ecs/BuiltinBridge.ts:377

boolean

connect(cppRegistry, module?, options?): void

Defined in: ecs/BuiltinBridge.ts:332

Bind to a C++ Registry.

Production call sites should pass { strict: true } so the bridge verifies that every component declared in COMPONENT_META has its four bindings (add/get/has/remove) and throws a single aggregated diagnostic if any are missing. This surfaces drift between the WASM build and the generated metadata at startup rather than on first component use.

In non-strict mode (default, used by unit tests with partial mock registries) the cache is pre-populated for whatever bindings exist and individual getBuiltinMethods() calls throw lazily on missing ones.

CppRegistry

ESEngineModule

BridgeConnectOptions = {}

void


deleteFromEntitySets(entity): string[]

Defined in: ecs/BuiltinBridge.ts:535

Removes the entity from every builtin set; returns the cppNames it was in.

number

string[]


disconnect(): void

Defined in: ecs/BuiltinBridge.ts:369

void


get<T>(entity, component): T

Defined in: ecs/BuiltinBridge.ts:585

T

number

BuiltinComponentDef<T>

T


getBuiltinMethods(cppName): BuiltinMethods

Defined in: ecs/BuiltinBridge.ts:466

string

BuiltinMethods


getCppRegistry(): CppRegistry | null

Defined in: ecs/BuiltinBridge.ts:381

CppRegistry | null


getEntitySet(cppName): Set<number> | undefined

Defined in: ecs/BuiltinBridge.ts:521

string

Set<number> | undefined


getMethodCache(): Map<string, BuiltinMethods>

Defined in: ecs/BuiltinBridge.ts:517

Map<string, BuiltinMethods>


getOrCreateEntitySet(cppName): Set<number>

Defined in: ecs/BuiltinBridge.ts:525

string

Set<number>


getWasmModule(): ESEngineModule | null

Defined in: ecs/BuiltinBridge.ts:385

ESEngineModule | null


has(entity, component): boolean

Defined in: ecs/BuiltinBridge.ts:601

number

BuiltinComponentDef<any>

boolean


insert<T>(entity, component, data?): object

Defined in: ecs/BuiltinBridge.ts:543

T

number

BuiltinComponentDef<T>

Partial<T>

object

isNew: boolean

merged: T


remove(entity, component): void

Defined in: ecs/BuiltinBridge.ts:613

number

BuiltinComponentDef<any>

void


resolvePtrFn(cppName): ((entity) => number) | null

Defined in: ecs/BuiltinBridge.ts:631

The wasm-exported pointer function for cppName(entity) => byte offset of that entity's component in the wasm heap. Web/emscripten only (there is no such numeric address on native); the fast path itself goes through the MemoryProvider, so this is a lower-level convenience.

string

((entity) => number) | null


resolvePtrGetter(cppName): ((entity) => unknown) | null

Defined in: ecs/BuiltinBridge.ts:651

Returns a getter that reads C++ component data into a shared preallocated object. WARNING: The returned object is reused across calls — copy it if you need to retain the values.

string

((entity) => unknown) | null


resolvePtrSetter(cppName): ((entity, data) => void) | null

Defined in: ecs/BuiltinBridge.ts:635

string

((entity, data) => void) | null


verify(): BridgeVerification

Defined in: ecs/BuiltinBridge.ts:393

Describe the current binding state without throwing. Useful for diagnostics and tests that want to inspect coverage.

BridgeVerification