Reformat all files with prettier

This commit is contained in:
Pieter Vander Vennet 2022-09-08 21:40:48 +02:00
parent e22d189376
commit b541d3eab4
382 changed files with 50893 additions and 35566 deletions

View file

@ -1,24 +1,24 @@
import {Store} from "../../Logic/UIEventSource";
import BaseUIElement from "../BaseUIElement";
import Combine from "./Combine";
import { Store } from "../../Logic/UIEventSource"
import BaseUIElement from "../BaseUIElement"
import Combine from "./Combine"
export class VariableUiElement extends BaseUIElement {
private readonly _contents?: Store<string | BaseUIElement | BaseUIElement[]>;
private readonly _contents?: Store<string | BaseUIElement | BaseUIElement[]>
constructor(contents?: Store<string | BaseUIElement | BaseUIElement[]>) {
super();
this._contents = contents;
super()
this._contents = contents
}
Destroy() {
super.Destroy();
this.isDestroyed = true;
super.Destroy()
this.isDestroyed = true
}
AsMarkdown(): string {
const d = this._contents?.data;
const d = this._contents?.data
if (typeof d === "string") {
return d;
return d
}
if (d instanceof BaseUIElement) {
return d.AsMarkdown()
@ -27,36 +27,36 @@ export class VariableUiElement extends BaseUIElement {
}
protected InnerConstructElement(): HTMLElement {
const el = document.createElement("span");
const self = this;
const el = document.createElement("span")
const self = this
this._contents?.addCallbackAndRun((contents) => {
if (self.isDestroyed) {
return true;
return true
}
while (el.firstChild) {
el.removeChild(el.lastChild);
el.removeChild(el.lastChild)
}
if (contents === undefined) {
return
}
if (typeof contents === "string") {
el.innerHTML = contents;
el.innerHTML = contents
} else if (contents instanceof Array) {
for (const content of contents) {
const c = content?.ConstructElement();
const c = content?.ConstructElement()
if (c !== undefined && c !== null) {
el.appendChild(c);
el.appendChild(c)
}
}
} else {
const c = contents.ConstructElement();
const c = contents.ConstructElement()
if (c !== undefined && c !== null) {
el.appendChild(c);
el.appendChild(c)
}
}
});
return el;
})
return el
}
}