mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-24 17:20:51 +02:00
@@ -38,6 +38,19 @@ pub struct Opener<R: Runtime> {
|
||||
impl<R: Runtime> Opener<R> {
|
||||
/// Open a url with a default or specific program.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use tauri_plugin_opener::OpenerExt;
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given URL on the system default browser
|
||||
/// app.opener().open_url("https://github.com/tauri-apps/tauri", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
///
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Android / iOS**: Always opens using default program.
|
||||
@@ -48,6 +61,19 @@ impl<R: Runtime> Opener<R> {
|
||||
|
||||
/// Open a url with a default or specific program.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use tauri_plugin_opener::OpenerExt;
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given URL on the system default browser
|
||||
/// app.opener().open_url("https://github.com/tauri-apps/tauri", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
///
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Android / iOS**: Always opens using default program.
|
||||
@@ -60,6 +86,19 @@ impl<R: Runtime> Opener<R> {
|
||||
|
||||
/// Open a path with a default or specific program.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use tauri_plugin_opener::OpenerExt;
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given path on the system default explorer
|
||||
/// app.opener().open_path("/path/to/file", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
///
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Android / iOS**: Always opens using default program.
|
||||
@@ -74,6 +113,19 @@ impl<R: Runtime> Opener<R> {
|
||||
|
||||
/// Open a path with a default or specific program.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use tauri_plugin_opener::OpenerExt;
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given path on the system default explorer
|
||||
/// app.opener().open_path("/path/to/file", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
///
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Android / iOS**: Always opens using default program.
|
||||
@@ -98,7 +150,7 @@ pub trait OpenerExt<R: Runtime> {
|
||||
fn opener(&self) -> &Opener<R>;
|
||||
}
|
||||
|
||||
impl<R: Runtime, T: Manager<R>> crate::OpenerExt<R> for T {
|
||||
impl<R: Runtime, T: Manager<R>> OpenerExt<R> for T {
|
||||
fn opener(&self) -> &Opener<R> {
|
||||
self.state::<Opener<R>>().inner()
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ pub(crate) fn open<P: AsRef<OsStr>, S: AsRef<str>>(path: P, with: Option<S>) ->
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given URL on the system default browser
|
||||
/// tauri_plugin_opener::open_url("https://github.com/tauri-apps/tauri", None)?;
|
||||
/// tauri_plugin_opener::open_url("https://github.com/tauri-apps/tauri", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
@@ -46,8 +46,8 @@ pub fn open_url<P: AsRef<str>, S: AsRef<str>>(url: P, with: Option<S>) -> crate:
|
||||
/// ```rust,no_run
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given URL on the system default browser
|
||||
/// tauri_plugin_opener::open_path("/path/to/file", None)?;
|
||||
/// // open the given URL on the system default explorer
|
||||
/// tauri_plugin_opener::open_path("/path/to/file", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
|
||||
Reference in New Issue
Block a user