Fix invoke calls in dialog & shell init scripts (#675)

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
Mo
2023-10-22 16:39:40 +03:30
committed by GitHub
parent 5c137365c6
commit beb6b139eb
14 changed files with 112 additions and 66 deletions
+2 -14
View File
@@ -3,19 +3,7 @@
// SPDX-License-Identifier: MIT
import { invoke } from "@tauri-apps/api/primitives";
interface WindowDef {
label: string;
}
declare global {
interface Window {
__TAURI_METADATA__: {
__windows: WindowDef[];
__currentWindow: WindowDef;
};
}
}
import { getCurrent } from "@tauri-apps/api/window";
export enum StateFlags {
SIZE = 1 << 0,
@@ -50,7 +38,7 @@ async function restoreState(label: string, flags: StateFlags): Promise<void> {
* Restore the state for the current window from disk.
*/
async function restoreStateCurrent(flags: StateFlags): Promise<void> {
return restoreState(window.__TAURI_METADATA__.__currentWindow.label, flags);
return restoreState(getCurrent().label, flags);
}
export { restoreState, restoreStateCurrent, saveWindowState };
File diff suppressed because one or more lines are too long