mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
feat: introduce App::run_return (#12668)
* Introduce `run_return` * Fix compile error * Clone web_context * Refactor to Result API * Fix clippy * Impl mock runtime * Make it desktop-only * Add changelog entry * Fix compile error * Make it semver compatible * Extend changelog entry * Undo semver-hack * Reduce diff * Remove unnecessary mut * Make it take `self` by value * Reduce diff * Undo diff hack * Make everything cfg(desktop) * Rename vars to reduce diff * Fix clippy * Extract make_event_handler * Reduce diff * Deprecate `App::run_return` * Update changelog * Fix compile errors * Accept reference * Create event handler first * Update example * Update manifest * Fix example * Fix example docs * Call `setup` only upon Ready * Update changelog entry * Update docs * Update changelog * Add platform-specific note * update docs * run_return on mobile * Apply suggestions from code review * remove change file --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
# Run Iteration Example
|
||||
|
||||
To execute run the following on the root directory of the repository: `cargo run --example run-iteration`.
|
||||
3
examples/run-return/README.md
Normal file
3
examples/run-return/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Run Return Example
|
||||
|
||||
To execute run the following on the root directory of the repository: `cargo run --example run-return`.
|
||||
@@ -4,23 +4,18 @@
|
||||
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use tauri::Manager;
|
||||
|
||||
fn main() {
|
||||
let mut app = tauri::Builder::default()
|
||||
let app = tauri::Builder::default()
|
||||
.build(tauri::generate_context!(
|
||||
"../../examples/run-iteration/tauri.conf.json"
|
||||
"../../examples/run-return/tauri.conf.json"
|
||||
))
|
||||
.expect("error while building tauri application");
|
||||
|
||||
loop {
|
||||
app.run_iteration(|_app, _event| {
|
||||
//println!("{:?}", _event);
|
||||
});
|
||||
let exit_code = app.run_return(|_app, _event| {
|
||||
//println!("{:?}", _event);
|
||||
});
|
||||
|
||||
if app.webview_windows().is_empty() {
|
||||
app.cleanup_before_exit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
println!("I run after exit");
|
||||
|
||||
std::process::exit(exit_code);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "../../crates/tauri-schema-generator/schemas/config.schema.json",
|
||||
"productName": "RunIteration",
|
||||
"productName": "RunReturn",
|
||||
"version": "0.1.0",
|
||||
"identifier": "com.tauri.dev",
|
||||
"build": {
|
||||
Reference in New Issue
Block a user