mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-12 14:17:48 +02:00
feat: update to tauri 2.0.0-alpha.9 (#372)
This commit is contained in:
committed by
GitHub
parent
717ae67097
commit
3c9771e287
@@ -1,4 +1,4 @@
|
||||
import { invoke, transformCallback } from "@tauri-apps/api/tauri";
|
||||
import { invoke, Channel } from "@tauri-apps/api/tauri";
|
||||
|
||||
interface ProgressPayload {
|
||||
progress: number;
|
||||
@@ -7,34 +7,6 @@ interface ProgressPayload {
|
||||
|
||||
type ProgressHandler = (progress: ProgressPayload) => void;
|
||||
|
||||
// TODO: use channel from @tauri-apps/api on v2
|
||||
class Channel<T = unknown> {
|
||||
id: number;
|
||||
// @ts-expect-error field used by the IPC serializer
|
||||
private readonly __TAURI_CHANNEL_MARKER__ = true;
|
||||
#onmessage: (response: T) => void = () => {
|
||||
// no-op
|
||||
};
|
||||
|
||||
constructor() {
|
||||
this.id = transformCallback((response: T) => {
|
||||
this.#onmessage(response);
|
||||
});
|
||||
}
|
||||
|
||||
set onmessage(handler: (response: T) => void) {
|
||||
this.#onmessage = handler;
|
||||
}
|
||||
|
||||
get onmessage(): (response: T) => void {
|
||||
return this.#onmessage;
|
||||
}
|
||||
|
||||
toJSON(): string {
|
||||
return `__CHANNEL__:${this.id}`;
|
||||
}
|
||||
}
|
||||
|
||||
async function upload(
|
||||
url: string,
|
||||
filePath: string,
|
||||
|
||||
@@ -28,6 +28,6 @@
|
||||
"tslib": "^2.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^1.2.0"
|
||||
"@tauri-apps/api": "2.0.0-alpha.4"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user