WatchableValue

A Watchable value of T which may also be replaced or bound. Use watchableValueOf to create.

interface WatchableValue<T> : MutableWatchable<MutableValue<T>, ValueChange<T>> , ReadOnlyWatchableValue<T>

Functions

batch
Link copied to clipboard
abstract override fun batch(scope: CoroutineScope, period: Long, func: SuspendFunction1<List<ValueChange<T>>, Unit>): Watcher
bind
Link copied to clipboard

Binds this unbound object to origin, such that when origin changes, this object is updated to match origin exactly, until scope completes. While bound, this object may not be externally modified or rebound.

abstract override fun bind(scope: CoroutineScope, origin: Watchable<ValueChange<T>>): Watcher

Binds this unbound object to origin, such that for every change to origin, the change is applied to this object with apply, until scope completes. While bound, this object may not be externally modified or rebound.

abstract override fun <C2 : Change> bind(scope: CoroutineScope, origin: Watchable<C2>, period: Long, apply: MutableValue<T>.(C2) -> Unit): Watcher
clear
Link copied to clipboard

Remove all items.

abstract suspend override fun clear()
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open override fun hashCode(): Int
invoke
Link copied to clipboard

Suspend until func can safely execute on the mutable form M of this watchable, returning func's result. func must not block or return the mutable form outside of this routine.

abstract suspend operator override fun <U> invoke(func: MutableValue<T>.() -> U): U
isBound
Link copied to clipboard

Return true if this object is already bound.

open override fun isBound(): Boolean
readOnly
Link copied to clipboard

Return an unmodifiable form of this WatchableSet.

abstract override fun readOnly(): ReadOnlyWatchableValue<T>
set
Link copied to clipboard

Replace the old value with value.

abstract suspend fun set(value: T)
toString
Link copied to clipboard
open override fun toString(): String
twoWayBind
Link copied to clipboard

Bind other to this so that any change in either object is reflected in the other.

abstract override fun twoWayBind(scope: CoroutineScope, other: MutableWatchable<MutableValue<T>, ValueChange<T>>): Watcher
abstract override fun <M2, C2 : Change> twoWayBind(scope: CoroutineScope, other: MutableWatchable<M2, C2>, update: MutableValue<T>.(C2) -> Unit, updateOther: M2.(ValueChange<T>) -> Unit): Watcher
unbind
Link copied to clipboard

Remove any existing binding for this object.

abstract override fun unbind()
waitFor
Link copied to clipboard
open suspend override fun waitFor(scope: CoroutineScope, func: () -> Boolean)
watch
Link copied to clipboard
open override fun watch(scope: CoroutineScope, period: Long, func: SuspendFunction1<ValueChange<T>, Unit>): Watcher

Properties

boundTo
Link copied to clipboard

The Watchable to which this object is bound, if any.

abstract override val boundTo: Watchable<*>?
value
Link copied to clipboard

Direct access to the current value inside the container.

abstract override val value: T