Skip to content

FullScreenPlugin

Defined in: plugins/FullScreenPlugin.ts:69

Cross-browser fullscreen functionality plugin for web applications.

Provides comprehensive fullscreen mode management with automatic browser compatibility handling, event management, and flexible element targeting. Supports all major browsers including Chrome, Firefox, Safari, and Edge.

Key Features:

  • Cross-browser fullscreen API compatibility
  • Automatic event handling and state synchronization
  • Flexible element targeting (container, window, or custom elements)
  • Signal-based event system for reactive programming
  • Graceful fallback handling for unsupported browsers
  • Automatic cleanup and error handling
// Get the fullscreen plugin
const fullscreen = app.plugins.get<IFullScreenPlugin>('fullscreen');
// Listen for fullscreen changes
fullscreen.onFullScreenChange.connect((isFullscreen) => {
console.log('Fullscreen state:', isFullscreen);
updateUIForFullscreen(isFullscreen);
});
// Toggle fullscreen mode
document.getElementById('fullscreenBtn').addEventListener('click', () => {
if (fullscreen.canFullscreen) {
fullscreen.toggleFullScreen();
} else {
console.warn('Fullscreen not supported');
}
});
// Set custom element for fullscreen
const gameContainer = document.getElementById('gameContainer');
fullscreen.setFullScreenElement(gameContainer);
fullscreen.setFullScreen(true);

new FullScreenPlugin(): FullScreenPlugin

Defined in: plugins/FullScreenPlugin.ts:121

Creates the fullscreen plugin instance. Binds all methods to maintain proper context when used as event handlers.

FullScreenPlugin

Plugin.constructor

__dill_pixel_method_binding_root: boolean

Defined in: plugins/Plugin.ts:39

Plugin.__dill_pixel_method_binding_root


readonly id: "fullscreen" = 'fullscreen'

Defined in: plugins/FullScreenPlugin.ts:71

Plugin identifier for framework registration

IFullScreenPlugin.id

Plugin.id


onFullScreenChange: Signal<(isFullscreen) => void>

Defined in: plugins/FullScreenPlugin.ts:77

Signal emitted when fullscreen state changes. Provides the new fullscreen state as a boolean parameter.

IFullScreenPlugin.onFullScreenChange

get app(): Application

Defined in: plugins/FullScreenPlugin.ts:130

Gets the application instance.

Application

The singleton Application instance

IFullScreenPlugin.app

Plugin.app


get canFullscreen(): boolean

Defined in: plugins/FullScreenPlugin.ts:259

Checks if the current environment and element support fullscreen functionality.

if (fullscreenPlugin.canFullscreen) {
// Show fullscreen button
fullscreenButton.style.display = 'block';
} else {
// Hide fullscreen button or show alternative
fullscreenButton.style.display = 'none';
console.log('Fullscreen not supported on this device');
}

boolean

True if fullscreen is supported and available

Whether the current environment supports fullscreen functionality

IFullScreenPlugin.canFullscreen


get fullScreenElement(): null | HTMLElement | Window

Defined in: plugins/FullScreenPlugin.ts:113

Gets the current fullscreen target element.

null | HTMLElement | Window

The element currently set for fullscreen operations

set fullScreenElement(value): void

Defined in: plugins/FullScreenPlugin.ts:105

Sets the element to be used for fullscreen operations.

The HTML element or Window object to use for fullscreen

null | HTMLElement | Window

void

The HTML element or Window object used for fullscreen operations

IFullScreenPlugin.fullScreenElement


get isFullscreen(): boolean

Defined in: plugins/FullScreenPlugin.ts:278

Checks if the document is currently in fullscreen mode. Uses browser-specific properties for cross-browser compatibility.

boolean

True if any element is currently in fullscreen mode


get isFullScreen(): boolean

Defined in: plugins/FullScreenPlugin.ts:97

Gets the current fullscreen state.

boolean

True if currently in fullscreen mode

set isFullScreen(value): void

Defined in: plugins/FullScreenPlugin.ts:88

Sets the fullscreen state and triggers the appropriate fullscreen operation.

boolean

True to enter fullscreen, false to exit

void

Current fullscreen state

IFullScreenPlugin.isFullScreen


get options(): O

Defined in: plugins/Plugin.ts:44

O

IFullScreenPlugin.options

Plugin.options

addSignalConnection(…args): void

Defined in: plugins/Plugin.ts:79

Add signal connections to the container.

SignalConnection[]

The signal connections to add.

void

IFullScreenPlugin.addSignalConnection

Plugin.addSignalConnection


clearSignalConnections(): void

Defined in: plugins/Plugin.ts:85

void

IFullScreenPlugin.clearSignalConnections

Plugin.clearSignalConnections


destroy(): void

Defined in: plugins/FullScreenPlugin.ts:157

Cleans up the plugin by removing all event listeners. Called automatically when the plugin is destroyed.

void

IFullScreenPlugin.destroy

Plugin.destroy


initialize(): void

Defined in: plugins/FullScreenPlugin.ts:145

Initializes the fullscreen plugin by setting up browser event listeners. Registers listeners for all major browser fullscreen change events.

void

// Called automatically by the plugin system
// Registers listeners for: fullscreenchange, webkitfullscreenchange,
// mozfullscreenchange, msfullscreenchange

IFullScreenPlugin.initialize

Plugin.initialize


postInitialize(_app): void | Promise<void>

Defined in: plugins/Plugin.ts:68

IApplication

void | Promise<void>

IFullScreenPlugin.postInitialize

Plugin.postInitialize


setFullScreen(value): void

Defined in: plugins/FullScreenPlugin.ts:207

Sets the fullscreen state explicitly

boolean

True to enter fullscreen, false to exit fullscreen

void

// Enter fullscreen mode
fullscreenPlugin.setFullScreen(true);
// Exit fullscreen mode
fullscreenPlugin.setFullScreen(false);
// Conditional fullscreen based on game state
if (gameState === 'playing') {
fullscreenPlugin.setFullScreen(true);
}

IFullScreenPlugin.setFullScreen


setFullScreenElement(value): void

Defined in: plugins/FullScreenPlugin.ts:235

Sets the element to be used for fullscreen operations

The HTML element or Window to use for fullscreen operations

null | HTMLElement | Window

void

// Use a specific game container
const gameDiv = document.getElementById('game-container');
fullscreenPlugin.setFullScreenElement(gameDiv);
// Use the entire window
fullscreenPlugin.setFullScreenElement(window);
// Reset to default (application container)
fullscreenPlugin.setFullScreenElement(null);

IFullScreenPlugin.setFullScreenElement


toggleFullScreen(): void

Defined in: plugins/FullScreenPlugin.ts:184

Toggles between fullscreen and windowed mode

void

// Toggle fullscreen on button click
button.addEventListener('click', () => {
fullscreenPlugin.toggleFullScreen();
});
// Keyboard shortcut for fullscreen
document.addEventListener('keydown', (e) => {
if (e.key === 'F11') {
e.preventDefault();
fullscreenPlugin.toggleFullScreen();
}
});

IFullScreenPlugin.toggleFullScreen