API reference

Announcer Protocol

A protocol for objects that can announce events to registered listeners.

Signature

protocol Announcer

Functions

listen ( listener )
Registers a listener for events of type T.
Signature
public func listen(_ listener: @Sendable @escaping (T) -> Void) -> AnyListenerToken
Parameters
_ listener: @Sendable @escaping (T) -> Void  The callback to execute when an event occurs.
Returns
AnyListenerToken  A token that can be used to cancel the listener.