docs(opener): add examples for None::<&str> (#2202)

closes #2200
This commit is contained in:
Amr Bashir
2024-12-13 04:22:35 +02:00
committed by GitHub
parent c9acff99c6
commit 802399a969
3 changed files with 66 additions and 4 deletions
+10
View File
@@ -98,8 +98,18 @@ fn main() {
.plugin(tauri_plugin_opener::init())
.setup(|app| {
let opener = app.opener();
// Opens the URL in the default browser
opener.open_url("https://example.com", None::<&str>)?;
// Or with a specific browser/app
opener.open_url("https://example.com", Some("firefox"))?;
// Opens the path with the system's default app
opener.open_path("/path/to/file", None::<&str>)?;
// Or with a specific app
opener.open_path("/path/to/file", Some("firefox"))?;
// Reveal a path with the system's default explorer
opener.reveal_item_in_dir("/path/to/file")?;
Ok(())
})