Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace EventTargets

Index

Functions

Functions

  • once<E>(target: EventTarget, type: string, opts?: boolean | AddEventListenerOptions): Promise<E>
  • Adds a listener to the given target, and returns a promise that resolves with the first event emitted of the given type.

    Type Parameters

    • E extends Event

    Parameters

    • target: EventTarget

      The target to add an event listener to.

    • type: string

      The event type to listen for.

    • Optional opts: boolean | AddEventListenerOptions

      Options to pass to addEventListener.

    Returns Promise<E>

    A promise that resolves with the first event emitted of type.