Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjj1024 committed Dec 26, 2024
1 parent 7e9f1b3 commit b15ee5e
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src-tauri/src/command/pakeplus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,27 @@ pub async fn preview_from_config(
config: WindowConfig,
js_content: String,
) {
// let window_label = config.label.clone();
// if let Some(existing_window) = handle.get_webview_window(window_label.as_str()) {
// if resize {
// let new_size = LogicalSize::new(config.width, config.height);
// match existing_window.set_size(new_size) {
// Ok(_) => println!("Window resized to {}x{}", config.width, config.height),
// Err(e) => eprintln!("Failed to resize window: {}", e),
// }
// } else {
// existing_window.close().unwrap();
// println!("Existing window closed.");
// let start = Instant::now();
// while handle.get_webview_window(window_label.as_str()).is_some() {
// if start.elapsed().as_secs() > 2 {
// println!("Window close took too long. Aborting.");
// return;
// }
// std::thread::yield_now();
// }
// }
// }
let window_label = config.label.clone();
if let Some(existing_window) = handle.get_webview_window(window_label.as_str()) {
if resize {
let new_size = LogicalSize::new(config.width, config.height);
match existing_window.set_size(new_size) {
Ok(_) => println!("Window resized to {}x{}", config.width, config.height),
Err(e) => eprintln!("Failed to resize window: {}", e),
}
} else {
existing_window.close().unwrap();
println!("Existing window closed.");
let start = Instant::now();
while handle.get_webview_window(window_label.as_str()).is_some() {
if start.elapsed().as_secs() > 2 {
println!("Window close took too long. Aborting.");
return;
}
std::thread::yield_now();
}
}
}
// println!("tauri config: {:?}", config);
let resource_path = handle
.path()
Expand All @@ -99,7 +99,7 @@ pub async fn preview_from_config(
let mut contents = String::new();
custom_js.read_to_string(&mut contents).unwrap();
contents += js_content.as_str();
println!("js file contents: {}", contents);
// println!("js file contents: {}", contents);
if !resize {
let _window = tauri::WebviewWindowBuilder::from_config(&handle, &config)
.unwrap()
Expand Down

0 comments on commit b15ee5e

Please sign in to comment.