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

# Observable

`interface Observable<T>` (source)

Interface for observables. This interface is implemented by ObserverRegistry so that classes that want to be observable can implement the interface by delegation:

        class MyObservableClass : Observable<MyObserverInterface> by registry {
          ...
        }

### Functions

notifyObservers | `abstract fun notifyObservers(block: T.() -> Unit): Unit` Notifies all registered observers about a change.
pauseObserver | `abstract fun pauseObserver(observer: T): Unit` Pauses the provided observer. No notifications will be sent to this observer until resumeObserver is called.
register | `abstract fun register(observer: T): Unit` `abstract fun register(observer: T, owner: LifecycleOwner, autoPause: Boolean = false): Unit` `abstract fun register(observer: T, view: View): Unit` Registers an observer to get notified about changes.
resumeObserver | `abstract 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 | `abstract fun unregister(observer: T): Unit` Unregisters an observer.
unregisterObservers | `abstract fun unregisterObservers(): Unit` Unregisters all observers.
wrapConsumers | `abstract fun <R> wrapConsumers(block: T.(R) -> Boolean): List<(R) -> Boolean>` Returns a list of lambdas wrapping a consuming method of an observer.

### Inheritors

EngineSession | `abstract class EngineSession : Observable<Observer>` Class representing a single engine session.
ObserverRegistry | `class ObserverRegistry<T> : Observable<T>` 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.
Session | `class Session : Observable<Observer>` Value type that represents the state of a browser session. Changes can be observed.
SessionManager | `class SessionManager : Observable<Observer>` This class provides access to a centralized registry of all active sessions.
TabsAdapter | `class TabsAdapter : Adapter<TabViewHolder>, TabsTray, Observable<Observer>` RecyclerView adapter implementation to display a list/grid of tabs.
TabsTray | `interface TabsTray : Observable<Observer>` Generic interface for components that provide "tabs tray" functionality.