aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/main.js')
-rw-r--r--ui/main.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/main.js b/ui/main.js
new file mode 100644
index 0000000..33099cd
--- /dev/null
+++ b/ui/main.js
@@ -0,0 +1,15 @@
+const { invoke } = window.__TAURI__.core;
+
+const startBtn = document.getElementById("start-game-btn");
+const statusText = document.getElementById("status-text");
+
+startBtn.addEventListener("click", async () => {
+ statusText.textContent = "正在获取 Manifest...";
+ try {
+ const response = await invoke("start_game");
+ statusText.textContent = response;
+ } catch (error) {
+ statusText.textContent = "错误: " + error;
+ console.error(error);
+ }
+});