Interface EventDispatcher<T>

Interface for an event dispatcher that sends events.

Type Parameters

  • T extends {
        type: string;
    }

Hierarchy

  • EventDispatcher

Implemented by

Methods

  • Adds an event listener.

    Returns

    A function that removes the listener.

    Type Parameters

    • P extends `ton-connect-${string}` | `ton-connect-ui-${string}`

    Parameters

    • eventName: P

      The name of the event to listen for.

    • listener: ((event: CustomEvent<T & {
          type: RemoveTonConnectPrefix<P>;
      }>) => void)

      The listener to add.

    • Optional options: AddEventListenerOptions

      The options for the listener.

    Returns Promise<(() => void)>

  • Dispatches an event with the given name and details.

    Type Parameters

    • P extends `ton-connect-${string}` | `ton-connect-ui-${string}`

    Parameters

    • eventName: P

      The name of the event to dispatch.

    • eventDetails: T & {
          type: RemoveTonConnectPrefix<P>;
      }

      The details of the event to dispatch.

    Returns Promise<void>

Generated using TypeDoc