-
Notifications
You must be signed in to change notification settings - Fork 44
/
index.d.ts
63 lines (57 loc) · 1.95 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import type { BrowserWindow, BrowserWindowConstructorOptions, WebPreferences, Rectangle } from 'electron';
import type { EventEmitter } from 'events';
type TabID = number;
interface Tab {
url: string;
href: string;
title: string;
favicon: string;
isLoading: boolean;
canGoBack: boolean;
canGoForward: boolean;
}
interface Tabs {
[key: number]: Tab;
}
interface BrowserLikeWindowOptions {
width?: number;
height?: number;
controlPanel: string;
controlHeight?: number;
viewReferences?: WebPreferences;
controlReferences?: WebPreferences;
winOptions?: BrowserWindowConstructorOptions;
startPage?: string;
blankPage?: string;
blankTitle?: string;
onNewWindow?: (e: any, newUrl: string, frameName: string, disposition: string, winOptions: BrowserWindowConstructorOptions) => void;
debug?: boolean;
}
export default class BrowserLikeWindow extends EventEmitter {
win: BrowserWindow;
constructor(options: BrowserLikeWindowOptions);
getControlBounds(): Rectangle;
setContentBounds(): void;
readonly currentView: {
id: TabID;
webContents: {
id: number;
canGoBack(): boolean;
canGoForward(): boolean;
loadURL(url: string): void;
getURL(): string;
getTitle(): string;
[key: string]: any; // To allow for additional methods/properties not specified
};
[key: string]: any; // To allow for additional methods/properties not specified
};
readonly currentWebContents: BrowserLikeWindow['currentView']['webContents'];
currentViewId: TabID;
tabConfigs: Tabs;
setTabConfig(viewId: TabID, kv: Partial<Tab>): Tabs;
loadURL(url: string): void;
setCurrentView(viewId: TabID): void;
newTab(url?: string, appendTo?: TabID, references?: WebPreferences): BrowserLikeWindow['currentView'];
switchTab(viewId: TabID): void;
destroyView(viewId: TabID): void;
}