main.rs 917 B

12345678910111213141516171819202122232425262728
  1. // Check that all events are being forwarded to the mock.
  2. //! This example roughly shows how events are serialized into Rust from JavaScript.
  3. //!
  4. //! There is some conversion happening when input types are checkbox/radio/select/textarea etc.
  5. use dioxus::prelude::*;
  6. mod events;
  7. fn main() {
  8. events::test_events();
  9. }
  10. pub(crate) fn check_app_exits(app: Component) {
  11. // This is a deadman's switch to ensure that the app exits
  12. let should_panic = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(true));
  13. let should_panic_clone = should_panic.clone();
  14. std::thread::spawn(move || {
  15. std::thread::sleep(std::time::Duration::from_secs(10));
  16. if should_panic_clone.load(std::sync::atomic::Ordering::SeqCst) {
  17. std::process::exit(exitcode::SOFTWARE);
  18. }
  19. });
  20. dioxus_desktop::launch(app);
  21. should_panic.store(false, std::sync::atomic::Ordering::SeqCst);
  22. }