Skip to content

QueryCache

Defined in: QueryCache.ts:51

Incrementally maintained entity sets based on component signatures.

Registrations made once at system-install time (e.g. DisplaySystem, UILayoutSystem) are intentionally engine-lifetime and never unregistered — those queries are meant to live as long as the engine does. Per-mount registrations (e.g. useQuery) must call unregister when done, or the query keeps receiving onComponentAdded/onComponentRemoved updates forever.

new QueryCache(): QueryCache

QueryCache

onComponentAdded(entity): void

Defined in: QueryCache.ts:104

Called by Entity when a component is added. A component added to a dormant entity joins nothing — onEntityActivated picks the entity up with its full component set when it wakes.

Entity

void


onComponentRemoved(entity): void

Defined in: QueryCache.ts:110

Called by Entity when a component is removed.

Entity

void


onEntityActivated(entity): void

Defined in: QueryCache.ts:124

Called when an entity becomes active — re-seeds its query membership.

Entity

void


onEntityDeactivated(entity): void

Defined in: QueryCache.ts:129

Called when an entity goes dormant — same removals as destruction.

Entity

void


onEntityDestroyed(entity): void

Defined in: QueryCache.ts:119

Called when an entity is destroyed.

Entity

void


queryOnce(filter): QueryResult

Defined in: QueryCache.ts:77

Build a seeded QueryResult without registering it — a detached point-in-time read for callers that must not register (e.g. render-phase snapshots). It never receives updates. Use register for a live query.

QueryFilter

QueryResult


register(filter): QueryResult

Defined in: QueryCache.ts:65

Register a query. The returned result is pre-populated with currently matching entities and then maintained incrementally as components are added/removed and entities are destroyed.

QueryFilter

QueryResult


unregister(result): void

Defined in: QueryCache.ts:94

Stop maintaining result — it no longer receives entity updates. A second call (or a result that was never registered) is a no-op.

QueryResult

void