WebExeBuilder Documentation

isFullScreen

Category: Application Control

Namespace: web.app.isFullScreen

Description

Check if the application is currently in fullscreen mode. Returns true if fullscreen is active, false otherwise.

Syntax

const isFullscreen = await web.app.isFullScreen();

Parameters

None

Returns

Promise<boolean> - True if in fullscreen mode, false otherwise

Example

Simple example

const isFullscreen = await web.app.isFullScreen();
console.log('Fullscreen:', isFullscreen);

Practical example

async function toggleFullscreen() {
    const isFullscreen = await web.app.isFullScreen();
    
    if (isFullscreen) {
        await web.app.exitFullScreen();
    } else {
        await web.app.enterFullScreen();
    }
}

Advanced example

async function updateFullscreenButton() {
    const isFullscreen = await web.app.isFullScreen();
    const button = document.getElementById('fullscreen-btn');
    
    if (isFullscreen) {
        button.innerHTML = '<i class="fas fa-compress"></i> Exit Fullscreen';
        button.title = 'Exit fullscreen mode (ESC)';
    } else {
        button.innerHTML = '<i class="fas fa-expand"></i> Enter Fullscreen';
        button.title = 'Enter fullscreen mode (F11)';
    }
}

// Update button on click
document.getElementById('fullscreen-btn').addEventListener('click', async () => {
    await toggleFullscreen();
    await updateFullscreenButton();
});

Use Cases

  • Toggle fullscreen mode intelligently
  • Update UI buttons based on fullscreen state
  • Show/hide fullscreen exit instructions
  • Track window state for user preferences
  • Conditional rendering based on fullscreen
  • Keyboard shortcut handling
  • Save fullscreen preference
  • Display appropriate icons (expand/compress)

Error Handling

This method does not throw errors. Always returns a boolean value.

Performance Tips

  • Cache the result if checking frequently
  • Use to avoid unnecessary enter/exit calls
  • Combine with window state management
  • Update UI reactively based on state
  • web.app.enterFullScreen() - Enter fullscreen mode
  • web.app.exitFullScreen() - Exit fullscreen mode
  • web.app.windowMaximize() - Maximize window
  • web.app.windowRestore() - Restore window

Notes

  • Returns current fullscreen state
  • Useful for toggle functionality
  • Check before entering/exiting fullscreen
  • Helps maintain consistent UI state