WebExeBuilder Documentation

getState

Category: Window Management

Namespace: web.window.getState

Description

Gets the current window state (normal, minimized, or maximized).

Syntax

const state = await web.window.getState();

Parameters

None

Returns

Promise<string> - Returns a promise that resolves with the window state: "normal", "minimized", or "maximized"

Examples

Simple example

const state = await web.window.getState();
console.log('Window state:', state);

if (state === 'maximized') {
    console.log('Window is maximized');
}

Check before operation

// Only perform action if window is visible
const state = await web.window.getState();

if (state !== 'minimized') {
    // Window is visible, safe to show dialog
    await web.dialogs.openFile({
        title: 'Select File'
    });
}

Use Cases

  • Check if window is minimized
  • Determine current window state
  • Save window state for restoration
  • Conditional logic based on window state

Notes

  • Returns one of three values: "normal", "minimized", "maximized"
  • Returns "normal" on error
  • State reflects current WindowState property