Base class for all widgets, providing common functionality

Hierarchy (view full)

Implements

Constructors

Properties

el: HTMLElement
iframe: HTMLIFrameElement = null

The iframe element

listeners: Map<string, MessageEventHandler<any>[]> = ...
uiPath: string = 'iframe'

The path to the iframe which will be appended to the uiBaseURL to get the full URL

Methods

  • Emits a message to the iframe

    Type Parameters

    • P

    Parameters

    Returns this

    this

  • Gets the iframe element

    Returns HTMLIFrameElement

    The iframe element or null if it doesn't exist currently

  • Returns whether the widget is open or not

    Returns boolean

    True if the widget is open, false otherwise

  • Lifecycle hooks for extending classes

    Parameters

    Returns Promise<boolean>

    Promise Whether the message was handled

    BaseWidget.onMessage

  • Triggers all listeners for a given message type

    Parameters

    • type: string

      The message type

    • envelope: MessageEnvelope<any>

      The message envelope containing the payload

    • sdk: ISDK

      The SDK instance

    • widget: IWidget

      The widget instance

    Returns void