Events

class Events

The Events manager. This is where all event payloads are being stored in memory as well as the listeners throughout the code. The class itself is a singleton but the public interfaces do not allow direct access to the single instance.

  • Listens to events of a given event type. A unique id must be specified and is completely arbitrary. The value serves as a key for the listener applied and prevents multiple listeners for the same unique id to from being registered when events are listened to in re-entrant code.

    Declaration

    Swift

    static func listen(to type: EventType, id: EventID, playback: EventPlayback = .lastSuccessful, listener: @escaping EventListener)

    Parameters

    to

    the EventType enum value

    id

    a unique identifier

    playback

    the type and number of previous events to immediately playback for the new listening code

    listener

    the closure that should be executed whenever the specified event fires