migrate from ts-rs to tauri-specta

This commit is contained in:
2026-03-07 18:36:51 +08:00
parent f65d837841
commit 4d7e97771a
86 changed files with 766 additions and 609 deletions

View File

@@ -1,7 +1,5 @@
import { listen } from "@tauri-apps/api/event";
import { invoke } from "@tauri-apps/api/core";
import { writable } from "svelte/store";
import { AppEvents } from "../types/bindings/AppEventsConstants";
import { commands, events } from "$lib/bindings";
import { createListenerSubscription, setupHmrCleanup } from "./listener-utils";
export const sceneInteractive = writable<boolean>(false);
@@ -16,13 +14,10 @@ export async function startSceneInteractive() {
if (subscription.isListening()) return;
try {
sceneInteractive.set(await invoke("get_scene_interactive"));
const unlisten = await listen<boolean>(
AppEvents.SceneInteractive,
(event) => {
sceneInteractive.set(Boolean(event.payload));
},
);
sceneInteractive.set(await commands.getSceneInteractive());
const unlisten = await events.sceneInteractiveChanged.listen((event) => {
sceneInteractive.set(Boolean(event.payload));
});
subscription.setUnlisten(unlisten);
subscription.setListening(true);
} catch (error) {