@gokula-krishnan/notify-lib
Version:
🔥 Angular toast notification library with position, hover pause, and close support.
51 lines (45 loc) • 1.86 kB
TypeScript
import * as i0 from '@angular/core';
import { OnInit } from '@angular/core';
import * as rxjs from 'rxjs';
declare class NotifyLib {
static ɵfac: i0.ɵɵFactoryDeclaration<NotifyLib, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NotifyLib, "lib-notify-lib", never, {}, {}, never, never, true, never>;
}
type ToastType = 'success' | 'error' | 'info' | 'warning';
interface Toast {
id: string;
message: string;
type: ToastType;
duration?: number;
}
declare class NotificationService {
private toasts;
private toastSubject;
toastStream$: rxjs.Observable<Toast[]>;
private toastTimeouts;
private generateId;
show(message: string, type?: ToastType, duration?: number): void;
remove(id: string): void;
pause(id: string): void;
resume(id: string, duration?: number): void;
success(msg: string): void;
error(msg: string): void;
info(msg: string): void;
warning(msg: string): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
}
declare class ToastContainerComponent implements OnInit {
private notifyService;
toasts: Toast[];
position: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
constructor(notifyService: NotificationService);
ngOnInit(): void;
pausedToasts: Set<string>;
pause(id: string, isPaused: boolean): void;
dismiss(id: string): void;
trackById(index: number, toast: Toast): string;
static ɵfac: i0.ɵɵFactoryDeclaration<ToastContainerComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ToastContainerComponent, "lib-toast-container", never, { "position": { "alias": "position"; "required": false; }; }, {}, never, never, true, never>;
}
export { NotificationService, NotifyLib, ToastContainerComponent };