import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; import * as i0 from "@angular/core"; /** * Message service used in messages and toast components. * @group Service */ export class MessageService { messageSource = new Subject(); clearSource = new Subject(); messageObserver = this.messageSource.asObservable(); clearObserver = this.clearSource.asObservable(); /** * Inserts single message. * @param {Message} message - Message to be added. * @group Method */ add(message) { if (message) { this.messageSource.next(message); } } /** * Inserts new messages. * @param {Message[]} messages - Messages to be added. * @group Method */ addAll(messages) { if (messages && messages.length) { this.messageSource.next(messages); } } /** * Clears the message with the given key. * @param {string} key - Key of the message to be cleared. * @group Method */ clear(key) { this.clearSource.next(key || null); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageService, decorators: [{ type: Injectable }] }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZXNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2NvbXBvbmVudHMvYXBpL21lc3NhZ2VzZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDM0MsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLE1BQU0sQ0FBQzs7QUFFL0I7OztHQUdHO0FBRUgsTUFBTSxPQUFPLGNBQWM7SUFDZixhQUFhLEdBQUcsSUFBSSxPQUFPLEVBQXVCLENBQUM7SUFDbkQsV0FBVyxHQUFHLElBQUksT0FBTyxFQUFpQixDQUFDO0lBRW5ELGVBQWUsR0FBRyxJQUFJLEN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