AbstractOptionaltransactions: IStoreIterates the collection's items.
The unfiltered walk — for (const sheet of wb.getSheets()). Every other iterable surface in
the SDK (ICellRange, ICellRegions, ICellRanges) reads this way, so a collection that did
not was a trap: for…of over one is the obvious line to write and it threw at runtime with
nothing in the types to warn first.
getItems remains the call that takes options — filtering, ordering, anything parameterized. This is sugar over the unfiltered case, not a replacement for it.
Add Listeners.
Optionaloptions: IListener.OptionsReturns the item at the given index, or undefined if there is none.
The position in iteration order. A negative index counts back from the end, as
Array.prototype.at does.
Returns the index of the item in iteration order, or -1 if it is not in the collection.
The item to find.
Returns true once the collection has been closed.
A closed collection is empty and announces nothing further. Collections that are closed by
their owner (the workbook's names, functions and modules, when the workbook closes) announce
it once with ICollection.Events.onClose; the others are never closed and always
return false.
Returns the items as a fresh array, in iteration order.
Base for every ICollection.
Remarks
A subclass supplies _getItems — how its items are stored is its own business, keyed or ordered, held here or fronted from elsewhere — and gets iteration, the count and every read helper from that one call. A subclass with a cheaper count overrides getCount.
Listeners are uniform: addListeners on the base, and _notifyCollectionChange / _notifyInvalidated for the subclass to announce with. A subclass that fronts another collection and forwards its events overrides
addListenersinstead of keeping a second emitter.