WebExeBuilder Documentation

windowRestore

Category: Application Control

Namespace: web.app.windowRestore

Description

Restore the application window to its previous size and position. This returns the window to normal state from either maximized or minimized state.

Syntax

await web.app.windowRestore();

Parameters

None

Returns

Promise<boolean> - Returns true when the window is restored

Example

Simple example

await web.app.windowRestore();

Practical example

document.getElementById('restore-btn').addEventListener('click', async () => {
    await web.app.windowRestore();
});

Advanced example

let isMaximized = false;

async function toggleWindowSize() {
    if (isMaximized) {
        await web.app.windowRestore();
        isMaximized = false;
        console.log('Window restored to normal size');
    } else {
        await web.app.windowMaximize();
        isMaximized = true;
        console.log('Window maximized');
    }
}

Use Cases

  • Restore window from maximized state
  • Bring back minimized window
  • Implement double-click title bar to toggle size
  • Create custom window control buttons
  • Restore window size on application startup
  • Return to normal size after fullscreen
  • Implement keyboard shortcuts
  • Restore window when user clicks taskbar icon

Error Handling

This method does not throw errors. If the window is already in normal state, calling this method has no effect.

Performance Tips

  • Track window state to avoid unnecessary restore calls
  • Combine with maximize/minimize for window management
  • Save and restore window position and size
  • Use with window state detection methods
  • web.app.windowMaximize() - Maximize the window
  • web.app.windowMinimize() - Minimize the window
  • web.app.exitFullScreen() - Exit fullscreen mode
  • web.app.isFullScreen() - Check fullscreen status

Notes

  • Restores window to size before maximize/minimize
  • Window position is also restored
  • Works from both maximized and minimized states
  • Normal state shows window at its previous size