From d79eb4fc210f1b7baf67a17832a746c420369985 Mon Sep 17 00:00:00 2001 From: Shihpin Tseng Date: Mon, 24 Feb 2020 07:14:49 +0800 Subject: [PATCH] fix(tauri) window.tauri is undefined upon reloading (#377) (#453) --- tauri/src/endpoints.rs | 3 +++ tauri/src/endpoints/cmd.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/tauri/src/endpoints.rs b/tauri/src/endpoints.rs index 324ff67d4..07809e7af 100644 --- a/tauri/src/endpoints.rs +++ b/tauri/src/endpoints.rs @@ -20,6 +20,9 @@ pub(crate) fn handle(webview: &mut WebView<'_, T>, arg: &str) -> cra event_init = event_init ))?; } + Reload {} => { + webview.eval(include_str!(concat!(env!("TAURI_DIR"), "/tauri.js"))); + } #[cfg(any(feature = "all-api", feature = "readTextFile"))] ReadTextFile { path, diff --git a/tauri/src/endpoints/cmd.rs b/tauri/src/endpoints/cmd.rs index c4434116b..a0f9ac870 100644 --- a/tauri/src/endpoints/cmd.rs +++ b/tauri/src/endpoints/cmd.rs @@ -4,6 +4,7 @@ use serde::Deserialize; #[serde(tag = "cmd", rename_all = "camelCase")] pub enum Cmd { Init {}, + Reload {}, #[cfg(any(feature = "all-api", feature = "readTextFile"))] ReadTextFile { path: String,