Browse Source

feat(core): add `config` and `package_info` getters on App and AppHandle (#2016)

Lucas Fernandes Nogueira 4 năm trước cách đây
mục cha
commit
70fc87a7ff
2 tập tin đã thay đổi với 15 bổ sung0 xóa
  1. 5 0
      .changes/config-package-info-getters.md
  2. 10 0
      core/tauri/src/app.rs

+ 5 - 0
.changes/config-package-info-getters.md

@@ -0,0 +1,5 @@
+---
+"tauri": patch
+---
+
+Adds `config` and `package_info` getters to the `App` and `AppHandle` structs.

+ 10 - 0
core/tauri/src/app.rs

@@ -216,6 +216,16 @@ macro_rules! shared_app_impl {
           package_info: self.manager.package_info().clone(),
         }
       }
+
+      /// Gets the app's configuration, defined on the `tauri.conf.json` file.
+      pub fn config(&self) -> Arc<Config> {
+        self.manager.config()
+      }
+
+      /// Gets the app's package information.
+      pub fn package_info(&self) -> &PackageInfo {
+        self.manager.package_info()
+      }
     }
   };
 }