added tauri specta
This commit is contained in:
+14
-1
@@ -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(())
|
||||
|
||||
Reference in New Issue
Block a user