This commit is contained in:
Jonas Kruckenberg 2022-11-01 16:38:29 +01:00
parent 6b5376d756
commit b9751a018f
4 changed files with 22 additions and 22 deletions

View file

@ -10,7 +10,7 @@ fn main() {
"tauri/tooling/api/src/clipboard.ts",
"tauri/tooling/api/src/tauri.ts",
"tauri/tooling/api/src/event.ts",
"tauri/tooling/api/src/mocks.ts"
"tauri/tooling/api/src/mocks.ts",
])
.output()
.unwrap();

View file

@ -1,9 +1,9 @@
use semver::Version;
/// Gets the application name.
///
///
/// # Example
///
///
/// ```typescript
/// import { getName } from '@tauri-apps/api/app';
/// const appName = await getName();
@ -14,9 +14,9 @@ pub async fn get_name() -> String {
}
/// Gets the application version.
///
///
/// # Example
///
///
/// ```rust,no_run
/// use tauri_api::app::get_version;
///
@ -30,10 +30,10 @@ pub async fn get_version() -> Version {
/// Gets the Tauri version.
///
/// # Example
///
///
/// ```rust,no_run
/// use tauri_app::app:get_tauri_version;
///
///
/// let version = get_tauri_version().await;
/// ```
#[inline(always)]
@ -44,10 +44,10 @@ pub async fn get_tauri_version() -> Version {
/// Shows the application on macOS. This function does not automatically focuses any app window.
///
/// # Example
///
///
/// ```rust,no_run
/// use tauri_api::app::show;
///
///
/// show().await;
/// ```
#[inline(always)]
@ -58,10 +58,10 @@ pub async fn show() {
/// Hides the application on macOS.
///
/// # Example
///
///
/// ```rust,no_run
/// use tauri_api::app::hide;
///
///
/// hide().await;
/// ```
#[inline(always)]
@ -71,7 +71,7 @@ pub async fn hide() {
mod inner {
use wasm_bindgen::{prelude::wasm_bindgen, JsValue};
#[wasm_bindgen(module = "/dist/app.js")]
extern "C" {
pub async fn getName() -> JsValue;
@ -80,4 +80,4 @@ mod inner {
pub async fn hide();
pub async fn show();
}
}
}

View file

@ -1,10 +1,10 @@
/// Gets the clipboard content as plain text.
///
///
/// # Example
///
///
/// ```rust,no_run
/// use tauri_api::clipboard::read_text;
///
///
/// let clipboard_text = read_text().await;
/// ```
#[inline(always)]
@ -13,12 +13,12 @@ pub async fn read_text() -> Option<String> {
}
/// Writes plain text to the clipboard.
///
///
/// # Example
///
///
/// ```rust,no_run
/// use tauri_api::clipboard::{write_text, read_text};
///
///
/// write_text("Tauri is awesome!").await;
/// assert_eq!(read_text().await, "Tauri is awesome!");
/// ```
@ -37,4 +37,4 @@ mod inner {
pub async fn readText() -> JsValue;
pub async fn writeText(text: &str);
}
}
}

View file

@ -16,7 +16,7 @@ pub enum Error {
#[error(transparent)]
Serde(#[from] serde_wasm_bindgen::Error),
#[error("{0:?}")]
Other(JsValue)
Other(JsValue),
}
pub(crate) type Result<T> = std::result::Result<T, Error>;
pub(crate) type Result<T> = std::result::Result<T, Error>;