fix(tauri) window.tauri is undefined upon reloading (#377) (#453)

This commit is contained in:
Shihpin Tseng 2020-02-24 07:14:49 +08:00 committed by GitHub
parent 7c0482f9a8
commit d79eb4fc21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,9 @@ pub(crate) fn handle<T: 'static>(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,

View File

@ -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,