History

class History<T>(maxSize: Int, initialValue: List<T>)

Keeps track of historical values (i.e. of a Store) and allows you to navigate back in history

Parameters

maxSize

history keeps at most this many last values

initialValue

initial content of the history

Constructors

History
Link copied to clipboard
js
fun <T> History(maxSize: Int, initialValue: List<T>)
history keeps at most this many last values

Functions

add
Link copied to clipboard
js
fun add(entry: T)
adds a new value to the history
back
Link copied to clipboard
js
fun back(): T
gets the last value that has been added and removes it from the history.
last
Link copied to clipboard
js
fun last(): T
gets the last value that has been added to the history.
reset
Link copied to clipboard
js
fun reset()
clears the history.
sync
Link copied to clipboard
js
fun sync(upstream: Store<T>): History<T>
syncs this history to a given store, so that each update is automatically stored in history.

Properties

available
Link copied to clipboard
js
val available: Flow<Boolean>
Flow describing, if a value is available in the history
current
Link copied to clipboard
js
val current: List<T>
Represents the current entries in history.
data
Link copied to clipboard
js
val data: Flow<List<T>>
Gives a Flow with the entries of the history.