mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-26 21:41:48 +02:00
chore: update to tauri alpha.16, api alpha.9 (#673)
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
This commit is contained in:
co-authored by
Amr Bashir
parent
b7c5407cac
commit
5c137365c6
@@ -4,11 +4,7 @@
|
||||
|
||||
import { listen, UnlistenFn } from "@tauri-apps/api/event";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__TAURI_INVOKE__: <T>(cmd: string, args?: unknown) => Promise<T>;
|
||||
}
|
||||
}
|
||||
import { invoke } from "@tauri-apps/api/primitives";
|
||||
|
||||
interface ChangePayload<T> {
|
||||
path: string;
|
||||
@@ -33,7 +29,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async set(key: string, value: unknown): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|set", {
|
||||
return await invoke("plugin:store|set", {
|
||||
path: this.path,
|
||||
key,
|
||||
value,
|
||||
@@ -47,7 +43,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async get<T>(key: string): Promise<T | null> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|get", {
|
||||
return await invoke("plugin:store|get", {
|
||||
path: this.path,
|
||||
key,
|
||||
});
|
||||
@@ -60,7 +56,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async has(key: string): Promise<boolean> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|has", {
|
||||
return await invoke("plugin:store|has", {
|
||||
path: this.path,
|
||||
key,
|
||||
});
|
||||
@@ -73,7 +69,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async delete(key: string): Promise<boolean> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|delete", {
|
||||
return await invoke("plugin:store|delete", {
|
||||
path: this.path,
|
||||
key,
|
||||
});
|
||||
@@ -86,7 +82,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async clear(): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|clear", {
|
||||
return await invoke("plugin:store|clear", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
@@ -98,7 +94,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async reset(): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|reset", {
|
||||
return await invoke("plugin:store|reset", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
@@ -109,7 +105,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async keys(): Promise<string[]> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|keys", {
|
||||
return await invoke("plugin:store|keys", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
@@ -120,7 +116,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async values<T>(): Promise<T[]> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|values", {
|
||||
return await invoke("plugin:store|values", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
@@ -131,7 +127,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async entries<T>(): Promise<Array<[key: string, value: T]>> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|entries", {
|
||||
return await invoke("plugin:store|entries", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
@@ -142,7 +138,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async length(): Promise<number> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|length", {
|
||||
return await invoke("plugin:store|length", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
@@ -156,7 +152,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async load(): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|load", {
|
||||
return await invoke("plugin:store|load", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
@@ -169,7 +165,7 @@ export class Store {
|
||||
* @returns
|
||||
*/
|
||||
async save(): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:store|save", {
|
||||
return await invoke("plugin:store|save", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user