Exports

Notification

1. Notify

The Notify function is used to display a simple notification with customizable options such as type, title, message, icon, duration, position, and style.

Usage:

Notify(type, title, message, icon, duration, position, style)

Parameters

  • type (string): The type of notification. Options are:

    • "info" (default)

    • "success"

    • "warning"

    • "error"

  • title (string)

  • message (string)

  • icon (string, optional) Default is nil (no icon).

  • duration (number, optional) Default is 3000.

  • position (string, optional):

    • "top-left"

    • "top-center"

    • "top-right"

    • "bottom-left"

    • "bottom-center"

    • "bottom-right"

    • Default is "top-center".

  • style (table, optional): A table of custom CSS properties to style the notification.

Example: Using Export

Example: Server Side Event

Promise

The Promise function is used for promise-based notifications that show a loading state and then display either a success or failure message based on the outcome of an asynchronous operation.

Usage

Parameters

  • loadingMessage (string): The message to display while the notification is in a loading state.

  • resultHandler (function): A function that determines the outcome of the operation. It takes a callback function (cb_NotificationPromise) as a parameter, which must be called with:

    • resultMessage (string): The message to display upon completion.

    • isSuccess (boolean): Whether the operation was successful (true) or failed (false).

  • options (table, optional): A table of custom options for the notification:

    • icon (string, optional): Custom icon or emoji for the notification.

    • duration (number, optional): Duration of the notification in milliseconds.

    • position (string, optional): Position of the notification on the screen (same options as Notify).

    • style (table, optional): Custom CSS properties for the notification style.

Example: Using Export

Example: Server Side Event

Last updated