mapcomplete/UI/Base/ToSvelte.svelte

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

19 lines
413 B
Svelte
Raw Normal View History

<script lang="ts">
2023-02-03 14:59:08 +01:00
import BaseUIElement from "../BaseUIElement.js"
import { onMount } from "svelte"
export let construct: BaseUIElement | (() => BaseUIElement)
let elem: HTMLElement
onMount(() => {
2023-02-03 14:59:08 +01:00
let html =
typeof construct === "function"
? construct().ConstructElement()
: construct.ConstructElement()
elem.replaceWith(html)
2023-02-03 14:59:08 +01:00
})
</script>
2023-02-03 14:59:08 +01:00
<span bind:this={elem} />