Skip to content

Commit

Permalink
Call creation callback on navigation end.
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny committed Mar 9, 2024
1 parent 8eb888e commit f87b3a9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/core/browser_window/edge2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,28 @@ impl BrowserWindowExt for BrowserWindowImpl {
.expect("unable to get web message as json");

let handle = BrowserWindowImpl { inner: bw_inner };
<<<<<<< HEAD
match JsValue::from_json(&string) {
JsValue::Array(args) => {
let command = args[0].to_string_unenclosed();
let command_args = args[1..].to_vec();
handler(handle, &command, command_args);
=======
if string == "\"__bw_loaded\"" {
// Once the `ìnvoke_extern` function exists, invoke the creation
// callback.
//creation_callback(handle, callback_data);
} else {
match JsValue::from_json(&string) {
JsValue::Array(args) => {
let command = args[0].to_string_unenclosed();
let command_args = args[1..].to_vec();
handler(handle, &command, command_args);
}
_ => panic!(
"unexpected JavaScript value received from Edge WebView2"
),
>>>>>>> 714e2a7 (Call creation callback on navigation end.)
}
_ => panic!(
"unexpected JavaScript value received from Edge WebView2"
Expand All @@ -178,6 +195,12 @@ impl BrowserWindowExt for BrowserWindowImpl {
Ok(())
});

webview.add_navigation_completed(move |_, _| {
let handle = BrowserWindowImpl { inner: bw_inner };
creation_callback(handle, callback_data);
Ok(())
});

Ok(())
});
Ok(())
Expand Down

0 comments on commit f87b3a9

Please sign in to comment.