kvision / pl.treksoft.kvision.state / ObservableValue

ObservableValue

(js) 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)

value

The observed variable.

var value: T

Functions

(js)

getState

Get current state.

fun getState(): T
(js)

subscribe

Subscribe for the state change notifications.

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

Extension Properties

(js)

stateFlow

Extension property returning StateFlow for an ObservableState.

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