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 {
|
2017-07-22 18:04:54 +03:00
|
|
|
public static warnings = new BehaviorSubject<Array<string>>([]);
|
2016-07-27 18:57:23 +03:00
|
|
|
|
2017-07-22 18:04:54 +03:00
|
|
|
private static _warnings: Array<string> = [];
|
2016-07-27 18:57:23 +03:00
|
|
|
|
|
|
|
static hasWarnings() {
|
|
|
|
return !!WarningsService._warnings.length;
|
|
|
|
}
|
|
|
|
|
|
|
|
static warn(message:string) {
|
|
|
|
WarningsService._warnings.push(message);
|
2017-07-22 18:04:54 +03:00
|
|
|
WarningsService.warnings.next(WarningsService._warnings);
|
2016-07-27 18:57:23 +03:00
|
|
|
console.warn(message);
|
|
|
|
}
|
|
|
|
}
|