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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new QueryCache():
QueryCache
Returns
Section titled “Returns”QueryCache
Methods
Section titled “Methods”onComponentAdded()
Section titled “onComponentAdded()”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.
Parameters
Section titled “Parameters”entity
Section titled “entity”Returns
Section titled “Returns”void
onComponentRemoved()
Section titled “onComponentRemoved()”onComponentRemoved(
entity):void
Defined in: QueryCache.ts:110
Called by Entity when a component is removed.
Parameters
Section titled “Parameters”entity
Section titled “entity”Returns
Section titled “Returns”void
onEntityActivated()
Section titled “onEntityActivated()”onEntityActivated(
entity):void
Defined in: QueryCache.ts:124
Called when an entity becomes active — re-seeds its query membership.
Parameters
Section titled “Parameters”entity
Section titled “entity”Returns
Section titled “Returns”void
onEntityDeactivated()
Section titled “onEntityDeactivated()”onEntityDeactivated(
entity):void
Defined in: QueryCache.ts:129
Called when an entity goes dormant — same removals as destruction.
Parameters
Section titled “Parameters”entity
Section titled “entity”Returns
Section titled “Returns”void
onEntityDestroyed()
Section titled “onEntityDestroyed()”onEntityDestroyed(
entity):void
Defined in: QueryCache.ts:119
Called when an entity is destroyed.
Parameters
Section titled “Parameters”entity
Section titled “entity”Returns
Section titled “Returns”void
queryOnce()
Section titled “queryOnce()”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.
Parameters
Section titled “Parameters”filter
Section titled “filter”QueryFilter
Returns
Section titled “Returns”register()
Section titled “register()”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.
Parameters
Section titled “Parameters”filter
Section titled “filter”QueryFilter
Returns
Section titled “Returns”unregister()
Section titled “unregister()”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.
Parameters
Section titled “Parameters”result
Section titled “result”Returns
Section titled “Returns”void