mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
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>
25 lines
507 B
Svelte
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}
|