ecsia-monorepo / three/src / ThreeBindings
Interface: ThreeBindings
Defined in: three/src/bindings.ts:22
Properties
size
readonly size: number;Defined in: three/src/bindings.ts:34
Number of live bindings.
Methods
bind()
bind(handle, object3d): void;Defined in: three/src/bindings.ts:25
Associate object3d with handle. If scene was provided, the object is added to it. Re-binding a handle replaces (and detaches from the scene) the previous object.
Parameters
| Parameter | Type |
|---|---|
handle | EntityHandle |
object3d | Object3D |
Returns
void
unbind()
unbind(handle): Object3D<Object3DEventMap> | undefined;Defined in: three/src/bindings.ts:28
Drop the binding for handle (and remove its object from the scene if one was provided). No-op if unbound. Returns the object that was bound, or undefined.
Parameters
| Parameter | Type |
|---|---|
handle | EntityHandle |
Returns
Object3D<Object3DEventMap> | undefined
objectOf()
objectOf(handle): Object3D<Object3DEventMap> | undefined;Defined in: three/src/bindings.ts:30
The Object3D bound to handle, or undefined.
Parameters
| Parameter | Type |
|---|---|
handle | EntityHandle |
Returns
Object3D<Object3DEventMap> | undefined
has()
has(handle): boolean;Defined in: three/src/bindings.ts:32
True if handle currently has a bound object.
Parameters
| Parameter | Type |
|---|---|
handle | EntityHandle |
Returns
boolean
entries()
entries(): IterableIterator<[EntityHandle, Object3D<Object3DEventMap>]>;Defined in: three/src/bindings.ts:36
Iterate the live (handle, object) pairs.
Returns
IterableIterator<[EntityHandle, Object3D<Object3DEventMap>]>
autoUnbindOn()
autoUnbindOn(anchor): ObserverHandle;Defined in: three/src/bindings.ts:43
Auto-unbind when anchor is removed from an entity OR the entity despawns (onRemove fires on both, ). Returns the observer handle so the caller can dispose it; registering twice for the same anchor is idempotent (the second call returns the existing handle). The handler reads only e.handle — a scalar safe to read under the lenient pooled-ref rules even for a dying entity.
Parameters
| Parameter | Type |
|---|---|
anchor | ComponentDef<Readonly<Record<string, FieldToken>>> |
Returns
sweep()
sweep(): number;Defined in: three/src/bindings.ts:49
Drop every binding whose entity is no longer alive (world.isAlive(handle) === false). The belt-and-suspenders path for entities despawned without an autoUnbindOn anchor. O(size). The frame driver / scheduler can call this once per frame; most apps prefer autoUnbindOn (O(despawns)).
Returns
number
clear()
clear(): void;Defined in: three/src/bindings.ts:51
Drop all bindings (detaching every object from the scene).
Returns
void