Skip to main content

Mountain/IPC/WindServiceHandlers/NativeHost/
Reload.rs

1
2//! `nativeHost:reload` - reload the webview without restarting the process.
3//! VS Code calls this from `ILifecycleMainService.reload()` for "Reload
4//! Window" (Developer menu / Cmd+Shift+P → Reload Window).
5
6use serde_json::Value;
7use tauri::{AppHandle, Manager};
8
9use crate::dev_log;
10
11pub async fn Fn(ApplicationHandle:AppHandle, _Arguments:Vec<Value>) -> Result<Value, String> {
12	dev_log!("lifecycle", "nativeHost:reload - reloading webview");
13
14	if let Some(Window) = ApplicationHandle.get_webview_window("main") {
15		Window
16			.eval("location.reload()")
17			.map_err(|E| format!("reload eval failed: {E}"))?;
18	}
19
20	Ok(Value::Null)
21}