mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-02 20:10:37 +02:00
fix(window-state): port fixes from v1 (#436)
* fix(window-state): correctly set decoration state if no saved state exists, fixes #421 (#424) * fix(window-state): propagate promise (#435) closes #432 * fix(window-state): manual default implentation (#425) * fix(window-state): manual default implentation, closes #421 * Update lib.rs * change file * generated files * fix symlinks? --------- Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
This commit is contained in:
co-authored by
Fabian-Lars
parent
c73049d3ed
commit
84b3612393
@@ -34,15 +34,17 @@ export enum StateFlags {
|
||||
/**
|
||||
* Save the state of all open windows to disk.
|
||||
*/
|
||||
async function saveWindowState(flags: StateFlags) {
|
||||
window.__TAURI_INVOKE__("plugin:window-state|save_window_state", { flags });
|
||||
async function saveWindowState(flags: StateFlags): Promise<void> {
|
||||
return window.__TAURI_INVOKE__("plugin:window-state|save_window_state", {
|
||||
flags,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the state for the specified window from disk.
|
||||
*/
|
||||
async function restoreState(label: string, flags: StateFlags) {
|
||||
window.__TAURI_INVOKE__("plugin:window-state|restore_state", {
|
||||
async function restoreState(label: string, flags: StateFlags): Promise<void> {
|
||||
return window.__TAURI_INVOKE__("plugin:window-state|restore_state", {
|
||||
label,
|
||||
flags,
|
||||
});
|
||||
@@ -51,8 +53,8 @@ async function restoreState(label: string, flags: StateFlags) {
|
||||
/**
|
||||
* Restore the state for the current window from disk.
|
||||
*/
|
||||
async function restoreStateCurrent(flags: StateFlags) {
|
||||
restoreState(window.__TAURI_METADATA__.__currentWindow.label, flags);
|
||||
async function restoreStateCurrent(flags: StateFlags): Promise<void> {
|
||||
return restoreState(window.__TAURI_METADATA__.__currentWindow.label, flags);
|
||||
}
|
||||
|
||||
export { restoreState, restoreStateCurrent, saveWindowState };
|
||||
|
||||
Reference in New Issue
Block a user