mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-01 11:13:40 +03:00
Add doc comment example for App::run
(#2824)
This commit is contained in:
parent
7c6c7adcc4
commit
dfe508d492
@ -457,6 +457,21 @@ impl<R: Runtime> App<R> {
|
||||
}
|
||||
|
||||
/// Runs the application.
|
||||
///
|
||||
/// # Example
|
||||
/// ```rust,ignore
|
||||
/// fn main() {
|
||||
/// let app = tauri::Builder::default()
|
||||
/// .build(tauri::generate_context!())
|
||||
/// .expect("error while building tauri application");
|
||||
/// app.run(|_app_handle, event| match event {
|
||||
/// tauri::Event::ExitRequested { api, .. } => {
|
||||
/// api.prevent_exit();
|
||||
/// }
|
||||
/// _ => {}
|
||||
/// });
|
||||
/// }
|
||||
/// ```
|
||||
pub fn run<F: FnMut(&AppHandle<R>, Event) + 'static>(mut self, mut callback: F) {
|
||||
let app_handle = self.handle();
|
||||
let manager = self.manager.clone();
|
||||
|
Loading…
Reference in New Issue
Block a user