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

Link copied to clipboard
fun <T> History(maxSize: Int, initialValue: List<T>)

Functions

Link copied to clipboard
fun add(entry: T)

adds a new value to the history

Link copied to clipboard
fun back(): T

gets the last value that has been added and removes it from the history.

Link copied to clipboard
fun last(): T

gets the last value that has been added to the history. Leaves history unmodified.

Link copied to clipboard
fun reset()

clears the history.

Link copied to clipboard
fun sync(upstream: Store<T>): History<T>

syncs this history to a given store, so that each update is automatically stored in history.

Properties

Link copied to clipboard
val available: Flow<Boolean>

Flow describing, if a value is available in the history

Link copied to clipboard
val current: List<T>

Represents the current entries in history.

Link copied to clipboard
val data: Flow<List<T>>

Gives a Flow with the entries of the history.