fix(docs): make the splashscreen guide work (fix: #2185) (#2186)

This commit is contained in:
Joaquín
2021-07-12 12:01:11 -03:00
committed by GitHub
parent 578610a29d
commit aba52cf21d

View File

@@ -38,15 +38,16 @@ Now, your main window will be hidden and the splashscreen window will show when
If you are waiting for your web code, you'll want to create a `close_splashscreen` [command](../command.md).
```rust title=src-tauri/main.rs
use tauri::Manager;
// Create the command:
#[tauri::command(with_window)]
fn close_splashscreen<M: Params>(window: tauri::Window<M>) {
#[tauri::command]
fn close_splashscreen(window: tauri::Window) {
// Close splashscreen
if let Ok(splashscreen) = window.get_webview("splashscreen") {
if let Some(splashscreen) = window.get_window("splashscreen") {
splashscreen.close().unwrap();
}
// Show main window
window.get_webview("main").unwrap().show().unwrap();
window.get_window("main").unwrap().show().unwrap();
}
// Register the command: