mirror of
https://github.com/mapillary/mapillary-js.git
synced 2026-02-01 14:33:45 +00:00
Add activaterd as a stream from every component
This commit is contained in:
parent
74cb625996
commit
c208cce734
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user