Skip to main content

export=

FitFileViewer - API Documentation v29.4.0


FitFileViewer - API Documentation / windowStateUtils / export=

Variable: export=

export=: { CONSTANTS: { DEFAULTS: { WINDOW: { height: number; minHeight: number; minWidth: number; width: number; }; }; FILES: { WINDOW_STATE: string; }; PATHS: { HTML: { INDEX: string; }; ICONS: { FAVICON: string; }; PRELOAD: string; }; WEB_PREFERENCES: { contextIsolation: boolean; nodeIntegration: boolean; sandbox: boolean; }; }; createWindow: () => BrowserWindow; getWindowState: () => WindowState; sanitizeWindowState: (state: Partial<WindowState>) => WindowState; saveWindowState: (win: BrowserWindow) => void; settingsPath: string; validateWindow: (win: unknown) => win is BrowserWindow; validateWindowState: (state: unknown) => state is WindowState; devHelpers?: { getConfig: () => { constants: { DEFAULTS: { WINDOW: { height: number; minHeight: number; minWidth: number; width: number; }; }; FILES: { WINDOW_STATE: string; }; PATHS: { HTML: { INDEX: string; }; ICONS: { FAVICON: string; }; PRELOAD: string; }; WEB_PREFERENCES: { contextIsolation: boolean; nodeIntegration: boolean; sandbox: boolean; }; }; currentState: WindowState; settingsPath: string; }; resetState: () => boolean; validateSettings: () => { exists: any; isValid: boolean; path: string; state: WindowState; error?: undefined; } | { state?: undefined; error: string; exists: boolean; isValid: boolean; path: string; }; }; version: string; }

Defined in: windowStateUtils.js:347

Module exports with enhanced structure

Type Declaration​

CONSTANTS​

CONSTANTS: { DEFAULTS: { WINDOW: { height: number; minHeight: number; minWidth: number; width: number; }; }; FILES: { WINDOW_STATE: string; }; PATHS: { HTML: { INDEX: string; }; ICONS: { FAVICON: string; }; PRELOAD: string; }; WEB_PREFERENCES: { contextIsolation: boolean; nodeIntegration: boolean; sandbox: boolean; }; }

CONSTANTS.DEFAULTS​

DEFAULTS: { WINDOW: { height: number; minHeight: number; minWidth: number; width: number; }; }

CONSTANTS.DEFAULTS.WINDOW​

WINDOW: { height: number; minHeight: number; minWidth: number; width: number; }

CONSTANTS.DEFAULTS.WINDOW.height​

height: number = 800

CONSTANTS.DEFAULTS.WINDOW.minHeight​

minHeight: number = 600

CONSTANTS.DEFAULTS.WINDOW.minWidth​

minWidth: number = 800

CONSTANTS.DEFAULTS.WINDOW.width​

width: number = 1200

CONSTANTS.FILES​

FILES: { WINDOW_STATE: string; }

CONSTANTS.FILES.WINDOW_STATE​

WINDOW_STATE: string = "window-state.json"

CONSTANTS.PATHS​

PATHS: { HTML: { INDEX: string; }; ICONS: { FAVICON: string; }; PRELOAD: string; }

CONSTANTS.PATHS.HTML​

HTML: { INDEX: string; }

CONSTANTS.PATHS.HTML.INDEX​

INDEX: string = "index.html"

CONSTANTS.PATHS.ICONS​

ICONS: { FAVICON: string; }

CONSTANTS.PATHS.ICONS.FAVICON​

FAVICON: string = "icons/favicon.ico"

CONSTANTS.PATHS.PRELOAD​

PRELOAD: string = "preload.js"

CONSTANTS.WEB_PREFERENCES​

WEB_PREFERENCES: { contextIsolation: boolean; nodeIntegration: boolean; sandbox: boolean; }

CONSTANTS.WEB_PREFERENCES.contextIsolation​

contextIsolation: boolean = true

CONSTANTS.WEB_PREFERENCES.nodeIntegration​

nodeIntegration: boolean = false

CONSTANTS.WEB_PREFERENCES.sandbox​

sandbox: boolean = true

createWindow()​

createWindow: () => BrowserWindow

Returns​

BrowserWindow

getWindowState()​

getWindowState: () => WindowState

Core functions

Returns​

WindowState

sanitizeWindowState()​

sanitizeWindowState: (state: Partial<WindowState>) => WindowState

Sanitize and normalize persisted window state.

Parameters​

state​

Partial<WindowState>

Returns​

WindowState

saveWindowState()​

saveWindowState: (win: BrowserWindow) => void

Parameters​

win​

BrowserWindow

Returns​

void

settingsPath​

settingsPath: string

Constants and configuration

validateWindow()​

validateWindow: (win: unknown) => win is BrowserWindow

Utility functions

Parameters​

win​

unknown

Returns​

win is BrowserWindow

validateWindowState()​

validateWindowState: (state: unknown) => state is WindowState

Type guard validating a window state object.

Parameters​

state​

unknown

Returns​

state is WindowState

devHelpers?​

optional devHelpers: { getConfig: () => { constants: { DEFAULTS: { WINDOW: { height: number; minHeight: number; minWidth: number; width: number; }; }; FILES: { WINDOW_STATE: string; }; PATHS: { HTML: { INDEX: string; }; ICONS: { FAVICON: string; }; PRELOAD: string; }; WEB_PREFERENCES: { contextIsolation: boolean; nodeIntegration: boolean; sandbox: boolean; }; }; currentState: WindowState; settingsPath: string; }; resetState: () => boolean; validateSettings: () => { exists: any; isValid: boolean; path: string; state: WindowState; error?: undefined; } | { state?: undefined; error: string; exists: boolean; isValid: boolean; path: string; }; }

Development and debugging helpers

devHelpers.getConfig()​

getConfig: () => { constants: { DEFAULTS: { WINDOW: { height: number; minHeight: number; minWidth: number; width: number; }; }; FILES: { WINDOW_STATE: string; }; PATHS: { HTML: { INDEX: string; }; ICONS: { FAVICON: string; }; PRELOAD: string; }; WEB_PREFERENCES: { contextIsolation: boolean; nodeIntegration: boolean; sandbox: boolean; }; }; currentState: WindowState; settingsPath: string; }

Get current window state configuration

Returns​

{ constants: { DEFAULTS: { WINDOW: { height: number; minHeight: number; minWidth: number; width: number; }; }; FILES: { WINDOW_STATE: string; }; PATHS: { HTML: { INDEX: string; }; ICONS: { FAVICON: string; }; PRELOAD: string; }; WEB_PREFERENCES: { contextIsolation: boolean; nodeIntegration: boolean; sandbox: boolean; }; }; currentState: WindowState; settingsPath: string; }

constants​

constants: { DEFAULTS: { WINDOW: { height: number; minHeight: number; minWidth: number; width: number; }; }; FILES: { WINDOW_STATE: string; }; PATHS: { HTML: { INDEX: string; }; ICONS: { FAVICON: string; }; PRELOAD: string; }; WEB_PREFERENCES: { contextIsolation: boolean; nodeIntegration: boolean; sandbox: boolean; }; } = CONSTANTS

constants.DEFAULTS​

DEFAULTS: { WINDOW: { height: number; minHeight: number; minWidth: number; width: number; }; }

constants.DEFAULTS.WINDOW​

WINDOW: { height: number; minHeight: number; minWidth: number; width: number; }

constants.DEFAULTS.WINDOW.height​

height: number = 800

constants.DEFAULTS.WINDOW.minHeight​

minHeight: number = 600

constants.DEFAULTS.WINDOW.minWidth​

minWidth: number = 800

constants.DEFAULTS.WINDOW.width​

width: number = 1200

constants.FILES​

FILES: { WINDOW_STATE: string; }

constants.FILES.WINDOW_STATE​

WINDOW_STATE: string = "window-state.json"

constants.PATHS​

PATHS: { HTML: { INDEX: string; }; ICONS: { FAVICON: string; }; PRELOAD: string; }

constants.PATHS.HTML​

HTML: { INDEX: string; }

constants.PATHS.HTML.INDEX​

INDEX: string = "index.html"

constants.PATHS.ICONS​

ICONS: { FAVICON: string; }

constants.PATHS.ICONS.FAVICON​

FAVICON: string = "icons/favicon.ico"

constants.PATHS.PRELOAD​

PRELOAD: string = "preload.js"

constants.WEB_PREFERENCES​

WEB_PREFERENCES: { contextIsolation: boolean; nodeIntegration: boolean; sandbox: boolean; }

constants.WEB_PREFERENCES.contextIsolation​

contextIsolation: boolean = true

constants.WEB_PREFERENCES.nodeIntegration​

nodeIntegration: boolean = false

constants.WEB_PREFERENCES.sandbox​

sandbox: boolean = true

currentState​

currentState: WindowState

settingsPath​

settingsPath: string

devHelpers.resetState()​

resetState: () => boolean

Reset window state to defaults

Returns​

boolean

devHelpers.validateSettings()​

validateSettings: () => { exists: any; isValid: boolean; path: string; state: WindowState; error?: undefined; } | { state?: undefined; error: string; exists: boolean; isValid: boolean; path: string; }

Validate current settings file

Returns​

{ exists: any; isValid: boolean; path: string; state: WindowState; error?: undefined; } | { state?: undefined; error: string; exists: boolean; isValid: boolean; path: string; }

version​

version: string = "1.0.0"

Version information