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

Link copied to clipboard
object Companion
Link copied to clipboard
interface Listener<T> : ValueChangeListener<Optional<T>, T>

Implemented by listeners to DeferredObservableProperty value changes.

Functions

Link copied to clipboard
abstract fun addListener(listener: DeferredObservableProperty.Listener<T>): CancellationToken

Add a ValueChangeListener for value change on this property.

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.

Link copied to clipboard
abstract suspend fun nextValue(): T

Blocks the current thread until latestValue is replaced by a new value.

Link copied to clipboard
abstract fun removeListener(listener: DeferredObservableProperty.Listener<T>)

Remove a ValueChangeListener from listeners to value change on this property.

Properties

Link copied to clipboard
abstract val latestValue: Optional<T>

Returns the latest value if any was emitted, null otherwise.

Extensions

Link copied to clipboard
fun <T, U> DeferredObservableProperty<T>.flatMapLatest(equalityPolicy: ObservableProperty.EqualityPolicy<DeferredObservableProperty<U>> = identityEqualityPolicy(), transform: (T) -> DeferredObservableProperty<U>): DeferredObservableProperty<U>

A mapping function applied to each element collected from the ObsrvableProperty to return a DeferredObservableProperty.

Link copied to clipboard
fun <T, U> DeferredObservableProperty<T>.map(equalityPolicy: ObservableProperty.EqualityPolicy<U> = defaultEqualityPolicy(), transform: (T) -> U): DeferredObservableProperty<U>

A mapping function applied to each element collected from the DeferredObservableProperty.

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

Conversion method to synchronous ObservableProperty.