Files
Graphite/frontend/src/App.svelte
Andre Roelofs 639a24d8ad Replace TS relative @ import path (#1087)
Migrated the import shortcut used in Svelte from @ to @graphite for better future package compatibility

Co-authored-by: Andre Roelofs <andreroelofsai@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-03-26 01:39:38 +01:00

25 lines
507 B
Svelte

<script lang="ts">
import { onMount, onDestroy } from "svelte";
import { initWasm, createEditor } from "@graphite/wasm-communication/editor";
import Editor from "@graphite/components/Editor.svelte";
let editor: ReturnType<typeof createEditor> | undefined = undefined;
onMount(async () => {
await initWasm();
editor = createEditor();
});
onDestroy(() => {
// Destroy the WASM editor instance
editor?.instance.free();
});
</script>
{#if editor !== undefined}
<Editor {editor} />
{/if}