main.rs 792 B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2019-2024 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
  5. use tauri::{AppHandle, Manager};
  6. #[tauri::command]
  7. fn close_splashscreen(app: AppHandle) {
  8. // Close splashscreen
  9. app
  10. .get_webview_window("splashscreen")
  11. .unwrap()
  12. .close()
  13. .unwrap();
  14. // Show main window
  15. app.get_webview_window("main").unwrap().show().unwrap();
  16. }
  17. fn main() {
  18. tauri::Builder::default()
  19. .menu(tauri::menu::Menu::default)
  20. .invoke_handler(tauri::generate_handler![close_splashscreen])
  21. .run(tauri::generate_context!(
  22. "../../examples/splashscreen/tauri.conf.json"
  23. ))
  24. .expect("error while running tauri application");
  25. }