ng-angular-popup
Version:
A modern, lightweight, and customizable toast notification library for Angular applications
100 lines (99 loc) • 5.27 kB
TypeScript
import { ToastMessage } from './toast-message.model';
import { ToastType } from './toast-type.enum';
import * as i0 from "@angular/core";
export declare class NgToastService {
#private;
/**
* Signal that holds the current toast messages
*/
toastMessages: import("@angular/core").WritableSignal<ToastMessage[]>;
/**
* Constructs a new NgToastService instance.
*/
constructor();
/**
* Displays a toast message.
* @param message The message to display.
* @param type The type of the toast message.
* @param title The optional title of the toast message.
* @param duration The duration in milliseconds for which the toast message should be displayed. Defaults to the default duration.
* @param showProgress Whether to show the progress bar. Defaults to true.
* @param dismissible Whether the toast can be manually dismissed. Defaults to true.
*/
toast(message: string, type: ToastType, title?: string, duration?: number, showProgress?: boolean, dismissible?: boolean): void;
/**
* Displays a success toast message.
* @param message The message to display.
* @param title The optional title of the toast message.
* @param duration The duration in milliseconds for which the toast message should be displayed. Defaults to the default duration.
* @param showProgress Whether to show the progress bar. Defaults to true.
* @param dismissible Whether the toast can be manually dismissed. Defaults to true.
*/
success(message: string, title?: string, duration?: number, showProgress?: boolean, dismissible?: boolean): void;
/**
* Displays an info toast message.
* @param message The message to display.
* @param title The optional title of the toast message.
* @param duration The duration in milliseconds for which the toast message should be displayed. Defaults to the default duration.
* @param showProgress Whether to show the progress bar. Defaults to true.
* @param dismissible Whether the toast can be manually dismissed. Defaults to true.
*/
info(message: string, title?: string, duration?: number, showProgress?: boolean, dismissible?: boolean): void;
/**
* Displays a warning toast message.
* @param message The message to display.
* @param title The optional title of the toast message.
* @param duration The duration in milliseconds for which the toast message should be displayed. Defaults to the default duration.
* @param showProgress Whether to show the progress bar. Defaults to true.
* @param dismissible Whether the toast can be manually dismissed. Defaults to true.
*/
warning(message: string, title?: string, duration?: number, showProgress?: boolean, dismissible?: boolean): void;
/**
* Displays a danger/error toast message.
* @param message The message to display.
* @param title The optional title of the toast message.
* @param duration The duration in milliseconds for which the toast message should be displayed. Defaults to the default duration.
* @param showProgress Whether to show the progress bar. Defaults to true.
* @param dismissible Whether the toast can be manually dismissed. Defaults to true.
*/
danger(message: string, title?: string, duration?: number, showProgress?: boolean, dismissible?: boolean): void;
/**
* Displays a primary toast message.
* @param message The message to display.
* @param title The optional title of the toast message.
* @param duration The duration in milliseconds for which the toast message should be displayed. Defaults to the default duration.
* @param showProgress Whether to show the progress bar. Defaults to true.
* @param dismissible Whether the toast can be manually dismissed. Defaults to true.
*/
primary(message: string, title?: string, duration?: number, showProgress?: boolean, dismissible?: boolean): void;
/**
* Displays a secondary toast message.
* @param message The message to display.
* @param title The optional title of the toast message.
* @param duration The duration in milliseconds for which the toast message should be displayed. Defaults to the default duration.
* @param showProgress Whether to show the progress bar. Defaults to true.
* @param dismissible Whether the toast can be manually dismissed. Defaults to true.
*/
secondary(message: string, title?: string, duration?: number, showProgress?: boolean, dismissible?: boolean): void;
/**
* Removes a toast message from the list
* @param messageId The ID of the message to remove
*/
removeToast(messageId: number): void;
/**
* Removes all toast messages
*/
clearAll(): void;
/**
* Updates the progress bars by triggering a signal update
* This is used by the component to refresh progress bars
*/
updateProgress(): void;
/**
* Sets the maximum number of toasts to display at once
* @param max The maximum number of toasts
*/
setMaxToasts(max: number): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NgToastService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<NgToastService>;
}