Interface INotificationApi

API for showing notification popups

interface INotificationApi {
    _apiId: "mendix.NotificationApi";
    addEventListener<K>(eventType: K, listener: EventHandler<{}, K>): DisposeListener;
    removeEventListener<K>(eventType: K, listener: EventHandler<{}, K>): void;
    show(notificationInfo: NotificationInfo): Promise<void>;
}

Hierarchy (view full)

Properties

_apiId

Unique identifier that can be used to register or retrieve a specific API.

Example: mendix.EditorsAPI, mycompany.MyFunkyAPI

Methods

  • Adds an event listener for the specified event type.

    Type Parameters

    • K extends never

    Parameters

    • eventType: K

      The type of event to listen for.

    • listener: EventHandler<{}, K>

      The event listener to add.

    Returns DisposeListener

    A function that can be called to remove the event listener.

  • Removes an event listener for the specified event type.

    Type Parameters

    • K extends never

    Parameters

    • eventType: K

      The type of event to remove the listener from.

    • listener: EventHandler<{}, K>

      The event listener to remove.

    Returns void

  • Shows a notification popup with the given message which will disappear after the specified duration.

    Parameters

    • notificationInfo: NotificationInfo

      A NotificationInfo object which contains the title and message of the notification. It also contains an optional icon and an optional duration in seconds for how long the notification will be displayed. If the duration is not provided, the notification will remain visible indefinitely.

    Returns Promise<void>