Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Notification

the notification module encapsulates common functions used to inform user about the results of certain actions

Hierarchy

  • Notification

Implements

Index

Properties

cls

cls: NotiClass | "" = ""

history

history: Readonly<NotiItem>[] = []

history of the notification states. index 0 corresponds to the most recent one

Private job

job: number | null = null

msg

msg: string = ""

Methods

clear

  • clear(timeout?: number): void
  • clear the current notification

    Parameters

    • Default value timeout: number = 0

      clear the current notification after timeout seconds. Default to 0, which clears the current notification immediately.

    Returns void

clearHistory

  • clearHistory(): void

empty

  • empty(): boolean

error

  • error(msg: string, timeout?: number, override?: boolean): void
  • display a notification to users. by default, only notifications of higher level will override the previous notification.

    Parameters

    • msg: string

      the message to display

    • Default value timeout: number = 5

      timeout in second. this noti msg will be automatically cleared after timeout.

    • Default value override: boolean = false

      force-override the previous notification, if it exists

    Returns void

info

  • info(msg: string, timeout?: number, override?: boolean): void
  • display a notification to users. by default, only notifications of higher level will override the previous notification.

    Parameters

    • msg: string

      the message to display

    • Default value timeout: number = 5

      timeout in second. this noti msg will be automatically cleared after timeout.

    • Default value override: boolean = false

      force-override the previous notification, if it exists

    Returns void

notify

  • notify<T>(msg: string | NotiMsg<T>, cls?: NotiClass, timeout?: number, override?: boolean): void
  • display a notification to users. by default, only notifications of higher level will override the previous notification.

    Type parameters

    • T

    Parameters

    • msg: string | NotiMsg<T>

      the message to display

    • Default value cls: NotiClass = "info"
    • Default value timeout: number = 5

      timeout in second. this noti msg will be automatically cleared after timeout.

    • Default value override: boolean = false

      force-override the previous notification, if it exists

    Returns void

success

  • success(msg: string, timeout?: number, override?: boolean): void
  • display a notification to users. by default, only notifications of higher level will override the previous notification.

    Parameters

    • msg: string

      the message to display

    • Default value timeout: number = 5

      timeout in second. this noti msg will be automatically cleared after timeout.

    • Default value override: boolean = false

      force-override the previous notification, if it exists

    Returns void

warn

  • warn(msg: string, timeout?: number, override?: boolean): void
  • display a notification to users. by default, only notifications of higher level will override the previous notification.

    Parameters

    • msg: string

      the message to display

    • Default value timeout: number = 5

      timeout in second. this noti msg will be automatically cleared after timeout.

    • Default value override: boolean = false

      force-override the previous notification, if it exists

    Returns void

Generated using TypeDoc