feat(core): add dev function (#9113)

This commit is contained in:
Lucas Fernandes Nogueira 2024-03-07 11:02:53 -03:00 committed by GitHub
parent e7f245e81e
commit 9dc9ca6e38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

5
.changes/dev-fn.md Normal file
View File

@ -0,0 +1,5 @@
---
"tauri": patch:enhance
---
Added `tauri::dev()` to determine whether we are running in development mode or not.

View File

@ -333,6 +333,11 @@ macro_rules! tauri_build_context {
pub use pattern::Pattern;
/// Whether we are running in development mode or not.
pub fn dev() -> bool {
!cfg!(feature = "custom-protocol")
}
/// User supplied data required inside of a Tauri application.
///
/// # Stability

View File

@ -320,7 +320,7 @@ impl<R: Runtime> AppManager<R> {
}
fn csp(&self) -> Option<Csp> {
if cfg!(feature = "custom-protocol") {
if !crate::dev() {
self.config.app.security.csp.clone()
} else {
self