Class Mediator

Mediator - a widget factory

Hierarchy

  • EventEmitter
    • Mediator

Constructors

  • Creating a new instance of the mediator

    Parameters

    • config: MediatorConfig

      Widget configuration

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

      Additional properties/methods for the mediator You can specify an object with any properties, except for reserved ones (and properties starting with _):

      • config
      • prefix
      • id
      • properties
      • initializeDOMElements
      • counterWidgetId
      • widgets
      • widgetInstances
      • destroy
      • provideWidgetId
      • defineWidget
      • buildWidget
      • updateViewport
      • initializeDOMElements
      • externalize
      • externalizeAsProvider

    Returns Mediator

Properties

id: string

Mediator identifier

prefix: string

Prefix used for data-attributes

widgetInstances: Record<string, Widget> = {}

Widget instances

widgets: Record<string, {
    config: WidgetConfig;
    properties: Record<string, any>;
}> = {}

Widgets

Type declaration

Methods

  • 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>

  • 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>

  • Define a widget

    Parameters

    • config: WidgetConfig

      Widget configuration

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

      Additional widget properties, this object is copied to the widget as is and supplements it with these properties

    Returns void

  • Destroy the mediator and stop listening to DOM events

    Returns void

  • Factory that exports a facade available to the widget

    Returns {
        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

  • Factory that exports a facade available inside an iframe

    Returns {
        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

Generated using TypeDoc