Linear undo/redo history of immutable state snapshots.
Snapshots are treated as opaque immutable values. Whatever is pushed
must not be mutated afterwards, or the history it sits in changes
under the caller; pushing a reference to a value the caller keeps
building new versions of is fine, and cheaper than copying.
Type Parameters
T
Parameters
capacity: number = 100
maximum number of snapshots kept, oldest dropped first
Linear undo/redo history of immutable state snapshots.
Snapshots are treated as opaque immutable values. Whatever is pushed must not be mutated afterwards, or the history it sits in changes under the caller; pushing a reference to a value the caller keeps building new versions of is fine, and cheaper than copying.