Bläddra i källkod

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

Joaquín 4 år sedan
förälder
incheckning
aba52cf21d
1 ändrade filer med 5 tillägg och 4 borttagningar
  1. 5 4
      docs/usage/guides/visual/splashscreen.md

+ 5 - 4
docs/usage/guides/visual/splashscreen.md

@@ -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: