import TinyPromiseQueue from '../../../utils/TinyPromiseQueue.mjs'; import TinyServiceWorkerEngine from '../TinyServiceWorkerEngine.mjs'; /** @type {ServiceWorkerGlobalScope} */ export declare const sw: ServiceWorkerGlobalScope; export type DebuggerConstructor = import('../../../tools/TinyDebugger.mjs').DebuggerConstructor; export type TabInfo = { /** * - The unique Client ID provided by the browser. */ id: string; /** * - The current URL of the tab. */ url: string; /** * - The document title of the tab. */ title: string; /** * - Whether the tab currently has window focus. */ isFocused: boolean; /** * - Custom data provided by the client. */ data?: any; }; export type TabInstance = Map; /** @typedef {import('../../../tools/TinyDebugger.mjs').DebuggerConstructor} DebuggerConstructor - The constructor function for a debugger instance. */ /** * Represents information about a single browser tab. * @typedef {Object} TabInfo * @property {string} id - The unique Client ID provided by the browser. * @property {string} url - The current URL of the tab. * @property {string} title - The document title of the tab. * @property {boolean} isFocused - Whether the tab currently has window focus. * @property {any} [data] - Custom data provided by the client. */ /** * A mapping of unique tab IDs to their corresponding TabInfo objects. * @typedef {Map} TabInstance */ /** * A layer within the TinyPlugin system specifically designed to manage and track tab instances. */ declare class TinySwTabsLayer extends TinyServiceWorkerEngine.TinyPluginLayer { #private; /** * Gets the internal promise queue instance. * @returns {TinyPromiseQueue} - The instance of the promise queue. */ get queue(): TinyPromiseQueue; /** * Synchronizes the current in-memory Map with the IndexedDB storage. * @returns {Promise} */ persist(): Promise; /** * Retrieves a snapshot of all tabs currently managed by the instance corresponding to the provided key. * @param {number} key - The unique key of the instance to retrieve tabs from. * @returns {Record|null} - An object mapping tab IDs to their information, or null if the instance is not found. */ static getTabsInstance(key: number): Record | null; /** * Retrieves the information for a specific tab by its unique ID. * @param {string} id - The unique identifier of the tab. * @returns {TabInfo|null} - The tab information if found, or null if the tab does not exist. * @throws {TypeError} If the provided id is not a string. * @throws {ReferenceError} If the internal layer instance cannot be found in the registry. */ getTab(id: string): TabInfo | null; /** * Initializes the layer, loads persisted data, and begins monitoring tab changes. * @template {Parameters[0]} Plugin - The TinyPlugin template. * @param {Plugin} plugin - The TinyPlugin instance. * @param {(tabs: TabInstance) => void} callback - The callback function to be executed with the current tabs upon initialization. */ _start[0]>(plugin: Plugin, callback: (tabs: TabInstance) => void): this; /** * Initializes a new instance of the TinySwTabsLayer, assigning it a unique key and registering it in the static instances registry. * @param {Partial} [lgConfig] - Configuration options for the instance. */ constructor(lgConfig?: Partial); } /** * A plugin for TinyServiceWorkerEngine that manages a centralized registry of all open website tabs. * @type {import('../TinyServiceWorkerEngine.mjs').SwPluginInstaller]|[]>} - The plugin installer for the Tab Manager. */ declare const TinyTabManagerPlugin: import('../TinyServiceWorkerEngine.mjs').SwPluginInstaller] | []>; export default TinyTabManagerPlugin; //# sourceMappingURL=TabManager.d.mts.map