File

packages/ui/src/lib/notifications/notification.ts

Description

A Notification is used inside NotificationService and NotificationComponent to display any information to the user.

Index

Properties

Constructor

constructor(notification: Notification)

The constructor just looks if an error is set, and if yes, sets the type to error.

Parameters :
Name Type Optional
notification Notification No

Properties

Optional append
Type : []

If set, the notification will be appended to the given array of Notifications when activated

Optional error
Type : any

If an error is given, the type will automatically be set to error. The error will be displayed inside the notification via ec-error.

Optional hide
Type : []

Notifications that should be hidden when this one gets active

Optional host
Type : NotificationsComponent

The host the is NotificationsComponent that should display the notification.

Optional message
Type : string

The message is shown below the title and is meant for further description.

Optional replace
Type : []

If set, the notification will replace all others in the given array of Notifications when activated

Optional sticky
Type : boolean

If true, the notification will stay forever

Optional time
Type : number

The amount of ms it should be visible

Optional title
Type : string

The title is the headline of a notification and the only value that is required.

Optional type
Type : string

Determines the looks. Currently info, error and success are defined.

import { NotificationsComponent } from './notifications.component';

/** A Notification is used inside NotificationService and NotificationComponent to display any information to the user.*/
export class Notification {
  /** The title is the headline of a notification and the only value that is required. */
  title?: string;
  /** The message is shown below the title and is meant for further description. */
  message?: string;
  /** The host the is NotificationsComponent that should display the notification. */
  host?: NotificationsComponent;
  /** The amount of ms it should be visible */
  time?: number;
  /** If true, the notification will stay forever */
  sticky?: boolean;
  /** Determines the looks. Currently info, error and success are defined. */
  type?: string;
  /** If an error is given, the type will automatically be set to error. The error will be displayed inside the notification via ec-error.*/
  error?: any;
  /** Notifications that should be hidden when this one gets active */
  hide?: this[];
  /** If set, the notification will be appended to the given array of Notifications when activated */
  append?: this[];
  /** If set, the notification will replace all others in the given array of Notifications when activated */
  replace?: this[];

  /** The constructor just looks if an error is set, and if yes, sets the type to error. */
  constructor(notification: Notification) {
    if (notification.error) {
      this.type = 'error';
    }
    Object.assign(this, notification);
  }
}

result-matching ""

    No results matching ""