MapComplete/UI/Base/FeatureSwitched.ts

22 lines
600 B
TypeScript
Raw Normal View History

import {UIElement} from "../UIElement";
import {UIEventSource} from "../../Logic/UIEventSource";
export default class FeatureSwitched extends UIElement{
private readonly _upstream: UIElement;
private readonly _swtch: UIEventSource<boolean>;
constructor(upstream :UIElement,
swtch: UIEventSource<boolean>) {
super(swtch);
this._upstream = upstream;
this._swtch = swtch;
}
2021-06-10 01:36:20 +02:00
InnerRender(): UIElement | string {
if(this._swtch.data){
return this._upstream.Render();
}
2021-06-10 01:36:20 +02:00
return undefined;
}
}