https://tauri.app/v1/guides/features/events/ https://github.com/tauri-apps/tauri/discussions/3018 main.rs use tauri::Manager; #[tauri::command] fn eventtest(name: &str, app_handle: tauri::AppHandle) -> String { let msg = format!("Hello, {}! You've been greeted from Rust!", &name); app_handle.emit_all("event_test", &msg).unwrap(); println!("{}", msg); format!("{}", msg) } fn main() { tauri::Builder::default() .invoke_handler(tauri::generate_handler![eventtest]) .run(tauri::generate_context!()) .expect("error while running tauri application"); } index.html <script> const taurievent = window.__TAURI__.event taurievent.listen("event_test",function(event){ var payload = event.payload; window.header.innerHTML = payload; }); setTimeout(function() { invoke('eventtest', { name: 'frontend' }).then((response) => { //window.header.innerHTML = response; }); }, 100); </script>