Proper way to close remaining windows #8503
-
Hello everyone. Currently my application creates couple webview windows. But when I close the main window, these webview windows are still left open and main executable still runs until these windows are also closed. My workaround was to exit the application from handle when the main window is closed but when I do this, following error pops-up to the console: My code for achieving this is the following at the moment: fn main() {
let tauri_builder = tauri::Builder::default().invoke_handler(tauri::generate_handler![...]);
...
tauri_builder
.on_window_event(|event| match event.event() {
tauri::WindowEvent::Destroyed => {
let window = event.window();
if window.label() == "main" {
window.app_handle().exit(0);
}
}
_ => {}
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can get all windows via |
Beta Was this translation helpful? Give feedback.
You can get all windows via
window.app_handle().windows()
and close them individually, but that may also trigger this warning since it's something chrome internal. You can even often trigger that same warning in a normal browser so i wouldn't worry about it.