Class Widget

Widget

destroy Widget deletion event

Hierarchy

  • EventEmitter
    • Widget

Constructors

  • Creating a new widget instance

    Parameters

    • mediator: Mediator

      Mediator

    • id: string

      Widget identifier

    • config: WidgetConfig

      Widget configuration

    • properties: Record<string, any>

      Widget properties, this object is copied as is into the widget and supplements it with these properties

    • params: Record<string, any> = {}

      Some external parameters for the widget. You can specify an object with any properties, except for reserved ones (and properties starting with _):

      • mediator
      • id
      • config
      • name
      • properties
      • params
      • initialize
      • updateViewport
      • destroy
      • createIFrame
      • externalize
      • externalizeAsProvider
      • whenContainerInViewport
      • reduceViewportChange

    Returns Widget

Properties

config: WidgetConfig

Widget configuration

id: string

Widget identifier

name: string

Widget name

params: Record<string, any>

External parameters for the widget

properties: Record<string, any>

Widget properties

Methods

  • Set a container for the widget

    Parameters

    Returns void

  • Destroy the widget and stop listening events

    Returns void

  • A factory that exports the facade available to the external user

    Returns {
        destroy: (() => void);
        params: Record<string, any>;
    }

    • destroy: (() => void)
        • (): void
        • Destroy the widget and stop listening events

          Returns void

    • params: Record<string, any>
  • A factory that exports the facade available in the iframe

    Returns {
        destroy: (() => void);
        getVisibleArea: (() => VisibleArea);
        mediator: {
            buildWidget: {
                (name, containerElement, params?): Promise<WidgetAPI>;
                (name, params?): Promise<WidgetAPI>;
            };
            initializeDOMElements: (() => void);
        };
        params: Record<string, any>;
        resize: undefined | (() => void);
        scrollTo: ((top, duration?) => Promise<void>);
        subscribeVisibleAreaChange: ((callback) => undefined | (() => void));
        url: string;
    }

    • destroy: (() => void)
        • (): void
        • Destroy the widget and stop listening events

          Returns void

    • getVisibleArea: (() => VisibleArea)
    • mediator: {
          buildWidget: {
              (name, containerElement, params?): Promise<WidgetAPI>;
              (name, params?): Promise<WidgetAPI>;
          };
          initializeDOMElements: (() => void);
      }
      • buildWidget: {
            (name, containerElement, params?): Promise<WidgetAPI>;
            (name, params?): Promise<WidgetAPI>;
        }
          • (name, containerElement, params?): Promise<WidgetAPI>
          • Create a widget and place it on the page

            Parameters

            • name: string

              Widget name

            • containerElement: string | HTMLElement

              Element/selector where the widget will be inserted

            • Optional params: Record<string, any>

              Widget initialization parameters

            Returns Promise<WidgetAPI>

          • (name, params?): Promise<WidgetAPI>
          • Create a widget and place it on the page

            Parameters

            • name: string

              Widget name

            • Optional params: Record<string, any>

              Widget initialization parameters

            Returns Promise<WidgetAPI>

      • initializeDOMElements: (() => void)
          • (): void
          • Initialization of DOM elements

            Returns void

    • params: Record<string, any>
    • resize: undefined | (() => void)
    • scrollTo: ((top, duration?) => Promise<void>)
        • (top, duration?): Promise<void>
        • Scroll to a specific part of the iframe

          Parameters

          • top: number

            The coordinate relative to the top-left corner of the iframe to scroll to

          • duration: number = 200

            Scroll animation time, default is 200

          Returns Promise<void>

    • subscribeVisibleAreaChange: ((callback) => undefined | (() => void))
        • (callback): undefined | (() => void)
        • Callback for iframe viewport change (whether the iframe is visible or not)

          Parameters

          Returns undefined | (() => void)

    • url: string
  • Widget initialization function

    Returns Promise<{
        destroy: (() => void);
        params: Record<string, any>;
    }>

  • Wait when the container enters the viewport from the top

    Parameters

    Returns Promise<void>

Generated using TypeDoc