chore: update to tauri alpha.16, api alpha.9 (#673)

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
This commit is contained in:
Lucas Fernandes Nogueira
2023-10-20 13:50:18 -03:00
committed by GitHub
co-authored by Amr Bashir
parent b7c5407cac
commit 5c137365c6
132 changed files with 1569 additions and 1692 deletions
+9 -14
View File
@@ -24,11 +24,7 @@
* @module
*/
declare global {
interface Window {
__TAURI_INVOKE__: <T>(cmd: string, args?: unknown) => Promise<T>;
}
}
import { invoke } from "@tauri-apps/api/primitives";
/**
* Options to configure the Rust client used to make fetch requests
@@ -76,7 +72,7 @@ export async function fetch(
const buffer = await req.arrayBuffer();
const reqData = buffer.byteLength ? Array.from(new Uint8Array(buffer)) : null;
const rid = await window.__TAURI_INVOKE__<number>("plugin:http|fetch", {
const rid = await invoke<number>("plugin:http|fetch", {
method: req.method,
url: req.url,
headers: Array.from(req.headers.entries()),
@@ -86,7 +82,7 @@ export async function fetch(
});
req.signal.addEventListener("abort", () => {
window.__TAURI_INVOKE__("plugin:http|fetch_cancel", {
invoke("plugin:http|fetch_cancel", {
rid,
});
});
@@ -98,18 +94,17 @@ export async function fetch(
url: string;
}
const { status, statusText, url, headers } =
await window.__TAURI_INVOKE__<FetchSendResponse>("plugin:http|fetch_send", {
rid,
});
const body = await window.__TAURI_INVOKE__<number[]>(
"plugin:http|fetch_read_body",
const { status, statusText, url, headers } = await invoke<FetchSendResponse>(
"plugin:http|fetch_send",
{
rid,
},
);
const body = await invoke<number[]>("plugin:http|fetch_read_body", {
rid,
});
const res = new Response(new Uint8Array(body), {
headers,
status,