Creates a new History instance.
Maximum number of items the history can hold.
Optional
items: T[]Initial items to populate the history. If the number of items exceeds capacity, the oldest items will be discarded.
Initial position relative to the end of history. Defaults to -1 (newest item).
Maximum number of items the history can hold.
Number of items in the history.
An iterator for the items in the history.
Checks if there is a next item to redo to.
true
if there is a next item to redo to, false
otherwise.
Checks if there is a previous item to undo to.
true
if there is a previous item to undo to, false
otherwise.
Adds items to the end of the history. If the current item is not the latest, future history will be deleted. If the history is full, it will overwrite the oldest items.
The items to add to the history.
The new size of the history.
Restore previous item.
The previous item or undefined
if there is no previous item.
Array-like structure with undo/redo functionality. It uses limited stack based on RingBuffer.