forked from MapComplete/MapComplete
Lot's of small improvements
This commit is contained in:
parent
9bd37d9cde
commit
8bca006787
29 changed files with 375 additions and 173 deletions
27
UI/Base/VariableUIElement.ts
Normal file
27
UI/Base/VariableUIElement.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import {UIElement} from "../UIElement";
|
||||
import {UIEventSource} from "../UIEventSource";
|
||||
|
||||
export class VariableUiElement extends UIElement {
|
||||
private _html: UIEventSource<string>;
|
||||
private _innerUpdate: (htmlElement: HTMLElement) => void;
|
||||
|
||||
constructor(html: UIEventSource<string>, innerUpdate : ((htmlElement : HTMLElement) => void) = undefined) {
|
||||
super(html);
|
||||
this._html = html;
|
||||
this._innerUpdate = innerUpdate;
|
||||
|
||||
}
|
||||
|
||||
protected InnerRender(): string {
|
||||
return this._html.data;
|
||||
}
|
||||
|
||||
InnerUpdate(htmlElement: HTMLElement) {
|
||||
super.InnerUpdate(htmlElement);
|
||||
if(this._innerUpdate !== undefined){
|
||||
this._innerUpdate(htmlElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue