Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 39x 39x 39x 17x 17x 1x 1x 1x | import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { AppNotification } from '@core/model/app-notification.interface'; @Injectable({ providedIn: 'root' }) export class NotificationService { private notificationSubject$ = new Subject<AppNotification | null>(); public notification$: Observable<AppNotification | null> = this.notificationSubject$.asObservable(); public error(errorMessage: string, error: Error | null) :void { this.handleNotification({type: 'error', message: errorMessage, error} as AppNotification); } public confirmation(confirmationMessage: string) :void { this.handleNotification({type: 'confirmation', message: confirmationMessage} as AppNotification); } public information(informationMessage: string) :void { this.handleNotification({type: 'information', message: informationMessage} as AppNotification); } private handleNotification(notification: AppNotification) :void { this.notificationSubject$.next(notification); } reset(): void { this.notificationSubject$.next(null); } } |