mapcomplete/UI/Base/ToSvelte.svelte

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
463 B
Svelte
Raw Normal View History

<script lang="ts">
import BaseUIElement from "../BaseUIElement.js";
import { onMount } from "svelte";
export let construct: BaseUIElement | (() => BaseUIElement);
let elem: HTMLElement;
onMount(() => {
let html: HTMLElement
if (typeof construct === "function") {
html = construct().ConstructElement();
} else {
html = construct.ConstructElement();
}
elem.replaceWith(html)
});
</script>
<span bind:this={elem}></span>