tauri_plugin_dev_invoke/lib.rs
1mod server;
2
3use tauri::{plugin::Builder, AppHandle, Runtime};
4
5pub fn init<R: Runtime>() -> tauri::plugin::TauriPlugin<R> {
6 Builder::new("dev-invoke")
7 .setup(|app, _| {
8 #[cfg(debug_assertions)]
9 {
10 let invoke_key = app.invoke_key().to_string();
11 let app_handle: AppHandle<R> = app.clone();
12
13 // Start the HTTP server in a separate thread
14 // It will wait for a webview to become available
15 std::thread::spawn(move || {
16 server::start(app_handle, invoke_key, 3030);
17 });
18 }
19
20 Ok(())
21 })
22 .build()
23}