AbstractNotifier

abstract class AbstractNotifier<E> : Notifier<E> , Listenable<E> (source)

Abstract implementation of Notifier that also implements Listenable.

This class provides a complete implementation of the observer pattern, combining both the ability to register/unregister listeners (from Listenable) and the ability to notify them of events (from Notifier).

The implementation maintains a set of listeners and ensures safe event delivery even if individual listeners throw exceptions.

Parameters

E

The type of event this notifier handles

Inheritors

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open override fun addListener(listener: Listener<E>)

Registers a listener to receive events.

Link copied to clipboard
fun <E> Listenable<E>.asFlow(): Flow<E>

Converts this Listenable into a Flow that emits events.

Link copied to clipboard

Checks if there are any registered listeners.

Link copied to clipboard
open override fun notify(event: E)

Notifies all registered listeners about an event.

Link copied to clipboard
open override fun removeListener(listener: Listener<E>)

Unregisters a listener from receiving events.