瀏覽代碼

feat(core): add `app` method on `PluginApi` (#6705)

Lucas Fernandes Nogueira 2 年之前
父節點
當前提交
34b8f339a4
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 5 0
      .changes/plugin-api-handle.md
  2. 5 0
      core/tauri/src/plugin.rs

+ 5 - 0
.changes/plugin-api-handle.md

@@ -0,0 +1,5 @@
+---
+"tauri": patch
+---
+
+Add `app` method for the `PluginApi` struct.

+ 5 - 0
core/tauri/src/plugin.rs

@@ -107,6 +107,11 @@ impl<R: Runtime, C: DeserializeOwned> PluginApi<R, C> {
   pub fn config(&self) -> &C {
     &self.config
   }
+
+  /// Returns the application handle.
+  pub fn app(&self) -> &AppHandle<R> {
+    &self.handle
+  }
 }
 
 /// Builds a [`TauriPlugin`].