@lynker-desktop/electron-window-manager
Version:
electron-window-manager
86 lines • 2.75 kB
TypeScript
import type { BrowserView, BrowserWindow, BrowserWindowConstructorOptions, BrowserViewConstructorOptions } from 'electron';
export interface BrowserWindowType extends Omit<BrowserWindowConstructorOptions, 'parent'> {
parent?: number | BrowserWindowConstructorOptions['parent'];
}
export interface BrowserViewType extends Omit<BrowserViewConstructorOptions, 'parent'> {
parent?: number | BrowserWindowConstructorOptions['parent'];
}
declare global {
interface Window {
__ELECTRON_WINDOW_MANAGER__?: any;
}
}
export type ElectronWindowsManagerOptions = ({
type?: 'BW';
browserWindow?: BrowserWindowType;
} & Omit<ElectronWindowsManagerOptionsBase, 'type' | 'browserWindow'>) | ({
type: 'BV';
browserWindow?: BrowserViewType;
} & Omit<ElectronWindowsManagerOptionsBase, 'type' | 'browserWindow'>);
interface ElectronWindowsManagerOptionsBase {
name: string;
url: string;
type?: 'BW' | 'BV';
extraData?: string;
usePreload?: boolean;
loadingView?: {
url: string;
};
errorView?: {
url: string;
};
browserWindow?: BrowserWindowType | BrowserViewType;
openDevTools?: boolean;
preventOriginClose?: boolean;
preventOriginNavigate?: boolean;
/** BrowserView zIndex层级,数值越小越靠前 */
zIndex?: number;
}
export interface BWItem extends BrowserWindow {
_id: number;
/** BW/BV */
_type: 'BW' | 'BV';
/** BW别名 */
_name: string;
/** 额外数据 */
_extraData?: string;
/** 初始化url */
_initUrl?: string;
/** zIndex层级,数值越小越靠前 */
_zIndex?: number;
}
export interface BVItem extends BrowserView {
id: number;
_id: number;
/** BW/BV */
_type: 'BW' | 'BV';
/** BW别名 */
_name: string;
/** 额外数据 */
_extraData?: string;
/** 初始化url */
_initUrl?: string;
/** zIndex层级,数值越小越靠前 */
_zIndex?: number;
}
/**
* 预加载配置接口
*/
export interface PreloadWebContentsConfig {
nodeIntegration?: boolean;
contextIsolation?: boolean;
/** 预加载的 URL */
url: string;
/** 是否预加载普通窗口 */
enableBW?: boolean;
/** 是否预加载无边框有按钮的窗口 */
enableBW_FramelessWithButtons?: boolean;
/** 是否预加载无边框无按钮的窗口 */
enableBW_FramelessNoButtons?: boolean;
/** 是否预加载浏览器视图 */
enableBV?: boolean;
/** 自定loadURL */
customLoadURL?: (url: string, originLoadURL: BrowserWindow['loadURL'] | BrowserView['webContents']['loadURL'], webContents: BrowserWindow['webContents'] | BrowserView['webContents']) => Promise<string>;
}
export {};
//# sourceMappingURL=index.d.ts.map