tiny-electron-essentials
Version:
A lightweight and modular utility library for Electron apps, offering simplified window management, tray support, IPC channels, and custom frameless window styling.
922 lines • 34.2 kB
text/typescript
export default TinyElectronClient;
/**
* Represents the result of installing a loading page, providing methods
* to control its insertion and removal from the DOM.
*/
export type InstallLoadingPageResult = {
/**
* - Appends the loading screen elements to the document.
*/
append: () => void;
/**
* - Removes the loading screen elements from the document.
*/
remove: () => void;
};
/**
* Represents the rectangular bounds of a window on the screen.
*/
export type Bounds = {
/**
* - The horizontal position of the window (distance from the left of the screen).
*/
x: number;
/**
* - The vertical position of the window (distance from the top of the screen).
*/
y: number;
/**
* - The width of the window in pixels.
*/
width: number;
/**
* - The height of the window in pixels.
*/
height: number;
};
/**
* A tuple representing a 2D position in pixels.
*/
export type Position = number[];
/**
* A tuple representing the size of a window in pixels.
*/
export type Size = number[];
/**
* Represents the current window state and its capabilities.
*/
export type WindowDataResult = {
bounds: Bounds;
/**
* - Indicates whether the window can be maximized.
*/
isMaximizable: boolean;
/**
* - Indicates whether the window can be closed.
*/
isClosable: boolean;
/**
* - Indicates whether the window can enter fullscreen mode.
*/
isFullScreenable: boolean;
/**
* - Indicates whether the window can be focused.
*/
isFocusable: boolean;
/**
* - True if the window is currently in fullscreen mode.
*/
isFullScreen: boolean;
/**
* - True if the window is currently focused.
*/
isFocused: boolean;
/**
* - True if the window is currently maximized.
*/
isMaximized: boolean;
};
/**
* Registers a listener for the specified event.
*/
export type TinyElectronClientApi = {
/**
* Removes a listener from the specified event.
*/
on: (event: string | symbol, listener: (...args: any[]) => void) => void;
/**
* Registers a one-time listener for the specified event.
*/
off: (event: string | symbol, listener: (...args: any[]) => void) => void;
/**
* Opens the Developer Tools (DevTools) for the window.
*/
once: (event: string | symbol, listener: (...args: any[]) => void) => void;
/**
* Sets the window title for the BrowserWindow.
*/
openDevTools: (ops: Electron.OpenDevToolsOptions) => Promise<void>;
/**
* Retrieves the current internal visibility status flag.
* May differ from actual visibility (`isVisible`) for internal tracking purposes.
*/
setTitle: (title: string) => Promise<void>;
/**
* Returns an object containing runtime data about the current session or app instance.
* This data is typically provided by the main process.
*/
getShowStatus: () => boolean;
/**
* Indicates whether the application window is currently visible on the screen.
*/
getData: () => Record<string, any>;
/**
* Indicates whether the application window is currently focused.
*/
isVisible: () => boolean;
/**
* Indicates whether the application window is currently maximized.
*/
isFocused: () => boolean;
/**
* Checks whether the window is in fullscreen mode.
*/
isMaximized: () => boolean;
/**
* Returns whether the window is currently maximizable.
*/
isFullScreen: () => boolean;
/**
* Returns whether the window is currently closable.
*/
isMaximizable: () => boolean;
/**
* Indicates whether the window can enter fullscreen mode.
*/
isClosable: () => boolean;
/**
* Returns whether the window is currently focusable.
*/
isFullScreenable: () => boolean;
/**
* Sets whether the window can be maximized.
*/
isFocusable: () => boolean;
/**
* Sets whether the window can be closed.
*/
setMaximizable: (value: boolean) => Promise<boolean>;
/**
* Sets whether the window can be focused.
*/
setClosable: (value: boolean) => Promise<boolean>;
/**
* Sets whether the window can enter fullscreen mode.
*/
setFocusable: (value: boolean) => Promise<boolean>;
/**
* Requests the current window data from the main process.
*/
setFullScreenable: (value: boolean) => Promise<boolean>;
/**
* Returns a key-value object representing cached state/data stored by the main process.
*/
getWindowData: () => Promise<WindowDataResult>;
/**
* Sends a request to the main process to update and resend the latest cache state.
*/
getCache: () => Record<string, any>;
/**
* Sends a request to forcibly focus the application window, even if it’s not currently visible or active.
*/
requestCache: () => Promise<Record<string, any>>;
/**
* Retrieves the current change count for a specific key.
*/
forceFocus: () => Promise<void>;
/**
* Retrieves all current change counters.
*/
getChangeCount: (where: string) => number;
/**
* Retrieves the current window bounds including position and size.
*/
getAllChangeCount: () => Record<string, number>;
/**
* Retrieves the current size of the window.
*/
getBounds: () => Bounds;
/**
* Retrieves the current position of the window.
*/
getSize: () => Size;
/**
* Brings the application window to the front and gives it focus.
*/
getPosition: () => Position;
/**
* Removes focus from the application window, if currently focused.
*/
focus: () => Promise<void>;
/**
* Makes the application window visible.
*/
blur: () => Promise<void>;
/**
* Hides the application window from view (but does not quit the app).
*/
show: () => Promise<void>;
/**
* Closes the application window (but does not quit the app).
*/
hide: () => Promise<void>;
/**
* Destroy the application window (but does not quit the app).
*/
close: () => Promise<void>;
/**
* Maximizes the application window to fill the screen.
*/
destroy: () => Promise<void>;
/**
* Restores the application window from maximized state to its previous size.
*/
maximize: () => Promise<void>;
/**
* Minimizes the application window to the taskbar/dock.
*/
unmaximize: () => Promise<void>;
/**
* Requests the application to quit immediately.
*/
minimize: () => Promise<void>;
/**
* Retrieves the amount of system idle time in seconds.
*/
quit: () => void;
/**
* Determines the current system idle state.
*/
systemIdleTime: () => Promise<number>;
/**
* Returns the absolute path to the current executable of the running application.
*/
systemIdleState: (idleThreshold: number) => Promise<"active" | "idle" | "locked" | "unknown">;
/**
* Changes the tray icon to the specified image.
* `img` should be a valid image file.
*/
getExecPath: () => string;
/**
* Changes the application window or dock icon (depending on platform).
* `img` should be a valid image file.
*/
changeTrayIcon: (img: string, id: string) => Promise<void>;
/**
* Sets the internal visibility flag.
*/
changeAppIcon: (img: string) => Promise<void>;
/**
* Updates the application's network proxy settings.
* Requires an Electron `ProxyConfig` object with appropriate options.
*/
setIsVisible: (isVisible?: boolean) => Promise<boolean>;
setProxy: (config: Electron.ProxyConfig) => Promise<void>;
};
/**
* Represents the result of installing a loading page, providing methods
* to control its insertion and removal from the DOM.
*
* @typedef {Object} InstallLoadingPageResult
* @property {() => void} append - Appends the loading screen elements to the document.
* @property {() => void} remove - Removes the loading screen elements from the document.
*/
/**
* Represents the rectangular bounds of a window on the screen.
*
* @typedef {Object} Bounds
* @property {number} x - The horizontal position of the window (distance from the left of the screen).
* @property {number} y - The vertical position of the window (distance from the top of the screen).
* @property {number} width - The width of the window in pixels.
* @property {number} height - The height of the window in pixels.
*/
/**
* A tuple representing a 2D position in pixels.
*
* @typedef {number[]} Position
* @property {number} 0 - The horizontal position (x).
* @property {number} 1 - The vertical position (y).
*/
/**
* A tuple representing the size of a window in pixels.
*
* @typedef {number[]} Size
* @property {number} 0 - The width.
* @property {number} 1 - The height.
*/
/**
* Represents the current window state and its capabilities.
*
* @typedef {Object} WindowDataResult
* @property {Bounds} bounds
* @property {boolean} isMaximizable - Indicates whether the window can be maximized.
* @property {boolean} isClosable - Indicates whether the window can be closed.
* @property {boolean} isFullScreenable - Indicates whether the window can enter fullscreen mode.
* @property {boolean} isFocusable - Indicates whether the window can be focused.
* @property {boolean} isFullScreen - True if the window is currently in fullscreen mode.
* @property {boolean} isFocused - True if the window is currently focused.
* @property {boolean} isMaximized - True if the window is currently maximized.
*/
/**
* Represents the client-side API exposed by the Electron preload script,
* enabling secure and controlled communication between the page and preload process.
*
* @typedef {Object} TinyElectronClientApi
*
* Registers a listener for the specified event.
* @property {(event: string | symbol, listener: ListenerCallback) => void} on
*
* Removes a listener from the specified event.
* @property {(event: string | symbol, listener: ListenerCallback) => void} off
*
* Registers a one-time listener for the specified event.
* @property {(event: string | symbol, listener: ListenerCallback) => void} once
*
* Opens the Developer Tools (DevTools) for the window.
* @property {(ops: Electron.OpenDevToolsOptions) => Promise<void>} openDevTools
*
* Sets the window title for the BrowserWindow.
* @property {(title: string) => Promise<void>} setTitle
*
* Retrieves the current internal visibility status flag.
* May differ from actual visibility (`isVisible`) for internal tracking purposes.
* @property {() => boolean} getShowStatus
*
* Returns an object containing runtime data about the current session or app instance.
* This data is typically provided by the main process.
* @property {() => Record<string, any>} getData
*
* Indicates whether the application window is currently visible on the screen.
* @property {() => boolean} isVisible
*
* Indicates whether the application window is currently focused.
* @property {() => boolean} isFocused
*
* Indicates whether the application window is currently maximized.
* @property {() => boolean} isMaximized
*
* Checks whether the window is in fullscreen mode.
* @property {() => boolean} isFullScreen
*
* Returns whether the window is currently maximizable.
* @property {() => boolean} isMaximizable
*
* Returns whether the window is currently closable.
* @property {() => boolean} isClosable
*
* Indicates whether the window can enter fullscreen mode.
* @property {() => boolean} isFullScreenable
*
* Returns whether the window is currently focusable.
* @property {() => boolean} isFocusable
*
* Sets whether the window can be maximized.
* @property {(value: boolean) => Promise<boolean>} setMaximizable
*
* Sets whether the window can be closed.
* @property {(value: boolean) => Promise<boolean>} setClosable
*
* Sets whether the window can be focused.
* @property {(value: boolean) => Promise<boolean>} setFocusable
*
* Sets whether the window can enter fullscreen mode.
* @property {(value: boolean) => Promise<boolean>} setFullScreenable
*
* Requests the current window data from the main process.
* @property {() => Promise<WindowDataResult>} getWindowData
*
* Returns a key-value object representing cached state/data stored by the main process.
* @property {() => Record<string, any>} getCache
*
* Sends a request to the main process to update and resend the latest cache state.
* @property {() => Promise<Record<string, *>>} requestCache
*
* Sends a request to forcibly focus the application window, even if it’s not currently visible or active.
* @property {() => Promise<void>} forceFocus
*
* Retrieves the current change count for a specific key.
* @property {(where: string) => number} getChangeCount
*
* Retrieves all current change counters.
* @property {() => Record<string, number>} getAllChangeCount
*
* Retrieves the current window bounds including position and size.
* @property {() => Bounds} getBounds
*
* Retrieves the current size of the window.
* @property {() => Size} getSize
*
* Retrieves the current position of the window.
* @property {() => Position} getPosition
*
* Brings the application window to the front and gives it focus.
* @property {() => Promise<void>} focus
*
* Removes focus from the application window, if currently focused.
* @property {() => Promise<void>} blur
*
* Makes the application window visible.
* @property {() => Promise<void>} show
*
* Hides the application window from view (but does not quit the app).
* @property {() => Promise<void>} hide
*
* Closes the application window (but does not quit the app).
* @property {() => Promise<void>} close
*
* Destroy the application window (but does not quit the app).
* @property {() => Promise<void>} destroy
*
* Maximizes the application window to fill the screen.
* @property {() => Promise<void>} maximize
*
* Restores the application window from maximized state to its previous size.
* @property {() => Promise<void>} unmaximize
*
* Minimizes the application window to the taskbar/dock.
* @property {() => Promise<void>} minimize
*
* Requests the application to quit immediately.
* @property {() => void} quit
*
* Retrieves the amount of system idle time in seconds.
* @property {() => Promise<number>} systemIdleTime
*
* Determines the current system idle state.
* @property {(idleThreshold: number) => Promise<"active" | "idle" | "locked" | "unknown">} systemIdleState
*
* Returns the absolute path to the current executable of the running application.
* @property {() => string} getExecPath
*
* Changes the tray icon to the specified image.
* `img` should be a valid image file.
* @property {(img: string, id: string) => Promise<void>} changeTrayIcon
*
* Changes the application window or dock icon (depending on platform).
* `img` should be a valid image file.
* @property {(img: string) => Promise<void>} changeAppIcon
*
* Sets the internal visibility flag.
* @property {(isVisible?: boolean) => Promise<boolean>} setIsVisible
*
* Updates the application's network proxy settings.
* Requires an Electron `ProxyConfig` object with appropriate options.
* @property {(config: Electron.ProxyConfig) => Promise<void>} setProxy
*/
/**
* Manages the state and communication of a single Electron window instance natively.
*
* This class handles window state tracking, including focus, visibility,
* fullscreen, and maximized states. It also manages cached data, window data,
* and the application show status. TinyElectronClient is designed to be used
* in Electron applications that require precise tracking of window status
* and reliable data synchronization between processes.
*
* Typical usage includes listening for window events, managing UI state,
* and handling first-time connections or pings from the window.
*
* Example usage:
* const client = new TinyElectronClient();
* client.isVisible(); // Returns true if the window is visible
*
* @class
*/
declare class TinyElectronClient {
/**
* @param {Object} [settings={}] - Configuration settings for the application.
* @param {AppEvents} [settings.eventNames=this.#AppEvents] - Set of event names for internal messaging.
*
* @throws {Error} If any required string values are missing or invalid.
*/
constructor({ eventNames }?: {
eventNames?: AppEvents | undefined;
});
/**
* Checks if a given value exists in the AppEvents values.
*
* @param {string} value - The value to check for.
* @returns {boolean} True if the value exists, false otherwise.
*/
isValidAppEvent(value: string): boolean;
/**
* Gets the key (event name) associated with a given AppEvents value.
*
* @param {string} value - The value to look up.
* @returns {string} The matching AppEvents key.
* @throws {Error} If the value is not found.
*/
getAppEventKey(value: string): string;
/**
* Provides access to a secure internal EventEmitter for subclass use only.
*
* This method exposes a dedicated EventEmitter instance intended specifically for subclasses
* that extend the main class. It prevents subclasses from accidentally or intentionally using
* the primary class's public event system (`emit`), which could lead to unpredictable behavior
* or interference in the base class's event flow.
*
* For security and consistency, this method is designed to be accessed only once.
* Multiple accesses are blocked to avoid leaks or misuse of the internal event bus.
*
* @returns {EventEmitter} A special internal EventEmitter instance for subclass use.
* @throws {Error} If the method is called more than once.
*/
getSysEvents(): EventEmitter;
/**
* @typedef {(...args: any[]) => void} ListenerCallback
* A generic callback function used for event listeners.
*/
/**
* Sets the maximum number of listeners for the internal event emitter.
*
* @param {number} max - The maximum number of listeners allowed.
*/
setMaxListeners(max: number): void;
/**
* Emits an event with optional arguments.
* @param {string | symbol} event - The name of the event to emit.
* @param {...any} args - Arguments passed to event listeners.
* @returns {boolean} `true` if the event had listeners, `false` otherwise.
*/
emit(event: string | symbol, ...args: any[]): boolean;
/**
* Registers a listener for the specified event.
* @param {string | symbol} event - The name of the event to listen for.
* @param {ListenerCallback} listener - The callback function to invoke.
* @returns {this} The current class instance (for chaining).
*/
on(event: string | symbol, listener: (...args: any[]) => void): this;
/**
* Registers a one-time listener for the specified event.
* @param {string | symbol} event - The name of the event to listen for once.
* @param {ListenerCallback} listener - The callback function to invoke.
* @returns {this} The current class instance (for chaining).
*/
once(event: string | symbol, listener: (...args: any[]) => void): this;
/**
* Removes a listener from the specified event.
* @param {string | symbol} event - The name of the event.
* @param {ListenerCallback} listener - The listener to remove.
* @returns {this} The current class instance (for chaining).
*/
off(event: string | symbol, listener: (...args: any[]) => void): this;
/**
* Alias for `on`.
* @param {string | symbol} event - The name of the event.
* @param {ListenerCallback} listener - The callback to register.
* @returns {this} The current class instance (for chaining).
*/
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
/**
* Alias for `off`.
* @param {string | symbol} event - The name of the event.
* @param {ListenerCallback} listener - The listener to remove.
* @returns {this} The current class instance (for chaining).
*/
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
/**
* Removes all listeners for a specific event, or all events if no event is specified.
* @param {string | symbol} [event] - The name of the event. If omitted, all listeners from all events will be removed.
* @returns {this} The current class instance (for chaining).
*/
removeAllListeners(event?: string | symbol): this;
/**
* Returns the number of times the given `listener` is registered for the specified `event`.
* If no `listener` is passed, returns how many listeners are registered for the `event`.
* @param {string | symbol} eventName - The name of the event.
* @param {Function} [listener] - Optional listener function to count.
* @returns {number} Number of matching listeners.
*/
listenerCount(eventName: string | symbol, listener?: Function): number;
/**
* Adds a listener function to the **beginning** of the listeners array for the specified event.
* The listener is called every time the event is emitted.
* @param {string | symbol} eventName - The event name.
* @param {ListenerCallback} listener - The callback function.
* @returns {this} The current class instance (for chaining).
*/
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
/**
* Adds a **one-time** listener function to the **beginning** of the listeners array.
* The next time the event is triggered, this listener is removed and then invoked.
* @param {string | symbol} eventName - The event name.
* @param {ListenerCallback} listener - The callback function.
* @returns {this} The current class instance (for chaining).
*/
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
/**
* Returns an array of event names for which listeners are currently registered.
* @returns {(string | symbol)[]} Array of event names.
*/
eventNames(): (string | symbol)[];
/**
* Gets the current maximum number of listeners allowed for any single event.
* @returns {number} The max listener count.
*/
getMaxListeners(): number;
/**
* Returns a copy of the listeners array for the specified event.
* @param {string | symbol} eventName - The event name.
* @returns {Function[]} An array of listener functions.
*/
listeners(eventName: string | symbol): Function[];
/**
* Returns a copy of the internal listeners array for the specified event,
* including wrapper functions like those used by `.once()`.
* @param {string | symbol} eventName - The event name.
* @returns {Function[]} An array of raw listener functions.
*/
rawListeners(eventName: string | symbol): Function[];
/** @type {Record<string, any>} */
data: Record<string, any>;
/** @type {Record<string, any>} */
cache: Record<string, any>;
/**
* Retrieves the current change count for a specific key.
*
* @param {string} where - The key representing the context or type of change.
* @returns {number} The current change count. Returns 0 if not initialized.
*/
getChangeCount(where: string): number;
/**
* Retrieves all current change counters.
*
* @returns {Record<string, number>} An object mapping each key to its change count.
*/
getAllChangeCount(): Record<string, number>;
/**
* Retrieves the cached data of the window.
*
* @returns {Record<string,*>} The cached data object.
*/
getCache(): Record<string, any>;
/**
* Retrieves the latest data received from the window.
*
* @returns {Record<string,*>} The current data object.
*/
getData(): Record<string, any>;
/**
* Retrieves the current window bounds including position and size.
*
* @returns {Bounds} An object containing the current x, y, width, and height of the window.
*/
getBounds(): Bounds;
/**
* Retrieves the current position of the window.
*
* @returns {Position} An array with two numbers: [x, y] representing the top-left corner of the window.
*/
getPosition(): Position;
/**
* Retrieves the current size of the window.
*
* @returns {Size} An array with two numbers: [width, height] representing the width and height of the window.
*/
getSize(): Size;
/**
* Gets whether the application is currently shown.
*
* @returns {boolean} True if the application is shown, false if hidden.
*/
getShowStatus(): boolean;
/**
* Checks whether the window is in fullscreen mode.
*
* @returns {boolean} True if the window is in fullscreen, false otherwise.
*/
isFullScreen(): boolean;
/**
* Returns whether the window is currently maximizable.
*
* @returns {boolean} True if the window can be maximized; otherwise, false.
*/
isMaximizable(): boolean;
/**
* Returns whether the window is currently closable.
*
* @returns {boolean} True if the window can be closed; otherwise, false.
*/
isClosable(): boolean;
/**
* Returns whether the window is currently fullscreenable.
*
* @returns {boolean} True if the window can enter fullscreen; otherwise, false.
*/
isFullScreenable(): boolean;
/**
* Returns whether the window is currently focusable.
*
* @returns {boolean} True if the window can be focused; otherwise, false.
*/
isFocusable(): boolean;
/**
* Checks whether the window has received the first ping.
*
* @returns {boolean} True if the window has been pinged, false otherwise.
*/
isPinged(): boolean;
/**
* Checks whether the window is currently focused.
*
* @returns {boolean} True if the window is focused, false otherwise.
*/
isFocused(): boolean;
/**
* Checks whether the window is currently visible.
*
* @returns {boolean} True if the window is visible, false otherwise.
*/
isVisible(): boolean;
/**
* Checks whether the window is currently maximized.
*
* @returns {boolean} True if the window is maximized, false otherwise.
*/
isMaximized(): boolean;
/**
* Requests the current window data from the main process.
* The returned data includes window bounds, state, and other properties.
*
* @returns {Promise<WindowDataResult>} A promise that resolves with the current window data.
*/
getWindowData(): Promise<WindowDataResult>;
/**
* Retrieves the amount of system idle time in seconds.
* This represents how long the system has been idle (i.e., without any user input).
*
* @returns {Promise<number>} A promise that resolves with the number of seconds since last user activity.
*/
systemIdleTime(): Promise<number>;
/**
* Determines the current system idle state.
*
* @param {number} idleThreshold
*
* @returns {Promise<"active" | "idle" | "locked" | "unknown">}
*/
systemIdleState(idleThreshold: number): Promise<"active" | "idle" | "locked" | "unknown">;
/**
* Sends a request to the main process to update and resend the latest cache state.
* @returns {Promise<Record<string, *>>}
*/
requestCache(): Promise<Record<string, any>>;
/**
* Sends a request to forcibly focus the application window, even if it’s not currently visible or active.
* @returns {Promise<void>}
*/
forceFocus(): Promise<void>;
/**
* Brings the application window to the front and gives it focus.
* @returns {Promise<void>}
*/
focus(): Promise<void>;
/**
* Removes focus from the application window, if currently focused.
* @returns {Promise<void>}
*/
blur(): Promise<void>;
/**
* Makes the application window visible.
* @returns {Promise<void>}
*/
show(): Promise<void>;
/**
* Hides the application window from view (but does not quit the app).
* @returns {Promise<void>}
*/
hide(): Promise<void>;
/**
* Closes the application window (but does not quit the app).
* @returns {Promise<void>}
*/
close(): Promise<void>;
/**
* Destroy the application window (but does not quit the app).
* @returns {Promise<void>}
*/
destroy(): Promise<void>;
/**
* Maximizes the application window to fill the screen.
* @returns {Promise<void>}
*/
maximize(): Promise<void>;
/**
* Restores the application window from maximized state to its previous size.
* @returns {Promise<void>}
*/
unmaximize(): Promise<void>;
/**
* Minimizes the application window to the taskbar/dock.
* @returns {Promise<void>}
*/
minimize(): Promise<void>;
/**
* Sets whether the window can be maximized.
* Sends an event to the renderer with the updated state.
*
* @param {boolean} value - If true, the window becomes maximizable; otherwise, it cannot be maximized.
* @returns {Promise<boolean>} - Edit result.
*/
setMaximizable(value: boolean): Promise<boolean>;
/**
* Sets whether the window can be closed.
* Sends an event to the renderer with the updated state.
*
* @param {boolean} value - If true, the window can be closed; otherwise, it cannot be closed.
* @returns {Promise<boolean>} - Edit result.
*/
setClosable(value: boolean): Promise<boolean>;
/**
* Sets whether the window can be focused.
* Sends an event to the renderer with the updated state.
*
* @param {boolean} value - If true, the window can be focused; otherwise, it cannot receive focus.
* @returns {Promise<boolean>} - Edit result.
*/
setFocusable(value: boolean): Promise<boolean>;
/**
* Sets whether the window can enter fullscreen mode.
* Sends an event to the renderer with the updated state.
*
* @param {boolean} value - If true, the window can enter fullscreen mode; otherwise, it cannot receive focus.
* @returns {Promise<boolean>} - Edit result.
*/
setFullScreenable(value: boolean): Promise<boolean>;
/**
* Requests the application to quit immediately.
*
* @returns {void}
*/
quit(): void;
/**
* Returns the absolute path to the current executable of the running application.
*
* @returns {string}
*/
getExecPath(): string;
/**
* Sets the internal visibility flag.
*
* @param {boolean} [isVisible]
* @returns {Promise<boolean>}
*/
setIsVisible(isVisible?: boolean): Promise<boolean>;
/**
* Updates the application's network proxy settings.
* Requires an Electron `ProxyConfig` object with appropriate options.
*
* @param {Electron.ProxyConfig} config
* @returns {Promise<void>}
*/
setProxy(config: Electron.ProxyConfig): Promise<void>;
/**
* Changes the tray icon to the specified image.
* `img` should be a valid image file.
*
* @param {string} img
* @param {string} key
*
* @returns {Promise<void>}
*/
changeTrayIcon(img: string, key: string): Promise<void>;
/**
* Changes the application window or dock icon (depending on platform).
*
* @param {string} img
* @returns {Promise<void>}
*/
changeAppIcon(img: string): Promise<void>;
/**
* Opens the Developer Tools (DevTools) for the window.
*
* This method triggers the main process to open the DevTools panel
* with optional configuration.
*
* @param {Electron.OpenDevToolsOptions} [ops] - Optional settings to customize the behavior of DevTools.
* Example options include `{ mode: 'undocked' }` or `{ mode: 'detach' }`.
*
* @returns {Promise<void>} A promise that resolves when the request is successfully sent.
*/
openDevTools(ops?: Electron.OpenDevToolsOptions): Promise<void>;
/**
* Sets the window title for the BrowserWindow.
*
* This method sends an request to the main process to update the
* window's title dynamically.
*
* @param {string} title - The new title to set. Must be a non-empty string.
* @throws {TypeError} If the title is not a string.
* @returns {Promise<void>} A promise that resolves when the title is set.
*/
setTitle(title: string): Promise<void>;
/**
* @param {string} apiName - The name under which the API will be exposed in the window context.
* @param {string[]} [enabledMethods] - Optional list of method names to include in the API. All methods are enabled by default.
* @returns {Partial<TinyElectronClientApi>}
*/
installWinScript(apiName?: string, enabledMethods?: string[]): Partial<TinyElectronClientApi>;
/**
* Installs a loading page and exposes methods to control it via the main world context.
*
* @param {string} [exposeInMainWorld='electronLoading'] - The name of the property exposed in the window object via Electron’s `contextBridge`.
* @param {GetLoadingHtml} [config] - Optional configuration for the loading screen, including custom HTML and CSS.
* @returns {InstallLoadingPageResult} Object containing `append` and `remove` methods.
*
* @throws {TypeError} If `exposeInMainWorld` is provided but is not a string.
*/
installLoadingPage(exposeInMainWorld?: string, config?: import("./LoadingHtml.mjs").GetLoadingHtml): InstallLoadingPageResult;
#private;
}
import { EventEmitter } from 'events';
import { AppEvents } from '../global/Events.mjs';
//# sourceMappingURL=TinyElectronClient.d.mts.map