Documentation
    Preparing search index...

    Class BrowserEventDispatcher<T>

    A concrete implementation of EventDispatcher that dispatches events to the browser window.

    Type Parameters

    • T extends { type: string }

    Implements

    Index

    Constructors

    Methods

    • Adds an event listener to the browser window.

      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.

      • Optionaloptions: AddEventListenerOptions

        The options for the listener.

      Returns Promise<() => void>

      A function that removes the listener.

    • Dispatches an event with the given name and details to the browser window.

      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>

      A promise that resolves when the event has been dispatched.