-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cant't listen event 'tauri://close-requested' or 'tauri://destroyed' #2996
Comments
looking forward to next version |
me too (somehow these words sound inapropriate lately...) |
For those who still struggle import { window } from "@tauri-apps/api"
import { TauriEvent } from "@tauri-apps/api/event"
window.getCurrent().listen(TauriEvent.WINDOW_CLOSE_REQUESTED, () => {
alert("Closing window and maybe saving some data :)")
}) |
Unfortunately this is also not working for me. I have tried pretty much everything I could find in any of the docs and examples 😢 I don't get any If I make it windowed, it will trigger both from Cmd+W or by clicking at the red X button just fine. I'm testing it fullscreen on macOS Big Sur. Any ideas? |
I'm on linux. Most likely you are listening to wrong window |
I follow the guide of window.WebviewWindow ( https://tauri.studio/en/docs/api/js/classes/window.WebviewWindow ), everything is OK.
But if I change the event from 'tauri://created' to 'tauri://close-requested' (or tauri://destroyed), the event handler won't be invoked.
What I want to do is to save working data and close other hidden windows after user click 'close' button of the main window.
I have tried listen 'tauri://close-requested' , ' tauri://destroyed' and set window.onbeforeunload, none of them works.
Please help.
The text was updated successfully, but these errors were encountered: