Skip to content

Get App Handle in on_window_event in WebviewWindow #13161

Closed Answered by FabianLars
RMadsenG asked this question in Q&A
Discussion options

You must be logged in to vote

You can get an AppHandle outside of the event handler and move it inside

let handle = app.app_handle().clone();
tauri::WebviewWindowBuilder::from_config(app, config).unwrap().build().unwrap().on_window_event(move |event| match event {
            WindowEvent::Destroyed => {
                handle.do_something()
            }
            _ => {}
      });

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RMadsenG
Comment options

Answer selected by RMadsenG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants