Vinyl
    Preparing search index...

    Interface ReadonlyEventHost<EventMap>

    interface ReadonlyEventHost<out EventMap> {
        hasAnyListeners(): boolean;
        hasListeners(type: keyof EventMap): boolean;
        on<K extends string | number | symbol>(
            type: K,
            handler: EventHandler<EventMap[K]>,
            options?: SignalOptions,
        ): Unsubscribe;
    }

    Type Parameters

    • out EventMap

    Hierarchy (View Summary)

    Index

    Methods

    • Returns true if the event host has any listeners.

      Returns boolean

    • Returns true if the event host has any listeners for the given type.

      Parameters

      Returns boolean

    • Adds an event handler for the given typed event.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • type: K

        The key representing the event type to listen for.

      • handler: EventHandler<EventMap[K]>

        A callback to invoke when the event with the given type is dispatched.

      • Optionaloptions: SignalOptions

        Options for changing listening behavior.

      Returns Unsubscribe

      Returns a method, when invoked, removes the handler.