ソースを参照

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`].