feat: use tauri next branch, fix tests, MSRV 1.65 (#354)

This commit is contained in:
Lucas Fernandes Nogueira
2023-05-12 13:16:50 -07:00
committed by GitHub
parent e0e7b4fc71
commit 937e6a5be6
64 changed files with 867 additions and 463 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ Save window positions and sizes and restore them when the app is reopened.
## Install
_This plugin requires a Rust version of at least **1.64**_
_This plugin requires a Rust version of at least **1.65**_
There are three general methods of installation that we can recommend.
+15 -3
View File
@@ -1,5 +1,17 @@
import { invoke } from "@tauri-apps/api/tauri";
import { WindowLabel, getCurrent } from "tauri-plugin-window-api";
interface WindowDef {
label: string;
}
declare global {
interface Window {
__TAURI_METADATA__: {
__windows: WindowDef[];
__currentWindow: WindowDef;
};
}
}
export enum StateFlags {
SIZE = 1 << 0,
@@ -21,7 +33,7 @@ async function saveWindowState(flags: StateFlags) {
/**
* Restore the state for the specified window from disk.
*/
async function restoreState(label: WindowLabel, flags: StateFlags) {
async function restoreState(label: string, flags: StateFlags) {
invoke("plugin:window-state|restore_state", { label, flags });
}
@@ -29,7 +41,7 @@ async function restoreState(label: WindowLabel, flags: StateFlags) {
* Restore the state for the current window from disk.
*/
async function restoreStateCurrent(flags: StateFlags) {
restoreState(getCurrent().label, flags);
restoreState(window.__TAURI_METADATA__.__currentWindow.label, flags);
}
export { restoreState, restoreStateCurrent, saveWindowState };
+1 -2
View File
@@ -28,7 +28,6 @@
"tslib": "^2.5.0"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0",
"tauri-plugin-window-api": "0.0.0"
"@tauri-apps/api": "^1.2.0"
}
}