feature: improve ApplicationGroup

This commit is contained in:
Radek Czemerys
2020-06-26 19:24:46 +02:00
parent 082d3d8e2d
commit f1ae5b2145

View File

@@ -11,11 +11,12 @@ import {
ThemeManager
} from '@/services';
import { AppState } from '@/ui_models/app_state';
import { pull } from 'lodash';
type AppManagerChangeCallback = () => void
export class ApplicationGroup {
$compile: ng.ICompileService
$rootScope: ng.IRootScopeService
$timeout: ng.ITimeoutService
@@ -50,8 +51,9 @@ export class ApplicationGroup {
}
if (this.applications.length === 0) {
this.createDefaultApplication();
} else {
this.notifyObserversOfAppChange();
}
this.notifyObserversOfAppChange();
}
private createNewApplication() {
@@ -121,6 +123,10 @@ export class ApplicationGroup {
if (this.application) {
callback();
}
return () => {
pull( this.changeObservers, callback)
}
}
private notifyObserversOfAppChange() {