Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

readEach

readEach<T>(world, query, callback): void

Calls callback for each entity query matches, in the order world.query lists them, as koota’s readEach does, building no array and no record: koota’s builds both on every call, which is most of a frame’s garbage. A trait of fields is handed as a record the pass reuses, so a callback keeps a field and never the record.

Type Parameter
T extends QueryParameter[]
Parameter Type
world World
query Query<T>
callback EachCallback<T>

void

readEach<T>(world, predictedQuery, callback): void

As readEach over koota’s query, over the engine’s query of a predicted trait, whose record it hands read-only.

Type Parameter
T extends EngineQueryParameter[]
Parameter Type
world World
predictedQuery PredictedQuery<T>
callback (traits, entity, index) => void

void