This repository has been archived by the owner on Aug 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
79 lines (72 loc) · 2.11 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
export interface BrowserWindowOptions {
width?: Number;
height?: Number;
title?: String;
url?: String;
center?: Boolean;
rightClickDevtools?: Boolean;
}
export declare type MenuTemplate = SubMenuTemplate[];
export type MenuItemType = "separator" | "checkbox" | "radio";
export interface MenuItem {
state: Boolean;
}
export interface SubMenuTemplate {
visible?: Boolean;
type?: MenuItemType;
label?: String;
checked?: Boolean; // TODO: Only if type is checkbox or radio
click?: (menuItem: MenuItem) => void
accelerator?: String; // TODO: Better checking
submenu?: MenuTemplate
enabled?: Boolean;
}
export declare type MenuReference = any;
declare global {
class BrowserWindow {
width: Number;
height: Number;
x: Number;
y: Number;
title: String;
url: String;
constructor(options: BrowserWindowOptions);
emit(event: String, info: any): void;
on(event: String, handler: (info?: any) => void): void;
close(): void;
// destroy(): void;
// focus(): void;
// blur(): void;
show(): void;
hide(): void;
maximize(): void;
minimize(): void;
// setBounds(): void;
setSize(width: Number, height: Number): void;
// setResizable(enabled: Boolean): void;
// setMovable(enabled: Boolean): void;
setAlwaysOnTop(enabled: Boolean): void;
moveTop(): void;
center(): void;
setPosition(x: Number, y: Number): void;
setTitle(title: String): void;
loadURL(url: String): void;
loadFile(path: String): void;
reload(): void;
}
const app: {
on(event: String, handler: (info?: any) => void): void;
emit(event: String, info: any): void;
quit(): void
}
const Menu: {
buildFromTemplate(template: MenuTemplate): MenuReference
setApplicationMenu(menu: MenuReference): void
}
const config: {
set(key: String, value: any): void;
emit(key: String): any;
delete(key: String): void;
clear(): void;
}
}