EntityIdAndClassIdIterable Type

EntityIdAndClassIdIterable = Iterable<Readonly<EntityIdAndClassId>>

A collection of EntityIdAndClassIds, as used by TxnChangedEntities. For efficiency, the iterator supplied by this iterable returns the same EntityIdAndClassId object on each iteration. Therefore the objects must be copied if you intend to store references to them. For example, to populate an array from the iterable:

 function arrayFromIterable(entities: EntityIdAndClassIdIterable): EntityIdAndClassId[] {
   // NO! return Array.from(entities);
   const array = [];
   for (const entity of entities)
     array.push({...entity});

   return array;
 }

Defined in

Last Updated: 17 December, 2024