Add activaterd as a stream from every component

This commit is contained in:
Johan Gyllenspetz 2016-02-12 14:35:27 -08:00
parent 74cb625996
commit c208cce734

View File

@ -7,6 +7,7 @@ export abstract class Component {
public static componentName: string = "not_worthy";
protected _activated: boolean;
protected _activated$: rx.BehaviorSubject<boolean> = new rx.BehaviorSubject<boolean>(false);
protected _configurationSubject$: rx.Subject<IComponentConfiguration> = new rx.Subject<IComponentConfiguration>();
protected _configuration$: rx.Observable<IComponentConfiguration>;
protected _container: Container;
@ -45,6 +46,7 @@ export abstract class Component {
this._activate();
this._activated = true;
this._activated$.onNext(true);
};
protected abstract _activate(): void;
@ -58,6 +60,7 @@ export abstract class Component {
this._container.glRenderer.clear(this._name);
this._deactivate();
this._activated = false;
this._activated$.onNext(false);
};
protected abstract _deactivate(): void;
@ -66,6 +69,10 @@ export abstract class Component {
return this._activated;
}
public get activated$(): rx.Observable<boolean> {
return this._activated$;
}
public configure(conf: IComponentConfiguration): void {
this._configurationSubject$.onNext(conf);
}