From 276e4a3fdbc3a9c2c1063e767eaf11a2ad79bc98 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Mon, 17 Apr 2023 09:49:09 -0700 Subject: [PATCH] feat(core): expose `runtime_handle` on AppHandle (#6727) --- .changes/app-runtime-handle.md | 5 +++++ .changes/expose-runtime.md | 5 +++++ core/tauri/src/app.rs | 5 +++++ core/tauri/src/lib.rs | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .changes/app-runtime-handle.md create mode 100644 .changes/expose-runtime.md diff --git a/.changes/app-runtime-handle.md b/.changes/app-runtime-handle.md new file mode 100644 index 000000000..c1912d723 --- /dev/null +++ b/.changes/app-runtime-handle.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Added the `runtime_handle` method on `AppHandle`. diff --git a/.changes/expose-runtime.md b/.changes/expose-runtime.md new file mode 100644 index 000000000..862fb85ef --- /dev/null +++ b/.changes/expose-runtime.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Re-export the `tauri_runtime` crate as `tauri::runtime`. diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 48a96fb54..c280058ba 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -277,6 +277,11 @@ impl AppHandle { pub(crate) fn create_proxy(&self) -> R::EventLoopProxy { self.runtime_handle.create_proxy() } + + /// Returns the handle to the application runtime. + pub fn runtime_handle(&self) -> &R::Handle { + &self.runtime_handle + } } /// APIs specific to the wry runtime. diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index e31e4cc1e..3d58f2391 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -199,7 +199,7 @@ mod manager; mod pattern; pub mod plugin; pub mod window; -use tauri_runtime as runtime; +pub use tauri_runtime as runtime; #[cfg(target_os = "ios")] mod ios; #[cfg(target_os = "android")]