Photo Sphere Viewer
    Preparing search index...

    Interface TypedEventTarget<TEvents>

    Decorator for EventTarget allowing to strongly type events and listeners

    interface TypedEventTarget<TEvents extends TypedEvent<any>> {
        addEventListener<
            T extends string,
            E extends TypedEvent<any> & { type: T },
        >(
            type: T,
            callback: EventListenerObject | ((e: E) => void),
            options?: boolean | AddEventListenerOptions,
        ): void;
        dispatchEvent(e: TEvents): boolean;
        removeEventListener<
            T extends string,
            E extends TypedEvent<any> & { type: T },
        >(
            type: TEvents["type"],
            callback: EventListenerObject | ((e: E) => void),
            options?: boolean | EventListenerOptions,
        ): void;
    }

    Type Parameters

    • TEvents extends TypedEvent<any>

      union of dispatched events

    Hierarchy (View Summary)

    Index

    Methods

    • Type Parameters

      • T extends string

        the name of event

      • E extends TypedEvent<any> & { type: T }

        the class of the event

      Parameters

      • type: T
      • callback: EventListenerObject | ((e: E) => void)
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Type Parameters

      • T extends string

        the name of event

      • E extends TypedEvent<any> & { type: T }

        the class of the event

      Parameters

      • type: TEvents["type"]
      • callback: EventListenerObject | ((e: E) => void)
      • Optionaloptions: boolean | EventListenerOptions

      Returns void