UNPKG

@mirawision/chrome-api

Version:

A comprehensive TypeScript library for Chrome Extension API, providing type-safe wrappers and utilities for bookmarks, commands, context menus, cookies, downloads, storage, notifications, runtime, scripting, and side panel functionalities.

46 lines (45 loc) 2.07 kB
/// <reference types="chrome" /> interface CreateData { url?: string | string[]; tabId?: number; left?: number; top?: number; width?: number; height?: number; focused?: boolean; incognito?: boolean; type?: 'normal' | 'popup' | 'panel'; state?: 'normal' | 'minimized' | 'maximized' | 'fullscreen' | 'locked-fullscreen'; } interface UpdateInfo { left?: number; top?: number; width?: number; height?: number; focused?: boolean; drawAttention?: boolean; state?: 'normal' | 'minimized' | 'maximized' | 'fullscreen' | 'locked-fullscreen'; } interface QueryOptions { windowTypes?: ('normal' | 'popup' | 'panel' | 'app' | 'devtools')[]; populate?: boolean; windowId?: number; } declare class Windows { static get(windowId: number, getInfo?: QueryOptions): Promise<chrome.windows.Window>; static getCurrent(getInfo?: QueryOptions): Promise<chrome.windows.Window>; static getLastFocused(getInfo?: QueryOptions): Promise<chrome.windows.Window>; static getAll(getInfo?: QueryOptions): Promise<chrome.windows.Window[]>; static create(createData?: CreateData): Promise<chrome.windows.Window>; static update(windowId: number, updateInfo: UpdateInfo): Promise<chrome.windows.Window>; static remove(windowId: number): Promise<void>; static addCreatedListener(callback: (window: chrome.windows.Window) => void): void; static addRemovedListener(callback: (windowId: number) => void): void; static addFocusChangedListener(callback: (windowId: number) => void): void; static addBoundsChangedListener(callback: (window: chrome.windows.Window) => void): void; static removeCreatedListener(callback: (window: chrome.windows.Window) => void): void; static removeRemovedListener(callback: (windowId: number) => void): void; static removeFocusChangedListener(callback: (windowId: number) => void): void; static removeBoundsChangedListener(callback: (window: chrome.windows.Window) => void): void; } export { Windows, CreateData, UpdateInfo, QueryOptions };