Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/WindServiceHandlers/NativeHost/
Reload.rs

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