ObservableComponent

Permits observable pattern to be used in delegation pattern by exposing notification of observers via public method.

Constructors

Link copied to clipboard
constructor()

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 notifyAttached(newValue: T)

Allows observable component to notify observers

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