2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-17 18:52:06 +00:00

chore: save shared modman info in context

This commit is contained in:
Jan Laupetin
2025-10-10 10:57:07 +01:00
parent 9845b0a889
commit 219f0c1c85
7 changed files with 68 additions and 64 deletions

View File

@@ -1,28 +1,13 @@
<script setup lang="ts">
import { onUnmounted, ref } from "vue";
import { webviewBinds, webviewAddEventListener, webviewRemoveEventListener } from "./native";
import { ref } from "vue";
import { webviewBinds } from "./native";
const greetMsg = ref("");
const lastPersonGreeted = ref("");
const lastPath = ref("");
const name = ref("");
async function greet() {
greetMsg.value = await webviewBinds.greet(name.value);
}
function onPersonGreeted(person: string) {
lastPersonGreeted.value = person;
}
async function onOpenFastfileClick() {
lastPath.value =
(await webviewBinds.openFileDialog({ filters: [{ name: "Fastfiles", filter: "*.ff" }] })) ?? "";
}
webviewAddEventListener("greeting", onPersonGreeted);
onUnmounted(() => webviewRemoveEventListener("greeting", onPersonGreeted));
</script>
<template>
@@ -30,12 +15,6 @@ onUnmounted(() => webviewRemoveEventListener("greeting", onPersonGreeted));
<h1>Welcome to ModMan</h1>
<small>Nothing to see here yet, this is mainly for testing</small>
<form class="row" @submit.prevent="greet">
<input id="greet-input" v-model="name" placeholder="Enter a name..." autocomplete="off" />
<button type="submit">Greet</button>
</form>
<p>{{ greetMsg }}</p>
<p>The last person greeted is: {{ lastPersonGreeted }}</p>
<p>
<button @click="onOpenFastfileClick">Open fastfile</button>
<span>The last path: {{ lastPath }}</span>

View File

@@ -1,12 +1,10 @@
import type { DialogBinds } from "./DialogBinds";
export type NativeMethods = {
greet(name: string): Promise<string>;
} & DialogBinds;
export type NativeMethods = DialogBinds;
interface NativeEventMap {
greeting: string;
}
type WebViewExtensions = {