fix example
This commit is contained in:
parent
52acfb3b3d
commit
6441a58a05
17 changed files with 190 additions and 81 deletions
|
@ -11,9 +11,9 @@ js-sys = "0.3.59"
|
||||||
serde = { version = "1.0.140", features = ["derive"] }
|
serde = { version = "1.0.140", features = ["derive"] }
|
||||||
wasm-bindgen = { version = "0.2.82", features = ["serde_json"] }
|
wasm-bindgen = { version = "0.2.82", features = ["serde_json"] }
|
||||||
wasm-bindgen-futures = "0.4.32"
|
wasm-bindgen-futures = "0.4.32"
|
||||||
url = { version = "2.3.1", optional = true }
|
url = { version = "2.3.1", optional = true, features = ["serde"] }
|
||||||
thiserror = "1.0.37"
|
thiserror = "1.0.37"
|
||||||
semver = { version = "1.0.14", optional = true }
|
semver = { version = "1.0.14", optional = true, features = ["serde"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
wasm-bindgen-test = "0.3.33"
|
wasm-bindgen-test = "0.3.33"
|
||||||
|
|
6
examples/test/dist/index.html
vendored
6
examples/test/dist/index.html
vendored
|
@ -2,10 +2,10 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Tauri + Yew App</title>
|
<title>Tauri + Yew App</title>
|
||||||
|
|
||||||
<link rel="preload" href="/tauri-sys-test-ui-3eb704384493bbf2_bg.wasm" as="fetch" type="application/wasm" crossorigin="">
|
<link rel="preload" href="/tauri-sys-test-ui-f3731bf7a986379f_bg.wasm" as="fetch" type="application/wasm" crossorigin="">
|
||||||
<link rel="modulepreload" href="/tauri-sys-test-ui-3eb704384493bbf2.js"></head>
|
<link rel="modulepreload" href="/tauri-sys-test-ui-f3731bf7a986379f.js"></head>
|
||||||
<body>
|
<body>
|
||||||
<script type="module">import init from '/tauri-sys-test-ui-3eb704384493bbf2.js';init('/tauri-sys-test-ui-3eb704384493bbf2_bg.wasm');</script><script>(function () {
|
<script type="module">import init from '/tauri-sys-test-ui-f3731bf7a986379f.js';init('/tauri-sys-test-ui-f3731bf7a986379f_bg.wasm');</script><script>(function () {
|
||||||
var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||||
var url = protocol + '//' + window.location.host + '/_trunk/ws';
|
var url = protocol + '//' + window.location.host + '/_trunk/ws';
|
||||||
var poll_interval = 5000;
|
var poll_interval = 5000;
|
||||||
|
|
111
examples/test/dist/snippets/tauri-sys-91bd50ded94e0ed7/src/dialog.js
vendored
Normal file
111
examples/test/dist/snippets/tauri-sys-91bd50ded94e0ed7/src/dialog.js
vendored
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
// tauri/tooling/api/src/tauri.ts
|
||||||
|
function uid() {
|
||||||
|
return window.crypto.getRandomValues(new Uint32Array(1))[0];
|
||||||
|
}
|
||||||
|
function transformCallback(callback, once = false) {
|
||||||
|
const identifier = uid();
|
||||||
|
const prop = `_${identifier}`;
|
||||||
|
Object.defineProperty(window, prop, {
|
||||||
|
value: (result) => {
|
||||||
|
if (once) {
|
||||||
|
Reflect.deleteProperty(window, prop);
|
||||||
|
}
|
||||||
|
return callback?.(result);
|
||||||
|
},
|
||||||
|
writable: false,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
async function invoke(cmd, args = {}) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const callback = transformCallback((e) => {
|
||||||
|
resolve(e);
|
||||||
|
Reflect.deleteProperty(window, `_${error}`);
|
||||||
|
}, true);
|
||||||
|
const error = transformCallback((e) => {
|
||||||
|
reject(e);
|
||||||
|
Reflect.deleteProperty(window, `_${callback}`);
|
||||||
|
}, true);
|
||||||
|
window.__TAURI_IPC__({
|
||||||
|
cmd,
|
||||||
|
callback,
|
||||||
|
error,
|
||||||
|
...args
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// tauri/tooling/api/src/helpers/tauri.ts
|
||||||
|
async function invokeTauriCommand(command) {
|
||||||
|
return invoke("tauri", command);
|
||||||
|
}
|
||||||
|
|
||||||
|
// tauri/tooling/api/src/dialog.ts
|
||||||
|
async function open(options = {}) {
|
||||||
|
if (typeof options === "object") {
|
||||||
|
Object.freeze(options);
|
||||||
|
}
|
||||||
|
return invokeTauriCommand({
|
||||||
|
__tauriModule: "Dialog",
|
||||||
|
message: {
|
||||||
|
cmd: "openDialog",
|
||||||
|
options
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async function save(options = {}) {
|
||||||
|
if (typeof options === "object") {
|
||||||
|
Object.freeze(options);
|
||||||
|
}
|
||||||
|
return invokeTauriCommand({
|
||||||
|
__tauriModule: "Dialog",
|
||||||
|
message: {
|
||||||
|
cmd: "saveDialog",
|
||||||
|
options
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async function message(message2, options) {
|
||||||
|
const opts = typeof options === "string" ? { title: options } : options;
|
||||||
|
return invokeTauriCommand({
|
||||||
|
__tauriModule: "Dialog",
|
||||||
|
message: {
|
||||||
|
cmd: "messageDialog",
|
||||||
|
message: message2.toString(),
|
||||||
|
title: opts?.title?.toString(),
|
||||||
|
type: opts?.type
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async function ask(message2, options) {
|
||||||
|
const opts = typeof options === "string" ? { title: options } : options;
|
||||||
|
return invokeTauriCommand({
|
||||||
|
__tauriModule: "Dialog",
|
||||||
|
message: {
|
||||||
|
cmd: "askDialog",
|
||||||
|
message: message2.toString(),
|
||||||
|
title: opts?.title?.toString(),
|
||||||
|
type: opts?.type
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async function confirm(message2, options) {
|
||||||
|
const opts = typeof options === "string" ? { title: options } : options;
|
||||||
|
return invokeTauriCommand({
|
||||||
|
__tauriModule: "Dialog",
|
||||||
|
message: {
|
||||||
|
cmd: "confirmDialog",
|
||||||
|
message: message2.toString(),
|
||||||
|
title: opts?.title?.toString(),
|
||||||
|
type: opts?.type
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export {
|
||||||
|
ask,
|
||||||
|
confirm,
|
||||||
|
message,
|
||||||
|
open,
|
||||||
|
save
|
||||||
|
};
|
Binary file not shown.
|
@ -1,17 +1,13 @@
|
||||||
import { getName, getTauriVersion, getVersion } from './snippets/tauri-sys-91bd50ded94e0ed7/dist/app.js';
|
import { getName, getTauriVersion, getVersion } from './snippets/tauri-sys-91bd50ded94e0ed7/src/app.js';
|
||||||
import { readText, writeText } from './snippets/tauri-sys-91bd50ded94e0ed7/dist/clipboard.js';
|
import { readText, writeText } from './snippets/tauri-sys-91bd50ded94e0ed7/src/clipboard.js';
|
||||||
import { emit } from './snippets/tauri-sys-91bd50ded94e0ed7/dist/event.js';
|
import { emit } from './snippets/tauri-sys-91bd50ded94e0ed7/src/event.js';
|
||||||
import { invoke } from './snippets/tauri-sys-91bd50ded94e0ed7/dist/tauri.js';
|
import { invoke } from './snippets/tauri-sys-91bd50ded94e0ed7/src/tauri.js';
|
||||||
|
|
||||||
let wasm;
|
let wasm;
|
||||||
|
|
||||||
const heap = new Array(32).fill(undefined);
|
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
||||||
|
|
||||||
heap.push(undefined, null, true, false);
|
cachedTextDecoder.decode();
|
||||||
|
|
||||||
function getObject(idx) { return heap[idx]; }
|
|
||||||
|
|
||||||
let WASM_VECTOR_LEN = 0;
|
|
||||||
|
|
||||||
let cachedUint8Memory0 = new Uint8Array();
|
let cachedUint8Memory0 = new Uint8Array();
|
||||||
|
|
||||||
|
@ -22,6 +18,29 @@ function getUint8Memory0() {
|
||||||
return cachedUint8Memory0;
|
return cachedUint8Memory0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getStringFromWasm0(ptr, len) {
|
||||||
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
||||||
|
}
|
||||||
|
|
||||||
|
const heap = new Array(32).fill(undefined);
|
||||||
|
|
||||||
|
heap.push(undefined, null, true, false);
|
||||||
|
|
||||||
|
let heap_next = heap.length;
|
||||||
|
|
||||||
|
function addHeapObject(obj) {
|
||||||
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
||||||
|
const idx = heap_next;
|
||||||
|
heap_next = heap[idx];
|
||||||
|
|
||||||
|
heap[idx] = obj;
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getObject(idx) { return heap[idx]; }
|
||||||
|
|
||||||
|
let WASM_VECTOR_LEN = 0;
|
||||||
|
|
||||||
const cachedTextEncoder = new TextEncoder('utf-8');
|
const cachedTextEncoder = new TextEncoder('utf-8');
|
||||||
|
|
||||||
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
||||||
|
@ -88,25 +107,6 @@ function getInt32Memory0() {
|
||||||
return cachedInt32Memory0;
|
return cachedInt32Memory0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let heap_next = heap.length;
|
|
||||||
|
|
||||||
function addHeapObject(obj) {
|
|
||||||
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
||||||
const idx = heap_next;
|
|
||||||
heap_next = heap[idx];
|
|
||||||
|
|
||||||
heap[idx] = obj;
|
|
||||||
return idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
||||||
|
|
||||||
cachedTextDecoder.decode();
|
|
||||||
|
|
||||||
function getStringFromWasm0(ptr, len) {
|
|
||||||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
||||||
}
|
|
||||||
|
|
||||||
let cachedFloat64Memory0 = new Float64Array();
|
let cachedFloat64Memory0 = new Float64Array();
|
||||||
|
|
||||||
function getFloat64Memory0() {
|
function getFloat64Memory0() {
|
||||||
|
@ -218,7 +218,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
||||||
return real;
|
return real;
|
||||||
}
|
}
|
||||||
function __wbg_adapter_28(arg0, arg1, arg2) {
|
function __wbg_adapter_28(arg0, arg1, arg2) {
|
||||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h45f286b32445b0b2(arg0, arg1, addHeapObject(arg2));
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1531275bccc70f0a(arg0, arg1, addHeapObject(arg2));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCachedStringFromWasm0(ptr, len) {
|
function getCachedStringFromWasm0(ptr, len) {
|
||||||
|
@ -271,36 +271,31 @@ async function load(module, imports) {
|
||||||
function getImports() {
|
function getImports() {
|
||||||
const imports = {};
|
const imports = {};
|
||||||
imports.wbg = {};
|
imports.wbg = {};
|
||||||
imports.wbg.__wbg_readText_d6aa69a1d055ebfb = function() {
|
imports.wbg.__wbg_getVersion_ffafb063403bc617 = function() { return handleError(function () {
|
||||||
const ret = readText();
|
const ret = getVersion();
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
}, arguments) };
|
||||||
imports.wbg.__wbg_writeText_98a927b6ebdc847f = function(arg0, arg1) {
|
imports.wbg.__wbg_getTauriVersion_e328534c86bd2dc2 = function() { return handleError(function () {
|
||||||
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
const ret = getTauriVersion();
|
||||||
const ret = writeText(v0);
|
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
}, arguments) };
|
||||||
imports.wbg.__wbg_invoke_575077e3d547074e = function() { return handleError(function (arg0, arg1, arg2) {
|
imports.wbg.__wbg_getName_68a59771155ee2ce = function() { return handleError(function () {
|
||||||
|
const ret = getName();
|
||||||
|
return addHeapObject(ret);
|
||||||
|
}, arguments) };
|
||||||
|
imports.wbg.__wbg_invoke_9b778281ea803eaa = function() { return handleError(function (arg0, arg1, arg2) {
|
||||||
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
||||||
const ret = invoke(v0, takeObject(arg2));
|
const ret = invoke(v0, takeObject(arg2));
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
}, arguments) };
|
}, arguments) };
|
||||||
imports.wbg.__wbg_getVersion_13e166788d7097c8 = function() {
|
imports.wbg.__wbg_emit_d58da538f5751592 = function() { return handleError(function (arg0, arg1, arg2) {
|
||||||
const ret = getVersion();
|
|
||||||
return addHeapObject(ret);
|
|
||||||
};
|
|
||||||
imports.wbg.__wbg_getTauriVersion_62b3cf54af008ea9 = function() {
|
|
||||||
const ret = getTauriVersion();
|
|
||||||
return addHeapObject(ret);
|
|
||||||
};
|
|
||||||
imports.wbg.__wbg_getName_d3872e5e2b652485 = function() {
|
|
||||||
const ret = getName();
|
|
||||||
return addHeapObject(ret);
|
|
||||||
};
|
|
||||||
imports.wbg.__wbg_emit_128d56f37ce5403a = function(arg0, arg1, arg2) {
|
|
||||||
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
||||||
const ret = emit(v0, takeObject(arg2));
|
const ret = emit(v0, takeObject(arg2));
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
|
}, arguments) };
|
||||||
|
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
||||||
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
||||||
|
return addHeapObject(ret);
|
||||||
};
|
};
|
||||||
imports.wbg.__wbindgen_boolean_get = function(arg0) {
|
imports.wbg.__wbindgen_boolean_get = function(arg0) {
|
||||||
const v = getObject(arg0);
|
const v = getObject(arg0);
|
||||||
|
@ -319,6 +314,19 @@ function getImports() {
|
||||||
const ret = getObject(arg0);
|
const ret = getObject(arg0);
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
};
|
||||||
|
imports.wbg.__wbg_readText_94a6e8d9907e78cc = function() { return handleError(function () {
|
||||||
|
const ret = readText();
|
||||||
|
return addHeapObject(ret);
|
||||||
|
}, arguments) };
|
||||||
|
imports.wbg.__wbg_writeText_f97e44754fa0ff39 = function() { return handleError(function (arg0, arg1) {
|
||||||
|
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
||||||
|
const ret = writeText(v0);
|
||||||
|
return addHeapObject(ret);
|
||||||
|
}, arguments) };
|
||||||
|
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
||||||
|
const ret = getStringFromWasm0(arg0, arg1);
|
||||||
|
return addHeapObject(ret);
|
||||||
|
};
|
||||||
imports.wbg.__wbg_nodeId_bbf0efafa303e805 = function(arg0, arg1) {
|
imports.wbg.__wbg_nodeId_bbf0efafa303e805 = function(arg0, arg1) {
|
||||||
const ret = getObject(arg1).$$$nodeId;
|
const ret = getObject(arg1).$$$nodeId;
|
||||||
getInt32Memory0()[arg0 / 4 + 1] = isLikeNone(ret) ? 0 : ret;
|
getInt32Memory0()[arg0 / 4 + 1] = isLikeNone(ret) ? 0 : ret;
|
||||||
|
@ -331,10 +339,6 @@ function getImports() {
|
||||||
const ret = getObject(arg0).createTextNode(arg1);
|
const ret = getObject(arg0).createTextNode(arg1);
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
};
|
||||||
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
||||||
const ret = getStringFromWasm0(arg0, arg1);
|
|
||||||
return addHeapObject(ret);
|
|
||||||
};
|
|
||||||
imports.wbg.__wbg_instanceof_Window_acc97ff9f5d2c7b4 = function(arg0) {
|
imports.wbg.__wbg_instanceof_Window_acc97ff9f5d2c7b4 = function(arg0) {
|
||||||
let result;
|
let result;
|
||||||
try {
|
try {
|
||||||
|
@ -456,14 +460,6 @@ function getImports() {
|
||||||
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
||||||
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
||||||
};
|
};
|
||||||
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
||||||
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
||||||
return addHeapObject(ret);
|
|
||||||
};
|
|
||||||
imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
|
|
||||||
const ret = getObject(arg0) == getObject(arg1);
|
|
||||||
return ret;
|
|
||||||
};
|
|
||||||
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
||||||
const obj = takeObject(arg0).original;
|
const obj = takeObject(arg0).original;
|
||||||
if (obj.cnt-- == 1) {
|
if (obj.cnt-- == 1) {
|
||||||
|
@ -473,6 +469,10 @@ function getImports() {
|
||||||
const ret = false;
|
const ret = false;
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
|
||||||
|
const ret = getObject(arg0) == getObject(arg1);
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
imports.wbg.__wbg_instanceof_ArrayBuffer_e5e48f4762c5610b = function(arg0) {
|
imports.wbg.__wbg_instanceof_ArrayBuffer_e5e48f4762c5610b = function(arg0) {
|
||||||
let result;
|
let result;
|
||||||
try {
|
try {
|
||||||
|
@ -586,8 +586,8 @@ imports.wbg.__wbindgen_memory = function() {
|
||||||
const ret = wasm.memory;
|
const ret = wasm.memory;
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
};
|
||||||
imports.wbg.__wbindgen_closure_wrapper5822 = function(arg0, arg1, arg2) {
|
imports.wbg.__wbindgen_closure_wrapper5093 = function(arg0, arg1, arg2) {
|
||||||
const ret = makeMutClosure(arg0, arg1, 295, __wbg_adapter_28);
|
const ret = makeMutClosure(arg0, arg1, 316, __wbg_adapter_28);
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ function initSync(module) {
|
||||||
|
|
||||||
async function init(input) {
|
async function init(input) {
|
||||||
if (typeof input === 'undefined') {
|
if (typeof input === 'undefined') {
|
||||||
input = new URL('tauri-sys-test-ui-3eb704384493bbf2_bg.wasm', import.meta.url);
|
input = new URL('tauri-sys-test-ui-f3731bf7a986379f_bg.wasm', import.meta.url);
|
||||||
}
|
}
|
||||||
const imports = getImports();
|
const imports = getImports();
|
||||||
|
|
BIN
examples/test/dist/tauri-sys-test-ui-f3731bf7a986379f_bg.wasm
vendored
Normal file
BIN
examples/test/dist/tauri-sys-test-ui-f3731bf7a986379f_bg.wasm
vendored
Normal file
Binary file not shown.
|
@ -2,7 +2,7 @@ use anyhow::ensure;
|
||||||
use tauri_sys::app;
|
use tauri_sys::app;
|
||||||
|
|
||||||
pub async fn get_name() -> anyhow::Result<()> {
|
pub async fn get_name() -> anyhow::Result<()> {
|
||||||
let name = app::get_name().await;
|
let name = app::get_name().await?;
|
||||||
|
|
||||||
ensure!(name == "tauri-sys-test");
|
ensure!(name == "tauri-sys-test");
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ pub async fn get_version() -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_tauri_version() -> anyhow::Result<()> {
|
pub async fn get_tauri_version() -> anyhow::Result<()> {
|
||||||
let version = app::get_tauri_version().await;
|
let version = app::get_tauri_version().await?;
|
||||||
|
|
||||||
ensure!(version.major == 1);
|
ensure!(version.major == 1);
|
||||||
ensure!(version.minor == 1);
|
ensure!(version.minor == 1);
|
||||||
|
|
|
@ -2,11 +2,11 @@ use anyhow::ensure;
|
||||||
use tauri_sys::clipboard;
|
use tauri_sys::clipboard;
|
||||||
|
|
||||||
pub async fn test() -> anyhow::Result<()> {
|
pub async fn test() -> anyhow::Result<()> {
|
||||||
clipboard::write_text("foobar").await;
|
clipboard::write_text("foobar").await?;
|
||||||
|
|
||||||
let text = clipboard::read_text().await?;
|
let text = clipboard::read_text().await?;
|
||||||
|
|
||||||
ensure!(text == Some("foobar".to_string()));
|
ensure!(text == "foobar".to_string());
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,9 @@ use anyhow::ensure;
|
||||||
use tauri_sys::{event, tauri};
|
use tauri_sys::{event, tauri};
|
||||||
|
|
||||||
pub async fn emit() -> anyhow::Result<()> {
|
pub async fn emit() -> anyhow::Result<()> {
|
||||||
event::emit("foo", &"bar").await;
|
event::emit("foo", &"bar").await?;
|
||||||
|
|
||||||
ensure!(tauri::invoke::<_, bool>("verify_receive", &())
|
ensure!(tauri::invoke::<_, bool>("verify_receive", &()).await?);
|
||||||
.await
|
|
||||||
.unwrap());
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ use tauri_sys::window;
|
||||||
pub async fn create_window() -> anyhow::Result<()> {
|
pub async fn create_window() -> anyhow::Result<()> {
|
||||||
let win = window::WebviewWindow::new("foo", ());
|
let win = window::WebviewWindow::new("foo", ());
|
||||||
|
|
||||||
ensure!(win.is_visible().await);
|
ensure!(win.is_visible().await?);
|
||||||
// ensure!(win.label() == "foo".to_string());
|
// ensure!(win.label() == "foo".to_string());
|
||||||
|
|
||||||
win.close().await;
|
win.close().await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue