mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-05 10:13:00 +02:00
36 lines
1.1 KiB
Rust
36 lines
1.1 KiB
Rust
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
|
|
use tauri::{AppHandle, Manager, Runtime};
|
|
|
|
#[tauri::command]
|
|
fn close_splashscreen<R: Runtime>(app: AppHandle<R>) {
|
|
// Close splashscreen
|
|
app
|
|
.get_webview_window("splashscreen")
|
|
.unwrap()
|
|
.close()
|
|
.unwrap();
|
|
// Show main window
|
|
app.get_webview_window("main").unwrap().show().unwrap();
|
|
}
|
|
|
|
#[cfg_attr(feature = "cef", tauri::cef_entry_point)]
|
|
fn main() {
|
|
#[cfg(feature = "wry")]
|
|
let builder = tauri::Builder::<tauri_runtime_wry::Wry<tauri::EventLoopMessage>>::new();
|
|
#[cfg(feature = "cef")]
|
|
let builder = tauri::Builder::<tauri_runtime_cef::CefRuntime<tauri::EventLoopMessage>>::new();
|
|
|
|
builder
|
|
.menu(tauri::menu::Menu::default)
|
|
.invoke_handler(tauri::generate_handler![close_splashscreen])
|
|
.run(tauri::generate_context!(
|
|
"../../examples/splashscreen/tauri.conf.json"
|
|
))
|
|
.expect("error while running tauri application");
|
|
}
|