UNPKG

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.

79 lines 2.7 kB
export default TinyWindowFile; /** * An object representing the size and position of a window. */ export type Bounds = { width: number; height: number; x?: number; y?: number; }; /** * Configuration used to initialize a window, including size and state. */ export type InitConfig = { bounds?: Bounds; maximized?: boolean; }; /** * @typedef {{ width: number; height: number; x?: number; y?: number; }} Bounds * An object representing the size and position of a window. */ /** * @typedef {{ bounds?: Bounds; maximized?: boolean }} InitConfig * Configuration used to initialize a window, including size and state. */ /** * Provides file operations scoped to a window instance. * * This class handles reading, writing, and managing files related * to the context of a specific Electron window. Useful for storing * window-specific configuration, cache, or temporary data. * * Ensures that file operations are organized per window instance * and isolated from global application files. * * @class */ declare class TinyWindowFile { /** * Loads window configuration from a file and stores it internally. * * @param {string} initFile - The path to the JSON file containing window data. * @param {Object} [settings={}] - Optional fallback settings. * @param {Bounds} [settings.bounds={ width: 1200, height: 700 }] - Default bounds. * @throws {TypeError} If `initFile` is not a string. * @throws {TypeError} If `settings.bounds` is invalid. */ loadFile(initFile: string, { bounds }?: { bounds?: Bounds | undefined; }): void; /** * Returns a complete configuration for a previously loaded window. * * @param {string} id - The ID or path used to load the window configuration. * @returns {InitConfig} * @throws {TypeError} If `id` is not a string. * @throws {Error} If `id` has not been registered. */ getData(id: string): InitConfig; /** * Checks if a configuration has been loaded for the given ID. * * @param {string} id - The ID or path to check. * @returns {boolean} True if a config exists, false otherwise. * @throws {TypeError} If `id` is not a string. */ hasId(id: string): boolean; /** * Returns the bounds for a previously loaded window. * * @param {string} id - The ID or path used to load the window configuration. * @returns {Bounds} A new copy of the bounds object. * @throws {TypeError} If `id` is not a string. * @throws {Error} If bounds are not found for the given ID. */ getBounds(id: string): Bounds; #private; } //# sourceMappingURL=TinyWindowFile.d.mts.map