Interface Widget<T>

Widget interface. Every widget implements this interface.

interface Widget<T> {
    mount(id: string, params?: WidgetParameters[T]): void;
    unmount(): void;
    update(props: WidgetProperties<T>): void;
    addListener<KEventName>(type: KEventName, callback: ((data: WidgetEventData[T][KEventName]) => void)): void;
    removeListener<KEventName>(type: KEventName): void;
}

Type Parameters

Methods

  • Mount a widget to a DOM ref element.

    Parameters

    • id: string

      ID of the DOM element where the widget will be mounted.

    • Optionalparams: WidgetParameters[T]

      widget parameters.

    Returns void

  • Unmount a widget and reset parameters

    Returns void

  • Update the widget properties

    Parameters

    Returns void

  • Add a listener for a widget event.

    Type Parameters

    • KEventName extends string | number | symbol

    Parameters

    Returns void

  • Removes an event listener for a widget event.

    Type Parameters

    • KEventName extends string | number | symbol

    Parameters

    Returns void