EventDispatcher

public class EventDispatcher : NSObject, EventDispatcherProtocol

Represents an EventDispatcher which will be responsible for dispatching an event, once it occurs.

  • Adds an EventListener for a particular type of event to the player.

    Declaration

    Swift

    public func addEventListener<E>(type: EventType<E>, listener: @escaping (E) -> ()) -> EventListener where E : EventProtocol

    Parameters

    type

    The EventType to listen for.

    listener

    The closure to be called when the event occurs.

  • Removes an EventListener for a particular type of event of the player.

    Declaration

    Swift

    public func removeEventListener<E>(type: EventType<E>, listener: EventListener) where E : EventProtocol

    Parameters

    type

    The EventType to be removed.

    listener

    The closure to be called when the event occurs.