Rev | Line | |
---|
[59329aa] | 1 | import { Injectable } from '@angular/core';
|
---|
| 2 | import { Subject } from 'rxjs';
|
---|
| 3 | import * as i0 from "@angular/core";
|
---|
| 4 | export class MessageService {
|
---|
| 5 | constructor() {
|
---|
| 6 | this.messageSource = new Subject();
|
---|
| 7 | this.clearSource = new Subject();
|
---|
| 8 | this.messageObserver = this.messageSource.asObservable();
|
---|
| 9 | this.clearObserver = this.clearSource.asObservable();
|
---|
| 10 | }
|
---|
| 11 | add(message) {
|
---|
| 12 | if (message) {
|
---|
| 13 | this.messageSource.next(message);
|
---|
| 14 | }
|
---|
| 15 | }
|
---|
| 16 | addAll(messages) {
|
---|
| 17 | if (messages && messages.length) {
|
---|
| 18 | this.messageSource.next(messages);
|
---|
| 19 | }
|
---|
| 20 | }
|
---|
| 21 | clear(key) {
|
---|
| 22 | this.clearSource.next(key || null);
|
---|
| 23 | }
|
---|
| 24 | }
|
---|
| 25 | MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MessageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
---|
| 26 | MessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MessageService });
|
---|
| 27 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MessageService, decorators: [{
|
---|
| 28 | type: Injectable
|
---|
| 29 | }] });
|
---|
| 30 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZXNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2NvbXBvbmVudHMvYXBpL21lc3NhZ2VzZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQU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YXNzIE1lc3NhZ2VTZXJ2aWNlIHtcbiAgICBcbiAgICBwcml2YXRlIG1lc3NhZ2VTb3VyY2UgPSBuZXcgU3ViamVjdDxNZXNzYWdlfE1lc3NhZ2VbXT4oKTtcbiAgICBwcml2YXRlIGNsZWFyU291cmNlID0gbmV3IFN1YmplY3Q8c3RyaW5nPigpO1xuICAgIFxuICAgIG1lc3NhZ2VPYnNlcnZlciA9IHRoaXMubWVzc2FnZVNvdXJjZS5hc09ic2VydmFibGUoKTtcbiAgICBjbGVhck9ic2VydmVyID0gdGhpcy5jbGVhclNvdXJjZS5hc09ic2VydmFibGUoKTtcbiAgICBcbiAgICBhZGQobWVzc2FnZTogTWVzc2FnZSkge1xuICAgICAgICBpZiAobWVzc2FnZSkge1xuICAgICAgICAgICAgdGhpcy5tZXNzYWdlU291cmNlLm5leHQobWVzc2FnZSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgXG4gICAgYWRkQWxsKG1lc3NhZ2VzOiBNZXNzYWdlW10pIHtcbiAgICAgICAgaWYgKG1lc3NhZ2VzICYmIG1lc3NhZ2VzLmxlbmd0aCkge1xuICAgICAgICAgICAgdGhpcy5tZXNzYWdlU291cmNlLm5leHQobWVzc2FnZXMpO1xuICAgICAgICB9IFxuICAgIH1cbiAgICBcbiAgICBjbGVhcihrZXk/OiBzdHJpbmcpIHtcbiAgICAgICAgdGhpcy5jbGVhclNvdXJjZS5uZXh0KGtleXx8bnVsbCk7XG4gICAgfVxuICAgIFxufSJdfQ== |
---|
Note:
See
TracBrowser
for help on using the repository browser.