added tauri specta

This commit is contained in:
2026-07-31 00:55:43 +08:00
parent 397643ae01
commit 5539fcc729
5 changed files with 188 additions and 3 deletions
+14 -1
View File
@@ -9,9 +9,22 @@ fn launch_app(app: &tauri::App) {
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let specta_builder = tauri_specta::Builder::<tauri::Wry>::new()
.error_handling(tauri_specta::ErrorHandlingMode::Throw)
.commands(tauri_specta::collect_commands![])
.events(tauri_specta::collect_events![]);
#[cfg(debug_assertions)]
specta_builder
.export(
specta_typescript::Typescript::default(),
"../src/lib/bindings.ts",
)
.expect("Failed to export TypeScript bindings");
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.invoke_handler(tauri::generate_handler![])
.invoke_handler(specta_builder.invoke_handler())
.setup(|app| {
launch_app(app);
Ok(())