kvision / pl.treksoft.kvision.state / ObservableValue

ObservableValue

(js) open class ObservableValue<T> : ObservableState<T>

The observable value class.

Parameters

value - the initial value

Constructors

(js)

<init>

The observable value class.

ObservableValue(value: T)

Properties

(js)

observers

val observers: MutableList<(T) -> Unit>
(js)

value

The observed variable.

var value: T

Functions

(js)

getState

Get current state.

open fun getState(): T
(js)

subscribe

Subscribe for the state change notifications.

open fun subscribe(observer: (T) -> Unit): () -> Unit

Extension Properties

(js)

stateFlow

Extension property returning StateFlow for an ObservableState.

val <S> ObservableState<S>.stateFlow: StateFlow<S>