Revert "Merge pull request #3 from JonasKruckenberg/revert-2-feat/window"
This reverts commit896fc516d3
, reversing changes made to5d6ea2060c
.
This commit is contained in:
parent
896fc516d3
commit
8911f55920
67 changed files with 11705 additions and 573 deletions
38
examples/test/src-tauri/src/main.rs
Normal file
38
examples/test/src-tauri/src/main.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use tauri::{State, Manager};
|
||||
|
||||
struct Received(AtomicBool);
|
||||
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
||||
#[tauri::command]
|
||||
fn verify_receive(emitted: State<Received>) -> bool {
|
||||
emitted.0.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn exit_with_error(e: &str) -> bool {
|
||||
eprintln!("{}", e);
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![verify_receive, exit_with_error])
|
||||
.setup(|app| {
|
||||
app.manage(Received(AtomicBool::new(false)));
|
||||
|
||||
let app_handle = app.handle();
|
||||
app.listen_global("foo", move |_| {
|
||||
app_handle.state::<Received>().0.store(true, Ordering::Relaxed);
|
||||
});
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue