feature: improve ApplicationGroup
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user