2020-06-29 03:12:44 +02:00
|
|
|
import {UIElement} from "../UIElement";
|
|
|
|
import {UIEventSource} from "../UIEventSource";
|
2020-06-25 03:39:31 +02:00
|
|
|
|
|
|
|
export class VariableUiElement extends UIElement {
|
|
|
|
private _html: UIEventSource<string>;
|
2020-06-27 03:06:51 +02:00
|
|
|
private _innerUpdate: (htmlElement: HTMLElement) => void;
|
2020-06-25 03:39:31 +02:00
|
|
|
|
2020-06-27 03:06:51 +02:00
|
|
|
constructor(html: UIEventSource<string>, innerUpdate : ((htmlElement : HTMLElement) => void) = undefined) {
|
2020-06-25 03:39:31 +02:00
|
|
|
super(html);
|
|
|
|
this._html = html;
|
2020-06-27 03:06:51 +02:00
|
|
|
this._innerUpdate = innerUpdate;
|
|
|
|
|
2020-06-25 03:39:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected InnerRender(): string {
|
|
|
|
return this._html.data;
|
|
|
|
}
|
2020-06-27 03:06:51 +02:00
|
|
|
|
|
|
|
InnerUpdate(htmlElement: HTMLElement) {
|
|
|
|
super.InnerUpdate(htmlElement);
|
|
|
|
if(this._innerUpdate !== undefined){
|
|
|
|
this._innerUpdate(htmlElement);
|
|
|
|
}
|
|
|
|
}
|
2020-06-25 03:39:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
}
|