mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
feat(core): allow listening to event loop events & prevent window close (#2131)
This commit is contained in:
committed by
GitHub
parent
d69b1cf6d7
commit
8157a68af1
@@ -6,7 +6,7 @@
|
||||
|
||||
#![cfg_attr(doc_cfg, feature(doc_cfg))]
|
||||
|
||||
use std::{fmt::Debug, hash::Hash, path::PathBuf};
|
||||
use std::{fmt::Debug, hash::Hash, path::PathBuf, sync::mpsc::Sender};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tauri_utils::assets::Assets;
|
||||
@@ -189,9 +189,17 @@ impl Icon {
|
||||
}
|
||||
|
||||
/// Event triggered on the event loop run.
|
||||
#[non_exhaustive]
|
||||
pub enum RunEvent {
|
||||
/// Event loop is exiting.
|
||||
Exit,
|
||||
/// Window close was requested by the user.
|
||||
CloseRequested {
|
||||
/// The window label.
|
||||
label: String,
|
||||
/// A signal sender. If a `true` value is emitted, the window won't be closed.
|
||||
signal_tx: Sender<bool>,
|
||||
},
|
||||
/// Window closed.
|
||||
WindowClose(String),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user