android-components / mozilla.components.support.base.observer / ObserverRegistry

# ObserverRegistry

`class ObserverRegistry<T> : Observable<T>` (source)

A helper for classes that want to get observed. This class keeps track of registered observers and can automatically unregister observers if a LifecycleOwner is provided.

### Constructors

<init> | `ObserverRegistry()` A helper for classes that want to get observed. This class keeps track of registered observers and can automatically unregister observers if a LifecycleOwner is provided.

### Functions

notifyObservers | `fun notifyObservers(block: T.() -> Unit): Unit` Notifies all registered observers about a change.
pauseObserver | `fun pauseObserver(observer: T): Unit` Pauses the provided observer. No notifications will be sent to this observer until resumeObserver is called.
register | `fun register(observer: T): Unit` `fun register(observer: T, owner: LifecycleOwner, autoPause: Boolean): Unit` `fun register(observer: T, view: View): Unit` Registers an observer to get notified about changes.
resumeObserver | `fun resumeObserver(observer: T): Unit` Resumes the provided observer. Notifications sent since it was last paused (see pauseObserver]) are lost and will not be re-delivered.
unregister | `fun unregister(observer: T): Unit` Unregisters an observer.
unregisterObservers | `fun unregisterObservers(): Unit` Unregisters all observers.
wrapConsumers | `fun <V> wrapConsumers(block: T.(V) -> Boolean): List<(V) -> Boolean>` Returns a list of lambdas wrapping a consuming method of an observer.