fix(tauri) race condition on onTauriInit and no-server mode
@@ -85,7 +85,15 @@ pub(crate) fn run(application: &mut crate::App) {
webview.eval("
if (window.onTauriInit !== void 0) {
window.onTauriInit()
+ window.onTauriInit = void 0
}
+ Object.defineProperty(window, 'onTauriInit', {
+ set: function(val) {
+ if (typeof(val) === 'function') {
+ val()
+ }
+ }
+ })
").expect("failed to evaluate window.onTauriInit");
} else if !crate::endpoints::handle(webview, arg) {
application.run_invoke_handler(webview, arg);
