DeferredObservableProperty

interface DeferredObservableProperty<T>

This interface is an asynchronous variation to the ObservableProperty. Used if the initial value is undefined. It doesn't provide a value if it hasn't been assigned yet, but you can block the thread until it is.

Types

ValueChangeListener
Link copied to clipboard
interface ValueChangeListener<T>
Implemented by listeners to DeferredObservableProperty value changes.

Functions

addListener
Link copied to clipboard
abstract fun addListener(listener: DeferredObservableProperty.ValueChangeListener<T>): CancellationToken
Add a ValueChangeListener for value change on this property.
await
Link copied to clipboard
abstract suspend fun await(): T
Blocks the current thread to wait for a value if latestValue is null, otherwise returns latestValue immediately.
nextValue
Link copied to clipboard
abstract suspend fun nextValue(): T
Blocks the current thread until latestValue is replaced by a new value.
removeListener
Link copied to clipboard
abstract fun removeListener(listener: DeferredObservableProperty.ValueChangeListener<T>): Boolean
Remove a ValueChangeListener from listeners to value change on this property.

Properties

latestValue
Link copied to clipboard
abstract val latestValue: Optional<T>
Returns the latest value if any was emitted, null otherwise.

Extensions

startWith
Link copied to clipboard
fun <T> DeferredObservableProperty<T>.startWith(initialValue: T): ObservableProperty<T>
Conversion method to synchronous ObservableProperty.