#How to watch for exit of a tauri app
3 messages · Page 1 of 1 (latest)
In JavaScript you can only listen to the window itself closing: https://tauri.app/v1/api/js/window#oncloserequested.
In Rust you can listen to the window being close via WindowEvent::CloseRequest in .on_window_event() or .run()
and for the app runtime being exited there is RunEvent::ExitRequested and RunEvent::Exit, small example: https://github.com/tauri-apps/tauri/blob/b02fc90f450ff9e9d8a35ee55dc1beced4957869/examples/api/src-tauri/src/main.rs#L240-L244
Thanks