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

Companion
Link copied to clipboard
object Companion
Listener
Link copied to clipboard
interface Listener<T> : ValueChangeListener<Optional<T>, T>
Implemented by listeners to DeferredObservableProperty value changes.

Functions

addListener
Link copied to clipboard
abstract fun addListener(listener: DeferredObservableProperty.Listener<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.Listener<T>)
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

flatMapLatest
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.
map
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.
startWith
Link copied to clipboard
fun <T> DeferredObservableProperty<T>.startWith(initialValue: T): ObservableProperty<T>
Conversion method to synchronous ObservableProperty.