Class ToastCustomScripting

This class supports the functionality for custom scripting on the toasts. You can access all the methods by using the namespace CSL.toast.

Hierarchy

  • CslBase
    • ToastCustomScripting

Constructors

  • Parameters

    • toastService: ToastService
    • componentService: ObizComponentService
    • animationService: GlobalAnimationService

    Returns ToastCustomScripting

Properties

componentId: string = ''

The component id of the current view instance.

Accessors

  • get componentConfig(): Component
  • The configuration of the component to render.

    Returns Component

  • get htmlElement(): any
  • The rendered HTML of the view.

    Returns any

  • get viewConfig(): UpdateView | MultiRecordView | SingleRecordView | CreateView
  • The configuration of the view to render.

    Returns UpdateView | MultiRecordView | SingleRecordView | CreateView

  • get viewFields(): ViewField[]
  • The viewFields of the view.

    Returns ViewField[]

Methods

  • Changes the type, message, title and timeout of a specific toast.

    // Creates a info toast and changes it to a success toast which will be cleared after 5 seconds.
    const toastId = CSL.toast.info('Processing!');
    /// Do some async code.
    CSL.toast.change(toastId, 'success', 'Done processing!', null, 5000);

    Parameters

    • toastId: number

      The toast to change.

    • toastType: ToastType

      Specify the toast type: error, info, success or warning.

    • Optional message: string

      The message to display.

    • Optional title: string

      The title to display above the message. The title is marked in bold.

    • timeOut: number = 0

      The toast id which can be used to change the toast.

    Returns number

  • Clears a specific toast when passing the toastId as an argument. Clears all toasts when no argument is passed.

    // Clear all toasts.
    CSL.toast.clear();

    // Clears a specific toast.
    const toastId = CSL.toast.success('Done processing!');
    CSL.toast.clear(toastId);

    Parameters

    • Optional toastId: number

      The toast id to clear. If null, all toast are cleared

    Returns void

  • Creates a new error toast which has the default red color.

    // Simple error toast with message and ERROR title.
    CSL.toast.error('Something went wrong!', 'ERROR');

    // Error toast cleared after 5 seconds.
    CSL.toast.error('Something went wrong!', 'ERROR', 5000);

    Returns

    The toast id which can be used to change the toast.

    Parameters

    • Optional message: string

      The message to display.

    • Optional title: string

      The title to display above the message. The title is marked in bold.

    • timeOut: number = 0

      The time in milliseconds after the toast is cleared. Default 0 which means it is not cleared unless the user clicks on the toast.

    Returns number

  • Creates a new info toast which has the default blue color.

    // Info toast cleared after 5 seconds.
    CSL.toast.info('Please hold on ...', null, 5000);

    Returns

    The toast id which can be used to change the toast.

    Parameters

    • Optional message: string

      The message to display.

    • Optional title: string

      The title to display above the message. The title is marked in bold.

    • timeOut: number = 0

      The time in milliseconds after the toast is cleared. Default 0 which means it is not cleared unless the user clicks on the toast.

    Returns number

  • Creates a new toast info which has the default green color.

    // Success toast cleared after 2 seconds.
    CSL.toast.success('Done processing!', null, 2000);

    Returns

    The toast id which can be used to change the toast.

    Parameters

    • Optional message: string

      The message to display.

    • Optional title: string

      The title to display above the message. The title is marked in bold.

    • timeOut: number = 0

      The time in milliseconds after the toast is cleared. Default 0 which means it is not cleared unless the user clicks on the toast.

    Returns number

  • Creates a new toast info message.

    // Warning toast displaying a message only.
    CSL.toast.warning('Wow, this is not good.');

    Returns

    The toast id which can be used to change the toast.

    Parameters

    • Optional message: string

      The message to display.

    • Optional title: string

      The title to display above the message. The title is marked in bold.

    • timeOut: number = 0

      The time in milliseconds after the toast is cleared. Default 0 which means it is not cleared unless the user clicks on the toast.

    Returns number

Generated using TypeDoc