wip: updater bindgen setup

This commit is contained in:
Max Coppen 2022-11-01 21:35:10 +01:00
parent 6a0e0a6e82
commit 893a6d0631
3 changed files with 227 additions and 1 deletions

40
src/updater.rs Normal file
View file

@ -0,0 +1,40 @@
/// Install the update if there's one available.
///
/// # Example
///
/// ```rust,no_run
/// use tauri_api::updater::install_update;
///
/// install_update().await;
/// ```
#[inline(always)]
pub async fn install_update() {
inner::installUpdate().await
}
/// Checks if an update is available.
///
/// # 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!");
/// ```
///
/// @returns A promise indicating the success or failure of the operation.
#[inline(always)]
pub async fn check_update() {
inner::checkUpdate().await
}
mod inner {
use wasm_bindgen::{prelude::wasm_bindgen, JsValue};
#[wasm_bindgen(module = "/dist/updater.js")]
extern "C" {
pub async fn installUpdate();
pub async fn checkUpdate();
}
}