2016-07-27 18:57:23 +03:00
|
|
|
'use strict';
|
|
|
|
import { Injectable } from '@angular/core';
|
2017-02-28 23:03:03 +03:00
|
|
|
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
2016-07-27 18:57:23 +03:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class WarningsService {
|
|
|
|
private static _warnings: Array<string> = [];
|
2017-02-28 23:03:03 +03:00
|
|
|
private static _warningsObs = new BehaviorSubject<Array<string>>([]);
|
2016-07-27 18:57:23 +03:00
|
|
|
|
|
|
|
static get warnings() {
|
|
|
|
return WarningsService._warningsObs;
|
|
|
|
}
|
|
|
|
|
|
|
|
static hasWarnings() {
|
|
|
|
return !!WarningsService._warnings.length;
|
|
|
|
}
|
|
|
|
|
|
|
|
static warn(message:string) {
|
|
|
|
WarningsService._warnings.push(message);
|
|
|
|
WarningsService._warningsObs.next(WarningsService._warnings);
|
|
|
|
console.warn(message);
|
|
|
|
}
|
|
|
|
}
|