ObservableValue

class ObservableValue<T>(initialValue: T) : Observable<T>

Another way to implement observable delegation. When the observed value property is changed, observers are notified.

Constructors

Link copied to clipboard
constructor(initialValue: T)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open override fun attachObserver(observer: ObserverIfc<T>)

Allows the adding (attaching) of an observer to the observable

Link copied to clipboard
open override fun countObservers(): Int

Returns how many observers are currently attached to the observable

Link copied to clipboard
open override fun detachAllObservers()

Detaches all the observers from the observable

Link copied to clipboard
open override fun detachObserver(observer: ObserverIfc<T>)

Allows the deletion (removing) of an observer from the observable

Link copied to clipboard
open override fun isAttached(observer: ObserverIfc<T>): Boolean

Returns true if the observer is already attached

Link copied to clipboard
fun <T> Observable<T>.observe(block: (T?) -> Unit)