interface Primitives · Collections
Sequence
interface Sequence<T> extends Collection<T>
A reactive list with entries by index: the base of every shape, and the type of
values.realArray.
Shapes are sequences of their points; values.realArray(…) is a sequence of numbers; some
computations return one (Boxes.vertices, Points.sequentialDistances). Iterate it with for … of or spread it into an array.
The sequence is one dependency for all its entries: an action in Reactive.do with the sequence
among its senders runs after each setAt or set, also when the new value equals the old one.
In a shape, setAt and set copy the coordinates into the shape's points; the shape keeps its
point objects (see Shape).
Properties
elementsreadonly
elements: T[]The entries as an array. It is the sequence's own array, not a copy: read it, but write with
setAt or set, because writes into the array are not reported as changes.
Methods
at
at(index: number): TGets the entry at the specified index.
Throws for an index outside the sequence. In a shape, setAt copies the coordinates into the
point at that index.
index- The zero-based index of the entry.
Returns The entry at the specified index.
set
set(elements: Iterable<T>): voidReplaces all entries with the given ones, as one change.
In a shape, it copies the coordinates into the shape's points, adds points at the end or removes the last ones; the shape keeps its point objects.
elements- The new entries.
setAt
setAt(index: number, value: T): voidSets the entry at the specified index.
Throws for an index outside the sequence. In a shape, setAt copies the coordinates into the
point at that index.
index- The zero-based index of the entry.
value- The new value.
Inherited
From ReadOnlyCollection count
From Iterable [iterator]
