@miracledevs/paradigm-web-angular
Version:
An angular wrapper with base functionality and helper services.
119 lines (118 loc) • 3.35 kB
TypeScript
/*!
* Paradigm Framework - Angular Wrapper
* Copyright (c) 2017 Miracle Devs, Inc
* Licensed under MIT (https://github.com/MiracleDevs/Paradigm.Web.Shared/blob/master/LICENSE)
*/
import { ArrayList } from '@miracledevs/paradigm-ui-web-shared';
import { LoggingService, LogType } from './logging.service';
import { ServiceBase } from './base.service';
/**
* Enumerates the different types of alerts.
*/
export declare enum AlertType {
/**
* Represents a message alert.
* It's the equivalent of @see LogType.Information
*/
Message = 2,
/**
* Represents a warning alert.
* It's the equivalent of @see LogType.Warning
*/
Warning = 3,
/**
* Represents an error alert.
* It's the equivalent of @see LogType.Error
*/
Error = 4
}
/**
* Represents an alert thrown by the system.
*/
export declare class Alert {
/**
* The alert type.
*/
private alertType;
/**
* The alert inner message.
*/
private innerMessage;
/**
* Gets the type of the alert.
*/
readonly type: AlertType;
/**
* Gets the type name.
*/
readonly typeName: string;
/**
* Gets the alert message.
*/
readonly message: string;
/**
* Creates a new instance of @see Alert.
*/
constructor(alertType: AlertType, message: string);
}
export declare class AlertService extends ServiceBase {
private logger;
/**
* An array holding the alerts that are currently alive.
*/
private alerts;
/**
* Creates a new instance of @see AlertService
* @param logger The current logging service.
*/
constructor(logger: LoggingService);
/**
* Gets the equivalent @see LogType for the specified @see AlertType.
* @param alertType The specified alert type.
* @returns the log type.
*/
static getLogType(alertType: AlertType): LogType;
/**
* Adds a new alert.
* The alert service will also notify the @see LoggingService.
* @param alertType the alert type.
* @param message the alert message.
*/
add(alertType: AlertType, message: string): void;
/**
* Adds a new error alert.
* The alert service will also notify the @see LoggingService.
* @param message the error message.
*/
addError(message: string): void;
/**
* Adds a new warning alert.
* The alert service will also notify the @see LoggingService.
* @param message the error message.
*/
addWarning(message: string): void;
/**
* Adds a new message alert.
* The alert service will also notify the @see LoggingService.
* @param message the error message.
*/
addMessage(message: string): void;
/**
* Removes one of the alerts from the alerts collection.
* @param index The index of the alert, or the alert that needs to be removed.
*/
remove(index: number | Alert): void;
/**
* Gets the specified alert by its index.
* @param index the alert index.
*/
get(index: number): Alert;
/**
* Gets the alert collection.
*/
getAlerts(): ArrayList<Alert>;
/**
* Clears the alert collection.
*/
clear(): void;
}