electron.d.ts 335.1 KB
Newer Older
D
deepak1556 已提交
1
// Type definitions for Electron 4.2.7
2
// Project: http://electronjs.org/
3 4
// Definitions by: The Electron Team <https://github.com/electron/electron>
// Definitions: https://github.com/electron/electron-typescript-definitions
B
Benjamin Pasero 已提交
5

6
/// <reference types="node" />
B
Benjamin Pasero 已提交
7

8 9
type GlobalEvent = Event;

B
Benjamin Pasero 已提交
10
declare namespace Electron {
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
	class EventEmitter {
		addListener(event: string, listener: Function): this;
		on(event: string, listener: Function): this;
		once(event: string, listener: Function): this;
		removeListener(event: string, listener: Function): this;
		removeAllListeners(event?: string): this;
		setMaxListeners(n: number): this;
		getMaxListeners(): number;
		listeners(event: string): Function[];
		emit(event: string, ...args: any[]): boolean;
		listenerCount(type: string): number;
		prependListener(event: string, listener: Function): this;
		prependOnceListener(event: string, listener: Function): this;
		eventNames(): string[];
	}

	class Accelerator extends String {
B
Benjamin Pasero 已提交
28 29 30

	}

B
Benjamin Pasero 已提交
31 32 33 34 35 36 37 38 39
	interface Event extends GlobalEvent {
		preventDefault: () => void;
		sender: WebContents;
		returnValue: any;
		ctrlKey?: boolean;
		metaKey?: boolean;
		shiftKey?: boolean;
		altKey?: boolean;
	}
B
Benjamin Pasero 已提交
40

41
	interface CommonInterface {
B
Benjamin Pasero 已提交
42 43 44 45 46
		clipboard: Clipboard;
		crashReporter: CrashReporter;
		nativeImage: typeof NativeImage;
		screen: Screen;
		shell: Shell;
B
Benjamin Pasero 已提交
47 48
	}

49
	interface MainInterface extends CommonInterface {
B
Benjamin Pasero 已提交
50 51 52 53 54 55 56 57 58 59 60
		app: App;
		autoUpdater: AutoUpdater;
		BrowserView: typeof BrowserView;
		BrowserWindow: typeof BrowserWindow;
		ClientRequest: typeof ClientRequest;
		contentTracing: ContentTracing;
		Cookies: typeof Cookies;
		Debugger: typeof Debugger;
		dialog: Dialog;
		DownloadItem: typeof DownloadItem;
		globalShortcut: GlobalShortcut;
61
		inAppPurchase: InAppPurchase;
B
Benjamin Pasero 已提交
62 63 64 65 66
		IncomingMessage: typeof IncomingMessage;
		ipcMain: IpcMain;
		Menu: typeof Menu;
		MenuItem: typeof MenuItem;
		net: Net;
67
		netLog: NetLog;
B
Benjamin Pasero 已提交
68 69 70 71 72 73 74 75 76 77
		Notification: typeof Notification;
		powerMonitor: PowerMonitor;
		powerSaveBlocker: PowerSaveBlocker;
		protocol: Protocol;
		session: typeof Session;
		systemPreferences: SystemPreferences;
		TouchBar: typeof TouchBar;
		Tray: typeof Tray;
		webContents: typeof WebContents;
		WebRequest: typeof WebRequest;
B
Benjamin Pasero 已提交
78 79
	}

80
	interface RendererInterface extends CommonInterface {
B
Benjamin Pasero 已提交
81 82 83 84 85 86 87 88
		BrowserWindowProxy: typeof BrowserWindowProxy;
		desktopCapturer: DesktopCapturer;
		ipcRenderer: IpcRenderer;
		remote: Remote;
		webFrame: WebFrame;
		webviewTag: WebviewTag;
	}

89
	interface AllElectron extends MainInterface, RendererInterface { }
B
Benjamin Pasero 已提交
90 91 92 93 94 95 96 97 98

	const app: App;
	const autoUpdater: AutoUpdater;
	const clipboard: Clipboard;
	const contentTracing: ContentTracing;
	const crashReporter: CrashReporter;
	const desktopCapturer: DesktopCapturer;
	const dialog: Dialog;
	const globalShortcut: GlobalShortcut;
99
	const inAppPurchase: InAppPurchase;
B
Benjamin Pasero 已提交
100 101 102 103 104
	const ipcMain: IpcMain;
	const ipcRenderer: IpcRenderer;
	type nativeImage = NativeImage;
	const nativeImage: typeof NativeImage;
	const net: Net;
105
	const netLog: NetLog;
B
Benjamin Pasero 已提交
106 107 108
	const powerMonitor: PowerMonitor;
	const powerSaveBlocker: PowerSaveBlocker;
	const protocol: Protocol;
109
	// const remote: Remote; ### VSCODE CHANGE (we do not want to use remote)
B
Benjamin Pasero 已提交
110 111 112 113 114 115 116 117 118
	const screen: Screen;
	type session = Session;
	const session: typeof Session;
	const shell: Shell;
	const systemPreferences: SystemPreferences;
	type webContents = WebContents;
	const webContents: typeof WebContents;
	const webFrame: WebFrame;
	const webviewTag: WebviewTag;
119

120 121
	interface App extends EventEmitter {

122
		// Docs: http://electronjs.org/docs/api/app
B
Benjamin Pasero 已提交
123

B
Benjamin Pasero 已提交
124
		/**
125 126 127 128
		 * Emitted when Chrome's accessibility support changes. This event fires when
		 * assistive technologies, such as screen readers, are enabled or disabled. See
		 * https://www.chromium.org/developers/design-documents/accessibility for more
		 * details.
B
Benjamin Pasero 已提交
129
		 */
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
		on(event: 'accessibility-support-changed', listener: (event: Event,
			/**
			 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
			 */
			accessibilitySupportEnabled: boolean) => void): this;
		once(event: 'accessibility-support-changed', listener: (event: Event,
			/**
			 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
			 */
			accessibilitySupportEnabled: boolean) => void): this;
		addListener(event: 'accessibility-support-changed', listener: (event: Event,
			/**
			 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
			 */
			accessibilitySupportEnabled: boolean) => void): this;
		removeListener(event: 'accessibility-support-changed', listener: (event: Event,
			/**
			 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
			 */
			accessibilitySupportEnabled: boolean) => void): this;
		/**
		 * Emitted when the application is activated. Various actions can trigger this
		 * event, such as launching the application for the first time, attempting to
		 * re-launch the application when it's already running, or clicking on the
		 * application's dock or taskbar icon.
		 */
		on(event: 'activate', listener: (event: Event,
			hasVisibleWindows: boolean) => void): this;
		once(event: 'activate', listener: (event: Event,
			hasVisibleWindows: boolean) => void): this;
		addListener(event: 'activate', listener: (event: Event,
			hasVisibleWindows: boolean) => void): this;
		removeListener(event: 'activate', listener: (event: Event,
			hasVisibleWindows: boolean) => void): this;
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
		/**
		 * Emitted during Handoff after an activity from this device was successfully
		 * resumed on another one.
		 */
		on(event: 'activity-was-continued', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity.
			 */
			userInfo: any) => void): this;
		once(event: 'activity-was-continued', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity.
			 */
			userInfo: any) => void): this;
		addListener(event: 'activity-was-continued', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity.
			 */
			userInfo: any) => void): this;
		removeListener(event: 'activity-was-continued', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity.
			 */
			userInfo: any) => void): this;
204 205 206 207 208
		/**
		 * Emitted before the application starts closing its windows. Calling
		 * event.preventDefault() will prevent the default behaviour, which is terminating
		 * the application. Note: If application quit was initiated by
		 * autoUpdater.quitAndInstall() then before-quit is emitted after emitting close
209 210 211
		 * event on all windows and closing them. Note: On Windows, this event will not be
		 * emitted if the app is closed due to a shutdown/restart of the system or a user
		 * logout.
B
Benjamin Pasero 已提交
212
		 */
B
Benjamin Pasero 已提交
213
		on(event: 'before-quit', listener: (event: Event) => void): this;
214 215 216
		once(event: 'before-quit', listener: (event: Event) => void): this;
		addListener(event: 'before-quit', listener: (event: Event) => void): this;
		removeListener(event: 'before-quit', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
217
		/**
B
Benjamin Pasero 已提交
218
		 * Emitted when a browserWindow gets blurred.
B
Benjamin Pasero 已提交
219
		 */
220 221 222 223 224 225 226 227
		on(event: 'browser-window-blur', listener: (event: Event,
			window: BrowserWindow) => void): this;
		once(event: 'browser-window-blur', listener: (event: Event,
			window: BrowserWindow) => void): this;
		addListener(event: 'browser-window-blur', listener: (event: Event,
			window: BrowserWindow) => void): this;
		removeListener(event: 'browser-window-blur', listener: (event: Event,
			window: BrowserWindow) => void): this;
B
Benjamin Pasero 已提交
228
		/**
B
Benjamin Pasero 已提交
229
		 * Emitted when a new browserWindow is created.
B
Benjamin Pasero 已提交
230
		 */
231 232 233 234 235 236 237 238
		on(event: 'browser-window-created', listener: (event: Event,
			window: BrowserWindow) => void): this;
		once(event: 'browser-window-created', listener: (event: Event,
			window: BrowserWindow) => void): this;
		addListener(event: 'browser-window-created', listener: (event: Event,
			window: BrowserWindow) => void): this;
		removeListener(event: 'browser-window-created', listener: (event: Event,
			window: BrowserWindow) => void): this;
B
Benjamin Pasero 已提交
239
		/**
240
		 * Emitted when a browserWindow gets focused.
B
Benjamin Pasero 已提交
241
		 */
242 243 244 245 246 247 248 249
		on(event: 'browser-window-focus', listener: (event: Event,
			window: BrowserWindow) => void): this;
		once(event: 'browser-window-focus', listener: (event: Event,
			window: BrowserWindow) => void): this;
		addListener(event: 'browser-window-focus', listener: (event: Event,
			window: BrowserWindow) => void): this;
		removeListener(event: 'browser-window-focus', listener: (event: Event,
			window: BrowserWindow) => void): this;
B
Benjamin Pasero 已提交
250
		/**
B
Benjamin Pasero 已提交
251
		 * Emitted when failed to verify the certificate for url, to trust the certificate
252 253
		 * you should prevent the default behavior with event.preventDefault() and call
		 * callback(true).
B
Benjamin Pasero 已提交
254
		 */
B
Benjamin Pasero 已提交
255 256 257
		on(event: 'certificate-error', listener: (event: Event,
			webContents: WebContents,
			url: string,
258 259 260
			/**
			 * The error code
			 */
B
Benjamin Pasero 已提交
261 262
			error: string,
			certificate: Certificate,
263 264
			callback: (isTrusted: boolean) => void) => void): this;
		once(event: 'certificate-error', listener: (event: Event,
B
Benjamin Pasero 已提交
265 266
			webContents: WebContents,
			url: string,
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
			/**
			 * The error code
			 */
			error: string,
			certificate: Certificate,
			callback: (isTrusted: boolean) => void) => void): this;
		addListener(event: 'certificate-error', listener: (event: Event,
			webContents: WebContents,
			url: string,
			/**
			 * The error code
			 */
			error: string,
			certificate: Certificate,
			callback: (isTrusted: boolean) => void) => void): this;
		removeListener(event: 'certificate-error', listener: (event: Event,
			webContents: WebContents,
			url: string,
			/**
			 * The error code
			 */
			error: string,
			certificate: Certificate,
			callback: (isTrusted: boolean) => void) => void): this;
B
Benjamin Pasero 已提交
291
		/**
292 293 294 295 296 297
		 * Emitted during Handoff when an activity from a different device wants to be
		 * resumed. You should call event.preventDefault() if you want to handle this
		 * event. A user activity can be continued only in an app that has the same
		 * developer Team ID as the activity's source app and that supports the activity's
		 * type. Supported activity types are specified in the app's Info.plist under the
		 * NSUserActivityTypes key.
B
Benjamin Pasero 已提交
298
		 */
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
		on(event: 'continue-activity', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity on another device.
			 */
			userInfo: any) => void): this;
		once(event: 'continue-activity', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity on another device.
			 */
			userInfo: any) => void): this;
		addListener(event: 'continue-activity', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity on another device.
			 */
			userInfo: any) => void): this;
		removeListener(event: 'continue-activity', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity on another device.
			 */
			userInfo: any) => void): this;
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
		/**
		 * Emitted during Handoff when an activity from a different device fails to be
		 * resumed.
		 */
		on(event: 'continue-activity-error', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * A string with the error's localized description.
			 */
			error: string) => void): this;
		once(event: 'continue-activity-error', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * A string with the error's localized description.
			 */
			error: string) => void): this;
		addListener(event: 'continue-activity-error', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * A string with the error's localized description.
			 */
			error: string) => void): this;
		removeListener(event: 'continue-activity-error', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * A string with the error's localized description.
			 */
			error: string) => void): this;
B
Benjamin Pasero 已提交
375
		/**
376
		 * Emitted when the gpu process crashes or is killed.
B
Benjamin Pasero 已提交
377
		 */
378 379 380 381 382 383 384 385
		on(event: 'gpu-process-crashed', listener: (event: Event,
			killed: boolean) => void): this;
		once(event: 'gpu-process-crashed', listener: (event: Event,
			killed: boolean) => void): this;
		addListener(event: 'gpu-process-crashed', listener: (event: Event,
			killed: boolean) => void): this;
		removeListener(event: 'gpu-process-crashed', listener: (event: Event,
			killed: boolean) => void): this;
B
Benjamin Pasero 已提交
386
		/**
387 388 389 390
		 * Emitted when webContents wants to do basic auth. The default behavior is to
		 * cancel all authentications, to override this you should prevent the default
		 * behavior with event.preventDefault() and call callback(username, password) with
		 * the credentials.
B
Benjamin Pasero 已提交
391
		 */
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
		on(event: 'login', listener: (event: Event,
			webContents: WebContents,
			request: Request,
			authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
		once(event: 'login', listener: (event: Event,
			webContents: WebContents,
			request: Request,
			authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
		addListener(event: 'login', listener: (event: Event,
			webContents: WebContents,
			request: Request,
			authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
		removeListener(event: 'login', listener: (event: Event,
			webContents: WebContents,
			request: Request,
			authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
B
Benjamin Pasero 已提交
412
		/**
B
Benjamin Pasero 已提交
413 414 415
		 * Emitted when the user clicks the native macOS new tab button. The new tab button
		 * is only visible if the current BrowserWindow has a tabbingIdentifier
		 */
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
		on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
		once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
		addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
		removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
		/**
		 * Emitted when the user wants to open a file with the application. The open-file
		 * event is usually emitted when the application is already open and the OS wants
		 * to reuse the application to open the file. open-file is also emitted when a file
		 * is dropped onto the dock and the application is not yet running. Make sure to
		 * listen for the open-file event very early in your application startup to handle
		 * this case (even before the ready event is emitted). You should call
		 * event.preventDefault() if you want to handle this event. On Windows, you have to
		 * parse process.argv (in the main process) to get the filepath.
		 */
		on(event: 'open-file', listener: (event: Event,
			path: string) => void): this;
		once(event: 'open-file', listener: (event: Event,
			path: string) => void): this;
		addListener(event: 'open-file', listener: (event: Event,
			path: string) => void): this;
		removeListener(event: 'open-file', listener: (event: Event,
			path: string) => void): this;
		/**
		 * Emitted when the user wants to open a URL with the application. Your
		 * application's Info.plist file must define the url scheme within the
		 * CFBundleURLTypes key, and set NSPrincipalClass to AtomApplication. You should
		 * call event.preventDefault() if you want to handle this event.
		 */
		on(event: 'open-url', listener: (event: Event,
			url: string) => void): this;
		once(event: 'open-url', listener: (event: Event,
			url: string) => void): this;
		addListener(event: 'open-url', listener: (event: Event,
			url: string) => void): this;
		removeListener(event: 'open-url', listener: (event: Event,
			url: string) => void): this;
B
Benjamin Pasero 已提交
452
		/**
453 454 455
		 * Emitted when the application is quitting. Note: On Windows, this event will not
		 * be emitted if the app is closed due to a shutdown/restart of the system or a
		 * user logout.
B
Benjamin Pasero 已提交
456
		 */
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474
		on(event: 'quit', listener: (event: Event,
			exitCode: number) => void): this;
		once(event: 'quit', listener: (event: Event,
			exitCode: number) => void): this;
		addListener(event: 'quit', listener: (event: Event,
			exitCode: number) => void): this;
		removeListener(event: 'quit', listener: (event: Event,
			exitCode: number) => void): this;
		/**
		 * Emitted when Electron has finished initializing. On macOS, launchInfo holds the
		 * userInfo of the NSUserNotification that was used to open the application, if it
		 * was launched from Notification Center. You can call app.isReady() to check if
		 * this event has already fired.
		 */
		on(event: 'ready', listener: (launchInfo: any) => void): this;
		once(event: 'ready', listener: (launchInfo: any) => void): this;
		addListener(event: 'ready', listener: (launchInfo: any) => void): this;
		removeListener(event: 'ready', listener: (launchInfo: any) => void): this;
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568
		/**
		 * Emitted when remote.getBuiltin() is called in the renderer process of
		 * webContents. Calling event.preventDefault() will prevent the module from being
		 * returned. Custom value can be returned by setting event.returnValue.
		 */
		on(event: 'remote-get-builtin', listener: (event: Event,
			webContents: WebContents,
			moduleName: string) => void): this;
		once(event: 'remote-get-builtin', listener: (event: Event,
			webContents: WebContents,
			moduleName: string) => void): this;
		addListener(event: 'remote-get-builtin', listener: (event: Event,
			webContents: WebContents,
			moduleName: string) => void): this;
		removeListener(event: 'remote-get-builtin', listener: (event: Event,
			webContents: WebContents,
			moduleName: string) => void): this;
		/**
		 * Emitted when remote.getCurrentWebContents() is called in the renderer process of
		 * webContents. Calling event.preventDefault() will prevent the object from being
		 * returned. Custom value can be returned by setting event.returnValue.
		 */
		on(event: 'remote-get-current-web-contents', listener: (event: Event,
			webContents: WebContents) => void): this;
		once(event: 'remote-get-current-web-contents', listener: (event: Event,
			webContents: WebContents) => void): this;
		addListener(event: 'remote-get-current-web-contents', listener: (event: Event,
			webContents: WebContents) => void): this;
		removeListener(event: 'remote-get-current-web-contents', listener: (event: Event,
			webContents: WebContents) => void): this;
		/**
		 * Emitted when remote.getCurrentWindow() is called in the renderer process of
		 * webContents. Calling event.preventDefault() will prevent the object from being
		 * returned. Custom value can be returned by setting event.returnValue.
		 */
		on(event: 'remote-get-current-window', listener: (event: Event,
			webContents: WebContents) => void): this;
		once(event: 'remote-get-current-window', listener: (event: Event,
			webContents: WebContents) => void): this;
		addListener(event: 'remote-get-current-window', listener: (event: Event,
			webContents: WebContents) => void): this;
		removeListener(event: 'remote-get-current-window', listener: (event: Event,
			webContents: WebContents) => void): this;
		/**
		 * Emitted when remote.getGlobal() is called in the renderer process of
		 * webContents. Calling event.preventDefault() will prevent the global from being
		 * returned. Custom value can be returned by setting event.returnValue.
		 */
		on(event: 'remote-get-global', listener: (event: Event,
			webContents: WebContents,
			globalName: string) => void): this;
		once(event: 'remote-get-global', listener: (event: Event,
			webContents: WebContents,
			globalName: string) => void): this;
		addListener(event: 'remote-get-global', listener: (event: Event,
			webContents: WebContents,
			globalName: string) => void): this;
		removeListener(event: 'remote-get-global', listener: (event: Event,
			webContents: WebContents,
			globalName: string) => void): this;
		/**
		 * Emitted when <webview>.getWebContents() is called in the renderer process of
		 * webContents. Calling event.preventDefault() will prevent the object from being
		 * returned. Custom value can be returned by setting event.returnValue.
		 */
		on(event: 'remote-get-guest-web-contents', listener: (event: Event,
			webContents: WebContents,
			guestWebContents: WebContents) => void): this;
		once(event: 'remote-get-guest-web-contents', listener: (event: Event,
			webContents: WebContents,
			guestWebContents: WebContents) => void): this;
		addListener(event: 'remote-get-guest-web-contents', listener: (event: Event,
			webContents: WebContents,
			guestWebContents: WebContents) => void): this;
		removeListener(event: 'remote-get-guest-web-contents', listener: (event: Event,
			webContents: WebContents,
			guestWebContents: WebContents) => void): this;
		/**
		 * Emitted when remote.require() is called in the renderer process of webContents.
		 * Calling event.preventDefault() will prevent the module from being returned.
		 * Custom value can be returned by setting event.returnValue.
		 */
		on(event: 'remote-require', listener: (event: Event,
			webContents: WebContents,
			moduleName: string) => void): this;
		once(event: 'remote-require', listener: (event: Event,
			webContents: WebContents,
			moduleName: string) => void): this;
		addListener(event: 'remote-require', listener: (event: Event,
			webContents: WebContents,
			moduleName: string) => void): this;
		removeListener(event: 'remote-require', listener: (event: Event,
			webContents: WebContents,
			moduleName: string) => void): this;
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612
		/**
		 * This event will be emitted inside the primary instance of your application when
		 * a second instance has been executed. argv is an Array of the second instance's
		 * command line arguments, and workingDirectory is its current working directory.
		 * Usually applications respond to this by making their primary window focused and
		 * non-minimized. This event is guaranteed to be emitted after the ready event of
		 * app gets emitted.
		 */
		on(event: 'second-instance', listener: (event: Event,
			/**
			 * An array of the second instance's command line arguments
			 */
			argv: string[],
			/**
			 * The second instance's working directory
			 */
			workingDirectory: string) => void): this;
		once(event: 'second-instance', listener: (event: Event,
			/**
			 * An array of the second instance's command line arguments
			 */
			argv: string[],
			/**
			 * The second instance's working directory
			 */
			workingDirectory: string) => void): this;
		addListener(event: 'second-instance', listener: (event: Event,
			/**
			 * An array of the second instance's command line arguments
			 */
			argv: string[],
			/**
			 * The second instance's working directory
			 */
			workingDirectory: string) => void): this;
		removeListener(event: 'second-instance', listener: (event: Event,
			/**
			 * An array of the second instance's command line arguments
			 */
			argv: string[],
			/**
			 * The second instance's working directory
			 */
			workingDirectory: string) => void): this;
613 614 615 616 617
		/**
		 * Emitted when a client certificate is requested. The url corresponds to the
		 * navigation entry requesting the client certificate and callback can be called
		 * with an entry filtered from the list. Using event.preventDefault() prevents the
		 * application from using the first certificate from the store.
B
Benjamin Pasero 已提交
618
		 */
619
		on(event: 'select-client-certificate', listener: (event: Event,
B
Benjamin Pasero 已提交
620 621
			webContents: WebContents,
			url: string,
622 623 624
			certificateList: Certificate[],
			callback: (certificate?: Certificate) => void) => void): this;
		once(event: 'select-client-certificate', listener: (event: Event,
B
Benjamin Pasero 已提交
625 626 627
			webContents: WebContents,
			url: string,
			certificateList: Certificate[],
628 629 630 631 632 633 634
			callback: (certificate?: Certificate) => void) => void): this;
		addListener(event: 'select-client-certificate', listener: (event: Event,
			webContents: WebContents,
			url: string,
			certificateList: Certificate[],
			callback: (certificate?: Certificate) => void) => void): this;
		removeListener(event: 'select-client-certificate', listener: (event: Event,
B
Benjamin Pasero 已提交
635
			webContents: WebContents,
636 637 638
			url: string,
			certificateList: Certificate[],
			callback: (certificate?: Certificate) => void) => void): this;
639 640 641 642 643 644 645
		/**
		 * Emitted when Electron has created a new session.
		 */
		on(event: 'session-created', listener: (session: Session) => void): this;
		once(event: 'session-created', listener: (session: Session) => void): this;
		addListener(event: 'session-created', listener: (session: Session) => void): this;
		removeListener(event: 'session-created', listener: (session: Session) => void): this;
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688
		/**
		 * Emitted when Handoff is about to be resumed on another device. If you need to
		 * update the state to be transferred, you should call event.preventDefault()
		 * immediately, construct a new userInfo dictionary and call
		 * app.updateCurrentActiviy() in a timely manner. Otherwise the operation will fail
		 * and continue-activity-error will be called.
		 */
		on(event: 'update-activity-state', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity.
			 */
			userInfo: any) => void): this;
		once(event: 'update-activity-state', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity.
			 */
			userInfo: any) => void): this;
		addListener(event: 'update-activity-state', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity.
			 */
			userInfo: any) => void): this;
		removeListener(event: 'update-activity-state', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string,
			/**
			 * Contains app-specific state stored by the activity.
			 */
			userInfo: any) => void): this;
B
Benjamin Pasero 已提交
689
		/**
690
		 * Emitted when a new webContents is created.
B
Benjamin Pasero 已提交
691
		 */
692 693 694 695 696 697 698 699
		on(event: 'web-contents-created', listener: (event: Event,
			webContents: WebContents) => void): this;
		once(event: 'web-contents-created', listener: (event: Event,
			webContents: WebContents) => void): this;
		addListener(event: 'web-contents-created', listener: (event: Event,
			webContents: WebContents) => void): this;
		removeListener(event: 'web-contents-created', listener: (event: Event,
			webContents: WebContents) => void): this;
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724
		/**
		 * Emitted during Handoff before an activity from a different device wants to be
		 * resumed. You should call event.preventDefault() if you want to handle this
		 * event.
		 */
		on(event: 'will-continue-activity', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string) => void): this;
		once(event: 'will-continue-activity', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string) => void): this;
		addListener(event: 'will-continue-activity', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string) => void): this;
		removeListener(event: 'will-continue-activity', listener: (event: Event,
			/**
			 * A string identifying the activity. Maps to .
			 */
			type: string) => void): this;
725 726 727 728 729 730
		/**
		 * Emitted when the application has finished basic startup. On Windows and Linux,
		 * the will-finish-launching event is the same as the ready event; on macOS, this
		 * event represents the applicationWillFinishLaunching notification of
		 * NSApplication. You would usually set up listeners for the open-file and open-url
		 * events here, and start the crash reporter and auto updater. In most cases, you
731
		 * should do everything in the ready event handler.
B
Benjamin Pasero 已提交
732
		 */
733 734 735 736
		on(event: 'will-finish-launching', listener: Function): this;
		once(event: 'will-finish-launching', listener: Function): this;
		addListener(event: 'will-finish-launching', listener: Function): this;
		removeListener(event: 'will-finish-launching', listener: Function): this;
B
Benjamin Pasero 已提交
737
		/**
738 739 740
		 * Emitted when all windows have been closed and the application will quit. Calling
		 * event.preventDefault() will prevent the default behaviour, which is terminating
		 * the application. See the description of the window-all-closed event for the
741 742 743
		 * differences between the will-quit and window-all-closed events. Note: On
		 * Windows, this event will not be emitted if the app is closed due to a
		 * shutdown/restart of the system or a user logout.
744
		 */
745 746 747 748
		on(event: 'will-quit', listener: (event: Event) => void): this;
		once(event: 'will-quit', listener: (event: Event) => void): this;
		addListener(event: 'will-quit', listener: (event: Event) => void): this;
		removeListener(event: 'will-quit', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
749
		/**
750 751 752 753 754 755
		 * Emitted when all windows have been closed. If you do not subscribe to this event
		 * and all windows are closed, the default behavior is to quit the app; however, if
		 * you subscribe, you control whether the app quits or not. If the user pressed Cmd
		 * + Q, or the developer called app.quit(), Electron will first try to close all
		 * the windows and then emit the will-quit event, and in this case the
		 * window-all-closed event would not be emitted.
B
Benjamin Pasero 已提交
756
		 */
757 758 759 760
		on(event: 'window-all-closed', listener: Function): this;
		once(event: 'window-all-closed', listener: Function): this;
		addListener(event: 'window-all-closed', listener: Function): this;
		removeListener(event: 'window-all-closed', listener: Function): this;
B
Benjamin Pasero 已提交
761
		/**
762 763 764
		 * Adds path to the recent documents list. This list is managed by the OS. On
		 * Windows you can visit the list from the task bar, and on macOS you can visit it
		 * from dock menu.
B
Benjamin Pasero 已提交
765
		 */
766
		addRecentDocument(path: string): void;
B
Benjamin Pasero 已提交
767
		/**
768
		 * Clears the recent documents list.
B
Benjamin Pasero 已提交
769
		 */
770
		clearRecentDocuments(): void;
B
Benjamin Pasero 已提交
771
		/**
B
Benjamin Pasero 已提交
772 773 774
		 * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
		 * basis if the GPU processes crashes too frequently. This function disables that
		 * behaviour. This method can only be called before app is ready.
B
Benjamin Pasero 已提交
775
		 */
B
Benjamin Pasero 已提交
776
		disableDomainBlockingFor3DAPIs(): void;
B
Benjamin Pasero 已提交
777
		/**
778 779
		 * Disables hardware acceleration for current app. This method can only be called
		 * before app is ready.
B
Benjamin Pasero 已提交
780
		 */
781
		disableHardwareAcceleration(): void;
B
Benjamin Pasero 已提交
782
		/**
B
Benjamin Pasero 已提交
783 784
		 * Enables mixed sandbox mode on the app. This method can only be called before app
		 * is ready.
B
Benjamin Pasero 已提交
785
		 */
B
Benjamin Pasero 已提交
786
		enableMixedSandbox(): void;
787 788 789 790 791
		/**
		 * Enables full sandbox mode on the app. This method can only be called before app
		 * is ready.
		 */
		enableSandbox(): void;
B
Benjamin Pasero 已提交
792
		/**
793
		 * Exits immediately with exitCode. exitCode defaults to 0. All windows will be
794 795
		 * closed immediately without asking user and the before-quit and will-quit events
		 * will not be emitted.
B
Benjamin Pasero 已提交
796
		 */
797
		exit(exitCode?: number): void;
B
Benjamin Pasero 已提交
798
		/**
799 800
		 * On Linux, focuses on the first visible window. On macOS, makes the application
		 * the active app. On Windows, focuses on the application's first window.
B
Benjamin Pasero 已提交
801
		 */
802 803
		focus(): void;
		getAppMetrics(): ProcessMetric[];
B
Benjamin Pasero 已提交
804
		getAppPath(): string;
805 806
		getBadgeCount(): number;
		getCurrentActivityType(): string;
B
Benjamin Pasero 已提交
807
		/**
808 809
		 * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux
		 * and macOS, icons depend on the application associated with file mime type.
B
Benjamin Pasero 已提交
810
		 */
811
		getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void;
B
Benjamin Pasero 已提交
812
		/**
813 814
		 * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux
		 * and macOS, icons depend on the application associated with file mime type.
B
Benjamin Pasero 已提交
815
		 */
816
		getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void;
817
		getGPUFeatureStatus(): GPUFeatureStatus;
818 819 820 821 822 823 824 825 826
		/**
		 * For infoType equal to complete: Promise is fulfilled with Object containing all
		 * the GPU Information as in chromium's GPUInfo object. This includes the version
		 * and driver information that's shown on chrome://gpu page. For infoType equal to
		 * basic: Promise is fulfilled with Object containing fewer attributes than when
		 * requested with complete. Here's an example of basic response: Using basic should
		 * be preferred if only basic information like vendorId or driverId is needed.
		 */
		getGPUInfo(infoType: string): Promise<any>;
827
		getJumpListSettings(): JumpListSettings;
B
Benjamin Pasero 已提交
828
		/**
829 830 831 832
		 * To set the locale, you'll want to use a command line switch at app startup,
		 * which may be found here. Note: When distributing your packaged app, you have to
		 * also ship the locales folder. Note: On Windows you have to call it after the
		 * ready events gets emitted.
B
Benjamin Pasero 已提交
833
		 */
834
		getLocale(): string;
B
Benjamin Pasero 已提交
835
		/**
836
		 * If you provided path and args options to app.setLoginItemSettings then you need
837
		 * to pass the same arguments here for openAtLogin to be set correctly.
B
Benjamin Pasero 已提交
838
		 */
839
		getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
B
Benjamin Pasero 已提交
840
		/**
B
Benjamin Pasero 已提交
841
		 * Usually the name field of package.json is a short lowercased name, according to
842 843
		 * the npm modules spec. You should usually also specify a productName field, which
		 * is your application's full capitalized name, and which will be preferred over
B
Benjamin Pasero 已提交
844
		 * name by Electron.
B
Benjamin Pasero 已提交
845
		 */
B
Benjamin Pasero 已提交
846
		getName(): string;
B
Benjamin Pasero 已提交
847
		/**
848
		 * You can request the following paths by the name:
B
Benjamin Pasero 已提交
849
		 */
850 851
		getPath(name: string): string;
		getVersion(): string;
852 853 854 855 856 857
		/**
		 * This method returns whether or not this instance of your app is currently
		 * holding the single instance lock.  You can request the lock with
		 * app.requestSingleInstanceLock() and release with app.releaseSingleInstanceLock()
		 */
		hasSingleInstanceLock(): boolean;
B
Benjamin Pasero 已提交
858
		/**
859
		 * Hides all application windows without minimizing them.
B
Benjamin Pasero 已提交
860
		 */
861
		hide(): void;
B
Benjamin Pasero 已提交
862
		/**
863 864
		 * Imports the certificate in pkcs12 format into the platform certificate store.
		 * callback is called with the result of import operation, a value of 0 indicates
865
		 * success while any other value indicates failure according to Chromium
866
		 * net_error_list.
B
Benjamin Pasero 已提交
867
		 */
868
		importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
869 870 871 872
		/**
		 * Invalidates the current Handoff user activity.
		 */
		invalidateCurrentActivity(type: string): void;
873
		isAccessibilitySupportEnabled(): boolean;
B
Benjamin Pasero 已提交
874
		/**
875 876 877 878 879 880 881
		 * This method checks if the current executable is the default handler for a
		 * protocol (aka URI scheme). If so, it will return true. Otherwise, it will return
		 * false. Note: On macOS, you can use this method to check if the app has been
		 * registered as the default protocol handler for a protocol. You can also verify
		 * this by checking ~/Library/Preferences/com.apple.LaunchServices.plist on the
		 * macOS machine. Please refer to Apple's documentation for details. The API uses
		 * the Windows Registry and LSCopyDefaultHandlerForURLScheme internally.
B
Benjamin Pasero 已提交
882
		 */
B
Benjamin Pasero 已提交
883
		isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
884
		isInApplicationsFolder(): boolean;
885 886
		isReady(): boolean;
		isUnityRunning(): boolean;
887 888 889 890 891 892 893 894 895
		/**
		 * No confirmation dialog will be presented by default, if you wish to allow the
		 * user to confirm the operation you may do so using the dialog API. NOTE: This
		 * method throws errors if anything other than the user causes the move to fail.
		 * For instance if the user cancels the authorization dialog this method returns
		 * false. If we fail to perform the copy then this method will throw an error. The
		 * message in the error should be informative and tell you exactly what went wrong
		 */
		moveToApplicationsFolder(): boolean;
896 897 898 899 900 901 902
		/**
		 * Try to close all windows. The before-quit event will be emitted first. If all
		 * windows are successfully closed, the will-quit event will be emitted and by
		 * default the application will terminate. This method guarantees that all
		 * beforeunload and unload event handlers are correctly executed. It is possible
		 * that a window cancels the quitting by returning false in the beforeunload event
		 * handler.
B
Benjamin Pasero 已提交
903
		 */
904
		quit(): void;
B
Benjamin Pasero 已提交
905
		/**
906 907 908 909 910 911 912 913 914 915
		 * Relaunches the app when current instance exits. By default the new instance will
		 * use the same working directory and command line arguments with current instance.
		 * When args is specified, the args will be passed as command line arguments
		 * instead. When execPath is specified, the execPath will be executed for relaunch
		 * instead of current app. Note that this method does not quit the app when
		 * executed, you have to call app.quit or app.exit after calling app.relaunch to
		 * make the app restart. When app.relaunch is called for multiple times, multiple
		 * instances will be started after current instance exited. An example of
		 * restarting current instance immediately and adding a new command line argument
		 * to the new instance:
B
Benjamin Pasero 已提交
916
		 */
917
		relaunch(options?: RelaunchOptions): void;
B
Benjamin Pasero 已提交
918
		/**
919 920
		 * Releases all locks that were created by requestSingleInstanceLock. This will
		 * allow multiple instances of the application to once again run side by side.
B
Benjamin Pasero 已提交
921
		 */
922
		releaseSingleInstanceLock(): void;
B
Benjamin Pasero 已提交
923
		/**
924 925
		 * This method checks if the current executable as the default handler for a
		 * protocol (aka URI scheme). If so, it will remove the app as the default handler.
B
Benjamin Pasero 已提交
926
		 */
927
		removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946
		/**
		 * This method makes your application a Single Instance Application - instead of
		 * allowing multiple instances of your app to run, this will ensure that only a
		 * single instance of your app is running, and other instances signal this instance
		 * and exit. The return value of this method indicates whether or not this instance
		 * of your application successfully obtained the lock.  If it failed to obtain the
		 * lock you can assume that another instance of your application is already running
		 * with the lock and exit immediately. I.e. This method returns true if your
		 * process is the primary instance of your application and your app should continue
		 * loading.  It returns false if your process should immediately quit as it has
		 * sent its parameters to another instance that has already acquired the lock. On
		 * macOS the system enforces single instance automatically when users try to open a
		 * second instance of your app in Finder, and the open-file and open-url events
		 * will be emitted for that. However when users start your app in command line the
		 * system's single instance mechanism will be bypassed and you have to use this
		 * method to ensure single instance. An example of activating the window of primary
		 * instance when a second instance starts:
		 */
		requestSingleInstanceLock(): boolean;
B
Benjamin Pasero 已提交
947
		/**
948 949
		 * Set the about panel options. This will override the values defined in the app's
		 * .plist file. See the Apple docs for more details.
B
Benjamin Pasero 已提交
950
		 */
951
		setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
952 953
		/**
		 * Manually enables Chrome's accessibility support, allowing to expose
954 955 956
		 * accessibility switch to users in application settings. See Chromium's
		 * accessibility docs for more details. Disabled by default. This API must be
		 * called after the ready event is emitted. Note: Rendering accessibility tree can
957 958 959 960
		 * significantly affect the performance of your app. It should not be enabled by
		 * default.
		 */
		setAccessibilitySupportEnabled(enabled: boolean): void;
B
Benjamin Pasero 已提交
961
		/**
B
Benjamin Pasero 已提交
962
		 * Changes the Application User Model ID to id.
B
Benjamin Pasero 已提交
963
		 */
B
Benjamin Pasero 已提交
964
		setAppUserModelId(id: string): void;
B
Benjamin Pasero 已提交
965
		/**
966 967 968 969 970 971 972 973 974 975 976 977
		 * This method sets the current executable as the default handler for a protocol
		 * (aka URI scheme). It allows you to integrate your app deeper into the operating
		 * system. Once registered, all links with your-protocol:// will be opened with the
		 * current executable. The whole link, including protocol, will be passed to your
		 * application as a parameter. On Windows you can provide optional parameters path,
		 * the path to your executable, and args, an array of arguments to be passed to
		 * your executable when it launches. Note: On macOS, you can only register
		 * protocols that have been added to your app's info.plist, which can not be
		 * modified at runtime. You can however change the file with a simple text editor
		 * or script during build time. Please refer to Apple's documentation for details.
		 * The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme
		 * internally.
B
Benjamin Pasero 已提交
978
		 */
979
		setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
B
Benjamin Pasero 已提交
980
		/**
981 982 983 984
		 * Sets the counter badge for current app. Setting the count to 0 will hide the
		 * badge. On macOS it shows on the dock icon. On Linux it only works for Unity
		 * launcher, Note: Unity launcher requires the existence of a .desktop file to
		 * work, for more information please read Desktop Environment Integration.
B
Benjamin Pasero 已提交
985
		 */
986
		setBadgeCount(count: number): boolean;
B
Benjamin Pasero 已提交
987
		/**
988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
		 * Sets or removes a custom Jump List for the application, and returns one of the
		 * following strings: If categories is null the previously set custom Jump List (if
		 * any) will be replaced by the standard Jump List for the app (managed by
		 * Windows). Note: If a JumpListCategory object has neither the type nor the name
		 * property set then its type is assumed to be tasks. If the name property is set
		 * but the type property is omitted then the type is assumed to be custom. Note:
		 * Users can remove items from custom categories, and Windows will not allow a
		 * removed item to be added back into a custom category until after the next
		 * successful call to app.setJumpList(categories). Any attempt to re-add a removed
		 * item to a custom category earlier than that will result in the entire custom
		 * category being omitted from the Jump List. The list of removed items can be
		 * obtained using app.getJumpListSettings(). Here's a very simple example of
		 * creating a custom Jump List:
		 */
		setJumpList(categories: JumpListCategory[]): void;
		/**
		 * Set the app's login item settings. To work with Electron's autoUpdater on
		 * Windows, which uses Squirrel, you'll want to set the launch path to Update.exe,
1006
		 * and pass arguments that specify your application name. For example:
1007
		 */
B
Benjamin Pasero 已提交
1008
		setLoginItemSettings(settings: Settings): void;
B
Benjamin Pasero 已提交
1009
		/**
1010
		 * Overrides the current application's name.
B
Benjamin Pasero 已提交
1011
		 */
1012
		setName(name: string): void;
B
Benjamin Pasero 已提交
1013
		/**
1014 1015 1016 1017 1018 1019 1020
		 * Overrides the path to a special directory or file associated with name. If the
		 * path specifies a directory that does not exist, the directory will be created by
		 * this method. On failure an Error is thrown. You can only override paths of a
		 * name defined in app.getPath. By default, web pages' cookies and caches will be
		 * stored under the userData directory. If you want to change this location, you
		 * have to override the userData path before the ready event of the app module is
		 * emitted.
B
Benjamin Pasero 已提交
1021
		 */
1022
		setPath(name: string, path: string): void;
B
Benjamin Pasero 已提交
1023
		/**
1024 1025
		 * Creates an NSUserActivity and sets it as the current activity. The activity is
		 * eligible for Handoff to another device afterward.
B
Benjamin Pasero 已提交
1026
		 */
1027
		setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
1028
		/**
1029 1030 1031
		 * Adds tasks to the Tasks category of the JumpList on Windows. tasks is an array
		 * of Task objects. Note: If you'd like to customize the Jump List even more use
		 * app.setJumpList(categories) instead.
1032
		 */
1033
		setUserTasks(tasks: Task[]): boolean;
B
Benjamin Pasero 已提交
1034
		/**
1035 1036
		 * Shows application windows after they were hidden. Does not automatically focus
		 * them.
B
Benjamin Pasero 已提交
1037
		 */
1038
		show(): void;
1039
		/**
1040 1041 1042 1043 1044 1045
		 * Show the about panel with the values defined in the app's .plist file or with
		 * the options set via app.setAboutPanelOptions(options).
		 */
		showAboutPanel(): void;
		/**
		 * Start accessing a security scoped resource. With this method Electron
1046 1047 1048 1049 1050 1051 1052 1053 1054 1055
		 * applications that are packaged for the Mac App Store may reach outside their
		 * sandbox to access files chosen by the user. See Apple's documentation for a
		 * description of how this system works.
		 */
		startAccessingSecurityScopedResource(bookmarkData: string): Function;
		/**
		 * Updates the current activity if its type matches type, merging the entries from
		 * userInfo into its current userInfo dictionary.
		 */
		updateCurrentActivity(type: string, userInfo: any): void;
1056
		whenReady(): Promise<void>;
1057
		commandLine: CommandLine;
B
Benjamin Pasero 已提交
1058
		dock: Dock;
1059 1060 1061 1062 1063 1064
		/**
		 * A Boolean property that returns  true if the app is packaged, false otherwise.
		 * For many apps, this property can be used to distinguish development and
		 * production environments.
		 */
		isPackaged?: boolean;
1065 1066 1067 1068 1069 1070 1071 1072
		/**
		 * A String which is the user agent string Electron will use as a global fallback.
		 * This is the user agent that will be used when no user agent is set at the
		 * webContents or session level.  Useful for ensuring your entire app has the same
		 * user agent.  Set to a custom value as early as possible in your apps
		 * initialization to ensure that your overridden value is used.
		 */
		userAgentFallback?: string;
B
Benjamin Pasero 已提交
1073 1074
	}

1075 1076
	interface AutoUpdater extends EventEmitter {

1077
		// Docs: http://electronjs.org/docs/api/auto-updater
B
Benjamin Pasero 已提交
1078

1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089
		/**
		 * This event is emitted after a user calls quitAndInstall(). When this API is
		 * called, the before-quit event is not emitted before all windows are closed. As a
		 * result you should listen to this event if you wish to perform actions before the
		 * windows are closed while a process is quitting, as well as listening to
		 * before-quit.
		 */
		on(event: 'before-quit-for-update', listener: Function): this;
		once(event: 'before-quit-for-update', listener: Function): this;
		addListener(event: 'before-quit-for-update', listener: Function): this;
		removeListener(event: 'before-quit-for-update', listener: Function): this;
B
Benjamin Pasero 已提交
1090
		/**
1091
		 * Emitted when checking if an update has started.
B
Benjamin Pasero 已提交
1092
		 */
1093 1094 1095 1096
		on(event: 'checking-for-update', listener: Function): this;
		once(event: 'checking-for-update', listener: Function): this;
		addListener(event: 'checking-for-update', listener: Function): this;
		removeListener(event: 'checking-for-update', listener: Function): this;
B
Benjamin Pasero 已提交
1097
		/**
1098
		 * Emitted when there is an error while updating.
B
Benjamin Pasero 已提交
1099
		 */
1100 1101 1102 1103
		on(event: 'error', listener: (error: Error) => void): this;
		once(event: 'error', listener: (error: Error) => void): this;
		addListener(event: 'error', listener: (error: Error) => void): this;
		removeListener(event: 'error', listener: (error: Error) => void): this;
B
Benjamin Pasero 已提交
1104
		/**
1105 1106
		 * Emitted when there is an available update. The update is downloaded
		 * automatically.
B
Benjamin Pasero 已提交
1107
		 */
1108 1109 1110 1111 1112 1113
		on(event: 'update-available', listener: Function): this;
		once(event: 'update-available', listener: Function): this;
		addListener(event: 'update-available', listener: Function): this;
		removeListener(event: 'update-available', listener: Function): this;
		/**
		 * Emitted when an update has been downloaded. On Windows only releaseName is
1114 1115 1116
		 * available. Note: It is not strictly necessary to handle this event. A
		 * successfully downloaded update will still be applied the next time the
		 * application starts.
1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137
		 */
		on(event: 'update-downloaded', listener: (event: Event,
			releaseNotes: string,
			releaseName: string,
			releaseDate: Date,
			updateURL: string) => void): this;
		once(event: 'update-downloaded', listener: (event: Event,
			releaseNotes: string,
			releaseName: string,
			releaseDate: Date,
			updateURL: string) => void): this;
		addListener(event: 'update-downloaded', listener: (event: Event,
			releaseNotes: string,
			releaseName: string,
			releaseDate: Date,
			updateURL: string) => void): this;
		removeListener(event: 'update-downloaded', listener: (event: Event,
			releaseNotes: string,
			releaseName: string,
			releaseDate: Date,
			updateURL: string) => void): this;
B
Benjamin Pasero 已提交
1138
		/**
1139
		 * Emitted when there is no available update.
B
Benjamin Pasero 已提交
1140
		 */
1141 1142 1143 1144
		on(event: 'update-not-available', listener: Function): this;
		once(event: 'update-not-available', listener: Function): this;
		addListener(event: 'update-not-available', listener: Function): this;
		removeListener(event: 'update-not-available', listener: Function): this;
B
Benjamin Pasero 已提交
1145
		/**
1146 1147
		 * Asks the server whether there is an update. You must call setFeedURL before
		 * using this API.
B
Benjamin Pasero 已提交
1148
		 */
1149 1150
		checkForUpdates(): void;
		getFeedURL(): string;
B
Benjamin Pasero 已提交
1151
		/**
1152
		 * Restarts the app and installs the update after it has been downloaded. It should
1153 1154
		 * only be called after update-downloaded has been emitted. Under the hood calling
		 * autoUpdater.quitAndInstall() will close all application windows first, and
1155 1156 1157 1158
		 * automatically call app.quit() after all windows have been closed. Note: It is
		 * not strictly necessary to call this function to apply an update, as a
		 * successfully downloaded update will always be applied the next time the
		 * application starts.
B
Benjamin Pasero 已提交
1159
		 */
1160
		quitAndInstall(): void;
B
Benjamin Pasero 已提交
1161
		/**
1162
		 * Sets the url and initialize the auto updater.
B
Benjamin Pasero 已提交
1163
		 */
1164
		setFeedURL(options: FeedURLOptions): void;
1165 1166 1167 1168
	}

	interface BluetoothDevice {

1169
		// Docs: http://electronjs.org/docs/api/structures/bluetooth-device
1170 1171 1172 1173 1174 1175 1176

		deviceId: string;
		deviceName: string;
	}

	class BrowserView extends EventEmitter {

1177
		// Docs: http://electronjs.org/docs/api/browser-view
1178 1179

		constructor(options?: BrowserViewConstructorOptions);
B
Benjamin Pasero 已提交
1180
		static fromId(id: number): BrowserView;
1181
		static fromWebContents(webContents: WebContents): (BrowserView) | (null);
1182 1183 1184 1185 1186 1187 1188 1189
		static getAllViews(): BrowserView[];
		/**
		 * Force closing the view, the unload and beforeunload events won't be emitted for
		 * the web page. After you're done with a view, call this function in order to free
		 * memory and other resources as soon as possible.
		 */
		destroy(): void;
		isDestroyed(): boolean;
1190 1191
		setAutoResize(options: AutoResizeOptions): void;
		setBackgroundColor(color: string): void;
B
Benjamin Pasero 已提交
1192
		/**
1193
		 * Resizes and moves the view to the supplied bounds relative to the window.
B
Benjamin Pasero 已提交
1194
		 */
1195 1196 1197 1198 1199 1200 1201
		setBounds(bounds: Rectangle): void;
		id: number;
		webContents: WebContents;
	}

	class BrowserWindow extends EventEmitter {

1202
		// Docs: http://electronjs.org/docs/api/browser-window
1203

1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214
		/**
		 * Emitted when the window is set or unset to show always on top of other windows.
		 */
		on(event: 'always-on-top-changed', listener: (event: Event,
			isAlwaysOnTop: boolean) => void): this;
		once(event: 'always-on-top-changed', listener: (event: Event,
			isAlwaysOnTop: boolean) => void): this;
		addListener(event: 'always-on-top-changed', listener: (event: Event,
			isAlwaysOnTop: boolean) => void): this;
		removeListener(event: 'always-on-top-changed', listener: (event: Event,
			isAlwaysOnTop: boolean) => void): this;
B
Benjamin Pasero 已提交
1215
		/**
1216 1217 1218 1219 1220
		 * Emitted when an App Command is invoked. These are typically related to keyboard
		 * media keys or browser commands, as well as the "Back" button built into some
		 * mice on Windows. Commands are lowercased, underscores are replaced with hyphens,
		 * and the APPCOMMAND_ prefix is stripped off. e.g. APPCOMMAND_BROWSER_BACKWARD is
		 * emitted as browser-backward.
B
Benjamin Pasero 已提交
1221
		 */
1222 1223 1224 1225 1226 1227 1228 1229
		on(event: 'app-command', listener: (event: Event,
			command: string) => void): this;
		once(event: 'app-command', listener: (event: Event,
			command: string) => void): this;
		addListener(event: 'app-command', listener: (event: Event,
			command: string) => void): this;
		removeListener(event: 'app-command', listener: (event: Event,
			command: string) => void): this;
B
Benjamin Pasero 已提交
1230
		/**
1231
		 * Emitted when the window loses focus.
B
Benjamin Pasero 已提交
1232
		 */
1233 1234 1235 1236
		on(event: 'blur', listener: Function): this;
		once(event: 'blur', listener: Function): this;
		addListener(event: 'blur', listener: Function): this;
		removeListener(event: 'blur', listener: Function): this;
B
Benjamin Pasero 已提交
1237
		/**
1238 1239 1240 1241 1242
		 * Emitted when the window is going to be closed. It's emitted before the
		 * beforeunload and unload event of the DOM. Calling event.preventDefault() will
		 * cancel the close. Usually you would want to use the beforeunload handler to
		 * decide whether the window should be closed, which will also be called when the
		 * window is reloaded. In Electron, returning any value other than undefined would
1243 1244 1245
		 * cancel the close. For example: Note: There is a subtle difference between the
		 * behaviors of window.onbeforeunload = handler and
		 * window.addEventListener('beforeunload', handler). It is recommended to always
1246
		 * set the event.returnValue explicitly, instead of only returning a value, as the
1247
		 * former works more consistently within Electron.
B
Benjamin Pasero 已提交
1248
		 */
1249 1250 1251 1252
		on(event: 'close', listener: (event: Event) => void): this;
		once(event: 'close', listener: (event: Event) => void): this;
		addListener(event: 'close', listener: (event: Event) => void): this;
		removeListener(event: 'close', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
1253
		/**
1254 1255
		 * Emitted when the window is closed. After you have received this event you should
		 * remove the reference to the window and avoid using it any more.
B
Benjamin Pasero 已提交
1256
		 */
1257 1258 1259 1260
		on(event: 'closed', listener: Function): this;
		once(event: 'closed', listener: Function): this;
		addListener(event: 'closed', listener: Function): this;
		removeListener(event: 'closed', listener: Function): this;
B
Benjamin Pasero 已提交
1261
		/**
1262
		 * Emitted when the window enters a full-screen state.
B
Benjamin Pasero 已提交
1263
		 */
1264 1265 1266 1267
		on(event: 'enter-full-screen', listener: Function): this;
		once(event: 'enter-full-screen', listener: Function): this;
		addListener(event: 'enter-full-screen', listener: Function): this;
		removeListener(event: 'enter-full-screen', listener: Function): this;
B
Benjamin Pasero 已提交
1268
		/**
1269
		 * Emitted when the window enters a full-screen state triggered by HTML API.
B
Benjamin Pasero 已提交
1270
		 */
1271 1272 1273 1274
		on(event: 'enter-html-full-screen', listener: Function): this;
		once(event: 'enter-html-full-screen', listener: Function): this;
		addListener(event: 'enter-html-full-screen', listener: Function): this;
		removeListener(event: 'enter-html-full-screen', listener: Function): this;
B
Benjamin Pasero 已提交
1275
		/**
1276
		 * Emitted when the window gains focus.
B
Benjamin Pasero 已提交
1277
		 */
1278 1279 1280 1281
		on(event: 'focus', listener: Function): this;
		once(event: 'focus', listener: Function): this;
		addListener(event: 'focus', listener: Function): this;
		removeListener(event: 'focus', listener: Function): this;
B
Benjamin Pasero 已提交
1282
		/**
1283
		 * Emitted when the window is hidden.
B
Benjamin Pasero 已提交
1284
		 */
1285 1286 1287 1288
		on(event: 'hide', listener: Function): this;
		once(event: 'hide', listener: Function): this;
		addListener(event: 'hide', listener: Function): this;
		removeListener(event: 'hide', listener: Function): this;
B
Benjamin Pasero 已提交
1289
		/**
1290
		 * Emitted when the window leaves a full-screen state.
B
Benjamin Pasero 已提交
1291
		 */
1292 1293 1294 1295
		on(event: 'leave-full-screen', listener: Function): this;
		once(event: 'leave-full-screen', listener: Function): this;
		addListener(event: 'leave-full-screen', listener: Function): this;
		removeListener(event: 'leave-full-screen', listener: Function): this;
B
Benjamin Pasero 已提交
1296
		/**
1297
		 * Emitted when the window leaves a full-screen state triggered by HTML API.
B
Benjamin Pasero 已提交
1298
		 */
1299 1300 1301 1302
		on(event: 'leave-html-full-screen', listener: Function): this;
		once(event: 'leave-html-full-screen', listener: Function): this;
		addListener(event: 'leave-html-full-screen', listener: Function): this;
		removeListener(event: 'leave-html-full-screen', listener: Function): this;
B
Benjamin Pasero 已提交
1303
		/**
1304
		 * Emitted when window is maximized.
B
Benjamin Pasero 已提交
1305
		 */
1306 1307 1308 1309
		on(event: 'maximize', listener: Function): this;
		once(event: 'maximize', listener: Function): this;
		addListener(event: 'maximize', listener: Function): this;
		removeListener(event: 'maximize', listener: Function): this;
B
Benjamin Pasero 已提交
1310
		/**
1311
		 * Emitted when the window is minimized.
B
Benjamin Pasero 已提交
1312
		 */
1313 1314 1315 1316
		on(event: 'minimize', listener: Function): this;
		once(event: 'minimize', listener: Function): this;
		addListener(event: 'minimize', listener: Function): this;
		removeListener(event: 'minimize', listener: Function): this;
B
Benjamin Pasero 已提交
1317
		/**
1318
		 * Emitted when the window is being moved to a new position. Note: On macOS this
1319
		 * event is an alias of moved.
B
Benjamin Pasero 已提交
1320
		 */
1321 1322 1323 1324
		on(event: 'move', listener: Function): this;
		once(event: 'move', listener: Function): this;
		addListener(event: 'move', listener: Function): this;
		removeListener(event: 'move', listener: Function): this;
B
Benjamin Pasero 已提交
1325
		/**
1326
		 * Emitted once when the window is moved to a new position.
B
Benjamin Pasero 已提交
1327
		 */
1328 1329 1330 1331
		on(event: 'moved', listener: Function): this;
		once(event: 'moved', listener: Function): this;
		addListener(event: 'moved', listener: Function): this;
		removeListener(event: 'moved', listener: Function): this;
B
Benjamin Pasero 已提交
1332
		/**
B
Benjamin Pasero 已提交
1333
		 * Emitted when the native new tab button is clicked.
B
Benjamin Pasero 已提交
1334
		 */
B
Benjamin Pasero 已提交
1335 1336 1337 1338
		on(event: 'new-window-for-tab', listener: Function): this;
		once(event: 'new-window-for-tab', listener: Function): this;
		addListener(event: 'new-window-for-tab', listener: Function): this;
		removeListener(event: 'new-window-for-tab', listener: Function): this;
B
Benjamin Pasero 已提交
1339
		/**
1340
		 * Emitted when the document changed its title, calling event.preventDefault() will
B
Benjamin Pasero 已提交
1341 1342
		 * prevent the native window's title from changing. explicitSet is false when title
		 * is synthesized from file url.
B
Benjamin Pasero 已提交
1343
		 */
1344
		on(event: 'page-title-updated', listener: (event: Event,
B
Benjamin Pasero 已提交
1345 1346
			title: string,
			explicitSet: boolean) => void): this;
1347
		once(event: 'page-title-updated', listener: (event: Event,
B
Benjamin Pasero 已提交
1348 1349
			title: string,
			explicitSet: boolean) => void): this;
1350
		addListener(event: 'page-title-updated', listener: (event: Event,
B
Benjamin Pasero 已提交
1351 1352
			title: string,
			explicitSet: boolean) => void): this;
1353
		removeListener(event: 'page-title-updated', listener: (event: Event,
B
Benjamin Pasero 已提交
1354 1355
			title: string,
			explicitSet: boolean) => void): this;
B
Benjamin Pasero 已提交
1356
		/**
1357 1358
		 * Emitted when the web page has been rendered (while not being shown) and window
		 * can be displayed without a visual flash.
B
Benjamin Pasero 已提交
1359
		 */
1360 1361 1362 1363
		on(event: 'ready-to-show', listener: Function): this;
		once(event: 'ready-to-show', listener: Function): this;
		addListener(event: 'ready-to-show', listener: Function): this;
		removeListener(event: 'ready-to-show', listener: Function): this;
B
Benjamin Pasero 已提交
1364
		/**
1365
		 * Emitted after the window has been resized.
B
Benjamin Pasero 已提交
1366
		 */
1367 1368 1369 1370
		on(event: 'resize', listener: Function): this;
		once(event: 'resize', listener: Function): this;
		addListener(event: 'resize', listener: Function): this;
		removeListener(event: 'resize', listener: Function): this;
B
Benjamin Pasero 已提交
1371
		/**
1372
		 * Emitted when the unresponsive web page becomes responsive again.
B
Benjamin Pasero 已提交
1373
		 */
1374 1375 1376 1377
		on(event: 'responsive', listener: Function): this;
		once(event: 'responsive', listener: Function): this;
		addListener(event: 'responsive', listener: Function): this;
		removeListener(event: 'responsive', listener: Function): this;
B
Benjamin Pasero 已提交
1378
		/**
1379
		 * Emitted when the window is restored from a minimized state.
B
Benjamin Pasero 已提交
1380
		 */
1381 1382 1383 1384
		on(event: 'restore', listener: Function): this;
		once(event: 'restore', listener: Function): this;
		addListener(event: 'restore', listener: Function): this;
		removeListener(event: 'restore', listener: Function): this;
B
Benjamin Pasero 已提交
1385
		/**
1386
		 * Emitted when scroll wheel event phase has begun.
B
Benjamin Pasero 已提交
1387
		 */
1388 1389 1390 1391
		on(event: 'scroll-touch-begin', listener: Function): this;
		once(event: 'scroll-touch-begin', listener: Function): this;
		addListener(event: 'scroll-touch-begin', listener: Function): this;
		removeListener(event: 'scroll-touch-begin', listener: Function): this;
B
Benjamin Pasero 已提交
1392
		/**
1393
		 * Emitted when scroll wheel event phase filed upon reaching the edge of element.
B
Benjamin Pasero 已提交
1394
		 */
1395 1396 1397 1398
		on(event: 'scroll-touch-edge', listener: Function): this;
		once(event: 'scroll-touch-edge', listener: Function): this;
		addListener(event: 'scroll-touch-edge', listener: Function): this;
		removeListener(event: 'scroll-touch-edge', listener: Function): this;
B
Benjamin Pasero 已提交
1399
		/**
1400
		 * Emitted when scroll wheel event phase has ended.
B
Benjamin Pasero 已提交
1401
		 */
1402 1403 1404 1405
		on(event: 'scroll-touch-end', listener: Function): this;
		once(event: 'scroll-touch-end', listener: Function): this;
		addListener(event: 'scroll-touch-end', listener: Function): this;
		removeListener(event: 'scroll-touch-end', listener: Function): this;
B
Benjamin Pasero 已提交
1406
		/**
1407 1408
		 * Emitted when window session is going to end due to force shutdown or machine
		 * restart or session log off.
B
Benjamin Pasero 已提交
1409
		 */
1410 1411 1412 1413
		on(event: 'session-end', listener: Function): this;
		once(event: 'session-end', listener: Function): this;
		addListener(event: 'session-end', listener: Function): this;
		removeListener(event: 'session-end', listener: Function): this;
B
Benjamin Pasero 已提交
1414
		/**
1415
		 * Emitted when the window opens a sheet.
B
Benjamin Pasero 已提交
1416
		 */
1417 1418 1419 1420
		on(event: 'sheet-begin', listener: Function): this;
		once(event: 'sheet-begin', listener: Function): this;
		addListener(event: 'sheet-begin', listener: Function): this;
		removeListener(event: 'sheet-begin', listener: Function): this;
B
Benjamin Pasero 已提交
1421
		/**
1422
		 * Emitted when the window has closed a sheet.
B
Benjamin Pasero 已提交
1423
		 */
1424 1425 1426 1427
		on(event: 'sheet-end', listener: Function): this;
		once(event: 'sheet-end', listener: Function): this;
		addListener(event: 'sheet-end', listener: Function): this;
		removeListener(event: 'sheet-end', listener: Function): this;
B
Benjamin Pasero 已提交
1428
		/**
1429
		 * Emitted when the window is shown.
B
Benjamin Pasero 已提交
1430
		 */
1431 1432 1433 1434
		on(event: 'show', listener: Function): this;
		once(event: 'show', listener: Function): this;
		addListener(event: 'show', listener: Function): this;
		removeListener(event: 'show', listener: Function): this;
B
Benjamin Pasero 已提交
1435
		/**
1436
		 * Emitted on 3-finger swipe. Possible directions are up, right, down, left.
B
Benjamin Pasero 已提交
1437
		 */
1438 1439 1440 1441 1442 1443 1444 1445
		on(event: 'swipe', listener: (event: Event,
			direction: string) => void): this;
		once(event: 'swipe', listener: (event: Event,
			direction: string) => void): this;
		addListener(event: 'swipe', listener: (event: Event,
			direction: string) => void): this;
		removeListener(event: 'swipe', listener: (event: Event,
			direction: string) => void): this;
B
Benjamin Pasero 已提交
1446
		/**
1447
		 * Emitted when the window exits from a maximized state.
B
Benjamin Pasero 已提交
1448
		 */
1449 1450 1451 1452
		on(event: 'unmaximize', listener: Function): this;
		once(event: 'unmaximize', listener: Function): this;
		addListener(event: 'unmaximize', listener: Function): this;
		removeListener(event: 'unmaximize', listener: Function): this;
B
Benjamin Pasero 已提交
1453
		/**
1454
		 * Emitted when the web page becomes unresponsive.
B
Benjamin Pasero 已提交
1455
		 */
1456 1457 1458 1459
		on(event: 'unresponsive', listener: Function): this;
		once(event: 'unresponsive', listener: Function): this;
		addListener(event: 'unresponsive', listener: Function): this;
		removeListener(event: 'unresponsive', listener: Function): this;
1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511
		/**
		 * Emitted before the window is moved. Calling event.preventDefault() will prevent
		 * the window from being moved. Note that this is only emitted when the window is
		 * being resized manually. Resizing the window with setBounds/setSize will not emit
		 * this event.
		 */
		on(event: 'will-move', listener: (event: Event,
			/**
			 * ` Location the window is being moved to.
			 */
			newBounds: Rectangle) => void): this;
		once(event: 'will-move', listener: (event: Event,
			/**
			 * ` Location the window is being moved to.
			 */
			newBounds: Rectangle) => void): this;
		addListener(event: 'will-move', listener: (event: Event,
			/**
			 * ` Location the window is being moved to.
			 */
			newBounds: Rectangle) => void): this;
		removeListener(event: 'will-move', listener: (event: Event,
			/**
			 * ` Location the window is being moved to.
			 */
			newBounds: Rectangle) => void): this;
		/**
		 * Emitted before the window is resized. Calling event.preventDefault() will
		 * prevent the window from being resized. Note that this is only emitted when the
		 * window is being resized manually. Resizing the window with setBounds/setSize
		 * will not emit this event.
		 */
		on(event: 'will-resize', listener: (event: Event,
			/**
			 * ` Size the window is being resized to.
			 */
			newBounds: Rectangle) => void): this;
		once(event: 'will-resize', listener: (event: Event,
			/**
			 * ` Size the window is being resized to.
			 */
			newBounds: Rectangle) => void): this;
		addListener(event: 'will-resize', listener: (event: Event,
			/**
			 * ` Size the window is being resized to.
			 */
			newBounds: Rectangle) => void): this;
		removeListener(event: 'will-resize', listener: (event: Event,
			/**
			 * ` Size the window is being resized to.
			 */
			newBounds: Rectangle) => void): this;
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522
		constructor(options?: BrowserWindowConstructorOptions);
		/**
		 * Adds DevTools extension located at path, and returns extension's name. The
		 * extension will be remembered so you only need to call this API once, this API is
		 * not for programming use. If you try to add an extension that has already been
		 * loaded, this method will not return and instead log a warning to the console.
		 * The method will also not return if the extension's manifest is missing or
		 * incomplete. Note: This API cannot be called before the ready event of the app
		 * module is emitted.
		 */
		static addDevToolsExtension(path: string): void;
B
Benjamin Pasero 已提交
1523 1524 1525 1526 1527 1528
		/**
		 * Adds Chrome extension located at path, and returns extension's name. The method
		 * will also not return if the extension's manifest is missing or incomplete. Note:
		 * This API cannot be called before the ready event of the app module is emitted.
		 */
		static addExtension(path: string): void;
1529
		static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
1530 1531 1532
		static fromId(id: number): BrowserWindow;
		static fromWebContents(webContents: WebContents): BrowserWindow;
		static getAllWindows(): BrowserWindow[];
B
Benjamin Pasero 已提交
1533
		/**
1534 1535
		 * To check if a DevTools extension is installed you can run the following: Note:
		 * This API cannot be called before the ready event of the app module is emitted.
B
Benjamin Pasero 已提交
1536
		 */
1537
		static getDevToolsExtensions(): DevToolsExtensions;
B
Benjamin Pasero 已提交
1538
		/**
B
Benjamin Pasero 已提交
1539 1540
		 * Note: This API cannot be called before the ready event of the app module is
		 * emitted.
B
Benjamin Pasero 已提交
1541
		 */
B
Benjamin Pasero 已提交
1542
		static getExtensions(): Extensions;
1543
		static getFocusedWindow(): (BrowserWindow) | (null);
1544
		/**
1545 1546
		 * Remove a DevTools extension by name. Note: This API cannot be called before the
		 * ready event of the app module is emitted.
1547
		 */
1548
		static removeDevToolsExtension(name: string): void;
1549
		/**
B
Benjamin Pasero 已提交
1550 1551
		 * Remove a Chrome extension by name. Note: This API cannot be called before the
		 * ready event of the app module is emitted.
1552
		 */
B
Benjamin Pasero 已提交
1553
		static removeExtension(name: string): void;
1554 1555 1556 1557
		/**
		 * Adds a window as a tab on this window, after the tab for the window instance.
		 */
		addTabbedWindow(browserWindow: BrowserWindow): void;
1558
		/**
1559
		 * Removes focus from the window.
1560
		 */
1561 1562
		blur(): void;
		blurWebView(): void;
1563
		/**
1564
		 * Same as webContents.capturePage([rect, ]callback).
1565
		 */
1566
		capturePage(callback: (image: NativeImage) => void): void;
1567
		/**
1568
		 * Same as webContents.capturePage([rect, ]callback).
1569
		 */
1570
		capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void;
B
Benjamin Pasero 已提交
1571
		/**
1572
		 * Moves window to the center of the screen.
B
Benjamin Pasero 已提交
1573
		 */
1574
		center(): void;
B
Benjamin Pasero 已提交
1575
		/**
1576 1577 1578
		 * Try to close the window. This has the same effect as a user manually clicking
		 * the close button of the window. The web page may cancel the close though. See
		 * the close event.
B
Benjamin Pasero 已提交
1579
		 */
1580
		close(): void;
B
Benjamin Pasero 已提交
1581
		/**
1582
		 * Closes the currently open Quick Look panel.
B
Benjamin Pasero 已提交
1583
		 */
1584
		closeFilePreview(): void;
B
Benjamin Pasero 已提交
1585
		/**
1586 1587 1588
		 * Force closing the window, the unload and beforeunload event won't be emitted for
		 * the web page, and close event will also not be emitted for this window, but it
		 * guarantees the closed event will be emitted.
B
Benjamin Pasero 已提交
1589
		 */
1590
		destroy(): void;
B
Benjamin Pasero 已提交
1591
		/**
1592
		 * Starts or stops flashing the window to attract user's attention.
B
Benjamin Pasero 已提交
1593
		 */
1594
		flashFrame(flag: boolean): void;
B
Benjamin Pasero 已提交
1595
		/**
1596
		 * Focuses on the window.
B
Benjamin Pasero 已提交
1597
		 */
1598 1599 1600
		focus(): void;
		focusOnWebView(): void;
		getBounds(): Rectangle;
1601 1602 1603 1604
		/**
		 * Note: The BrowserView API is currently experimental and may change or be removed
		 * in future Electron releases.
		 */
1605
		getBrowserView(): (BrowserView) | (null);
1606 1607 1608 1609 1610
		getChildWindows(): BrowserWindow[];
		getContentBounds(): Rectangle;
		getContentSize(): number[];
		getMaximumSize(): number[];
		getMinimumSize(): number[];
B
Benjamin Pasero 已提交
1611
		/**
1612 1613
		 * The native type of the handle is HWND on Windows, NSView* on macOS, and Window
		 * (unsigned long) on Linux.
B
Benjamin Pasero 已提交
1614
		 */
1615
		getNativeWindowHandle(): Buffer;
1616 1617 1618 1619 1620 1621 1622
		/**
		 * Note: whatever the current state of the window : maximized, minimized or in
		 * fullscreen, this function always returns the position and size of the window in
		 * normal state. In normal state, getBounds and getNormalBounds returns the same
		 * Rectangle.
		 */
		getNormalBounds(): Rectangle;
1623
		getOpacity(): number;
1624 1625 1626 1627
		getParentWindow(): BrowserWindow;
		getPosition(): number[];
		getRepresentedFilename(): string;
		getSize(): number[];
B
Benjamin Pasero 已提交
1628
		/**
1629 1630
		 * Note: The title of web page can be different from the title of the native
		 * window.
B
Benjamin Pasero 已提交
1631
		 */
1632
		getTitle(): string;
B
Benjamin Pasero 已提交
1633
		/**
1634
		 * On Windows and Linux always returns true.
B
Benjamin Pasero 已提交
1635
		 */
1636
		hasShadow(): boolean;
B
Benjamin Pasero 已提交
1637
		/**
1638
		 * Hides the window.
B
Benjamin Pasero 已提交
1639
		 */
1640
		hide(): void;
B
Benjamin Pasero 已提交
1641
		/**
1642 1643
		 * Hooks a windows message. The callback is called when the message is received in
		 * the WndProc.
B
Benjamin Pasero 已提交
1644
		 */
1645 1646
		hookWindowMessage(message: number, callback: Function): void;
		isAlwaysOnTop(): boolean;
B
Benjamin Pasero 已提交
1647
		/**
1648
		 * On Linux always returns true.
B
Benjamin Pasero 已提交
1649
		 */
1650 1651 1652 1653 1654 1655 1656
		isClosable(): boolean;
		isDestroyed(): boolean;
		isDocumentEdited(): boolean;
		isFocused(): boolean;
		isFullScreen(): boolean;
		isFullScreenable(): boolean;
		isKiosk(): boolean;
B
Benjamin Pasero 已提交
1657
		/**
1658
		 * On Linux always returns true.
B
Benjamin Pasero 已提交
1659
		 */
1660 1661 1662 1663
		isMaximizable(): boolean;
		isMaximized(): boolean;
		isMenuBarAutoHide(): boolean;
		isMenuBarVisible(): boolean;
B
Benjamin Pasero 已提交
1664
		/**
1665
		 * On Linux always returns true.
B
Benjamin Pasero 已提交
1666
		 */
1667 1668 1669
		isMinimizable(): boolean;
		isMinimized(): boolean;
		isModal(): boolean;
B
Benjamin Pasero 已提交
1670
		/**
1671
		 * On Linux always returns true.
B
Benjamin Pasero 已提交
1672
		 */
1673
		isMovable(): boolean;
1674
		isNormal(): boolean;
1675
		isResizable(): boolean;
1676
		isSimpleFullScreen(): boolean;
1677
		isVisible(): boolean;
B
Benjamin Pasero 已提交
1678
		/**
1679
		 * Note: This API always returns false on Windows.
B
Benjamin Pasero 已提交
1680
		 */
1681 1682
		isVisibleOnAllWorkspaces(): boolean;
		isWindowMessageHooked(message: number): boolean;
1683 1684 1685 1686
		/**
		 * Same as webContents.loadFile, filePath should be a path to an HTML file relative
		 * to the root of your application.  See the webContents docs for more information.
		 */
1687
		loadFile(filePath: string, options?: LoadFileOptions): void;
B
Benjamin Pasero 已提交
1688
		/**
1689 1690 1691 1692 1693
		 * Same as webContents.loadURL(url[, options]). The url can be a remote address
		 * (e.g. http://) or a path to a local HTML file using the file:// protocol. To
		 * ensure that file URLs are properly formatted, it is recommended to use Node's
		 * url.format method: You can load a URL using a POST request with URL-encoded data
		 * by doing the following:
B
Benjamin Pasero 已提交
1694
		 */
1695
		loadURL(url: string, options?: LoadURLOptions): void;
B
Benjamin Pasero 已提交
1696
		/**
1697 1698
		 * Maximizes the window. This will also show (but not focus) the window if it isn't
		 * being displayed already.
B
Benjamin Pasero 已提交
1699
		 */
1700
		maximize(): void;
1701 1702 1703 1704 1705
		/**
		 * Merges all windows into one window with multiple tabs when native tabs are
		 * enabled and there is more than one open window.
		 */
		mergeAllWindows(): void;
B
Benjamin Pasero 已提交
1706
		/**
1707 1708
		 * Minimizes the window. On some platforms the minimized window will be shown in
		 * the Dock.
B
Benjamin Pasero 已提交
1709
		 */
1710
		minimize(): void;
1711 1712 1713 1714 1715
		/**
		 * Moves the current tab into a new window if native tabs are enabled and there is
		 * more than one tab in the current window.
		 */
		moveTabToNewWindow(): void;
1716 1717 1718 1719
		/**
		 * Moves window to top(z-order) regardless of focus
		 */
		moveTop(): void;
B
Benjamin Pasero 已提交
1720
		/**
1721
		 * Uses Quick Look to preview a file at a given path.
B
Benjamin Pasero 已提交
1722
		 */
1723
		previewFile(path: string, displayName?: string): void;
B
Benjamin Pasero 已提交
1724
		/**
1725
		 * Same as webContents.reload.
B
Benjamin Pasero 已提交
1726
		 */
1727
		reload(): void;
B
Benjamin Pasero 已提交
1728
		/**
1729
		 * Restores the window from minimized state to its previous state.
B
Benjamin Pasero 已提交
1730
		 */
1731
		restore(): void;
1732 1733 1734 1735 1736 1737 1738 1739 1740 1741
		/**
		 * Selects the next tab when native tabs are enabled and there are other tabs in
		 * the window.
		 */
		selectNextTab(): void;
		/**
		 * Selects the previous tab when native tabs are enabled and there are other tabs
		 * in the window.
		 */
		selectPreviousTab(): void;
B
Benjamin Pasero 已提交
1742
		/**
1743 1744 1745
		 * Sets whether the window should show always on top of other windows. After
		 * setting this, the window is still a normal window, not a toolbox window which
		 * can not be focused on.
B
Benjamin Pasero 已提交
1746
		 */
1747
		setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
1748
		/**
1749 1750 1751
		 * Sets the properties for the window's taskbar button. Note: relaunchCommand and
		 * relaunchDisplayName must always be set together. If one of those properties is
		 * not set, then neither will be used.
1752
		 */
1753
		setAppDetails(options: AppDetailsOptions): void;
B
Benjamin Pasero 已提交
1754
		/**
1755 1756 1757 1758 1759 1760 1761 1762 1763 1764
		 * This will make a window maintain an aspect ratio. The extra size allows a
		 * developer to have space, specified in pixels, not included within the aspect
		 * ratio calculations. This API already takes into account the difference between a
		 * window's size and its content size. Consider a normal window with an HD video
		 * player and associated controls. Perhaps there are 15 pixels of controls on the
		 * left edge, 25 pixels of controls on the right edge and 50 pixels of controls
		 * below the player. In order to maintain a 16:9 aspect ratio (standard aspect
		 * ratio for HD @1920x1080) within the player itself we would call this function
		 * with arguments of 16/9 and [ 40, 50 ]. The second argument doesn't care where
		 * the extra width and height are within the content view--only that they exist.
1765 1766 1767
		 * Sum any extra width and height areas you have within the overall content view.
		 * Calling this function with a value of 0 will remove any previously set aspect
		 * ratios.
B
Benjamin Pasero 已提交
1768
		 */
1769
		setAspectRatio(aspectRatio: number, extraSize: Size): void;
B
Benjamin Pasero 已提交
1770
		/**
1771
		 * Controls whether to hide cursor when typing.
B
Benjamin Pasero 已提交
1772
		 */
1773
		setAutoHideCursor(autoHide: boolean): void;
B
Benjamin Pasero 已提交
1774
		/**
1775 1776 1777
		 * Sets whether the window menu bar should hide itself automatically. Once set the
		 * menu bar will only show when users press the single Alt key. If the menu bar is
		 * already visible, calling setAutoHideMenuBar(true) won't hide it immediately.
B
Benjamin Pasero 已提交
1778
		 */
1779
		setAutoHideMenuBar(hide: boolean): void;
B
Benjamin Pasero 已提交
1780
		/**
1781 1782 1783 1784 1785 1786
		 * Sets the background color of the window. See Setting backgroundColor.
		 */
		setBackgroundColor(backgroundColor: string): void;
		/**
		 * Resizes and moves the window to the supplied bounds. Any properties that are not
		 * supplied will default to their current values.
B
Benjamin Pasero 已提交
1787
		 */
1788 1789
		setBounds(bounds: Rectangle, animate?: boolean): void;
		setBrowserView(browserView: BrowserView): void;
B
Benjamin Pasero 已提交
1790
		/**
1791
		 * Sets whether the window can be manually closed by user. On Linux does nothing.
B
Benjamin Pasero 已提交
1792
		 */
1793
		setClosable(closable: boolean): void;
B
Benjamin Pasero 已提交
1794
		/**
1795 1796
		 * Resizes and moves the window's client area (e.g. the web page) to the supplied
		 * bounds.
B
Benjamin Pasero 已提交
1797
		 */
1798
		setContentBounds(bounds: Rectangle, animate?: boolean): void;
B
Benjamin Pasero 已提交
1799
		/**
1800 1801 1802
		 * Prevents the window contents from being captured by other apps. On macOS it sets
		 * the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls
		 * SetWindowDisplayAffinity with WDA_MONITOR.
B
Benjamin Pasero 已提交
1803
		 */
1804
		setContentProtection(enable: boolean): void;
1805
		/**
1806
		 * Resizes the window's client area (e.g. the web page) to width and height.
1807
		 */
1808
		setContentSize(width: number, height: number, animate?: boolean): void;
B
Benjamin Pasero 已提交
1809
		/**
1810 1811
		 * Specifies whether the window’s document has been edited, and the icon in title
		 * bar will become gray when set to true.
B
Benjamin Pasero 已提交
1812
		 */
1813
		setDocumentEdited(edited: boolean): void;
1814 1815 1816 1817
		/**
		 * Disable or enable the window.
		 */
		setEnabled(enable: boolean): void;
B
Benjamin Pasero 已提交
1818
		/**
1819
		 * Changes whether the window can be focused.
B
Benjamin Pasero 已提交
1820
		 */
1821
		setFocusable(focusable: boolean): void;
B
Benjamin Pasero 已提交
1822
		/**
1823
		 * Sets whether the window should be in fullscreen mode.
B
Benjamin Pasero 已提交
1824
		 */
1825
		setFullScreen(flag: boolean): void;
B
Benjamin Pasero 已提交
1826
		/**
1827 1828
		 * Sets whether the maximize/zoom window button toggles fullscreen mode or
		 * maximizes the window.
B
Benjamin Pasero 已提交
1829
		 */
1830
		setFullScreenable(fullscreenable: boolean): void;
B
Benjamin Pasero 已提交
1831
		/**
1832
		 * Sets whether the window should have a shadow. On Windows and Linux does nothing.
B
Benjamin Pasero 已提交
1833
		 */
1834
		setHasShadow(hasShadow: boolean): void;
B
Benjamin Pasero 已提交
1835
		/**
1836
		 * Changes window icon.
B
Benjamin Pasero 已提交
1837
		 */
1838
		setIcon(icon: NativeImage): void;
B
Benjamin Pasero 已提交
1839
		/**
1840 1841 1842
		 * Makes the window ignore all mouse events. All mouse events happened in this
		 * window will be passed to the window below this window, but if this window has
		 * focus, it will still receive keyboard events.
B
Benjamin Pasero 已提交
1843
		 */
1844
		setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
B
Benjamin Pasero 已提交
1845
		/**
1846
		 * Enters or leaves the kiosk mode.
B
Benjamin Pasero 已提交
1847
		 */
1848
		setKiosk(flag: boolean): void;
B
Benjamin Pasero 已提交
1849
		/**
1850 1851
		 * Sets whether the window can be manually maximized by user. On Linux does
		 * nothing.
B
Benjamin Pasero 已提交
1852
		 */
1853
		setMaximizable(maximizable: boolean): void;
B
Benjamin Pasero 已提交
1854
		/**
1855
		 * Sets the maximum size of window to width and height.
B
Benjamin Pasero 已提交
1856
		 */
1857
		setMaximumSize(width: number, height: number): void;
B
Benjamin Pasero 已提交
1858
		/**
1859 1860
		 * Sets the menu as the window's menu bar, setting it to null will remove the menu
		 * bar.
B
Benjamin Pasero 已提交
1861
		 */
1862
		setMenu(menu: (Menu) | (null)): void;
B
Benjamin Pasero 已提交
1863
		/**
1864 1865
		 * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
		 * can still bring up the menu bar by pressing the single Alt key.
B
Benjamin Pasero 已提交
1866
		 */
1867
		setMenuBarVisibility(visible: boolean): void;
B
Benjamin Pasero 已提交
1868
		/**
1869 1870
		 * Sets whether the window can be manually minimized by user. On Linux does
		 * nothing.
B
Benjamin Pasero 已提交
1871
		 */
1872
		setMinimizable(minimizable: boolean): void;
B
Benjamin Pasero 已提交
1873
		/**
1874
		 * Sets the minimum size of window to width and height.
B
Benjamin Pasero 已提交
1875
		 */
1876
		setMinimumSize(width: number, height: number): void;
B
Benjamin Pasero 已提交
1877
		/**
1878
		 * Sets whether the window can be moved by user. On Linux does nothing.
B
Benjamin Pasero 已提交
1879
		 */
1880
		setMovable(movable: boolean): void;
1881 1882 1883 1884
		/**
		 * Sets the opacity of the window. On Linux does nothing.
		 */
		setOpacity(opacity: number): void;
B
Benjamin Pasero 已提交
1885
		/**
1886 1887
		 * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
		 * convey some sort of application status or to passively notify the user.
B
Benjamin Pasero 已提交
1888
		 */
1889
		setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
B
Benjamin Pasero 已提交
1890
		/**
1891 1892
		 * Sets parent as current window's parent window, passing null will turn current
		 * window into a top-level window.
B
Benjamin Pasero 已提交
1893
		 */
1894
		setParentWindow(parent: BrowserWindow): void;
B
Benjamin Pasero 已提交
1895
		/**
1896
		 * Moves window to x and y.
B
Benjamin Pasero 已提交
1897
		 */
1898
		setPosition(x: number, y: number, animate?: boolean): void;
B
Benjamin Pasero 已提交
1899
		/**
1900 1901 1902 1903 1904 1905 1906 1907
		 * Sets progress value in progress bar. Valid range is [0, 1.0]. Remove progress
		 * bar when progress < 0; Change to indeterminate mode when progress > 1. On Linux
		 * platform, only supports Unity desktop environment, you need to specify the
		 * *.desktop file name to desktopName field in package.json. By default, it will
		 * assume app.getName().desktop. On Windows, a mode can be passed. Accepted values
		 * are none, normal, indeterminate, error, and paused. If you call setProgressBar
		 * without a mode set (but with a value within the valid range), normal will be
		 * assumed.
B
Benjamin Pasero 已提交
1908
		 */
1909
		setProgressBar(progress: number, options?: ProgressBarOptions): void;
B
Benjamin Pasero 已提交
1910
		/**
1911 1912
		 * Sets the pathname of the file the window represents, and the icon of the file
		 * will show in window's title bar.
B
Benjamin Pasero 已提交
1913
		 */
1914
		setRepresentedFilename(filename: string): void;
B
Benjamin Pasero 已提交
1915
		/**
1916
		 * Sets whether the window can be manually resized by user.
B
Benjamin Pasero 已提交
1917
		 */
1918
		setResizable(resizable: boolean): void;
1919 1920 1921 1922 1923 1924 1925 1926
		/**
		 * Setting a window shape determines the area within the window where the system
		 * permits drawing and user interaction. Outside of the given region, no pixels
		 * will be drawn and no mouse events will be registered. Mouse events outside of
		 * the region will not be received by that window, but will fall through to
		 * whatever is behind the window.
		 */
		setShape(rects: Rectangle[]): void;
B
Benjamin Pasero 已提交
1927
		/**
1928 1929 1930
		 * Changes the attachment point for sheets on macOS. By default, sheets are
		 * attached just below the window frame, but you may want to display them beneath a
		 * HTML-rendered toolbar. For example:
B
Benjamin Pasero 已提交
1931
		 */
1932
		setSheetOffset(offsetY: number, offsetX?: number): void;
1933 1934 1935 1936 1937
		/**
		 * Enters or leaves simple fullscreen mode. Simple fullscreen mode emulates the
		 * native fullscreen behavior found in versions of Mac OS X prior to Lion (10.7).
		 */
		setSimpleFullScreen(flag: boolean): void;
B
Benjamin Pasero 已提交
1938
		/**
1939 1940
		 * Resizes the window to width and height. If width or height are below any set
		 * minimum size constraints the window will snap to its minimum size.
B
Benjamin Pasero 已提交
1941
		 */
1942
		setSize(width: number, height: number, animate?: boolean): void;
B
Benjamin Pasero 已提交
1943
		/**
1944
		 * Makes the window not show in the taskbar.
B
Benjamin Pasero 已提交
1945
		 */
1946
		setSkipTaskbar(skip: boolean): void;
B
Benjamin Pasero 已提交
1947
		/**
1948 1949 1950 1951 1952 1953 1954 1955
		 * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
		 * of a window in a taskbar button layout. Returns a Boolean object indicates
		 * whether the thumbnail has been added successfully. The number of buttons in
		 * thumbnail toolbar should be no greater than 7 due to the limited room. Once you
		 * setup the thumbnail toolbar, the toolbar cannot be removed due to the platform's
		 * limitation. But you can call the API with an empty array to clean the buttons.
		 * The buttons is an array of Button objects: The flags is an array that can
		 * include following Strings:
B
Benjamin Pasero 已提交
1956
		 */
1957
		setThumbarButtons(buttons: ThumbarButton[]): boolean;
B
Benjamin Pasero 已提交
1958
		/**
1959 1960
		 * Sets the region of the window to show as the thumbnail image displayed when
		 * hovering over the window in the taskbar. You can reset the thumbnail to be the
1961 1962
		 * entire window by specifying an empty region: { x: 0, y: 0, width: 0, height: 0
		 * }.
B
Benjamin Pasero 已提交
1963
		 */
1964
		setThumbnailClip(region: Rectangle): void;
B
Benjamin Pasero 已提交
1965
		/**
1966 1967
		 * Sets the toolTip that is displayed when hovering over the window thumbnail in
		 * the taskbar.
B
Benjamin Pasero 已提交
1968
		 */
1969
		setThumbnailToolTip(toolTip: string): void;
B
Benjamin Pasero 已提交
1970
		/**
1971
		 * Changes the title of native window to title.
B
Benjamin Pasero 已提交
1972
		 */
1973
		setTitle(title: string): void;
B
Benjamin Pasero 已提交
1974
		/**
1975 1976 1977 1978
		 * Sets the touchBar layout for the current window. Specifying null or undefined
		 * clears the touch bar. This method only has an effect if the machine has a touch
		 * bar and is running on macOS 10.12.1+. Note: The TouchBar API is currently
		 * experimental and may change or be removed in future Electron releases.
B
Benjamin Pasero 已提交
1979
		 */
1980
		setTouchBar(touchBar: TouchBar): void;
B
Benjamin Pasero 已提交
1981
		/**
1982 1983
		 * Adds a vibrancy effect to the browser window. Passing null or an empty string
		 * will remove the vibrancy effect on the window.
B
Benjamin Pasero 已提交
1984
		 */
1985
		setVibrancy(type: 'appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark'): void;
J
Joao Moreno 已提交
1986
		/**
1987 1988
		 * Sets whether the window should be visible on all workspaces. Note: This API does
		 * nothing on Windows.
J
Joao Moreno 已提交
1989
		 */
1990 1991 1992 1993 1994 1995
		setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
		/**
		 * Sets whether the window traffic light buttons should be visible. This cannot be
		 * called when titleBarStyle is set to customButtonsOnHover.
		 */
		setWindowButtonVisibility(visible: boolean): void;
B
Benjamin Pasero 已提交
1996
		/**
1997
		 * Shows and gives focus to the window.
B
Benjamin Pasero 已提交
1998
		 */
1999
		show(): void;
B
Benjamin Pasero 已提交
2000
		/**
2001
		 * Same as webContents.showDefinitionForSelection().
B
Benjamin Pasero 已提交
2002
		 */
2003
		showDefinitionForSelection(): void;
B
Benjamin Pasero 已提交
2004
		/**
2005
		 * Shows the window but doesn't focus on it.
B
Benjamin Pasero 已提交
2006
		 */
2007
		showInactive(): void;
2008 2009 2010 2011 2012
		/**
		 * Toggles the visibility of the tab bar if native tabs are enabled and there is
		 * only one tab in the current window.
		 */
		toggleTabBar(): void;
B
Benjamin Pasero 已提交
2013
		/**
2014
		 * Unhooks all of the window messages.
B
Benjamin Pasero 已提交
2015
		 */
2016
		unhookAllWindowMessages(): void;
B
Benjamin Pasero 已提交
2017
		/**
2018
		 * Unhook the window message.
B
Benjamin Pasero 已提交
2019
		 */
2020
		unhookWindowMessage(message: number): void;
2021
		/**
2022
		 * Unmaximizes the window.
2023
		 */
2024 2025 2026 2027 2028 2029 2030
		unmaximize(): void;
		id: number;
		webContents: WebContents;
	}

	class BrowserWindowProxy extends EventEmitter {

2031
		// Docs: http://electronjs.org/docs/api/browser-window-proxy
2032

B
Benjamin Pasero 已提交
2033
		/**
2034
		 * Removes focus from the child window.
B
Benjamin Pasero 已提交
2035
		 */
2036
		blur(): void;
B
Benjamin Pasero 已提交
2037
		/**
2038
		 * Forcefully closes the child window without calling its unload event.
B
Benjamin Pasero 已提交
2039
		 */
2040
		close(): void;
B
Benjamin Pasero 已提交
2041
		/**
2042
		 * Evaluates the code in the child window.
B
Benjamin Pasero 已提交
2043
		 */
2044
		eval(code: string): void;
B
Benjamin Pasero 已提交
2045
		/**
2046
		 * Focuses the child window (brings the window to front).
B
Benjamin Pasero 已提交
2047
		 */
2048
		focus(): void;
B
Benjamin Pasero 已提交
2049
		/**
2050 2051 2052
		 * Sends a message to the child window with the specified origin or * for no origin
		 * preference. In addition to these methods, the child window implements
		 * window.opener object with no properties and a single method.
B
Benjamin Pasero 已提交
2053
		 */
2054
		postMessage(message: string, targetOrigin: string): void;
B
Benjamin Pasero 已提交
2055
		/**
2056
		 * Invokes the print dialog on the child window.
B
Benjamin Pasero 已提交
2057
		 */
2058 2059 2060 2061 2062 2063
		print(): void;
		closed: boolean;
	}

	interface Certificate {

2064
		// Docs: http://electronjs.org/docs/api/structures/certificate
2065

B
Benjamin Pasero 已提交
2066
		/**
2067
		 * PEM encoded data
B
Benjamin Pasero 已提交
2068
		 */
2069
		data: string;
B
Benjamin Pasero 已提交
2070
		/**
2071
		 * Fingerprint of the certificate
B
Benjamin Pasero 已提交
2072
		 */
2073
		fingerprint: string;
B
Benjamin Pasero 已提交
2074
		/**
2075
		 * Issuer principal
B
Benjamin Pasero 已提交
2076
		 */
2077
		issuer: CertificatePrincipal;
B
Benjamin Pasero 已提交
2078
		/**
2079
		 * Issuer certificate (if not self-signed)
B
Benjamin Pasero 已提交
2080
		 */
2081
		issuerCert: Certificate;
B
Benjamin Pasero 已提交
2082
		/**
2083
		 * Issuer's Common Name
B
Benjamin Pasero 已提交
2084
		 */
2085
		issuerName: string;
B
Benjamin Pasero 已提交
2086
		/**
2087
		 * Hex value represented string
B
Benjamin Pasero 已提交
2088
		 */
2089
		serialNumber: string;
B
Benjamin Pasero 已提交
2090
		/**
2091
		 * Subject principal
B
Benjamin Pasero 已提交
2092
		 */
2093
		subject: CertificatePrincipal;
B
Benjamin Pasero 已提交
2094
		/**
2095
		 * Subject's Common Name
B
Benjamin Pasero 已提交
2096
		 */
2097
		subjectName: string;
B
Benjamin Pasero 已提交
2098
		/**
2099
		 * End date of the certificate being valid in seconds
B
Benjamin Pasero 已提交
2100
		 */
2101
		validExpiry: number;
B
Benjamin Pasero 已提交
2102
		/**
2103
		 * Start date of the certificate being valid in seconds
B
Benjamin Pasero 已提交
2104
		 */
2105 2106 2107 2108 2109
		validStart: number;
	}

	interface CertificatePrincipal {

2110
		// Docs: http://electronjs.org/docs/api/structures/certificate-principal
2111

B
Benjamin Pasero 已提交
2112
		/**
2113
		 * Common Name.
B
Benjamin Pasero 已提交
2114
		 */
2115
		commonName: string;
B
Benjamin Pasero 已提交
2116
		/**
2117
		 * Country or region.
B
Benjamin Pasero 已提交
2118
		 */
2119
		country: string;
B
Benjamin Pasero 已提交
2120
		/**
2121
		 * Locality.
B
Benjamin Pasero 已提交
2122
		 */
2123
		locality: string;
B
Benjamin Pasero 已提交
2124
		/**
2125
		 * Organization names.
B
Benjamin Pasero 已提交
2126
		 */
2127
		organizations: string[];
B
Benjamin Pasero 已提交
2128
		/**
2129
		 * Organization Unit names.
B
Benjamin Pasero 已提交
2130
		 */
2131
		organizationUnits: string[];
B
Benjamin Pasero 已提交
2132
		/**
2133
		 * State or province.
B
Benjamin Pasero 已提交
2134
		 */
2135 2136 2137 2138 2139
		state: string;
	}

	class ClientRequest extends EventEmitter {

2140
		// Docs: http://electronjs.org/docs/api/client-request
2141

B
Benjamin Pasero 已提交
2142
		/**
2143 2144
		 * Emitted when the request is aborted. The abort event will not be fired if the
		 * request is already closed.
B
Benjamin Pasero 已提交
2145
		 */
2146 2147 2148 2149
		on(event: 'abort', listener: Function): this;
		once(event: 'abort', listener: Function): this;
		addListener(event: 'abort', listener: Function): this;
		removeListener(event: 'abort', listener: Function): this;
B
Benjamin Pasero 已提交
2150
		/**
2151 2152 2153
		 * Emitted as the last event in the HTTP request-response transaction. The close
		 * event indicates that no more events will be emitted on either the request or
		 * response objects.
B
Benjamin Pasero 已提交
2154
		 */
2155 2156 2157 2158
		on(event: 'close', listener: Function): this;
		once(event: 'close', listener: Function): this;
		addListener(event: 'close', listener: Function): this;
		removeListener(event: 'close', listener: Function): this;
B
Benjamin Pasero 已提交
2159
		/**
2160 2161 2162
		 * Emitted when the net module fails to issue a network request. Typically when the
		 * request object emits an error event, a close event will subsequently follow and
		 * no response object will be provided.
B
Benjamin Pasero 已提交
2163
		 */
2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183
		on(event: 'error', listener: (
			/**
			 * an error object providing some information about the failure.
			 */
			error: Error) => void): this;
		once(event: 'error', listener: (
			/**
			 * an error object providing some information about the failure.
			 */
			error: Error) => void): this;
		addListener(event: 'error', listener: (
			/**
			 * an error object providing some information about the failure.
			 */
			error: Error) => void): this;
		removeListener(event: 'error', listener: (
			/**
			 * an error object providing some information about the failure.
			 */
			error: Error) => void): this;
B
Benjamin Pasero 已提交
2184
		/**
2185 2186
		 * Emitted just after the last chunk of the request's data has been written into
		 * the request object.
B
Benjamin Pasero 已提交
2187
		 */
2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245
		on(event: 'finish', listener: Function): this;
		once(event: 'finish', listener: Function): this;
		addListener(event: 'finish', listener: Function): this;
		removeListener(event: 'finish', listener: Function): this;
		/**
		 * Emitted when an authenticating proxy is asking for user credentials. The
		 * callback function is expected to be called back with user credentials: Providing
		 * empty credentials will cancel the request and report an authentication error on
		 * the response object:
		 */
		on(event: 'login', listener: (authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
		once(event: 'login', listener: (authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
		addListener(event: 'login', listener: (authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
		removeListener(event: 'login', listener: (authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
		/**
		 * Emitted when there is redirection and the mode is manual. Calling
		 * request.followRedirect will continue with the redirection.
		 */
		on(event: 'redirect', listener: (statusCode: number,
			method: string,
			redirectUrl: string,
			responseHeaders: any) => void): this;
		once(event: 'redirect', listener: (statusCode: number,
			method: string,
			redirectUrl: string,
			responseHeaders: any) => void): this;
		addListener(event: 'redirect', listener: (statusCode: number,
			method: string,
			redirectUrl: string,
			responseHeaders: any) => void): this;
		removeListener(event: 'redirect', listener: (statusCode: number,
			method: string,
			redirectUrl: string,
			responseHeaders: any) => void): this;
		on(event: 'response', listener: (
			/**
			 * An object representing the HTTP response message.
			 */
			response: IncomingMessage) => void): this;
		once(event: 'response', listener: (
			/**
			 * An object representing the HTTP response message.
			 */
			response: IncomingMessage) => void): this;
		addListener(event: 'response', listener: (
			/**
			 * An object representing the HTTP response message.
			 */
			response: IncomingMessage) => void): this;
		removeListener(event: 'response', listener: (
			/**
			 * An object representing the HTTP response message.
			 */
			response: IncomingMessage) => void): this;
2246
		constructor(options: 'method' | 'url' | 'session' | 'partition' | 'protocol' | 'host' | 'hostname' | 'port' | 'path' | 'redirect');
B
Benjamin Pasero 已提交
2247
		/**
2248 2249 2250 2251
		 * Cancels an ongoing HTTP transaction. If the request has already emitted the
		 * close event, the abort operation will have no effect. Otherwise an ongoing event
		 * will emit abort and close events. Additionally, if there is an ongoing response
		 * object,it will emit the aborted event.
B
Benjamin Pasero 已提交
2252
		 */
2253
		abort(): void;
B
Benjamin Pasero 已提交
2254
		/**
2255 2256
		 * Sends the last chunk of the request data. Subsequent write or end operations
		 * will not be allowed. The finish event is emitted just after the end operation.
B
Benjamin Pasero 已提交
2257
		 */
2258
		end(chunk?: (string) | (Buffer), encoding?: string, callback?: Function): void;
B
Benjamin Pasero 已提交
2259
		/**
2260
		 * Continues any deferred redirection request when the redirection mode is manual.
B
Benjamin Pasero 已提交
2261
		 */
2262 2263
		followRedirect(): void;
		getHeader(name: string): Header;
2264 2265 2266 2267 2268
		/**
		 * You can use this method in conjunction with POST requests to get the progress of
		 * a file upload or other data transfer.
		 */
		getUploadProgress(): UploadProgress;
B
Benjamin Pasero 已提交
2269
		/**
2270 2271
		 * Removes a previously set extra header name. This method can be called only
		 * before first write. Trying to call it after the first write will throw an error.
B
Benjamin Pasero 已提交
2272
		 */
2273
		removeHeader(name: string): void;
B
Benjamin Pasero 已提交
2274
		/**
2275 2276 2277 2278
		 * Adds an extra HTTP header. The header name will issued as it is without
		 * lowercasing. It can be called only before first write. Calling this method after
		 * the first write will throw an error. If the passed value is not a String, its
		 * toString() method will be called to obtain the final value.
B
Benjamin Pasero 已提交
2279
		 */
2280
		setHeader(name: string, value: any): void;
B
Benjamin Pasero 已提交
2281
		/**
2282 2283 2284 2285 2286 2287 2288 2289
		 * callback is essentially a dummy function introduced in the purpose of keeping
		 * similarity with the Node.js API. It is called asynchronously in the next tick
		 * after chunk content have been delivered to the Chromium networking layer.
		 * Contrary to the Node.js implementation, it is not guaranteed that chunk content
		 * have been flushed on the wire before callback is called. Adds a chunk of data to
		 * the request body. The first write operation may cause the request headers to be
		 * issued on the wire. After the first write operation, it is not allowed to add or
		 * remove a custom header.
B
Benjamin Pasero 已提交
2290
		 */
2291
		write(chunk: (string) | (Buffer), encoding?: string, callback?: Function): void;
2292 2293 2294 2295 2296
		chunkedEncoding: boolean;
	}

	interface Clipboard extends EventEmitter {

2297
		// Docs: http://electronjs.org/docs/api/clipboard
2298 2299

		availableFormats(type?: string): string[];
B
Benjamin Pasero 已提交
2300
		/**
2301
		 * Clears the clipboard content.
B
Benjamin Pasero 已提交
2302
		 */
2303 2304 2305
		clear(type?: string): void;
		has(format: string, type?: string): boolean;
		read(format: string): string;
B
Benjamin Pasero 已提交
2306
		/**
2307 2308 2309
		 * Returns an Object containing title and url keys representing the bookmark in the
		 * clipboard. The title and url values will be empty strings when the bookmark is
		 * unavailable.
B
Benjamin Pasero 已提交
2310
		 */
2311 2312 2313 2314 2315 2316 2317
		readBookmark(): ReadBookmark;
		readBuffer(format: string): Buffer;
		readFindText(): string;
		readHTML(type?: string): string;
		readImage(type?: string): NativeImage;
		readRTF(type?: string): string;
		readText(type?: string): string;
B
Benjamin Pasero 已提交
2318
		/**
2319
		 * Writes data to the clipboard.
B
Benjamin Pasero 已提交
2320
		 */
2321
		write(data: Data, type?: string): void;
B
Benjamin Pasero 已提交
2322
		/**
2323 2324 2325
		 * Writes the title and url into the clipboard as a bookmark. Note: Most apps on
		 * Windows don't support pasting bookmarks into them so you can use clipboard.write
		 * to write both a bookmark and fallback text to the clipboard.
B
Benjamin Pasero 已提交
2326
		 */
2327
		writeBookmark(title: string, url: string, type?: string): void;
B
Benjamin Pasero 已提交
2328
		/**
2329
		 * Writes the buffer into the clipboard as format.
B
Benjamin Pasero 已提交
2330
		 */
2331
		writeBuffer(format: string, buffer: Buffer, type?: string): void;
B
Benjamin Pasero 已提交
2332
		/**
2333 2334
		 * Writes the text into the find pasteboard as plain text. This method uses
		 * synchronous IPC when called from the renderer process.
B
Benjamin Pasero 已提交
2335
		 */
2336
		writeFindText(text: string): void;
B
Benjamin Pasero 已提交
2337
		/**
2338
		 * Writes markup to the clipboard.
B
Benjamin Pasero 已提交
2339
		 */
2340
		writeHTML(markup: string, type?: string): void;
B
Benjamin Pasero 已提交
2341
		/**
2342
		 * Writes image to the clipboard.
B
Benjamin Pasero 已提交
2343
		 */
2344
		writeImage(image: NativeImage, type?: string): void;
B
Benjamin Pasero 已提交
2345
		/**
2346
		 * Writes the text into the clipboard in RTF.
B
Benjamin Pasero 已提交
2347
		 */
2348
		writeRTF(text: string, type?: string): void;
B
Benjamin Pasero 已提交
2349
		/**
2350
		 * Writes the text into the clipboard as plain text.
B
Benjamin Pasero 已提交
2351
		 */
2352 2353 2354 2355 2356
		writeText(text: string, type?: string): void;
	}

	interface ContentTracing extends EventEmitter {

2357
		// Docs: http://electronjs.org/docs/api/content-tracing
2358

B
Benjamin Pasero 已提交
2359
		/**
2360 2361 2362 2363 2364 2365 2366
		 * Get the current monitoring traced data. Child processes typically cache trace
		 * data and only rarely flush and send trace data back to the main process. This is
		 * because it may be an expensive operation to send the trace data over IPC and we
		 * would like to avoid unneeded runtime overhead from tracing. So, to end tracing,
		 * we must asynchronously ask all child processes to flush any pending trace data.
		 * Once all child processes have acknowledged the captureMonitoringSnapshot request
		 * the callback will be called with a file that contains the traced data.
B
Benjamin Pasero 已提交
2367
		 */
2368
		captureMonitoringSnapshot(resultFilePath: string, callback: (resultFilePath: string) => void): void;
B
Benjamin Pasero 已提交
2369
		/**
2370 2371 2372
		 * Get a set of category groups. The category groups can change as new code paths
		 * are reached. Once all child processes have acknowledged the getCategories
		 * request the callback is invoked with an array of category groups.
B
Benjamin Pasero 已提交
2373
		 */
2374
		getCategories(callback: (categories: string[]) => void): void;
B
Benjamin Pasero 已提交
2375
		/**
2376 2377 2378
		 * Get the maximum usage across processes of trace buffer as a percentage of the
		 * full state. When the TraceBufferUsage value is determined the callback is
		 * called.
B
Benjamin Pasero 已提交
2379
		 */
2380
		getTraceBufferUsage(callback: (value: number, percentage: number) => void): void;
B
Benjamin Pasero 已提交
2381
		/**
2382 2383 2384 2385
		 * Start monitoring on all processes. Monitoring begins immediately locally and
		 * asynchronously on child processes as soon as they receive the startMonitoring
		 * request. Once all child processes have acknowledged the startMonitoring request
		 * the callback will be called.
B
Benjamin Pasero 已提交
2386
		 */
2387
		startMonitoring(options: StartMonitoringOptions, callback: Function): void;
B
Benjamin Pasero 已提交
2388
		/**
2389 2390 2391
		 * Start recording on all processes. Recording begins immediately locally and
		 * asynchronously on child processes as soon as they receive the EnableRecording
		 * request. The callback will be called once all child processes have acknowledged
2392 2393
		 * the startRecording request.
		 */
2394
		startRecording(options: (TraceCategoriesAndOptions) | (TraceConfig), callback: Function): void;
B
Benjamin Pasero 已提交
2395
		/**
2396 2397
		 * Stop monitoring on all processes. Once all child processes have acknowledged the
		 * stopMonitoring request the callback is called.
B
Benjamin Pasero 已提交
2398
		 */
2399
		stopMonitoring(callback: Function): void;
B
Benjamin Pasero 已提交
2400
		/**
2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415
		 * Stop recording on all processes. Child processes typically cache trace data and
		 * only rarely flush and send trace data back to the main process. This helps to
		 * minimize the runtime overhead of tracing since sending trace data over IPC can
		 * be an expensive operation. So, to end tracing, we must asynchronously ask all
		 * child processes to flush any pending trace data. Once all child processes have
		 * acknowledged the stopRecording request, callback will be called with a file that
		 * contains the traced data. Trace data will be written into resultFilePath if it
		 * is not empty or into a temporary file. The actual file path will be passed to
		 * callback if it's not null.
		 */
		stopRecording(resultFilePath: string, callback: (resultFilePath: string) => void): void;
	}

	interface Cookie {

2416
		// Docs: http://electronjs.org/docs/api/structures/cookie
2417

B
Benjamin Pasero 已提交
2418
		/**
2419 2420
		 * The domain of the cookie; this will be normalized with a preceding dot so that
		 * it's also valid for subdomains.
B
Benjamin Pasero 已提交
2421
		 */
2422
		domain?: string;
B
Benjamin Pasero 已提交
2423
		/**
2424 2425
		 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
		 * Not provided for session cookies.
B
Benjamin Pasero 已提交
2426
		 */
2427
		expirationDate?: number;
2428
		/**
2429 2430
		 * Whether the cookie is a host-only cookie; this will only be true if no domain
		 * was passed.
2431
		 */
2432
		hostOnly?: boolean;
B
Benjamin Pasero 已提交
2433
		/**
2434
		 * Whether the cookie is marked as HTTP only.
B
Benjamin Pasero 已提交
2435
		 */
2436
		httpOnly?: boolean;
B
Benjamin Pasero 已提交
2437
		/**
2438
		 * The name of the cookie.
B
Benjamin Pasero 已提交
2439
		 */
2440
		name: string;
B
Benjamin Pasero 已提交
2441
		/**
2442
		 * The path of the cookie.
B
Benjamin Pasero 已提交
2443
		 */
2444
		path?: string;
B
Benjamin Pasero 已提交
2445
		/**
2446
		 * Whether the cookie is marked as secure.
B
Benjamin Pasero 已提交
2447
		 */
2448
		secure?: boolean;
B
Benjamin Pasero 已提交
2449
		/**
2450 2451
		 * Whether the cookie is a session cookie or a persistent cookie with an expiration
		 * date.
B
Benjamin Pasero 已提交
2452
		 */
2453
		session?: boolean;
B
Benjamin Pasero 已提交
2454
		/**
2455
		 * The value of the cookie.
B
Benjamin Pasero 已提交
2456
		 */
2457 2458 2459 2460 2461
		value: string;
	}

	class Cookies extends EventEmitter {

2462
		// Docs: http://electronjs.org/docs/api/cookies
2463

B
Benjamin Pasero 已提交
2464
		/**
2465 2466
		 * Emitted when a cookie is changed because it was added, edited, removed, or
		 * expired.
B
Benjamin Pasero 已提交
2467
		 */
2468 2469
		on(event: 'changed', listener: (event: Event,
			/**
2470
			 * The cookie that was changed.
2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482
			 */
			cookie: Cookie,
			/**
			 * The cause of the change with one of the following values:
			 */
			cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
			/**
			 * `true` if the cookie was removed, `false` otherwise.
			 */
			removed: boolean) => void): this;
		once(event: 'changed', listener: (event: Event,
			/**
2483
			 * The cookie that was changed.
2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495
			 */
			cookie: Cookie,
			/**
			 * The cause of the change with one of the following values:
			 */
			cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
			/**
			 * `true` if the cookie was removed, `false` otherwise.
			 */
			removed: boolean) => void): this;
		addListener(event: 'changed', listener: (event: Event,
			/**
2496
			 * The cookie that was changed.
2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508
			 */
			cookie: Cookie,
			/**
			 * The cause of the change with one of the following values:
			 */
			cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
			/**
			 * `true` if the cookie was removed, `false` otherwise.
			 */
			removed: boolean) => void): this;
		removeListener(event: 'changed', listener: (event: Event,
			/**
2509
			 * The cookie that was changed.
2510 2511 2512 2513 2514 2515 2516 2517 2518 2519
			 */
			cookie: Cookie,
			/**
			 * The cause of the change with one of the following values:
			 */
			cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
			/**
			 * `true` if the cookie was removed, `false` otherwise.
			 */
			removed: boolean) => void): this;
B
Benjamin Pasero 已提交
2520
		/**
2521
		 * Writes any unwritten cookies data to disk.
B
Benjamin Pasero 已提交
2522
		 */
2523
		flushStore(callback: Function): void;
B
Benjamin Pasero 已提交
2524
		/**
2525 2526
		 * Sends a request to get all cookies matching filter, callback will be called with
		 * callback(error, cookies) on complete.
B
Benjamin Pasero 已提交
2527
		 */
2528
		get(filter: Filter, callback: (error: Error, cookies: Cookie[]) => void): void;
B
Benjamin Pasero 已提交
2529
		/**
2530 2531
		 * Removes the cookies matching url and name, callback will called with callback()
		 * on complete.
B
Benjamin Pasero 已提交
2532
		 */
2533
		remove(url: string, name: string, callback: Function): void;
B
Benjamin Pasero 已提交
2534
		/**
2535 2536
		 * Sets a cookie with details, callback will be called with callback(error) on
		 * complete.
B
Benjamin Pasero 已提交
2537
		 */
2538 2539 2540 2541 2542
		set(details: Details, callback: (error: Error) => void): void;
	}

	interface CPUUsage {

2543
		// Docs: http://electronjs.org/docs/api/structures/cpu-usage
2544

B
Benjamin Pasero 已提交
2545
		/**
2546
		 * The number of average idle cpu wakeups per second since the last call to
2547
		 * getCPUUsage. First call returns 0. Will always return 0 on Windows.
B
Benjamin Pasero 已提交
2548
		 */
2549
		idleWakeupsPerSecond: number;
B
Benjamin Pasero 已提交
2550
		/**
2551
		 * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
B
Benjamin Pasero 已提交
2552
		 */
2553
		percentCPUUsage: number;
B
Benjamin Pasero 已提交
2554 2555
	}

2556 2557
	interface CrashReport {

2558
		// Docs: http://electronjs.org/docs/api/structures/crash-report
B
Benjamin Pasero 已提交
2559

2560 2561
		date: Date;
		id: string;
B
Benjamin Pasero 已提交
2562 2563
	}

2564 2565
	interface CrashReporter extends EventEmitter {

2566
		// Docs: http://electronjs.org/docs/api/crash-reporter
B
Benjamin Pasero 已提交
2567

2568 2569 2570 2571 2572 2573 2574 2575
		/**
		 * Set an extra parameter to be sent with the crash report. The values specified
		 * here will be sent in addition to any values set via the extra option when start
		 * was called. This API is only available on macOS, if you need to add/update extra
		 * parameters on Linux and Windows after your first call to start you can call
		 * start again with the updated extra options.
		 */
		addExtraParameter(key: string, value: string): void;
2576
		/**
2577 2578 2579 2580
		 * Returns the date and ID of the last crash report. Only crash reports that have
		 * been uploaded will be returned; even if a crash report is present on disk it
		 * will not be returned until it is uploaded. In the case that there are no
		 * uploaded reports, null is returned.
2581
		 */
2582
		getLastCrashReport(): CrashReport;
2583 2584 2585 2586
		/**
		 * See all of the current parameters being passed to the crash reporter.
		 */
		getParameters(): void;
B
Benjamin Pasero 已提交
2587
		/**
2588 2589
		 * Returns all uploaded crash reports. Each report contains the date and uploaded
		 * ID.
B
Benjamin Pasero 已提交
2590
		 */
2591
		getUploadedReports(): CrashReport[];
B
Benjamin Pasero 已提交
2592
		/**
2593 2594 2595 2596
		 * Note: This API can only be called from the main process.
		 */
		getUploadToServer(): boolean;
		/**
2597 2598
		 * Remove a extra parameter from the current set of parameters so that it will not
		 * be sent with the crash report.
2599
		 */
2600
		removeExtraParameter(key: string): void;
2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620
		/**
		 * This would normally be controlled by user preferences. This has no effect if
		 * called before start is called. Note: This API can only be called from the main
		 * process.
		 */
		setUploadToServer(uploadToServer: boolean): void;
		/**
		 * You are required to call this method before using any other crashReporter APIs
		 * and in each process (main/renderer) from which you want to collect crash
		 * reports. You can pass different options to crashReporter.start when calling from
		 * different processes. Note Child processes created via the child_process module
		 * will not have access to the Electron modules. Therefore, to collect crash
		 * reports from them, use process.crashReporter.start instead. Pass the same
		 * options as above along with an additional one called crashesDirectory that
		 * should point to a directory to store the crash reports temporarily. You can test
		 * this out by calling process.crash() to crash the child process. Note: To collect
		 * crash reports from child process in Windows, you need to add this extra code as
		 * well. This will start the process that will monitor and send the crash reports.
		 * Replace submitURL, productName and crashesDirectory with appropriate values.
		 * Note: If you need send additional/updated extra parameters after your first call
2621
		 * start you can call addExtraParameter on macOS or call start again with the
2622 2623 2624 2625 2626 2627 2628 2629
		 * new/updated extra parameters on Linux and Windows. Note: On macOS, Electron uses
		 * a new crashpad client for crash collection and reporting. If you want to enable
		 * crash reporting, initializing crashpad from the main process using
		 * crashReporter.start is required regardless of which process you want to collect
		 * crashes from. Once initialized this way, the crashpad handler collects crashes
		 * from all processes. You still have to call crashReporter.start from the renderer
		 * or child process, otherwise crashes from them will get reported without
		 * companyName, productName or any of the extra information.
B
Benjamin Pasero 已提交
2630
		 */
2631
		start(options: CrashReporterStartOptions): void;
B
Benjamin Pasero 已提交
2632 2633
	}

2634
	class Debugger extends EventEmitter {
B
Benjamin Pasero 已提交
2635

2636
		// Docs: http://electronjs.org/docs/api/debugger
B
Benjamin Pasero 已提交
2637 2638

		/**
2639 2640
		 * Emitted when debugging session is terminated. This happens either when
		 * webContents is closed or devtools is invoked for the attached webContents.
B
Benjamin Pasero 已提交
2641
		 */
2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661
		on(event: 'detach', listener: (event: Event,
			/**
			 * Reason for detaching debugger.
			 */
			reason: string) => void): this;
		once(event: 'detach', listener: (event: Event,
			/**
			 * Reason for detaching debugger.
			 */
			reason: string) => void): this;
		addListener(event: 'detach', listener: (event: Event,
			/**
			 * Reason for detaching debugger.
			 */
			reason: string) => void): this;
		removeListener(event: 'detach', listener: (event: Event,
			/**
			 * Reason for detaching debugger.
			 */
			reason: string) => void): this;
B
Benjamin Pasero 已提交
2662
		/**
2663
		 * Emitted whenever debugging target issues instrumentation event.
B
Benjamin Pasero 已提交
2664
		 */
2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704
		on(event: 'message', listener: (event: Event,
			/**
			 * Method name.
			 */
			method: string,
			/**
			 * Event parameters defined by the 'parameters' attribute in the remote debugging
			 * protocol.
			 */
			params: any) => void): this;
		once(event: 'message', listener: (event: Event,
			/**
			 * Method name.
			 */
			method: string,
			/**
			 * Event parameters defined by the 'parameters' attribute in the remote debugging
			 * protocol.
			 */
			params: any) => void): this;
		addListener(event: 'message', listener: (event: Event,
			/**
			 * Method name.
			 */
			method: string,
			/**
			 * Event parameters defined by the 'parameters' attribute in the remote debugging
			 * protocol.
			 */
			params: any) => void): this;
		removeListener(event: 'message', listener: (event: Event,
			/**
			 * Method name.
			 */
			method: string,
			/**
			 * Event parameters defined by the 'parameters' attribute in the remote debugging
			 * protocol.
			 */
			params: any) => void): this;
B
Benjamin Pasero 已提交
2705
		/**
2706
		 * Attaches the debugger to the webContents.
B
Benjamin Pasero 已提交
2707
		 */
2708
		attach(protocolVersion?: string): void;
B
Benjamin Pasero 已提交
2709
		/**
2710
		 * Detaches the debugger from the webContents.
B
Benjamin Pasero 已提交
2711
		 */
2712 2713
		detach(): void;
		isAttached(): boolean;
B
Benjamin Pasero 已提交
2714
		/**
2715
		 * Send given command to the debugging target.
B
Benjamin Pasero 已提交
2716
		 */
2717 2718 2719 2720 2721
		sendCommand(method: string, commandParams?: any, callback?: (error: any, result: any) => void): void;
	}

	interface DesktopCapturer extends EventEmitter {

2722
		// Docs: http://electronjs.org/docs/api/desktop-capturer
2723

B
Benjamin Pasero 已提交
2724
		/**
2725 2726 2727 2728
		 * Starts gathering information about all available desktop media sources, and
		 * calls callback(error, sources) when finished. sources is an array of
		 * DesktopCapturerSource objects, each DesktopCapturerSource represents a screen or
		 * an individual window that can be captured.
B
Benjamin Pasero 已提交
2729
		 */
2730 2731 2732 2733 2734
		getSources(options: SourcesOptions, callback: (error: Error, sources: DesktopCapturerSource[]) => void): void;
	}

	interface DesktopCapturerSource {

2735
		// Docs: http://electronjs.org/docs/api/structures/desktop-capturer-source
2736

2737 2738 2739 2740 2741 2742
		/**
		 * A unique identifier that will correspond to the id of the matching returned by
		 * the . On some platforms, this is equivalent to the XX portion of the id field
		 * above and on others it will differ. It will be an empty string if not available.
		 */
		display_id: string;
B
Benjamin Pasero 已提交
2743
		/**
2744 2745 2746 2747
		 * The identifier of a window or screen that can be used as a chromeMediaSourceId
		 * constraint when calling [navigator.webkitGetUserMedia]. The format of the
		 * identifier will be window:XX or screen:XX, where XX is a random generated
		 * number.
B
Benjamin Pasero 已提交
2748
		 */
2749
		id: string;
B
Benjamin Pasero 已提交
2750
		/**
2751 2752
		 * A screen source will be named either Entire Screen or Screen , while the name of
		 * a window source will match the window title.
B
Benjamin Pasero 已提交
2753
		 */
2754
		name: string;
B
Benjamin Pasero 已提交
2755
		/**
2756 2757 2758 2759
		 * A thumbnail image. There is no guarantee that the size of the thumbnail is the
		 * same as the thumbnailSize specified in the options passed to
		 * desktopCapturer.getSources. The actual size depends on the scale of the screen
		 * or window.
B
Benjamin Pasero 已提交
2760
		 */
2761 2762 2763 2764 2765
		thumbnail: NativeImage;
	}

	interface Dialog extends EventEmitter {

2766
		// Docs: http://electronjs.org/docs/api/dialog
2767

B
Benjamin Pasero 已提交
2768
		/**
2769 2770 2771 2772 2773
		 * On macOS, this displays a modal dialog that shows a message and certificate
		 * information, and gives the user the option of trusting/importing the
		 * certificate. If you provide a browserWindow argument the dialog will be attached
		 * to the parent window, making it modal. On Windows the options are more limited,
		 * due to the Win32 APIs used:
B
Benjamin Pasero 已提交
2774
		 */
2775
		showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions, callback: Function): void;
B
Benjamin Pasero 已提交
2776
		/**
2777 2778 2779 2780 2781
		 * On macOS, this displays a modal dialog that shows a message and certificate
		 * information, and gives the user the option of trusting/importing the
		 * certificate. If you provide a browserWindow argument the dialog will be attached
		 * to the parent window, making it modal. On Windows the options are more limited,
		 * due to the Win32 APIs used:
B
Benjamin Pasero 已提交
2782
		 */
2783
		showCertificateTrustDialog(options: CertificateTrustDialogOptions, callback: Function): void;
B
Benjamin Pasero 已提交
2784
		/**
2785 2786 2787 2788 2789
		 * On macOS, this displays a modal dialog that shows a message and certificate
		 * information, and gives the user the option of trusting/importing the
		 * certificate. If you provide a browserWindow argument the dialog will be attached
		 * to the parent window, making it modal. On Windows the options are more limited,
		 * due to the Win32 APIs used:
B
Benjamin Pasero 已提交
2790
		 */
2791
		showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions, callback: Function): void;
B
Benjamin Pasero 已提交
2792
		/**
2793 2794
		 * Displays a modal dialog that shows an error message. This API can be called
		 * safely before the ready event the app module emits, it is usually used to report
2795
		 * errors in early stage of startup. If called before the app readyevent on Linux,
2796
		 * the message will be emitted to stderr, and no GUI dialog will appear.
B
Benjamin Pasero 已提交
2797
		 */
2798
		showErrorBox(title: string, content: string): void;
B
Benjamin Pasero 已提交
2799
		/**
2800 2801 2802 2803 2804 2805
		 * Shows a message box, it will block the process until the message box is closed.
		 * It returns the index of the clicked button. The browserWindow argument allows
		 * the dialog to attach itself to a parent window, making it modal. If a callback
		 * is passed, the dialog will not block the process. The API call will be
		 * asynchronous and the result will be passed via callback(response).
		 */
2806
		showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number;
2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822
		/**
		 * Shows a message box, it will block the process until the message box is closed.
		 * It returns the index of the clicked button. The browserWindow argument allows
		 * the dialog to attach itself to a parent window, making it modal. If a callback
		 * is passed, the dialog will not block the process. The API call will be
		 * asynchronous and the result will be passed via callback(response).
		 */
		showMessageBox(options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number;
		/**
		 * The browserWindow argument allows the dialog to attach itself to a parent
		 * window, making it modal. The filters specifies an array of file types that can
		 * be displayed or selected when you want to limit the user to a specific type. For
		 * example: The extensions array should contain extensions without wildcards or
		 * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use
		 * the '*' wildcard (no other wildcard is supported). If a callback is passed, the
		 * API call will be asynchronous and the result will be passed via
2823
		 * callback(filenames). Note: On Windows and Linux an open dialog can not be both a
2824 2825 2826
		 * file selector and a directory selector, so if you set properties to ['openFile',
		 * 'openDirectory'] on these platforms, a directory selector will be shown.
		 */
2827
		showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: (filePaths: string[], bookmarks: string[]) => void): (string[]) | (undefined);
2828 2829 2830 2831 2832 2833 2834 2835
		/**
		 * The browserWindow argument allows the dialog to attach itself to a parent
		 * window, making it modal. The filters specifies an array of file types that can
		 * be displayed or selected when you want to limit the user to a specific type. For
		 * example: The extensions array should contain extensions without wildcards or
		 * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use
		 * the '*' wildcard (no other wildcard is supported). If a callback is passed, the
		 * API call will be asynchronous and the result will be passed via
2836
		 * callback(filenames). Note: On Windows and Linux an open dialog can not be both a
2837 2838 2839
		 * file selector and a directory selector, so if you set properties to ['openFile',
		 * 'openDirectory'] on these platforms, a directory selector will be shown.
		 */
2840
		showOpenDialog(options: OpenDialogOptions, callback?: (filePaths: string[], bookmarks: string[]) => void): (string[]) | (undefined);
2841 2842 2843 2844 2845
		/**
		 * The browserWindow argument allows the dialog to attach itself to a parent
		 * window, making it modal. The filters specifies an array of file types that can
		 * be displayed, see dialog.showOpenDialog for an example. If a callback is passed,
		 * the API call will be asynchronous and the result will be passed via
2846
		 * callback(filename).
2847
		 */
2848
		showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback?: (filename: string, bookmark: string) => void): (string) | (undefined);
2849 2850 2851 2852 2853
		/**
		 * The browserWindow argument allows the dialog to attach itself to a parent
		 * window, making it modal. The filters specifies an array of file types that can
		 * be displayed, see dialog.showOpenDialog for an example. If a callback is passed,
		 * the API call will be asynchronous and the result will be passed via
2854
		 * callback(filename).
2855
		 */
2856
		showSaveDialog(options: SaveDialogOptions, callback?: (filename: string, bookmark: string) => void): (string) | (undefined);
2857 2858 2859 2860
	}

	interface Display {

2861
		// Docs: http://electronjs.org/docs/api/structures/display
2862 2863

		bounds: Rectangle;
B
Benjamin Pasero 已提交
2864
		/**
2865
		 * Unique identifier associated with the display.
B
Benjamin Pasero 已提交
2866
		 */
2867
		id: number;
B
Benjamin Pasero 已提交
2868
		/**
2869
		 * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
B
Benjamin Pasero 已提交
2870
		 */
2871
		rotation: number;
B
Benjamin Pasero 已提交
2872
		/**
2873
		 * Output device's pixel scale factor.
B
Benjamin Pasero 已提交
2874
		 */
2875 2876
		scaleFactor: number;
		size: Size;
B
Benjamin Pasero 已提交
2877
		/**
2878
		 * Can be available, unavailable, unknown.
B
Benjamin Pasero 已提交
2879
		 */
2880 2881 2882 2883 2884 2885 2886
		touchSupport: ('available' | 'unavailable' | 'unknown');
		workArea: Rectangle;
		workAreaSize: Size;
	}

	class DownloadItem extends EventEmitter {

2887
		// Docs: http://electronjs.org/docs/api/download-item
2888

B
Benjamin Pasero 已提交
2889
		/**
2890 2891 2892
		 * Emitted when the download is in a terminal state. This includes a completed
		 * download, a cancelled download (via downloadItem.cancel()), and interrupted
		 * download that can't be resumed. The state can be one of following:
B
Benjamin Pasero 已提交
2893
		 */
2894
		on(event: 'done', listener: (event: Event,
2895 2896 2897 2898
			/**
			 * Can be `completed`, `cancelled` or `interrupted`.
			 */
			state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
2899
		once(event: 'done', listener: (event: Event,
2900 2901 2902 2903
			/**
			 * Can be `completed`, `cancelled` or `interrupted`.
			 */
			state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
2904
		addListener(event: 'done', listener: (event: Event,
2905 2906 2907 2908
			/**
			 * Can be `completed`, `cancelled` or `interrupted`.
			 */
			state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
2909
		removeListener(event: 'done', listener: (event: Event,
2910 2911 2912 2913
			/**
			 * Can be `completed`, `cancelled` or `interrupted`.
			 */
			state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
B
Benjamin Pasero 已提交
2914
		/**
2915 2916
		 * Emitted when the download has been updated and is not done. The state can be one
		 * of following:
B
Benjamin Pasero 已提交
2917
		 */
2918
		on(event: 'updated', listener: (event: Event,
2919 2920 2921 2922
			/**
			 * Can be `progressing` or `interrupted`.
			 */
			state: ('progressing' | 'interrupted')) => void): this;
2923
		once(event: 'updated', listener: (event: Event,
2924 2925 2926 2927
			/**
			 * Can be `progressing` or `interrupted`.
			 */
			state: ('progressing' | 'interrupted')) => void): this;
2928
		addListener(event: 'updated', listener: (event: Event,
2929 2930 2931 2932
			/**
			 * Can be `progressing` or `interrupted`.
			 */
			state: ('progressing' | 'interrupted')) => void): this;
2933
		removeListener(event: 'updated', listener: (event: Event,
2934 2935 2936 2937
			/**
			 * Can be `progressing` or `interrupted`.
			 */
			state: ('progressing' | 'interrupted')) => void): this;
B
Benjamin Pasero 已提交
2938
		/**
2939
		 * Cancels the download operation.
B
Benjamin Pasero 已提交
2940
		 */
2941
		cancel(): void;
2942
		canResume(): boolean;
2943 2944
		getContentDisposition(): string;
		getETag(): string;
B
Benjamin Pasero 已提交
2945
		/**
2946 2947 2948
		 * Note: The file name is not always the same as the actual one saved in local
		 * disk. If user changes the file name in a prompted download saving dialog, the
		 * actual name of saved file will be different.
B
Benjamin Pasero 已提交
2949
		 */
2950 2951 2952 2953 2954 2955
		getFilename(): string;
		getLastModifiedTime(): string;
		getMimeType(): string;
		getReceivedBytes(): number;
		getSavePath(): string;
		getStartTime(): number;
B
Benjamin Pasero 已提交
2956
		/**
2957 2958
		 * Note: The following methods are useful specifically to resume a cancelled item
		 * when session is restarted.
B
Benjamin Pasero 已提交
2959
		 */
2960
		getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
B
Benjamin Pasero 已提交
2961
		/**
2962
		 * If the size is unknown, it returns 0.
B
Benjamin Pasero 已提交
2963
		 */
2964 2965 2966 2967 2968
		getTotalBytes(): number;
		getURL(): string;
		getURLChain(): string[];
		hasUserGesture(): boolean;
		isPaused(): boolean;
B
Benjamin Pasero 已提交
2969
		/**
2970
		 * Pauses the download.
B
Benjamin Pasero 已提交
2971
		 */
2972
		pause(): void;
2973
		/**
2974 2975 2976 2977
		 * Resumes the download that has been paused. Note: To enable resumable downloads
		 * the server you are downloading from must support range requests and provide both
		 * Last-Modified and ETag header values. Otherwise resume() will dismiss previously
		 * received bytes and restart the download from the beginning.
2978
		 */
2979
		resume(): void;
2980
		/**
2981 2982 2983
		 * The API is only available in session's will-download callback function. If user
		 * doesn't set the save path via the API, Electron will use the original routine to
		 * determine the save path(Usually prompts a save dialog).
2984
		 */
2985
		setSavePath(path: string): void;
B
Benjamin Pasero 已提交
2986 2987
	}

2988 2989
	interface FileFilter {

2990
		// Docs: http://electronjs.org/docs/api/structures/file-filter
2991 2992 2993

		extensions: string[];
		name: string;
B
Benjamin Pasero 已提交
2994 2995
	}

2996 2997
	interface GlobalShortcut extends EventEmitter {

2998
		// Docs: http://electronjs.org/docs/api/global-shortcut
2999

B
Benjamin Pasero 已提交
3000
		/**
3001 3002 3003
		 * When the accelerator is already taken by other applications, this call will
		 * still return false. This behavior is intended by operating systems, since they
		 * don't want applications to fight for global shortcuts.
B
Benjamin Pasero 已提交
3004
		 */
3005
		isRegistered(accelerator: Accelerator): boolean;
B
Benjamin Pasero 已提交
3006
		/**
3007 3008 3009 3010
		 * Registers a global shortcut of accelerator. The callback is called when the
		 * registered shortcut is pressed by the user. When the accelerator is already
		 * taken by other applications, this call will silently fail. This behavior is
		 * intended by operating systems, since they don't want applications to fight for
B
Benjamin Pasero 已提交
3011 3012 3013
		 * global shortcuts. The following accelerators will not be registered successfully
		 * on macOS 10.14 Mojave unless the app has been authorized as a trusted
		 * accessibility client:
B
Benjamin Pasero 已提交
3014
		 */
3015
		register(accelerator: Accelerator, callback: Function): void;
B
Benjamin Pasero 已提交
3016
		/**
3017
		 * Unregisters the global shortcut of accelerator.
B
Benjamin Pasero 已提交
3018
		 */
3019
		unregister(accelerator: Accelerator): void;
B
Benjamin Pasero 已提交
3020
		/**
3021
		 * Unregisters all of the global shortcuts.
B
Benjamin Pasero 已提交
3022
		 */
3023 3024 3025 3026 3027
		unregisterAll(): void;
	}

	interface GPUFeatureStatus {

3028
		// Docs: http://electronjs.org/docs/api/structures/gpu-feature-status
3029

B
Benjamin Pasero 已提交
3030
		/**
3031
		 * Canvas.
B
Benjamin Pasero 已提交
3032
		 */
3033
		'2d_canvas': string;
B
Benjamin Pasero 已提交
3034
		/**
3035
		 * Flash.
B
Benjamin Pasero 已提交
3036
		 */
3037
		flash_3d: string;
B
Benjamin Pasero 已提交
3038
		/**
3039
		 * Flash Stage3D.
B
Benjamin Pasero 已提交
3040
		 */
3041
		flash_stage3d: string;
B
Benjamin Pasero 已提交
3042
		/**
3043
		 * Flash Stage3D Baseline profile.
B
Benjamin Pasero 已提交
3044
		 */
3045
		flash_stage3d_baseline: string;
B
Benjamin Pasero 已提交
3046
		/**
3047
		 * Compositing.
B
Benjamin Pasero 已提交
3048
		 */
3049
		gpu_compositing: string;
B
Benjamin Pasero 已提交
3050
		/**
3051
		 * Multiple Raster Threads.
B
Benjamin Pasero 已提交
3052
		 */
3053
		multiple_raster_threads: string;
B
Benjamin Pasero 已提交
3054
		/**
3055
		 * Native GpuMemoryBuffers.
B
Benjamin Pasero 已提交
3056
		 */
3057
		native_gpu_memory_buffers: string;
B
Benjamin Pasero 已提交
3058
		/**
3059
		 * Rasterization.
B
Benjamin Pasero 已提交
3060
		 */
3061
		rasterization: string;
B
Benjamin Pasero 已提交
3062
		/**
3063
		 * Video Decode.
B
Benjamin Pasero 已提交
3064
		 */
3065
		video_decode: string;
B
Benjamin Pasero 已提交
3066
		/**
3067
		 * Video Encode.
B
Benjamin Pasero 已提交
3068
		 */
3069
		video_encode: string;
B
Benjamin Pasero 已提交
3070
		/**
3071
		 * VPx Video Decode.
B
Benjamin Pasero 已提交
3072
		 */
3073
		vpx_decode: string;
B
Benjamin Pasero 已提交
3074
		/**
3075
		 * WebGL.
B
Benjamin Pasero 已提交
3076
		 */
3077
		webgl: string;
B
Benjamin Pasero 已提交
3078
		/**
3079
		 * WebGL2.
B
Benjamin Pasero 已提交
3080
		 */
3081 3082 3083
		webgl2: string;
	}

3084 3085
	interface InAppPurchase extends EventEmitter {

3086
		// Docs: http://electronjs.org/docs/api/in-app-purchase
3087 3088 3089 3090 3091 3092

		/**
		 * Emitted when one or more transactions have been updated.
		 */
		on(event: 'transactions-updated', listener: (event: Event,
			/**
3093
			 * Array of objects.
3094 3095 3096 3097
			 */
			transactions: Transaction[]) => void): this;
		once(event: 'transactions-updated', listener: (event: Event,
			/**
3098
			 * Array of objects.
3099 3100 3101 3102
			 */
			transactions: Transaction[]) => void): this;
		addListener(event: 'transactions-updated', listener: (event: Event,
			/**
3103
			 * Array of objects.
3104 3105 3106 3107
			 */
			transactions: Transaction[]) => void): this;
		removeListener(event: 'transactions-updated', listener: (event: Event,
			/**
3108
			 * Array of objects.
3109 3110 3111
			 */
			transactions: Transaction[]) => void): this;
		canMakePayments(): boolean;
3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123
		/**
		 * Completes all pending transactions.
		 */
		finishAllTransactions(): void;
		/**
		 * Completes the pending transactions corresponding to the date.
		 */
		finishTransactionByDate(date: string): void;
		/**
		 * Retrieves the product descriptions.
		 */
		getProducts(productIDs: string[], callback: (products: Product[]) => void): void;
3124
		getReceiptURL(): string;
3125 3126 3127 3128
		/**
		 * You should listen for the transactions-updated event as soon as possible and
		 * certainly before you call purchaseProduct.
		 */
3129 3130 3131
		purchaseProduct(productID: string, quantity?: number, callback?: (isProductValid: boolean) => void): void;
	}

3132 3133
	class IncomingMessage extends EventEmitter {

3134
		// Docs: http://electronjs.org/docs/api/incoming-message
3135

B
Benjamin Pasero 已提交
3136
		/**
3137
		 * Emitted when a request has been canceled during an ongoing HTTP transaction.
B
Benjamin Pasero 已提交
3138
		 */
3139 3140 3141 3142
		on(event: 'aborted', listener: Function): this;
		once(event: 'aborted', listener: Function): this;
		addListener(event: 'aborted', listener: Function): this;
		removeListener(event: 'aborted', listener: Function): this;
B
Benjamin Pasero 已提交
3143
		/**
3144 3145
		 * The data event is the usual method of transferring response data into
		 * applicative code.
B
Benjamin Pasero 已提交
3146
		 */
3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166
		on(event: 'data', listener: (
			/**
			 * A chunk of response body's data.
			 */
			chunk: Buffer) => void): this;
		once(event: 'data', listener: (
			/**
			 * A chunk of response body's data.
			 */
			chunk: Buffer) => void): this;
		addListener(event: 'data', listener: (
			/**
			 * A chunk of response body's data.
			 */
			chunk: Buffer) => void): this;
		removeListener(event: 'data', listener: (
			/**
			 * A chunk of response body's data.
			 */
			chunk: Buffer) => void): this;
B
Benjamin Pasero 已提交
3167
		/**
3168
		 * Indicates that response body has ended.
B
Benjamin Pasero 已提交
3169
		 */
3170 3171 3172 3173
		on(event: 'end', listener: Function): this;
		once(event: 'end', listener: Function): this;
		addListener(event: 'end', listener: Function): this;
		removeListener(event: 'end', listener: Function): this;
B
Benjamin Pasero 已提交
3174
		/**
3175 3176 3177 3178 3179
		 * error Error - Typically holds an error string identifying failure root cause.
		 * Emitted when an error was encountered while streaming response data events. For
		 * instance, if the server closes the underlying while the response is still
		 * streaming, an error event will be emitted on the response object and a close
		 * event will subsequently follow on the request object.
B
Benjamin Pasero 已提交
3180
		 */
3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194
		on(event: 'error', listener: Function): this;
		once(event: 'error', listener: Function): this;
		addListener(event: 'error', listener: Function): this;
		removeListener(event: 'error', listener: Function): this;
		headers: any;
		httpVersion: string;
		httpVersionMajor: number;
		httpVersionMinor: number;
		statusCode: number;
		statusMessage: string;
	}

	interface IOCounters {

3195
		// Docs: http://electronjs.org/docs/api/structures/io-counters
3196

B
Benjamin Pasero 已提交
3197
		/**
3198
		 * Then number of I/O other operations.
B
Benjamin Pasero 已提交
3199
		 */
3200
		otherOperationCount: number;
B
Benjamin Pasero 已提交
3201
		/**
3202
		 * Then number of I/O other transfers.
B
Benjamin Pasero 已提交
3203
		 */
3204
		otherTransferCount: number;
B
Benjamin Pasero 已提交
3205
		/**
3206
		 * The number of I/O read operations.
B
Benjamin Pasero 已提交
3207
		 */
3208
		readOperationCount: number;
B
Benjamin Pasero 已提交
3209
		/**
3210
		 * The number of I/O read transfers.
B
Benjamin Pasero 已提交
3211
		 */
3212
		readTransferCount: number;
B
Benjamin Pasero 已提交
3213
		/**
3214
		 * The number of I/O write operations.
B
Benjamin Pasero 已提交
3215
		 */
3216
		writeOperationCount: number;
B
Benjamin Pasero 已提交
3217
		/**
3218
		 * The number of I/O write transfers.
B
Benjamin Pasero 已提交
3219
		 */
3220 3221 3222 3223 3224
		writeTransferCount: number;
	}

	interface IpcMain extends EventEmitter {

3225
		// Docs: http://electronjs.org/docs/api/ipc-main
3226

B
Benjamin Pasero 已提交
3227
		/**
3228 3229
		 * Listens to channel, when a new message arrives listener would be called with
		 * listener(event, args...).
B
Benjamin Pasero 已提交
3230
		 */
3231
		on(channel: string, listener: Function): this;
B
Benjamin Pasero 已提交
3232
		/**
3233 3234
		 * Adds a one time listener function for the event. This listener is invoked only
		 * the next time a message is sent to channel, after which it is removed.
B
Benjamin Pasero 已提交
3235
		 */
3236
		once(channel: string, listener: Function): this;
B
Benjamin Pasero 已提交
3237
		/**
3238
		 * Removes listeners of the specified channel.
B
Benjamin Pasero 已提交
3239
		 */
3240
		removeAllListeners(channel: string): this;
B
Benjamin Pasero 已提交
3241
		/**
3242 3243
		 * Removes the specified listener from the listener array for the specified
		 * channel.
B
Benjamin Pasero 已提交
3244
		 */
3245 3246 3247 3248 3249
		removeListener(channel: string, listener: Function): this;
	}

	interface IpcRenderer extends EventEmitter {

3250
		// Docs: http://electronjs.org/docs/api/ipc-renderer
3251

B
Benjamin Pasero 已提交
3252
		/**
3253 3254
		 * Listens to channel, when a new message arrives listener would be called with
		 * listener(event, args...).
B
Benjamin Pasero 已提交
3255
		 */
3256
		on(channel: string, listener: Function): this;
B
Benjamin Pasero 已提交
3257
		/**
3258 3259
		 * Adds a one time listener function for the event. This listener is invoked only
		 * the next time a message is sent to channel, after which it is removed.
B
Benjamin Pasero 已提交
3260
		 */
3261
		once(channel: string, listener: Function): this;
B
Benjamin Pasero 已提交
3262
		/**
3263
		 * Removes all listeners, or those of the specified channel.
B
Benjamin Pasero 已提交
3264
		 */
3265
		removeAllListeners(channel: string): this;
B
Benjamin Pasero 已提交
3266
		/**
3267 3268
		 * Removes the specified listener from the listener array for the specified
		 * channel.
B
Benjamin Pasero 已提交
3269
		 */
3270
		removeListener(channel: string, listener: Function): this;
B
Benjamin Pasero 已提交
3271
		/**
3272 3273 3274 3275
		 * Send a message to the main process asynchronously via channel, you can also send
		 * arbitrary arguments. Arguments will be serialized in JSON internally and hence
		 * no functions or prototype chain will be included. The main process handles it by
		 * listening for channel with ipcMain module.
B
Benjamin Pasero 已提交
3276
		 */
3277
		send(channel: string, ...args: any[]): void;
B
Benjamin Pasero 已提交
3278
		/**
3279 3280 3281 3282 3283 3284
		 * Send a message to the main process synchronously via channel, you can also send
		 * arbitrary arguments. Arguments will be serialized in JSON internally and hence
		 * no functions or prototype chain will be included. The main process handles it by
		 * listening for channel with ipcMain module, and replies by setting
		 * event.returnValue. Note: Sending a synchronous message will block the whole
		 * renderer process, unless you know what you are doing you should never use it.
B
Benjamin Pasero 已提交
3285
		 */
3286
		// sendSync(channel: string, ...args: any[]): any; ### VSCODE CHANGE (we do not want to use sendSync)
3287
		/**
3288
		 * Sends a message to a window with webContentsId via channel.
3289
		 */
3290
		sendTo(webContentsId: number, channel: string, ...args: any[]): void;
3291
		/**
3292 3293
		 * Like ipcRenderer.send but the event will be sent to the <webview> element in the
		 * host page instead of the main process.
3294
		 */
3295
		sendToHost(channel: string, ...args: any[]): void;
B
Benjamin Pasero 已提交
3296 3297
	}

3298
	interface JumpListCategory {
B
Benjamin Pasero 已提交
3299

3300
		// Docs: http://electronjs.org/docs/api/structures/jump-list-category
B
Benjamin Pasero 已提交
3301 3302

		/**
3303
		 * Array of objects if type is tasks or custom, otherwise it should be omitted.
B
Benjamin Pasero 已提交
3304
		 */
3305
		items?: JumpListItem[];
B
Benjamin Pasero 已提交
3306
		/**
3307
		 * Must be set if type is custom, otherwise it should be omitted.
B
Benjamin Pasero 已提交
3308
		 */
3309
		name?: string;
B
Benjamin Pasero 已提交
3310
		/**
3311
		 * One of the following:
B
Benjamin Pasero 已提交
3312
		 */
3313 3314 3315 3316 3317
		type?: ('tasks' | 'frequent' | 'recent' | 'custom');
	}

	interface JumpListItem {

3318
		// Docs: http://electronjs.org/docs/api/structures/jump-list-item
3319

B
Benjamin Pasero 已提交
3320
		/**
3321 3322
		 * The command line arguments when program is executed. Should only be set if type
		 * is task.
B
Benjamin Pasero 已提交
3323
		 */
3324
		args?: string;
B
Benjamin Pasero 已提交
3325
		/**
3326 3327
		 * Description of the task (displayed in a tooltip). Should only be set if type is
		 * task.
B
Benjamin Pasero 已提交
3328
		 */
3329
		description?: string;
B
Benjamin Pasero 已提交
3330
		/**
3331 3332 3333 3334
		 * The index of the icon in the resource file. If a resource file contains multiple
		 * icons this value can be used to specify the zero-based index of the icon that
		 * should be displayed for this task. If a resource file contains only one icon,
		 * this property should be set to zero.
B
Benjamin Pasero 已提交
3335
		 */
3336
		iconIndex?: number;
B
Benjamin Pasero 已提交
3337
		/**
3338 3339 3340
		 * The absolute path to an icon to be displayed in a Jump List, which can be an
		 * arbitrary resource file that contains an icon (e.g. .ico, .exe, .dll). You can
		 * usually specify process.execPath to show the program icon.
B
Benjamin Pasero 已提交
3341
		 */
3342
		iconPath?: string;
B
Benjamin Pasero 已提交
3343
		/**
3344
		 * Path of the file to open, should only be set if type is file.
B
Benjamin Pasero 已提交
3345
		 */
3346
		path?: string;
B
Benjamin Pasero 已提交
3347
		/**
3348 3349
		 * Path of the program to execute, usually you should specify process.execPath
		 * which opens the current program. Should only be set if type is task.
B
Benjamin Pasero 已提交
3350
		 */
3351
		program?: string;
B
Benjamin Pasero 已提交
3352
		/**
3353 3354
		 * The text to be displayed for the item in the Jump List. Should only be set if
		 * type is task.
B
Benjamin Pasero 已提交
3355
		 */
3356
		title?: string;
B
Benjamin Pasero 已提交
3357
		/**
3358
		 * One of the following:
B
Benjamin Pasero 已提交
3359
		 */
3360 3361 3362 3363
		type?: ('task' | 'separator' | 'file');
	}

	interface MemoryUsageDetails {
B
Benjamin Pasero 已提交
3364

3365
		// Docs: http://electronjs.org/docs/api/structures/memory-usage-details
3366 3367 3368 3369

		count: number;
		liveSize: number;
		size: number;
B
Benjamin Pasero 已提交
3370 3371
	}

3372
	class Menu {
B
Benjamin Pasero 已提交
3373

3374
		// Docs: http://electronjs.org/docs/api/menu
3375

3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389
		/**
		 * Emitted when a popup is closed either manually or with menu.closePopup().
		 */
		on(event: 'menu-will-close', listener: (event: Event) => void): this;
		once(event: 'menu-will-close', listener: (event: Event) => void): this;
		addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
		removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
		/**
		 * Emitted when menu.popup() is called.
		 */
		on(event: 'menu-will-show', listener: (event: Event) => void): this;
		once(event: 'menu-will-show', listener: (event: Event) => void): this;
		addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
		removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
3390
		constructor();
B
Benjamin Pasero 已提交
3391
		/**
3392 3393 3394
		 * Generally, the template is an array of options for constructing a MenuItem. The
		 * usage can be referenced above. You can also attach other fields to the element
		 * of the template and they will become properties of the constructed menu items.
B
Benjamin Pasero 已提交
3395
		 */
3396
		static buildFromTemplate(template: MenuItemConstructorOptions[]): Menu;
B
Benjamin Pasero 已提交
3397
		/**
3398 3399
		 * Note: The returned Menu instance doesn't support dynamic addition or removal of
		 * menu items. Instance properties can still be dynamically modified.
B
Benjamin Pasero 已提交
3400
		 */
3401
		static getApplicationMenu(): (Menu) | (null);
B
Benjamin Pasero 已提交
3402
		/**
3403
		 * Sends the action to the first responder of application. This is used for
3404 3405 3406
		 * emulating default macOS menu behaviors. Usually you would use the role property
		 * of a MenuItem. See the macOS Cocoa Event Handling Guide for more information on
		 * macOS' native actions.
B
Benjamin Pasero 已提交
3407
		 */
3408
		static sendActionToFirstResponder(action: string): void;
B
Benjamin Pasero 已提交
3409
		/**
3410 3411 3412 3413
		 * Sets menu as the application menu on macOS. On Windows and Linux, the menu will
		 * be set as each window's top menu. Passing null will remove the menu bar on
		 * Windows and Linux but has no effect on macOS. Note: This API has to be called
		 * after the ready event of app module.
B
Benjamin Pasero 已提交
3414
		 */
3415
		static setApplicationMenu(menu: (Menu) | (null)): void;
B
Benjamin Pasero 已提交
3416
		/**
3417
		 * Appends the menuItem to the menu.
B
Benjamin Pasero 已提交
3418
		 */
3419
		append(menuItem: MenuItem): void;
B
Benjamin Pasero 已提交
3420
		/**
3421
		 * Closes the context menu in the browserWindow.
B
Benjamin Pasero 已提交
3422
		 */
3423
		closePopup(browserWindow?: BrowserWindow): void;
3424
		getMenuItemById(id: string): MenuItem;
B
Benjamin Pasero 已提交
3425
		/**
3426
		 * Inserts the menuItem to the pos position of the menu.
B
Benjamin Pasero 已提交
3427
		 */
3428
		insert(pos: number, menuItem: MenuItem): void;
B
Benjamin Pasero 已提交
3429
		/**
3430
		 * Pops up this menu as a context menu in the BrowserWindow.
B
Benjamin Pasero 已提交
3431
		 */
3432
		popup(options?: PopupOptions): void;
3433 3434 3435 3436 3437
		items: MenuItem[];
	}

	class MenuItem {

3438
		// Docs: http://electronjs.org/docs/api/menu-item
3439 3440 3441 3442 3443 3444 3445

		constructor(options: MenuItemConstructorOptions);
		checked: boolean;
		click: Function;
		enabled: boolean;
		label: string;
		visible: boolean;
B
Benjamin Pasero 已提交
3446 3447
	}

3448 3449
	interface MimeTypedBuffer {

3450
		// Docs: http://electronjs.org/docs/api/structures/mime-typed-buffer
3451

B
Benjamin Pasero 已提交
3452
		/**
3453
		 * The actual Buffer content.
B
Benjamin Pasero 已提交
3454
		 */
3455
		data: Buffer;
B
Benjamin Pasero 已提交
3456
		/**
3457
		 * The mimeType of the Buffer that you are sending.
B
Benjamin Pasero 已提交
3458
		 */
3459
		mimeType: string;
B
Benjamin Pasero 已提交
3460 3461
	}

3462 3463
	class NativeImage {

3464
		// Docs: http://electronjs.org/docs/api/native-image
B
Benjamin Pasero 已提交
3465 3466

		/**
3467
		 * Creates an empty NativeImage instance.
B
Benjamin Pasero 已提交
3468
		 */
3469
		static createEmpty(): NativeImage;
B
Benjamin Pasero 已提交
3470
		/**
3471
		 * Creates a new NativeImage instance from buffer.
B
Benjamin Pasero 已提交
3472
		 */
3473
		static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
B
Benjamin Pasero 已提交
3474
		/**
3475
		 * Creates a new NativeImage instance from dataURL.
B
Benjamin Pasero 已提交
3476
		 */
3477
		static createFromDataURL(dataURL: string): NativeImage;
3478 3479 3480 3481
		/**
		 * Creates a new NativeImage instance from the NSImage that maps to the given image
		 * name. See NSImageName for a list of possible values. The hslShift is applied to
		 * the image with the following rules This means that [-1, 0, 1] will make the
D
deepak1556 已提交
3482 3483 3484 3485 3486 3487 3488 3489
		 * image completely white and [-1, 1, 0] will make the image completely black. In
		 * some cases, the NSImageName doesn't match its string representation; one example
		 * of this is NSFolderImageName, whose string representation would actually be
		 * NSFolder. Therefore, you'll need to determine the correct string representation
		 * for your image before passing it in. This can be done with the following: echo
		 * -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME); }' |
		 * clang -otest -x objective-c -framework Cocoa - && ./test where SYSTEM_IMAGE_NAME
		 * should be replaced with any value from this list.
3490 3491
		 */
		static createFromNamedImage(imageName: string, hslShift: number[]): NativeImage;
B
Benjamin Pasero 已提交
3492
		/**
3493 3494 3495
		 * Creates a new NativeImage instance from a file located at path. This method
		 * returns an empty image if the path does not exist, cannot be read, or is not a
		 * valid image.
B
Benjamin Pasero 已提交
3496
		 */
3497
		static createFromPath(path: string): NativeImage;
B
Benjamin Pasero 已提交
3498
		/**
3499 3500 3501
		 * Add an image representation for a specific scale factor. This can be used to
		 * explicitly add different scale factor representations to an image. This can be
		 * called on empty images.
B
Benjamin Pasero 已提交
3502
		 */
3503 3504 3505
		addRepresentation(options: AddRepresentationOptions): void;
		crop(rect: Rectangle): NativeImage;
		getAspectRatio(): number;
B
Benjamin Pasero 已提交
3506
		/**
3507 3508 3509
		 * The difference between getBitmap() and toBitmap() is, getBitmap() does not copy
		 * the bitmap data, so you have to use the returned Buffer immediately in current
		 * event loop tick, otherwise the data might be changed or destroyed.
B
Benjamin Pasero 已提交
3510
		 */
3511
		getBitmap(options?: BitmapOptions): Buffer;
B
Benjamin Pasero 已提交
3512
		/**
3513 3514 3515
		 * Notice that the returned pointer is a weak pointer to the underlying native
		 * image instead of a copy, so you must ensure that the associated nativeImage
		 * instance is kept around.
B
Benjamin Pasero 已提交
3516
		 */
3517 3518 3519 3520
		getNativeHandle(): Buffer;
		getSize(): Size;
		isEmpty(): boolean;
		isTemplateImage(): boolean;
B
Benjamin Pasero 已提交
3521
		/**
3522 3523
		 * If only the height or the width are specified then the current aspect ratio will
		 * be preserved in the resized image.
B
Benjamin Pasero 已提交
3524
		 */
3525
		resize(options: ResizeOptions): NativeImage;
3526
		/**
3527
		 * Marks the image as a template image.
3528
		 */
3529 3530 3531 3532 3533
		setTemplateImage(option: boolean): void;
		toBitmap(options?: ToBitmapOptions): Buffer;
		toDataURL(options?: ToDataURLOptions): string;
		toJPEG(quality: number): Buffer;
		toPNG(options?: ToPNGOptions): Buffer;
B
Benjamin Pasero 已提交
3534 3535
	}

3536
	interface Net extends EventEmitter {
B
Benjamin Pasero 已提交
3537

3538
		// Docs: http://electronjs.org/docs/api/net
B
Benjamin Pasero 已提交
3539 3540

		/**
3541 3542 3543 3544
		 * Creates a ClientRequest instance using the provided options which are directly
		 * forwarded to the ClientRequest constructor. The net.request method would be used
		 * to issue both secure and insecure HTTP requests according to the specified
		 * protocol scheme in the options object.
B
Benjamin Pasero 已提交
3545
		 */
3546
		request(options: (any) | (string)): ClientRequest;
B
Benjamin Pasero 已提交
3547 3548
	}

3549 3550
	interface NetLog extends EventEmitter {

3551
		// Docs: http://electronjs.org/docs/api/net-log
3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571

		/**
		 * Starts recording network events to path.
		 */
		startLogging(path: string): void;
		/**
		 * Stops recording network events. If not called, net logging will automatically
		 * end when app quits.
		 */
		stopLogging(callback?: (path: string) => void): void;
		/**
		 * A Boolean property that indicates whether network logs are recorded.
		 */
		currentlyLogging?: boolean;
		/**
		 * A String property that returns the path to the current log file.
		 */
		currentlyLoggingPath?: string;
	}

3572 3573
	class Notification extends EventEmitter {

3574
		// Docs: http://electronjs.org/docs/api/notification
3575

B
Benjamin Pasero 已提交
3576 3577
		on(event: 'action', listener: (event: Event,
			/**
3578
			 * The index of the action that was activated.
B
Benjamin Pasero 已提交
3579 3580 3581 3582
			 */
			index: number) => void): this;
		once(event: 'action', listener: (event: Event,
			/**
3583
			 * The index of the action that was activated.
B
Benjamin Pasero 已提交
3584 3585 3586 3587
			 */
			index: number) => void): this;
		addListener(event: 'action', listener: (event: Event,
			/**
3588
			 * The index of the action that was activated.
B
Benjamin Pasero 已提交
3589 3590 3591 3592
			 */
			index: number) => void): this;
		removeListener(event: 'action', listener: (event: Event,
			/**
3593
			 * The index of the action that was activated.
B
Benjamin Pasero 已提交
3594 3595
			 */
			index: number) => void): this;
B
Benjamin Pasero 已提交
3596
		/**
3597
		 * Emitted when the notification is clicked by the user.
B
Benjamin Pasero 已提交
3598
		 */
3599 3600 3601 3602
		on(event: 'click', listener: (event: Event) => void): this;
		once(event: 'click', listener: (event: Event) => void): this;
		addListener(event: 'click', listener: (event: Event) => void): this;
		removeListener(event: 'click', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
3603
		/**
3604
		 * Emitted when the notification is closed by manual intervention from the user.
3605
		 * This event is not guaranteed to be emitted in all cases where the notification
3606
		 * is closed.
B
Benjamin Pasero 已提交
3607
		 */
3608 3609 3610 3611
		on(event: 'close', listener: (event: Event) => void): this;
		once(event: 'close', listener: (event: Event) => void): this;
		addListener(event: 'close', listener: (event: Event) => void): this;
		removeListener(event: 'close', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
3612
		/**
3613 3614
		 * Emitted when the user clicks the "Reply" button on a notification with hasReply:
		 * true.
B
Benjamin Pasero 已提交
3615
		 */
3616 3617
		on(event: 'reply', listener: (event: Event,
			/**
3618
			 * The string the user entered into the inline reply field.
3619 3620 3621 3622
			 */
			reply: string) => void): this;
		once(event: 'reply', listener: (event: Event,
			/**
3623
			 * The string the user entered into the inline reply field.
3624 3625 3626 3627
			 */
			reply: string) => void): this;
		addListener(event: 'reply', listener: (event: Event,
			/**
3628
			 * The string the user entered into the inline reply field.
3629 3630 3631 3632
			 */
			reply: string) => void): this;
		removeListener(event: 'reply', listener: (event: Event,
			/**
3633
			 * The string the user entered into the inline reply field.
3634 3635
			 */
			reply: string) => void): this;
B
Benjamin Pasero 已提交
3636
		/**
3637 3638 3639
		 * Emitted when the notification is shown to the user, note this could be fired
		 * multiple times as a notification can be shown multiple times through the show()
		 * method.
B
Benjamin Pasero 已提交
3640
		 */
3641 3642 3643 3644 3645 3646
		on(event: 'show', listener: (event: Event) => void): this;
		once(event: 'show', listener: (event: Event) => void): this;
		addListener(event: 'show', listener: (event: Event) => void): this;
		removeListener(event: 'show', listener: (event: Event) => void): this;
		constructor(options: NotificationConstructorOptions);
		static isSupported(): boolean;
3647 3648 3649 3650
		/**
		 * Dismisses the notification.
		 */
		close(): void;
B
Benjamin Pasero 已提交
3651
		/**
3652
		 * Immediately shows the notification to the user, please note this means unlike
3653 3654 3655 3656 3657
		 * the HTML5 Notification implementation, instantiating a new Notification does not
		 * immediately show it to the user, you need to call this method before the OS will
		 * display it. If the notification has been shown before, this method will dismiss
		 * the previously shown notification and create a new one with identical
		 * properties.
B
Benjamin Pasero 已提交
3658
		 */
3659
		show(): void;
B
Benjamin Pasero 已提交
3660 3661
	}

B
Benjamin Pasero 已提交
3662
	interface NotificationAction {
B
Benjamin Pasero 已提交
3663

3664
		// Docs: http://electronjs.org/docs/api/structures/notification-action
B
Benjamin Pasero 已提交
3665 3666 3667 3668 3669

		/**
		 * The label for the given action.
		 */
		text?: string;
B
Benjamin Pasero 已提交
3670
		/**
B
Benjamin Pasero 已提交
3671
		 * The type of action, can be button.
B
Benjamin Pasero 已提交
3672
		 */
B
Benjamin Pasero 已提交
3673 3674 3675
		type: ('button');
	}

3676 3677
	interface Point {

3678
		// Docs: http://electronjs.org/docs/api/structures/point
3679 3680 3681 3682 3683 3684 3685

		x: number;
		y: number;
	}

	interface PowerMonitor extends EventEmitter {

3686
		// Docs: http://electronjs.org/docs/api/power-monitor
B
Benjamin Pasero 已提交
3687

3688 3689 3690 3691 3692 3693 3694
		/**
		 * Emitted when the system is about to lock the screen.
		 */
		on(event: 'lock-screen', listener: Function): this;
		once(event: 'lock-screen', listener: Function): this;
		addListener(event: 'lock-screen', listener: Function): this;
		removeListener(event: 'lock-screen', listener: Function): this;
B
Benjamin Pasero 已提交
3695
		/**
3696
		 * Emitted when the system changes to AC power.
B
Benjamin Pasero 已提交
3697
		 */
3698 3699 3700 3701
		on(event: 'on-ac', listener: Function): this;
		once(event: 'on-ac', listener: Function): this;
		addListener(event: 'on-ac', listener: Function): this;
		removeListener(event: 'on-ac', listener: Function): this;
B
Benjamin Pasero 已提交
3702
		/**
3703
		 * Emitted when system changes to battery power.
B
Benjamin Pasero 已提交
3704
		 */
3705 3706 3707 3708
		on(event: 'on-battery', listener: Function): this;
		once(event: 'on-battery', listener: Function): this;
		addListener(event: 'on-battery', listener: Function): this;
		removeListener(event: 'on-battery', listener: Function): this;
B
Benjamin Pasero 已提交
3709
		/**
3710
		 * Emitted when system is resuming.
B
Benjamin Pasero 已提交
3711
		 */
3712 3713 3714 3715
		on(event: 'resume', listener: Function): this;
		once(event: 'resume', listener: Function): this;
		addListener(event: 'resume', listener: Function): this;
		removeListener(event: 'resume', listener: Function): this;
3716 3717 3718 3719 3720 3721 3722 3723 3724 3725
		/**
		 * Emitted when the system is about to reboot or shut down. If the event handler
		 * invokes e.preventDefault(), Electron will attempt to delay system shutdown in
		 * order for the app to exit cleanly. If e.preventDefault() is called, the app
		 * should exit as soon as possible by calling something like app.quit().
		 */
		on(event: 'shutdown', listener: Function): this;
		once(event: 'shutdown', listener: Function): this;
		addListener(event: 'shutdown', listener: Function): this;
		removeListener(event: 'shutdown', listener: Function): this;
B
Benjamin Pasero 已提交
3726
		/**
3727
		 * Emitted when the system is suspending.
B
Benjamin Pasero 已提交
3728
		 */
3729 3730 3731 3732
		on(event: 'suspend', listener: Function): this;
		once(event: 'suspend', listener: Function): this;
		addListener(event: 'suspend', listener: Function): this;
		removeListener(event: 'suspend', listener: Function): this;
3733 3734 3735 3736 3737 3738 3739
		/**
		 * Emitted as soon as the systems screen is unlocked.
		 */
		on(event: 'unlock-screen', listener: Function): this;
		once(event: 'unlock-screen', listener: Function): this;
		addListener(event: 'unlock-screen', listener: Function): this;
		removeListener(event: 'unlock-screen', listener: Function): this;
D
deepak1556 已提交
3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750
		/**
		 * Calculate the system idle state. idleThreshold is the amount of time (in
		 * seconds) before considered idle. callback will be called synchronously on some
		 * systems and with an idleState argument that describes the system's state. locked
		 * is available on supported systems only.
		 */
		querySystemIdleState(idleThreshold: number, callback: (idleState: 'active' | 'idle' | 'locked' | 'unknown') => void): void;
		/**
		 * Calculate system idle time in seconds.
		 */
		querySystemIdleTime(callback: (idleTime: number) => void): void;
3751 3752 3753 3754
	}

	interface PowerSaveBlocker extends EventEmitter {

3755
		// Docs: http://electronjs.org/docs/api/power-save-blocker
3756 3757

		isStarted(id: number): boolean;
B
Benjamin Pasero 已提交
3758
		/**
3759 3760 3761 3762 3763 3764 3765 3766
		 * Starts preventing the system from entering lower-power mode. Returns an integer
		 * identifying the power save blocker. Note: prevent-display-sleep has higher
		 * precedence over prevent-app-suspension. Only the highest precedence type takes
		 * effect. In other words, prevent-display-sleep always takes precedence over
		 * prevent-app-suspension. For example, an API calling A requests for
		 * prevent-app-suspension, and another calling B requests for
		 * prevent-display-sleep. prevent-display-sleep will be used until B stops its
		 * request. After that, prevent-app-suspension is used.
B
Benjamin Pasero 已提交
3767
		 */
3768
		start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
B
Benjamin Pasero 已提交
3769
		/**
3770
		 * Stops the specified power save blocker.
B
Benjamin Pasero 已提交
3771
		 */
3772
		stop(id: number): void;
B
Benjamin Pasero 已提交
3773 3774
	}

3775 3776
	interface PrinterInfo {

3777
		// Docs: http://electronjs.org/docs/api/structures/printer-info
3778 3779 3780 3781 3782 3783 3784 3785 3786

		description: string;
		isDefault: boolean;
		name: string;
		status: number;
	}

	interface ProcessMetric {

3787
		// Docs: http://electronjs.org/docs/api/structures/process-metric
3788

B
Benjamin Pasero 已提交
3789
		/**
3790
		 * CPU usage of the process.
B
Benjamin Pasero 已提交
3791
		 */
3792
		cpu: CPUUsage;
B
Benjamin Pasero 已提交
3793
		/**
3794
		 * Process id of the process.
B
Benjamin Pasero 已提交
3795
		 */
3796
		pid: number;
B
Benjamin Pasero 已提交
3797
		/**
3798
		 * Process type (Browser or Tab or GPU etc).
B
Benjamin Pasero 已提交
3799
		 */
3800
		type: string;
B
Benjamin Pasero 已提交
3801 3802
	}

3803 3804
	interface Product {

3805
		// Docs: http://electronjs.org/docs/api/structures/product
3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841

		/**
		 * The total size of the content, in bytes.
		 */
		contentLengths: number[];
		/**
		 * A string that identifies the version of the content.
		 */
		contentVersion: string;
		/**
		 * A Boolean value that indicates whether the App Store has downloadable content
		 * for this product.
		 */
		downloadable: boolean;
		/**
		 * The locale formatted price of the product.
		 */
		formattedPrice: string;
		/**
		 * A description of the product.
		 */
		localizedDescription: string;
		/**
		 * The name of the product.
		 */
		localizedTitle: string;
		/**
		 * The cost of the product in the local currency.
		 */
		price: number;
		/**
		 * The string that identifies the product to the Apple App Store.
		 */
		productIdentifier: string;
	}

3842 3843
	interface Protocol extends EventEmitter {

3844
		// Docs: http://electronjs.org/docs/api/protocol
3845

B
Benjamin Pasero 已提交
3846
		/**
3847 3848
		 * Intercepts scheme protocol and uses handler as the protocol's new handler which
		 * sends a Buffer as a response.
B
Benjamin Pasero 已提交
3849
		 */
3850
		interceptBufferProtocol(scheme: string, handler: (request: InterceptBufferProtocolRequest, callback: (buffer?: Buffer) => void) => void, completion?: (error: Error) => void): void;
B
Benjamin Pasero 已提交
3851
		/**
3852 3853
		 * Intercepts scheme protocol and uses handler as the protocol's new handler which
		 * sends a file as a response.
B
Benjamin Pasero 已提交
3854
		 */
3855
		interceptFileProtocol(scheme: string, handler: (request: InterceptFileProtocolRequest, callback: (filePath: string) => void) => void, completion?: (error: Error) => void): void;
B
Benjamin Pasero 已提交
3856
		/**
3857 3858
		 * Intercepts scheme protocol and uses handler as the protocol's new handler which
		 * sends a new HTTP request as a response.
B
Benjamin Pasero 已提交
3859
		 */
3860
		interceptHttpProtocol(scheme: string, handler: (request: InterceptHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void;
3861 3862 3863 3864
		/**
		 * Same as protocol.registerStreamProtocol, except that it replaces an existing
		 * protocol handler.
		 */
3865
		interceptStreamProtocol(scheme: string, handler: (request: InterceptStreamProtocolRequest, callback: (stream?: (NodeJS.ReadableStream) | (StreamProtocolResponse)) => void) => void, completion?: (error: Error) => void): void;
B
Benjamin Pasero 已提交
3866
		/**
3867 3868
		 * Intercepts scheme protocol and uses handler as the protocol's new handler which
		 * sends a String as a response.
B
Benjamin Pasero 已提交
3869
		 */
3870
		interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void;
B
Benjamin Pasero 已提交
3871
		/**
3872 3873
		 * The callback will be called with a boolean that indicates whether there is
		 * already a handler for scheme.
B
Benjamin Pasero 已提交
3874
		 */
3875
		isProtocolHandled(scheme: string, callback: (error: Error) => void): void;
B
Benjamin Pasero 已提交
3876
		/**
3877 3878 3879 3880
		 * Registers a protocol of scheme that will send a Buffer as a response. The usage
		 * is the same with registerFileProtocol, except that the callback should be called
		 * with either a Buffer object or an object that has the data, mimeType, and
		 * charset properties. Example:
B
Benjamin Pasero 已提交
3881
		 */
3882
		registerBufferProtocol(scheme: string, handler: (request: RegisterBufferProtocolRequest, callback: (buffer?: (Buffer) | (MimeTypedBuffer)) => void) => void, completion?: (error: Error) => void): void;
B
Benjamin Pasero 已提交
3883
		/**
3884 3885 3886 3887 3888
		 * Registers a protocol of scheme that will send the file as a response. The
		 * handler will be called with handler(request, callback) when a request is going
		 * to be created with scheme. completion will be called with completion(null) when
		 * scheme is successfully registered or completion(error) when failed. To handle
		 * the request, the callback should be called with either the file's path or an
3889 3890
		 * object that has a path property, e.g. callback(filePath) or callback({ path:
		 * filePath }). When callback is called with nothing, a number, or an object that
3891 3892 3893 3894 3895 3896
		 * has an error property, the request will fail with the error number you
		 * specified. For the available error numbers you can use, please see the net error
		 * list. By default the scheme is treated like http:, which is parsed differently
		 * than protocols that follow the "generic URI syntax" like file:, so you probably
		 * want to call protocol.registerStandardSchemes to have your scheme treated as a
		 * standard scheme.
B
Benjamin Pasero 已提交
3897
		 */
3898
		registerFileProtocol(scheme: string, handler: (request: RegisterFileProtocolRequest, callback: (filePath?: string) => void) => void, completion?: (error: Error) => void): void;
B
Benjamin Pasero 已提交
3899
		/**
3900 3901 3902 3903 3904 3905
		 * Registers a protocol of scheme that will send an HTTP request as a response. The
		 * usage is the same with registerFileProtocol, except that the callback should be
		 * called with a redirectRequest object that has the url, method, referrer,
		 * uploadData and session properties. By default the HTTP request will reuse the
		 * current session. If you want the request to have a different session you should
		 * set session to null. For POST requests the uploadData object must be provided.
B
Benjamin Pasero 已提交
3906
		 */
3907 3908
		registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void;
		registerServiceWorkerSchemes(schemes: string[]): void;
B
Benjamin Pasero 已提交
3909
		/**
3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925
		 * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
		 * http and https are standard schemes, while file is not. Registering a scheme as
		 * standard, will allow relative and absolute resources to be resolved correctly
		 * when served. Otherwise the scheme will behave like the file protocol, but
		 * without the ability to resolve relative URLs. For example when you load
		 * following page with custom protocol without registering it as standard scheme,
		 * the image will not be loaded because non-standard schemes can not recognize
		 * relative URLs: Registering a scheme as standard will allow access to files
		 * through the FileSystem API. Otherwise the renderer will throw a security error
		 * for the scheme. By default web storage apis (localStorage, sessionStorage,
		 * webSQL, indexedDB, cookies) are disabled for non standard schemes. So in general
		 * if you want to register a custom protocol to replace the http protocol, you have
		 * to register it as a standard scheme: Note: This method can only be used before
		 * the ready event of the app module gets emitted.
		 */
		registerStandardSchemes(schemes: string[], options?: RegisterStandardSchemesOptions): void;
3926 3927 3928 3929 3930 3931 3932 3933
		/**
		 * Registers a protocol of scheme that will send a Readable as a response. The
		 * usage is similar to the other register{Any}Protocol, except that the callback
		 * should be called with either a Readable object or an object that has the data,
		 * statusCode, and headers properties. Example: It is possible to pass any object
		 * that implements the readable stream API (emits data/end/error events). For
		 * example, here's how a file could be returned:
		 */
3934
		registerStreamProtocol(scheme: string, handler: (request: RegisterStreamProtocolRequest, callback: (stream?: (NodeJS.ReadableStream) | (StreamProtocolResponse)) => void) => void, completion?: (error: Error) => void): void;
3935 3936 3937 3938 3939 3940 3941
		/**
		 * Registers a protocol of scheme that will send a String as a response. The usage
		 * is the same with registerFileProtocol, except that the callback should be called
		 * with either a String or an object that has the data, mimeType, and charset
		 * properties.
		 */
		registerStringProtocol(scheme: string, handler: (request: RegisterStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void;
B
Benjamin Pasero 已提交
3942
		/**
3943
		 * Remove the interceptor installed for scheme and restore its original handler.
B
Benjamin Pasero 已提交
3944
		 */
3945
		uninterceptProtocol(scheme: string, completion?: (error: Error) => void): void;
B
Benjamin Pasero 已提交
3946
		/**
3947
		 * Unregisters the custom protocol of scheme.
B
Benjamin Pasero 已提交
3948
		 */
3949
		unregisterProtocol(scheme: string, completion?: (error: Error) => void): void;
B
Benjamin Pasero 已提交
3950 3951
	}

3952
	interface Rectangle {
B
Benjamin Pasero 已提交
3953

3954
		// Docs: http://electronjs.org/docs/api/structures/rectangle
B
Benjamin Pasero 已提交
3955 3956

		/**
3957
		 * The height of the rectangle (must be an integer).
B
Benjamin Pasero 已提交
3958
		 */
3959
		height: number;
B
Benjamin Pasero 已提交
3960
		/**
3961
		 * The width of the rectangle (must be an integer).
B
Benjamin Pasero 已提交
3962
		 */
3963
		width: number;
B
Benjamin Pasero 已提交
3964
		/**
3965
		 * The x coordinate of the origin of the rectangle (must be an integer).
B
Benjamin Pasero 已提交
3966
		 */
3967
		x: number;
B
Benjamin Pasero 已提交
3968
		/**
3969
		 * The y coordinate of the origin of the rectangle (must be an integer).
B
Benjamin Pasero 已提交
3970
		 */
3971 3972 3973
		y: number;
	}

3974 3975
	interface Referrer {

3976
		// Docs: http://electronjs.org/docs/api/structures/referrer
3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989

		/**
		 * Can be default, unsafe-url, no-referrer-when-downgrade, no-referrer, origin,
		 * strict-origin-when-cross-origin, same-origin or strict-origin. See the for more
		 * details on the meaning of these values.
		 */
		policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
		/**
		 * HTTP Referrer URL.
		 */
		url: string;
	}

3990 3991
	interface Remote extends MainInterface {

3992
		// Docs: http://electronjs.org/docs/api/remote
3993 3994

		getCurrentWebContents(): WebContents;
3995 3996 3997 3998 3999
		/**
		 * Note: Do not use removeAllListeners on BrowserWindow. Use of this can remove all
		 * blur listeners, disable click events on touch bar buttons, and other unintended
		 * consequences.
		 */
4000 4001
		getCurrentWindow(): BrowserWindow;
		getGlobal(name: string): any;
B
Benjamin Pasero 已提交
4002
		/**
4003
		 * e.g.
B
Benjamin Pasero 已提交
4004
		 */
4005
		require(module: string): any;
B
Benjamin Pasero 已提交
4006
		/**
4007 4008
		 * The process object in the main process. This is the same as
		 * remote.getGlobal('process') but is cached.
B
Benjamin Pasero 已提交
4009
		 */
4010 4011 4012 4013 4014
		process?: any;
	}

	interface RemoveClientCertificate {

4015
		// Docs: http://electronjs.org/docs/api/structures/remove-client-certificate
4016

B
Benjamin Pasero 已提交
4017
		/**
4018 4019
		 * Origin of the server whose associated client certificate must be removed from
		 * the cache.
B
Benjamin Pasero 已提交
4020
		 */
4021
		origin: string;
B
Benjamin Pasero 已提交
4022
		/**
4023
		 * clientCertificate.
B
Benjamin Pasero 已提交
4024
		 */
4025 4026 4027 4028 4029
		type: string;
	}

	interface RemovePassword {

4030
		// Docs: http://electronjs.org/docs/api/structures/remove-password
4031

B
Benjamin Pasero 已提交
4032
		/**
4033 4034
		 * When provided, the authentication info related to the origin will only be
		 * removed otherwise the entire cache will be cleared.
B
Benjamin Pasero 已提交
4035
		 */
4036
		origin?: string;
B
Benjamin Pasero 已提交
4037
		/**
4038
		 * Credentials of the authentication. Must be provided if removing by origin.
B
Benjamin Pasero 已提交
4039
		 */
4040
		password?: string;
B
Benjamin Pasero 已提交
4041
		/**
4042
		 * Realm of the authentication. Must be provided if removing by origin.
B
Benjamin Pasero 已提交
4043
		 */
4044
		realm?: string;
B
Benjamin Pasero 已提交
4045
		/**
4046 4047
		 * Scheme of the authentication. Can be basic, digest, ntlm, negotiate. Must be
		 * provided if removing by origin.
B
Benjamin Pasero 已提交
4048
		 */
4049
		scheme?: ('basic' | 'digest' | 'ntlm' | 'negotiate');
B
Benjamin Pasero 已提交
4050
		/**
4051
		 * password.
B
Benjamin Pasero 已提交
4052
		 */
4053
		type: string;
B
Benjamin Pasero 已提交
4054
		/**
4055
		 * Credentials of the authentication. Must be provided if removing by origin.
B
Benjamin Pasero 已提交
4056
		 */
4057 4058 4059 4060 4061
		username?: string;
	}

	interface Screen extends EventEmitter {

4062
		// Docs: http://electronjs.org/docs/api/screen
4063

B
Benjamin Pasero 已提交
4064
		/**
4065
		 * Emitted when newDisplay has been added.
B
Benjamin Pasero 已提交
4066
		 */
4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091
		on(event: 'display-added', listener: (event: Event,
			newDisplay: Display) => void): this;
		once(event: 'display-added', listener: (event: Event,
			newDisplay: Display) => void): this;
		addListener(event: 'display-added', listener: (event: Event,
			newDisplay: Display) => void): this;
		removeListener(event: 'display-added', listener: (event: Event,
			newDisplay: Display) => void): this;
		/**
		 * Emitted when one or more metrics change in a display. The changedMetrics is an
		 * array of strings that describe the changes. Possible changes are bounds,
		 * workArea, scaleFactor and rotation.
		 */
		on(event: 'display-metrics-changed', listener: (event: Event,
			display: Display,
			changedMetrics: string[]) => void): this;
		once(event: 'display-metrics-changed', listener: (event: Event,
			display: Display,
			changedMetrics: string[]) => void): this;
		addListener(event: 'display-metrics-changed', listener: (event: Event,
			display: Display,
			changedMetrics: string[]) => void): this;
		removeListener(event: 'display-metrics-changed', listener: (event: Event,
			display: Display,
			changedMetrics: string[]) => void): this;
B
Benjamin Pasero 已提交
4092
		/**
4093
		 * Emitted when oldDisplay has been removed.
B
Benjamin Pasero 已提交
4094
		 */
4095 4096 4097 4098 4099 4100 4101 4102
		on(event: 'display-removed', listener: (event: Event,
			oldDisplay: Display) => void): this;
		once(event: 'display-removed', listener: (event: Event,
			oldDisplay: Display) => void): this;
		addListener(event: 'display-removed', listener: (event: Event,
			oldDisplay: Display) => void): this;
		removeListener(event: 'display-removed', listener: (event: Event,
			oldDisplay: Display) => void): this;
4103 4104 4105 4106 4107 4108 4109 4110 4111 4112
		/**
		 * Converts a screen DIP point to a screen physical point. The DPI scale is
		 * performed relative to the display containing the DIP point.
		 */
		dipToScreenPoint(point: Point): Point;
		/**
		 * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
		 * relative to the display nearest to window. If window is null, scaling will be
		 * performed to the display nearest to rect.
		 */
4113
		dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
4114
		getAllDisplays(): Display[];
B
Benjamin Pasero 已提交
4115
		/**
4116
		 * The current absolute position of the mouse pointer.
B
Benjamin Pasero 已提交
4117
		 */
4118 4119 4120 4121
		getCursorScreenPoint(): Point;
		getDisplayMatching(rect: Rectangle): Display;
		getDisplayNearestPoint(point: Point): Display;
		getPrimaryDisplay(): Display;
4122 4123 4124 4125 4126 4127 4128 4129 4130 4131
		/**
		 * Converts a screen physical point to a screen DIP point. The DPI scale is
		 * performed relative to the display containing the physical point.
		 */
		screenToDipPoint(point: Point): Point;
		/**
		 * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
		 * relative to the display nearest to window. If window is null, scaling will be
		 * performed to the display nearest to rect.
		 */
4132
		screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
B
Benjamin Pasero 已提交
4133 4134
	}

4135 4136
	interface ScrubberItem {

4137
		// Docs: http://electronjs.org/docs/api/structures/scrubber-item
B
Benjamin Pasero 已提交
4138 4139

		/**
4140
		 * The image to appear in this item.
B
Benjamin Pasero 已提交
4141
		 */
4142
		icon?: NativeImage;
B
Benjamin Pasero 已提交
4143
		/**
4144
		 * The text to appear in this item.
B
Benjamin Pasero 已提交
4145
		 */
4146
		label?: string;
B
Benjamin Pasero 已提交
4147 4148
	}

4149 4150
	interface SegmentedControlSegment {

4151
		// Docs: http://electronjs.org/docs/api/structures/segmented-control-segment
B
Benjamin Pasero 已提交
4152 4153

		/**
4154
		 * Whether this segment is selectable. Default: true.
B
Benjamin Pasero 已提交
4155
		 */
4156
		enabled?: boolean;
B
Benjamin Pasero 已提交
4157
		/**
4158
		 * The image to appear in this segment.
B
Benjamin Pasero 已提交
4159
		 */
4160
		icon?: NativeImage;
B
Benjamin Pasero 已提交
4161
		/**
4162
		 * The text to appear in this segment.
B
Benjamin Pasero 已提交
4163
		 */
4164
		label?: string;
B
Benjamin Pasero 已提交
4165 4166
	}

4167
	class Session extends EventEmitter {
B
Benjamin Pasero 已提交
4168

4169
		// Docs: http://electronjs.org/docs/api/session
B
Benjamin Pasero 已提交
4170 4171

		/**
4172 4173 4174 4175 4176 4177
		 * If partition starts with persist:, the page will use a persistent session
		 * available to all pages in the app with the same partition. if there is no
		 * persist: prefix, the page will use an in-memory session. If the partition is
		 * empty then default session of the app will be returned. To create a Session with
		 * options, you have to ensure the Session with the partition has never been used
		 * before. There is no way to change the options of an existing Session object.
B
Benjamin Pasero 已提交
4178
		 */
4179
		static fromPartition(partition: string, options?: FromPartitionOptions): Session;
B
Benjamin Pasero 已提交
4180
		/**
4181
		 * A Session object, the default session object of the app.
B
Benjamin Pasero 已提交
4182
		 */
4183
		static defaultSession?: Session;
B
Benjamin Pasero 已提交
4184
		/**
4185 4186 4187
		 * Emitted when Electron is about to download item in webContents. Calling
		 * event.preventDefault() will cancel the download and item will not be available
		 * from next tick of the process.
B
Benjamin Pasero 已提交
4188
		 */
4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200
		on(event: 'will-download', listener: (event: Event,
			item: DownloadItem,
			webContents: WebContents) => void): this;
		once(event: 'will-download', listener: (event: Event,
			item: DownloadItem,
			webContents: WebContents) => void): this;
		addListener(event: 'will-download', listener: (event: Event,
			item: DownloadItem,
			webContents: WebContents) => void): this;
		removeListener(event: 'will-download', listener: (event: Event,
			item: DownloadItem,
			webContents: WebContents) => void): this;
B
Benjamin Pasero 已提交
4201
		/**
4202 4203
		 * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
		 * authentication.
B
Benjamin Pasero 已提交
4204
		 */
4205
		allowNTLMCredentialsForDomains(domains: string): void;
B
Benjamin Pasero 已提交
4206
		/**
4207
		 * Clears the session’s HTTP authentication cache.
B
Benjamin Pasero 已提交
4208
		 */
4209
		clearAuthCache(options: (RemovePassword) | (RemoveClientCertificate), callback?: Function): void;
B
Benjamin Pasero 已提交
4210
		/**
4211
		 * Clears the session’s HTTP cache.
B
Benjamin Pasero 已提交
4212
		 */
4213
		clearCache(callback: Function): void;
B
Benjamin Pasero 已提交
4214
		/**
4215
		 * Clears the host resolver cache.
B
Benjamin Pasero 已提交
4216
		 */
4217
		clearHostResolverCache(callback?: Function): void;
B
Benjamin Pasero 已提交
4218
		/**
4219
		 * Clears the data of web storages.
B
Benjamin Pasero 已提交
4220
		 */
4221
		clearStorageData(options?: ClearStorageDataOptions, callback?: Function): void;
B
Benjamin Pasero 已提交
4222
		/**
4223 4224 4225 4226 4227
		 * Allows resuming cancelled or interrupted downloads from previous Session. The
		 * API will generate a DownloadItem that can be accessed with the will-download
		 * event. The DownloadItem will not have any WebContents associated with it and the
		 * initial state will be interrupted. The download will start only when the resume
		 * API is called on the DownloadItem.
B
Benjamin Pasero 已提交
4228
		 */
4229
		createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
B
Benjamin Pasero 已提交
4230
		/**
4231 4232
		 * Disables any network emulation already active for the session. Resets to the
		 * original network configuration.
B
Benjamin Pasero 已提交
4233
		 */
4234
		disableNetworkEmulation(): void;
B
Benjamin Pasero 已提交
4235
		/**
4236
		 * Emulates network with the given configuration for the session.
B
Benjamin Pasero 已提交
4237
		 */
4238
		enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
B
Benjamin Pasero 已提交
4239
		/**
4240
		 * Writes any unwritten DOMStorage data to disk.
B
Benjamin Pasero 已提交
4241
		 */
4242
		flushStorageData(): void;
4243
		getBlobData(identifier: string, callback: (result: Buffer) => void): void;
4244 4245 4246 4247
		/**
		 * Callback is invoked with the session's current cache size.
		 */
		getCacheSize(callback: (size: number) => void): void;
4248
		getPreloads(): string[];
4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267
		getUserAgent(): string;
		/**
		 * Resolves the proxy information for url. The callback will be called with
		 * callback(proxy) when the request is performed.
		 */
		resolveProxy(url: string, callback: (proxy: string) => void): void;
		/**
		 * Sets the certificate verify proc for session, the proc will be called with
		 * proc(request, callback) whenever a server certificate verification is requested.
		 * Calling callback(0) accepts the certificate, calling callback(-2) rejects it.
		 * Calling setCertificateVerifyProc(null) will revert back to default certificate
		 * verify proc.
		 */
		setCertificateVerifyProc(proc: (request: CertificateVerifyProcRequest, callback: (verificationResult: number) => void) => void): void;
		/**
		 * Sets download saving directory. By default, the download directory will be the
		 * Downloads under the respective app folder.
		 */
		setDownloadPath(path: string): void;
4268 4269 4270 4271 4272 4273
		/**
		 * Sets the handler which can be used to respond to permission checks for the
		 * session. Returning true will allow the permission and false will reject it. To
		 * clear the handler, call setPermissionCheckHandler(null).
		 */
		setPermissionCheckHandler(handler: ((webContents: WebContents, permission: string, requestingOrigin: string, details: PermissionCheckHandlerDetails) => boolean) | (null)): void;
4274 4275 4276
		/**
		 * Sets the handler which can be used to respond to permission requests for the
		 * session. Calling callback(true) will allow the permission and callback(false)
4277 4278
		 * will reject it. To clear the handler, call setPermissionRequestHandler(null).
		 */
4279
		setPermissionRequestHandler(handler: ((webContents: WebContents, permission: string, callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerDetails) => void) | (null)): void;
4280 4281 4282
		/**
		 * Adds scripts that will be executed on ALL web contents that are associated with
		 * this session just before normal preload scripts run.
4283
		 */
4284
		setPreloads(preloads: string[]): void;
4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300
		/**
		 * Sets the proxy settings. When pacScript and proxyRules are provided together,
		 * the proxyRules option is ignored and pacScript configuration is applied. The
		 * proxyRules has to follow the rules below: For example: The proxyBypassRules is a
		 * comma separated list of rules described below:
		 */
		setProxy(config: Config, callback: Function): void;
		/**
		 * Overrides the userAgent and acceptLanguages for this session. The
		 * acceptLanguages must a comma separated ordered list of language codes, for
		 * example "en-US,fr,de,ko,zh-CN,ja". This doesn't affect existing WebContents, and
		 * each WebContents can use webContents.setUserAgent to override the session-wide
		 * user agent.
		 */
		setUserAgent(userAgent: string, acceptLanguages?: string): void;
		cookies: Cookies;
4301
		netLog: NetLog;
4302 4303
		protocol: Protocol;
		webRequest: WebRequest;
B
Benjamin Pasero 已提交
4304 4305
	}

4306 4307
	interface Shell {

4308
		// Docs: http://electronjs.org/docs/api/shell
B
Benjamin Pasero 已提交
4309 4310

		/**
4311
		 * Play the beep sound.
B
Benjamin Pasero 已提交
4312
		 */
4313
		beep(): void;
B
Benjamin Pasero 已提交
4314
		/**
4315
		 * Move the given file to trash and returns a boolean status for the operation.
B
Benjamin Pasero 已提交
4316
		 */
4317
		moveItemToTrash(fullPath: string): boolean;
B
Benjamin Pasero 已提交
4318
		/**
4319 4320
		 * Open the given external protocol URL in the desktop's default manner. (For
		 * example, mailto: URLs in the user's default mail agent).
B
Benjamin Pasero 已提交
4321
		 */
4322
		openExternal(url: string, options?: OpenExternalOptions, callback?: (error: Error) => void): boolean;
B
Benjamin Pasero 已提交
4323
		/**
4324
		 * Open the given file in the desktop's default manner.
B
Benjamin Pasero 已提交
4325
		 */
4326
		openItem(fullPath: string): boolean;
B
Benjamin Pasero 已提交
4327
		/**
4328 4329
		 * Resolves the shortcut link at shortcutPath. An exception will be thrown when any
		 * error happens.
B
Benjamin Pasero 已提交
4330
		 */
4331
		readShortcutLink(shortcutPath: string): ShortcutDetails;
B
Benjamin Pasero 已提交
4332
		/**
4333
		 * Show the given file in a file manager. If possible, select the file.
B
Benjamin Pasero 已提交
4334
		 */
4335
		showItemInFolder(fullPath: string): boolean;
B
Benjamin Pasero 已提交
4336
		/**
4337
		 * Creates or updates a shortcut link at shortcutPath.
B
Benjamin Pasero 已提交
4338
		 */
4339
		writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
B
Benjamin Pasero 已提交
4340
		/**
4341
		 * Creates or updates a shortcut link at shortcutPath.
B
Benjamin Pasero 已提交
4342
		 */
4343
		writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
B
Benjamin Pasero 已提交
4344 4345
	}

4346 4347
	interface ShortcutDetails {

4348
		// Docs: http://electronjs.org/docs/api/structures/shortcut-details
B
Benjamin Pasero 已提交
4349 4350

		/**
4351
		 * The Application User Model ID. Default is empty.
B
Benjamin Pasero 已提交
4352
		 */
4353 4354 4355 4356 4357 4358
		appUserModelId?: string;
		/**
		 * The arguments to be applied to target when launching from this shortcut. Default
		 * is empty.
		 */
		args?: string;
B
Benjamin Pasero 已提交
4359
		/**
4360
		 * The working directory. Default is empty.
B
Benjamin Pasero 已提交
4361
		 */
4362
		cwd?: string;
B
Benjamin Pasero 已提交
4363
		/**
4364
		 * The description of the shortcut. Default is empty.
B
Benjamin Pasero 已提交
4365
		 */
4366
		description?: string;
B
Benjamin Pasero 已提交
4367
		/**
4368 4369
		 * The path to the icon, can be a DLL or EXE. icon and iconIndex have to be set
		 * together. Default is empty, which uses the target's icon.
B
Benjamin Pasero 已提交
4370
		 */
4371
		icon?: string;
B
Benjamin Pasero 已提交
4372
		/**
4373
		 * The resource ID of icon when icon is a DLL or EXE. Default is 0.
B
Benjamin Pasero 已提交
4374
		 */
4375
		iconIndex?: number;
B
Benjamin Pasero 已提交
4376
		/**
4377
		 * The target to launch from this shortcut.
B
Benjamin Pasero 已提交
4378
		 */
4379
		target: string;
B
Benjamin Pasero 已提交
4380 4381
	}

4382
	interface Size {
B
Benjamin Pasero 已提交
4383

4384
		// Docs: http://electronjs.org/docs/api/structures/size
4385 4386 4387

		height: number;
		width: number;
B
Benjamin Pasero 已提交
4388 4389
	}

4390 4391
	interface StreamProtocolResponse {

4392
		// Docs: http://electronjs.org/docs/api/structures/stream-protocol-response
4393 4394

		/**
4395
		 * A Node.js readable stream representing the response body.
4396
		 */
4397
		data: NodeJS.ReadableStream;
4398
		/**
4399
		 * An object containing the response headers.
4400 4401 4402
		 */
		headers: Headers;
		/**
4403
		 * The HTTP response code.
4404 4405 4406 4407
		 */
		statusCode: number;
	}

4408
	interface SystemPreferences extends EventEmitter {
B
Benjamin Pasero 已提交
4409

4410
		// Docs: http://electronjs.org/docs/api/system-preferences
4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459

		on(event: 'accent-color-changed', listener: (event: Event,
			/**
			 * The new RGBA color the user assigned to be their system accent color.
			 */
			newColor: string) => void): this;
		once(event: 'accent-color-changed', listener: (event: Event,
			/**
			 * The new RGBA color the user assigned to be their system accent color.
			 */
			newColor: string) => void): this;
		addListener(event: 'accent-color-changed', listener: (event: Event,
			/**
			 * The new RGBA color the user assigned to be their system accent color.
			 */
			newColor: string) => void): this;
		removeListener(event: 'accent-color-changed', listener: (event: Event,
			/**
			 * The new RGBA color the user assigned to be their system accent color.
			 */
			newColor: string) => void): this;
		on(event: 'color-changed', listener: (event: Event) => void): this;
		once(event: 'color-changed', listener: (event: Event) => void): this;
		addListener(event: 'color-changed', listener: (event: Event) => void): this;
		removeListener(event: 'color-changed', listener: (event: Event) => void): this;
		on(event: 'inverted-color-scheme-changed', listener: (event: Event,
			/**
			 * `true` if an inverted color scheme, such as a high contrast theme, is being
			 * used, `false` otherwise.
			 */
			invertedColorScheme: boolean) => void): this;
		once(event: 'inverted-color-scheme-changed', listener: (event: Event,
			/**
			 * `true` if an inverted color scheme, such as a high contrast theme, is being
			 * used, `false` otherwise.
			 */
			invertedColorScheme: boolean) => void): this;
		addListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
			/**
			 * `true` if an inverted color scheme, such as a high contrast theme, is being
			 * used, `false` otherwise.
			 */
			invertedColorScheme: boolean) => void): this;
		removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
			/**
			 * `true` if an inverted color scheme, such as a high contrast theme, is being
			 * used, `false` otherwise.
			 */
			invertedColorScheme: boolean) => void): this;
4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470
		/**
		 * Important: In order to properly leverage this API, you must set the
		 * NSMicrophoneUsageDescription and NSCameraUsageDescription strings in your app's
		 * Info.plist file. The values for these keys will be used to populate the
		 * permission dialogs so that the user will be properly informed as to the purpose
		 * of the permission request. See Electron Application Distribution for more
		 * information about how to set these in the context of Electron. This user consent
		 * was not required until macOS 10.14 Mojave, so this method will always return
		 * true if your system is running 10.13 High Sierra or lower.
		 */
		askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<Boolean>;
4471
		getAccentColor(): string;
4472 4473 4474 4475 4476 4477
		/**
		 * Gets the macOS appearance setting that you have declared you want for your
		 * application, maps to NSApplication.appearance. You can use the
		 * setAppLevelAppearance API to set this value.
		 */
		getAppLevelAppearance(): ('dark' | 'light' | 'unknown');
4478
		getColor(color: '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text'): string;
4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494
		/**
		 * Gets the macOS appearance setting that is currently applied to your application,
		 * maps to NSApplication.effectiveAppearance Please note that until Electron is
		 * built targeting the 10.14 SDK, your application's effectiveAppearance will
		 * default to 'light' and won't inherit the OS preference. In the interim in order
		 * for your application to inherit the OS preference you must set the
		 * NSRequiresAquaSystemAppearance key in your apps Info.plist to false.  If you are
		 * using electron-packager or electron-forge just set the enableDarwinDarkMode
		 * packager option to true.  See the Electron Packager API for more details.
		 */
		getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
		/**
		 * This user consent was not required until macOS 10.14 Mojave, so this method will
		 * always return granted if your system is running 10.13 High Sierra or lower.
		 */
		getMediaAccessStatus(mediaType: string): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
B
Benjamin Pasero 已提交
4495
		/**
4496
		 * Some popular key and types are:
B
Benjamin Pasero 已提交
4497
		 */
4498
		getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any;
B
Benjamin Pasero 已提交
4499
		/**
4500 4501
		 * An example of using it to determine if you should create a transparent window or
		 * not (transparent windows won't work correctly when DWM composition is disabled):
B
Benjamin Pasero 已提交
4502
		 */
4503 4504 4505 4506
		isAeroGlassEnabled(): boolean;
		isDarkMode(): boolean;
		isInvertedColorScheme(): boolean;
		isSwipeTrackingFromScrollEventsEnabled(): boolean;
4507
		isTrustedAccessibilityClient(prompt: boolean): boolean;
B
Benjamin Pasero 已提交
4508
		/**
4509 4510
		 * Posts event as native notifications of macOS. The userInfo is an Object that
		 * contains the user information dictionary sent along with the notification.
B
Benjamin Pasero 已提交
4511
		 */
4512
		postLocalNotification(event: string, userInfo: any): void;
B
Benjamin Pasero 已提交
4513
		/**
4514 4515
		 * Posts event as native notifications of macOS. The userInfo is an Object that
		 * contains the user information dictionary sent along with the notification.
B
Benjamin Pasero 已提交
4516
		 */
4517
		postNotification(event: string, userInfo: any): void;
4518 4519 4520 4521 4522
		/**
		 * Posts event as native notifications of macOS. The userInfo is an Object that
		 * contains the user information dictionary sent along with the notification.
		 */
		postWorkspaceNotification(event: string, userInfo: any): void;
B
Benjamin Pasero 已提交
4523
		/**
4524 4525 4526 4527 4528 4529 4530 4531
		 * Add the specified defaults to your application's NSUserDefaults.
		 */
		registerDefaults(defaults: any): void;
		/**
		 * Removes the key in NSUserDefaults. This can be used to restore the default or
		 * global value of a key previously set with setUserDefault.
		 */
		removeUserDefault(key: string): void;
4532 4533 4534 4535 4536
		/**
		 * Sets the appearance setting for your application, this should override the
		 * system default and override the value of getEffectiveAppearance.
		 */
		setAppLevelAppearance(appearance: 'dark' | 'light'): void;
4537 4538 4539
		/**
		 * Set the value of key in NSUserDefaults. Note that type should match actual type
		 * of value. An exception is thrown if they don't. Some popular key and types are:
B
Benjamin Pasero 已提交
4540
		 */
4541
		setUserDefault(key: string, type: string, value: string): void;
B
Benjamin Pasero 已提交
4542
		/**
4543
		 * Same as subscribeNotification, but uses NSNotificationCenter for local defaults.
4544
		 * This is necessary for events such as NSUserDefaultsDidChangeNotification.
B
Benjamin Pasero 已提交
4545
		 */
4546
		subscribeLocalNotification(event: string, callback: (event: string, userInfo: any) => void): number;
B
Benjamin Pasero 已提交
4547
		/**
4548 4549 4550 4551 4552 4553
		 * Subscribes to native notifications of macOS, callback will be called with
		 * callback(event, userInfo) when the corresponding event happens. The userInfo is
		 * an Object that contains the user information dictionary sent along with the
		 * notification. The id of the subscriber is returned, which can be used to
		 * unsubscribe the event. Under the hood this API subscribes to
		 * NSDistributedNotificationCenter, example values of event are:
B
Benjamin Pasero 已提交
4554
		 */
4555 4556 4557 4558 4559 4560 4561
		subscribeNotification(event: string, callback: (event: string, userInfo: any) => void): number;
		/**
		 * Same as subscribeNotification, but uses
		 * NSWorkspace.sharedWorkspace.notificationCenter. This is necessary for events
		 * such as NSWorkspaceDidActivateApplicationNotification.
		 */
		subscribeWorkspaceNotification(event: string, callback: (event: string, userInfo: any) => void): void;
B
Benjamin Pasero 已提交
4562
		/**
4563 4564
		 * Same as unsubscribeNotification, but removes the subscriber from
		 * NSNotificationCenter.
B
Benjamin Pasero 已提交
4565
		 */
4566
		unsubscribeLocalNotification(id: number): void;
B
Benjamin Pasero 已提交
4567
		/**
4568
		 * Removes the subscriber with id.
B
Benjamin Pasero 已提交
4569
		 */
4570
		unsubscribeNotification(id: number): void;
4571 4572 4573 4574 4575
		/**
		 * Same as unsubscribeNotification, but removes the subscriber from
		 * NSWorkspace.sharedWorkspace.notificationCenter.
		 */
		unsubscribeWorkspaceNotification(id: number): void;
B
Benjamin Pasero 已提交
4576 4577
	}

4578 4579
	interface Task {

4580
		// Docs: http://electronjs.org/docs/api/structures/task
B
Benjamin Pasero 已提交
4581 4582

		/**
4583
		 * The command line arguments when program is executed.
B
Benjamin Pasero 已提交
4584
		 */
4585
		arguments: string;
B
Benjamin Pasero 已提交
4586
		/**
4587
		 * Description of this task.
B
Benjamin Pasero 已提交
4588
		 */
4589
		description: string;
B
Benjamin Pasero 已提交
4590
		/**
4591 4592 4593
		 * The icon index in the icon file. If an icon file consists of two or more icons,
		 * set this value to identify the icon. If an icon file consists of one icon, this
		 * value is 0.
B
Benjamin Pasero 已提交
4594
		 */
4595
		iconIndex: number;
B
Benjamin Pasero 已提交
4596
		/**
4597 4598 4599
		 * The absolute path to an icon to be displayed in a JumpList, which can be an
		 * arbitrary resource file that contains an icon. You can usually specify
		 * process.execPath to show the icon of the program.
B
Benjamin Pasero 已提交
4600
		 */
4601
		iconPath: string;
B
Benjamin Pasero 已提交
4602
		/**
4603 4604
		 * Path of the program to execute, usually you should specify process.execPath
		 * which opens the current program.
B
Benjamin Pasero 已提交
4605
		 */
4606
		program: string;
B
Benjamin Pasero 已提交
4607
		/**
4608
		 * The string to be displayed in a JumpList.
B
Benjamin Pasero 已提交
4609
		 */
4610 4611 4612 4613 4614
		title: string;
	}

	interface ThumbarButton {

4615
		// Docs: http://electronjs.org/docs/api/structures/thumbar-button
4616 4617

		click: Function;
B
Benjamin Pasero 已提交
4618
		/**
4619 4620
		 * Control specific states and behaviors of the button. By default, it is
		 * ['enabled'].
B
Benjamin Pasero 已提交
4621
		 */
4622
		flags?: string[];
B
Benjamin Pasero 已提交
4623
		/**
4624
		 * The icon showing in thumbnail toolbar.
B
Benjamin Pasero 已提交
4625
		 */
4626
		icon: NativeImage;
B
Benjamin Pasero 已提交
4627
		/**
4628
		 * The text of the button's tooltip.
B
Benjamin Pasero 已提交
4629
		 */
4630 4631 4632 4633 4634
		tooltip?: string;
	}

	class TouchBarButton extends EventEmitter {

4635
		// Docs: http://electronjs.org/docs/api/touch-bar-button
4636 4637 4638 4639 4640 4641 4642 4643 4644

		constructor(options: TouchBarButtonConstructorOptions);
		backgroundColor: string;
		icon: NativeImage;
		label: string;
	}

	class TouchBarColorPicker extends EventEmitter {

4645
		// Docs: http://electronjs.org/docs/api/touch-bar-color-picker
4646 4647 4648 4649 4650 4651 4652 4653

		constructor(options: TouchBarColorPickerConstructorOptions);
		availableColors: string[];
		selectedColor: string;
	}

	class TouchBarGroup extends EventEmitter {

4654
		// Docs: http://electronjs.org/docs/api/touch-bar-group
4655 4656 4657 4658 4659 4660

		constructor(options: TouchBarGroupConstructorOptions);
	}

	class TouchBarLabel extends EventEmitter {

4661
		// Docs: http://electronjs.org/docs/api/touch-bar-label
4662 4663 4664 4665 4666 4667 4668 4669

		constructor(options: TouchBarLabelConstructorOptions);
		label: string;
		textColor: string;
	}

	class TouchBarPopover extends EventEmitter {

4670
		// Docs: http://electronjs.org/docs/api/touch-bar-popover
4671 4672 4673 4674 4675 4676 4677 4678

		constructor(options: TouchBarPopoverConstructorOptions);
		icon: NativeImage;
		label: string;
	}

	class TouchBarScrubber extends EventEmitter {

4679
		// Docs: http://electronjs.org/docs/api/touch-bar-scrubber
4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691

		constructor(options: TouchBarScrubberConstructorOptions);
		continuous: boolean;
		items: ScrubberItem[];
		mode: string;
		overlayStyle: string;
		selectedStyle: string;
		showArrowButtons: boolean;
	}

	class TouchBarSegmentedControl extends EventEmitter {

4692
		// Docs: http://electronjs.org/docs/api/touch-bar-segmented-control
4693 4694 4695 4696 4697 4698 4699 4700 4701

		constructor(options: TouchBarSegmentedControlConstructorOptions);
		segments: SegmentedControlSegment[];
		segmentStyle: string;
		selectedIndex: number;
	}

	class TouchBarSlider extends EventEmitter {

4702
		// Docs: http://electronjs.org/docs/api/touch-bar-slider
4703 4704 4705 4706 4707 4708 4709 4710 4711 4712

		constructor(options: TouchBarSliderConstructorOptions);
		label: string;
		maxValue: number;
		minValue: number;
		value: number;
	}

	class TouchBarSpacer extends EventEmitter {

4713
		// Docs: http://electronjs.org/docs/api/touch-bar-spacer
4714 4715 4716 4717 4718 4719

		constructor(options: TouchBarSpacerConstructorOptions);
	}

	class TouchBar extends EventEmitter {

4720
		// Docs: http://electronjs.org/docs/api/touch-bar
4721

B
Benjamin Pasero 已提交
4722
		constructor(options: TouchBarConstructorOptions);
4723
		escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734
		static TouchBarButton: typeof TouchBarButton;
		static TouchBarColorPicker: typeof TouchBarColorPicker;
		static TouchBarGroup: typeof TouchBarGroup;
		static TouchBarLabel: typeof TouchBarLabel;
		static TouchBarPopover: typeof TouchBarPopover;
		static TouchBarScrubber: typeof TouchBarScrubber;
		static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
		static TouchBarSlider: typeof TouchBarSlider;
		static TouchBarSpacer: typeof TouchBarSpacer;
	}

4735 4736
	interface TraceCategoriesAndOptions {

4737
		// Docs: http://electronjs.org/docs/api/structures/trace-categories-and-options
4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763

		/**
		 * – is a filter to control what category groups should be traced. A filter can
		 * have an optional prefix to exclude category groups that contain a matching
		 * category. Having both included and excluded category patterns in the same list
		 * is not supported. Examples: test_MyTest*, test_MyTest*,test_OtherStuff,
		 * -excluded_category1,-excluded_category2.
		 */
		categoryFilter: string;
		/**
		 * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
		 * the following strings: record-until-full, record-continuously, trace-to-console,
		 * enable-sampling, enable-systrace, e.g. 'record-until-full,enable-sampling'. The
		 * first 3 options are trace recording modes and hence mutually exclusive. If more
		 * than one trace recording modes appear in the traceOptions string, the last one
		 * takes precedence. If none of the trace recording modes are specified, recording
		 * mode is record-until-full. The trace option will first be reset to the default
		 * option (record_mode set to record-until-full, enable_sampling and
		 * enable_systrace set to false) before options parsed from traceOptions are
		 * applied on it.
		 */
		traceOptions: string;
	}

	interface TraceConfig {

4764
		// Docs: http://electronjs.org/docs/api/structures/trace-config
4765 4766 4767 4768 4769 4770

		excluded_categories?: string[];
		included_categories?: string[];
		memory_dump_config?: MemoryDumpConfig;
	}

4771 4772
	interface Transaction {

4773
		// Docs: http://electronjs.org/docs/api/structures/transaction
4774

4775 4776 4777
		/**
		 * The error code if an error occurred while processing the transaction.
		 */
4778
		errorCode: number;
4779 4780 4781
		/**
		 * The error message if an error occurred while processing the transaction.
		 */
4782
		errorMessage: string;
4783 4784 4785
		/**
		 * The identifier of the restored transaction by the App Store.
		 */
4786 4787
		originalTransactionIdentifier: string;
		payment: Payment;
4788 4789 4790
		/**
		 * The date the transaction was added to the App Store’s payment queue.
		 */
4791
		transactionDate: string;
4792 4793 4794
		/**
		 * A string that uniquely identifies a successful payment transaction.
		 */
4795 4796
		transactionIdentifier: string;
		/**
4797 4798
		 * The transaction state, can be purchasing, purchased, failed, restored or
		 * deferred.
4799
		 */
4800
		transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
4801 4802
	}

4803 4804
	class Tray extends EventEmitter {

4805
		// Docs: http://electronjs.org/docs/api/tray
4806

B
Benjamin Pasero 已提交
4807
		/**
4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821
		 * Emitted when the tray balloon is clicked.
		 */
		on(event: 'balloon-click', listener: Function): this;
		once(event: 'balloon-click', listener: Function): this;
		addListener(event: 'balloon-click', listener: Function): this;
		removeListener(event: 'balloon-click', listener: Function): this;
		/**
		 * Emitted when the tray balloon is closed because of timeout or user manually
		 * closes it.
		 */
		on(event: 'balloon-closed', listener: Function): this;
		once(event: 'balloon-closed', listener: Function): this;
		addListener(event: 'balloon-closed', listener: Function): this;
		removeListener(event: 'balloon-closed', listener: Function): this;
B
Benjamin Pasero 已提交
4822
		/**
4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833
		 * Emitted when the tray balloon shows.
		 */
		on(event: 'balloon-show', listener: Function): this;
		once(event: 'balloon-show', listener: Function): this;
		addListener(event: 'balloon-show', listener: Function): this;
		removeListener(event: 'balloon-show', listener: Function): this;
		/**
		 * Emitted when the tray icon is clicked.
		 */
		on(event: 'click', listener: (event: Event,
			/**
4834
			 * The bounds of tray icon.
B
Benjamin Pasero 已提交
4835
			 */
4836 4837 4838 4839 4840
			bounds: Rectangle,
			/**
			 * The position of the event.
			 */
			position: Point) => void): this;
4841 4842
		once(event: 'click', listener: (event: Event,
			/**
4843
			 * The bounds of tray icon.
B
Benjamin Pasero 已提交
4844
			 */
4845 4846 4847 4848 4849
			bounds: Rectangle,
			/**
			 * The position of the event.
			 */
			position: Point) => void): this;
4850 4851
		addListener(event: 'click', listener: (event: Event,
			/**
4852
			 * The bounds of tray icon.
B
Benjamin Pasero 已提交
4853
			 */
4854 4855 4856 4857 4858
			bounds: Rectangle,
			/**
			 * The position of the event.
			 */
			position: Point) => void): this;
4859 4860
		removeListener(event: 'click', listener: (event: Event,
			/**
4861
			 * The bounds of tray icon.
B
Benjamin Pasero 已提交
4862
			 */
4863 4864 4865 4866 4867
			bounds: Rectangle,
			/**
			 * The position of the event.
			 */
			position: Point) => void): this;
4868 4869 4870 4871 4872
		/**
		 * Emitted when the tray icon is double clicked.
		 */
		on(event: 'double-click', listener: (event: Event,
			/**
4873
			 * The bounds of tray icon.
4874 4875 4876 4877
			 */
			bounds: Rectangle) => void): this;
		once(event: 'double-click', listener: (event: Event,
			/**
4878
			 * The bounds of tray icon.
4879 4880 4881 4882
			 */
			bounds: Rectangle) => void): this;
		addListener(event: 'double-click', listener: (event: Event,
			/**
4883
			 * The bounds of tray icon.
4884 4885 4886 4887
			 */
			bounds: Rectangle) => void): this;
		removeListener(event: 'double-click', listener: (event: Event,
			/**
4888
			 * The bounds of tray icon.
4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946
			 */
			bounds: Rectangle) => void): this;
		/**
		 * Emitted when a drag operation ends on the tray or ends at another location.
		 */
		on(event: 'drag-end', listener: Function): this;
		once(event: 'drag-end', listener: Function): this;
		addListener(event: 'drag-end', listener: Function): this;
		removeListener(event: 'drag-end', listener: Function): this;
		/**
		 * Emitted when a drag operation enters the tray icon.
		 */
		on(event: 'drag-enter', listener: Function): this;
		once(event: 'drag-enter', listener: Function): this;
		addListener(event: 'drag-enter', listener: Function): this;
		removeListener(event: 'drag-enter', listener: Function): this;
		/**
		 * Emitted when a drag operation exits the tray icon.
		 */
		on(event: 'drag-leave', listener: Function): this;
		once(event: 'drag-leave', listener: Function): this;
		addListener(event: 'drag-leave', listener: Function): this;
		removeListener(event: 'drag-leave', listener: Function): this;
		/**
		 * Emitted when any dragged items are dropped on the tray icon.
		 */
		on(event: 'drop', listener: Function): this;
		once(event: 'drop', listener: Function): this;
		addListener(event: 'drop', listener: Function): this;
		removeListener(event: 'drop', listener: Function): this;
		/**
		 * Emitted when dragged files are dropped in the tray icon.
		 */
		on(event: 'drop-files', listener: (event: Event,
			/**
			 * The paths of the dropped files.
			 */
			files: string[]) => void): this;
		once(event: 'drop-files', listener: (event: Event,
			/**
			 * The paths of the dropped files.
			 */
			files: string[]) => void): this;
		addListener(event: 'drop-files', listener: (event: Event,
			/**
			 * The paths of the dropped files.
			 */
			files: string[]) => void): this;
		removeListener(event: 'drop-files', listener: (event: Event,
			/**
			 * The paths of the dropped files.
			 */
			files: string[]) => void): this;
		/**
		 * Emitted when dragged text is dropped in the tray icon.
		 */
		on(event: 'drop-text', listener: (event: Event,
			/**
4947
			 * the dropped text string.
4948 4949 4950 4951
			 */
			text: string) => void): this;
		once(event: 'drop-text', listener: (event: Event,
			/**
4952
			 * the dropped text string.
4953 4954 4955 4956
			 */
			text: string) => void): this;
		addListener(event: 'drop-text', listener: (event: Event,
			/**
4957
			 * the dropped text string.
4958 4959 4960 4961
			 */
			text: string) => void): this;
		removeListener(event: 'drop-text', listener: (event: Event,
			/**
4962
			 * the dropped text string.
4963 4964
			 */
			text: string) => void): this;
B
Benjamin Pasero 已提交
4965 4966 4967 4968 4969
		/**
		 * Emitted when the mouse enters the tray icon.
		 */
		on(event: 'mouse-enter', listener: (event: Event,
			/**
4970
			 * The position of the event.
B
Benjamin Pasero 已提交
4971 4972 4973 4974
			 */
			position: Point) => void): this;
		once(event: 'mouse-enter', listener: (event: Event,
			/**
4975
			 * The position of the event.
B
Benjamin Pasero 已提交
4976 4977 4978 4979
			 */
			position: Point) => void): this;
		addListener(event: 'mouse-enter', listener: (event: Event,
			/**
4980
			 * The position of the event.
B
Benjamin Pasero 已提交
4981 4982 4983 4984
			 */
			position: Point) => void): this;
		removeListener(event: 'mouse-enter', listener: (event: Event,
			/**
4985
			 * The position of the event.
B
Benjamin Pasero 已提交
4986 4987 4988 4989 4990 4991 4992
			 */
			position: Point) => void): this;
		/**
		 * Emitted when the mouse exits the tray icon.
		 */
		on(event: 'mouse-leave', listener: (event: Event,
			/**
4993
			 * The position of the event.
B
Benjamin Pasero 已提交
4994 4995 4996 4997
			 */
			position: Point) => void): this;
		once(event: 'mouse-leave', listener: (event: Event,
			/**
4998
			 * The position of the event.
B
Benjamin Pasero 已提交
4999 5000 5001 5002
			 */
			position: Point) => void): this;
		addListener(event: 'mouse-leave', listener: (event: Event,
			/**
5003
			 * The position of the event.
B
Benjamin Pasero 已提交
5004 5005 5006 5007
			 */
			position: Point) => void): this;
		removeListener(event: 'mouse-leave', listener: (event: Event,
			/**
5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031
			 * The position of the event.
			 */
			position: Point) => void): this;
		/**
		 * Emitted when the mouse moves in the tray icon.
		 */
		on(event: 'mouse-move', listener: (event: Event,
			/**
			 * The position of the event.
			 */
			position: Point) => void): this;
		once(event: 'mouse-move', listener: (event: Event,
			/**
			 * The position of the event.
			 */
			position: Point) => void): this;
		addListener(event: 'mouse-move', listener: (event: Event,
			/**
			 * The position of the event.
			 */
			position: Point) => void): this;
		removeListener(event: 'mouse-move', listener: (event: Event,
			/**
			 * The position of the event.
B
Benjamin Pasero 已提交
5032 5033
			 */
			position: Point) => void): this;
5034 5035 5036 5037 5038
		/**
		 * Emitted when the tray icon is right clicked.
		 */
		on(event: 'right-click', listener: (event: Event,
			/**
5039
			 * The bounds of tray icon.
5040 5041 5042 5043
			 */
			bounds: Rectangle) => void): this;
		once(event: 'right-click', listener: (event: Event,
			/**
5044
			 * The bounds of tray icon.
5045 5046 5047 5048
			 */
			bounds: Rectangle) => void): this;
		addListener(event: 'right-click', listener: (event: Event,
			/**
5049
			 * The bounds of tray icon.
5050 5051 5052 5053
			 */
			bounds: Rectangle) => void): this;
		removeListener(event: 'right-click', listener: (event: Event,
			/**
5054
			 * The bounds of tray icon.
5055 5056
			 */
			bounds: Rectangle) => void): this;
5057
		constructor(image: (NativeImage) | (string));
5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069
		/**
		 * Destroys the tray icon immediately.
		 */
		destroy(): void;
		/**
		 * Displays a tray balloon.
		 */
		displayBalloon(options: DisplayBalloonOptions): void;
		/**
		 * The bounds of this tray icon as Object.
		 */
		getBounds(): Rectangle;
5070
		getIgnoreDoubleClickEvents(): boolean;
5071 5072 5073 5074 5075 5076 5077 5078 5079 5080
		isDestroyed(): boolean;
		/**
		 * Pops up the context menu of the tray icon. When menu is passed, the menu will be
		 * shown instead of the tray icon's context menu. The position is only available on
		 * Windows, and it is (0, 0) by default.
		 */
		popUpContextMenu(menu?: Menu, position?: Point): void;
		/**
		 * Sets the context menu for this icon.
		 */
5081
		setContextMenu(menu: (Menu) | (null)): void;
5082 5083 5084 5085 5086 5087
		/**
		 * Sets when the tray's icon background becomes highlighted (in blue). Note: You
		 * can use highlightMode with a BrowserWindow by toggling between 'never' and
		 * 'always' modes when the window visibility changes.
		 */
		setHighlightMode(mode: 'selection' | 'always' | 'never'): void;
5088 5089 5090 5091 5092 5093
		/**
		 * Sets the option to ignore double click events. Ignoring these events allows you
		 * to detect every individual click of the tray icon. This value is set to false by
		 * default.
		 */
		setIgnoreDoubleClickEvents(ignore: boolean): void;
5094 5095 5096
		/**
		 * Sets the image associated with this tray icon.
		 */
5097
		setImage(image: (NativeImage) | (string)): void;
5098 5099 5100
		/**
		 * Sets the image associated with this tray icon when pressed on macOS.
		 */
5101
		setPressedImage(image: (NativeImage) | (string)): void;
5102
		/**
5103 5104
		 * Sets the title displayed aside of the tray icon in the status bar (Support ANSI
		 * colors).
5105 5106 5107 5108 5109 5110 5111 5112 5113 5114
		 */
		setTitle(title: string): void;
		/**
		 * Sets the hover text for this tray icon.
		 */
		setToolTip(toolTip: string): void;
	}

	interface UploadBlob {

5115
		// Docs: http://electronjs.org/docs/api/structures/upload-blob
5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128

		/**
		 * UUID of blob data to upload.
		 */
		blobUUID: string;
		/**
		 * blob.
		 */
		type: string;
	}

	interface UploadData {

5129
		// Docs: http://electronjs.org/docs/api/structures/upload-data
5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146

		/**
		 * UUID of blob data. Use method to retrieve the data.
		 */
		blobUUID: string;
		/**
		 * Content being sent.
		 */
		bytes: Buffer;
		/**
		 * Path of file being uploaded.
		 */
		file: string;
	}

	interface UploadFile {

5147
		// Docs: http://electronjs.org/docs/api/structures/upload-file
5148 5149 5150 5151 5152 5153 5154 5155 5156 5157

		/**
		 * Path of file to be uploaded.
		 */
		filePath: string;
		/**
		 * Number of bytes to read from offset. Defaults to 0.
		 */
		length: number;
		/**
5158
		 * Last Modification time in number of seconds since the UNIX epoch.
5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172
		 */
		modificationTime: number;
		/**
		 * Defaults to 0.
		 */
		offset: number;
		/**
		 * file.
		 */
		type: string;
	}

	interface UploadRawData {

5173
		// Docs: http://electronjs.org/docs/api/structures/upload-raw-data
5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186

		/**
		 * Data to be uploaded.
		 */
		bytes: Buffer;
		/**
		 * rawData.
		 */
		type: string;
	}

	class WebContents extends EventEmitter {

5187
		// Docs: http://electronjs.org/docs/api/web-contents
5188 5189 5190 5191 5192 5193

		static fromId(id: number): WebContents;
		static getAllWebContents(): WebContents[];
		static getFocusedWebContents(): WebContents;
		/**
		 * Emitted before dispatching the keydown and keyup events in the page. Calling
B
Benjamin Pasero 已提交
5194 5195
		 * event.preventDefault will prevent the page keydown/keyup events and the menu
		 * shortcuts. To only prevent the menu shortcuts, use setIgnoreMenuShortcuts:
5196 5197 5198
		 */
		on(event: 'before-input-event', listener: (event: Event,
			/**
5199
			 * Input properties.
5200 5201 5202 5203
			 */
			input: Input) => void): this;
		once(event: 'before-input-event', listener: (event: Event,
			/**
5204
			 * Input properties.
5205 5206 5207 5208
			 */
			input: Input) => void): this;
		addListener(event: 'before-input-event', listener: (event: Event,
			/**
5209
			 * Input properties.
5210 5211 5212 5213
			 */
			input: Input) => void): this;
		removeListener(event: 'before-input-event', listener: (event: Event,
			/**
5214
			 * Input properties.
5215 5216 5217 5218 5219 5220 5221 5222 5223
			 */
			input: Input) => void): this;
		/**
		 * Emitted when failed to verify the certificate for url. The usage is the same
		 * with the certificate-error event of app.
		 */
		on(event: 'certificate-error', listener: (event: Event,
			url: string,
			/**
5224
			 * The error code.
5225 5226 5227 5228 5229 5230 5231
			 */
			error: string,
			certificate: Certificate,
			callback: (isTrusted: boolean) => void) => void): this;
		once(event: 'certificate-error', listener: (event: Event,
			url: string,
			/**
5232
			 * The error code.
5233 5234 5235 5236 5237 5238 5239
			 */
			error: string,
			certificate: Certificate,
			callback: (isTrusted: boolean) => void) => void): this;
		addListener(event: 'certificate-error', listener: (event: Event,
			url: string,
			/**
5240
			 * The error code.
5241 5242 5243 5244 5245 5246 5247
			 */
			error: string,
			certificate: Certificate,
			callback: (isTrusted: boolean) => void) => void): this;
		removeListener(event: 'certificate-error', listener: (event: Event,
			url: string,
			/**
5248
			 * The error code.
5249 5250 5251 5252
			 */
			error: string,
			certificate: Certificate,
			callback: (isTrusted: boolean) => void) => void): this;
5253 5254 5255 5256
		/**
		 * Emitted when the associated window logs a console message. Will not be emitted
		 * for windows with offscreen rendering enabled.
		 */
5257 5258
		on(event: 'console-message', listener: (event: Event,
			level: number,
5259 5260 5261
			message: string,
			line: number,
			sourceId: string) => void): this;
5262 5263
		once(event: 'console-message', listener: (event: Event,
			level: number,
5264 5265 5266
			message: string,
			line: number,
			sourceId: string) => void): this;
5267 5268
		addListener(event: 'console-message', listener: (event: Event,
			level: number,
5269 5270 5271
			message: string,
			line: number,
			sourceId: string) => void): this;
5272 5273
		removeListener(event: 'console-message', listener: (event: Event,
			level: number,
5274 5275 5276
			message: string,
			line: number,
			sourceId: string) => void): this;
5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305
		/**
		 * Emitted when there is a new context menu that needs to be handled.
		 */
		on(event: 'context-menu', listener: (event: Event,
			params: ContextMenuParams) => void): this;
		once(event: 'context-menu', listener: (event: Event,
			params: ContextMenuParams) => void): this;
		addListener(event: 'context-menu', listener: (event: Event,
			params: ContextMenuParams) => void): this;
		removeListener(event: 'context-menu', listener: (event: Event,
			params: ContextMenuParams) => void): this;
		/**
		 * Emitted when the renderer process crashes or is killed.
		 */
		on(event: 'crashed', listener: (event: Event,
			killed: boolean) => void): this;
		once(event: 'crashed', listener: (event: Event,
			killed: boolean) => void): this;
		addListener(event: 'crashed', listener: (event: Event,
			killed: boolean) => void): this;
		removeListener(event: 'crashed', listener: (event: Event,
			killed: boolean) => void): this;
		/**
		 * Emitted when the cursor's type changes. The type parameter can be default,
		 * crosshair, pointer, text, wait, help, e-resize, n-resize, ne-resize, nw-resize,
		 * s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize,
		 * nwse-resize, col-resize, row-resize, m-panning, e-panning, n-panning,
		 * ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move,
		 * vertical-text, cell, context-menu, alias, progress, nodrop, copy, none,
5306 5307 5308 5309
		 * not-allowed, zoom-in, zoom-out, grab, grabbing or custom. If the type parameter
		 * is custom, the image parameter will hold the custom cursor image in a
		 * NativeImage, and scale, size and hotspot will hold additional information about
		 * the custom cursor.
5310 5311 5312 5313 5314
		 */
		on(event: 'cursor-changed', listener: (event: Event,
			type: string,
			image?: NativeImage,
			/**
5315
			 * scaling factor for the custom cursor.
5316 5317 5318
			 */
			scale?: number,
			/**
5319
			 * the size of the `image`.
5320 5321 5322
			 */
			size?: Size,
			/**
5323
			 * coordinates of the custom cursor's hotspot.
5324 5325 5326 5327 5328 5329
			 */
			hotspot?: Point) => void): this;
		once(event: 'cursor-changed', listener: (event: Event,
			type: string,
			image?: NativeImage,
			/**
5330
			 * scaling factor for the custom cursor.
5331 5332 5333
			 */
			scale?: number,
			/**
5334
			 * the size of the `image`.
5335 5336 5337
			 */
			size?: Size,
			/**
5338
			 * coordinates of the custom cursor's hotspot.
5339 5340 5341 5342 5343 5344
			 */
			hotspot?: Point) => void): this;
		addListener(event: 'cursor-changed', listener: (event: Event,
			type: string,
			image?: NativeImage,
			/**
5345
			 * scaling factor for the custom cursor.
5346 5347 5348
			 */
			scale?: number,
			/**
5349
			 * the size of the `image`.
5350 5351 5352
			 */
			size?: Size,
			/**
5353
			 * coordinates of the custom cursor's hotspot.
5354 5355 5356 5357 5358 5359
			 */
			hotspot?: Point) => void): this;
		removeListener(event: 'cursor-changed', listener: (event: Event,
			type: string,
			image?: NativeImage,
			/**
5360
			 * scaling factor for the custom cursor.
5361 5362 5363
			 */
			scale?: number,
			/**
5364
			 * the size of the `image`.
5365 5366 5367
			 */
			size?: Size,
			/**
5368
			 * coordinates of the custom cursor's hotspot.
5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405
			 */
			hotspot?: Point) => void): this;
		/**
		 * Emitted when webContents is destroyed.
		 */
		on(event: 'destroyed', listener: Function): this;
		once(event: 'destroyed', listener: Function): this;
		addListener(event: 'destroyed', listener: Function): this;
		removeListener(event: 'destroyed', listener: Function): this;
		/**
		 * Emitted when DevTools is closed.
		 */
		on(event: 'devtools-closed', listener: Function): this;
		once(event: 'devtools-closed', listener: Function): this;
		addListener(event: 'devtools-closed', listener: Function): this;
		removeListener(event: 'devtools-closed', listener: Function): this;
		/**
		 * Emitted when DevTools is focused / opened.
		 */
		on(event: 'devtools-focused', listener: Function): this;
		once(event: 'devtools-focused', listener: Function): this;
		addListener(event: 'devtools-focused', listener: Function): this;
		removeListener(event: 'devtools-focused', listener: Function): this;
		/**
		 * Emitted when DevTools is opened.
		 */
		on(event: 'devtools-opened', listener: Function): this;
		once(event: 'devtools-opened', listener: Function): this;
		addListener(event: 'devtools-opened', listener: Function): this;
		removeListener(event: 'devtools-opened', listener: Function): this;
		/**
		 * Emitted when the devtools window instructs the webContents to reload
		 */
		on(event: 'devtools-reload-page', listener: Function): this;
		once(event: 'devtools-reload-page', listener: Function): this;
		addListener(event: 'devtools-reload-page', listener: Function): this;
		removeListener(event: 'devtools-reload-page', listener: Function): this;
5406 5407 5408 5409 5410
		/**
		 * Emitted when a <webview> has been attached to this web contents.
		 */
		on(event: 'did-attach-webview', listener: (event: Event,
			/**
5411
			 * The guest web contents that is used by the `
5412 5413 5414 5415
			 */
			webContents: WebContents) => void): this;
		once(event: 'did-attach-webview', listener: (event: Event,
			/**
5416
			 * The guest web contents that is used by the `
5417 5418 5419 5420
			 */
			webContents: WebContents) => void): this;
		addListener(event: 'did-attach-webview', listener: (event: Event,
			/**
5421
			 * The guest web contents that is used by the `
5422 5423 5424 5425
			 */
			webContents: WebContents) => void): this;
		removeListener(event: 'did-attach-webview', listener: (event: Event,
			/**
5426
			 * The guest web contents that is used by the `
5427 5428
			 */
			webContents: WebContents) => void): this;
5429 5430 5431 5432
		/**
		 * Emitted when a page's theme color changes. This is usually due to encountering a
		 * meta tag:
		 */
5433 5434 5435 5436
		on(event: 'did-change-theme-color', listener: (event: Event,
			/**
			 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
			 */
5437
			color: (string) | (null)) => void): this;
5438 5439 5440 5441
		once(event: 'did-change-theme-color', listener: (event: Event,
			/**
			 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
			 */
5442
			color: (string) | (null)) => void): this;
5443 5444 5445 5446
		addListener(event: 'did-change-theme-color', listener: (event: Event,
			/**
			 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
			 */
5447
			color: (string) | (null)) => void): this;
5448 5449 5450 5451
		removeListener(event: 'did-change-theme-color', listener: (event: Event,
			/**
			 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
			 */
5452
			color: (string) | (null)) => void): this;
5453 5454 5455 5456 5457 5458 5459 5460 5461
		/**
		 * This event is like did-finish-load but emitted when the load failed or was
		 * cancelled, e.g. window.stop() is invoked. The full list of error codes and their
		 * meaning is available here.
		 */
		on(event: 'did-fail-load', listener: (event: Event,
			errorCode: number,
			errorDescription: string,
			validatedURL: string,
5462 5463 5464
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5465 5466 5467 5468
		once(event: 'did-fail-load', listener: (event: Event,
			errorCode: number,
			errorDescription: string,
			validatedURL: string,
5469 5470 5471
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5472 5473 5474 5475
		addListener(event: 'did-fail-load', listener: (event: Event,
			errorCode: number,
			errorDescription: string,
			validatedURL: string,
5476 5477 5478
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5479 5480 5481 5482
		removeListener(event: 'did-fail-load', listener: (event: Event,
			errorCode: number,
			errorDescription: string,
			validatedURL: string,
5483 5484 5485
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497
		/**
		 * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
		 * spinning, and the onload event was dispatched.
		 */
		on(event: 'did-finish-load', listener: Function): this;
		once(event: 'did-finish-load', listener: Function): this;
		addListener(event: 'did-finish-load', listener: Function): this;
		removeListener(event: 'did-finish-load', listener: Function): this;
		/**
		 * Emitted when a frame has done navigation.
		 */
		on(event: 'did-frame-finish-load', listener: (event: Event,
5498 5499 5500
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5501
		once(event: 'did-frame-finish-load', listener: (event: Event,
5502 5503 5504
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5505
		addListener(event: 'did-frame-finish-load', listener: (event: Event,
5506 5507 5508
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5509
		removeListener(event: 'did-frame-finish-load', listener: (event: Event,
5510 5511 5512
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5513
		/**
5514 5515 5516
		 * Emitted when any frame navigation is done. This event is not emitted for in-page
		 * navigations, such as clicking anchor links or updating the window.location.hash.
		 * Use did-navigate-in-page event for this purpose.
5517
		 */
5518 5519 5520 5521 5522
		on(event: 'did-frame-navigate', listener: (event: Event,
			url: string,
			/**
			 * -1 for non HTTP navigations
			 */
5523
			httpResponseCode: number,
5524 5525 5526 5527
			/**
			 * empty for non HTTP navigations,
			 */
			httpStatusText: string,
5528
			isMainFrame: boolean,
5529 5530 5531 5532 5533 5534 5535
			frameProcessId: number,
			frameRoutingId: number) => void): this;
		once(event: 'did-frame-navigate', listener: (event: Event,
			url: string,
			/**
			 * -1 for non HTTP navigations
			 */
5536
			httpResponseCode: number,
5537 5538 5539 5540
			/**
			 * empty for non HTTP navigations,
			 */
			httpStatusText: string,
5541
			isMainFrame: boolean,
5542 5543 5544 5545 5546 5547 5548
			frameProcessId: number,
			frameRoutingId: number) => void): this;
		addListener(event: 'did-frame-navigate', listener: (event: Event,
			url: string,
			/**
			 * -1 for non HTTP navigations
			 */
5549
			httpResponseCode: number,
5550 5551 5552 5553
			/**
			 * empty for non HTTP navigations,
			 */
			httpStatusText: string,
5554
			isMainFrame: boolean,
5555 5556 5557 5558 5559 5560 5561
			frameProcessId: number,
			frameRoutingId: number) => void): this;
		removeListener(event: 'did-frame-navigate', listener: (event: Event,
			url: string,
			/**
			 * -1 for non HTTP navigations
			 */
5562
			httpResponseCode: number,
5563 5564 5565 5566 5567 5568 5569
			/**
			 * empty for non HTTP navigations,
			 */
			httpStatusText: string,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5570
		/**
5571 5572 5573
		 * Emitted when a main frame navigation is done. This event is not emitted for
		 * in-page navigations, such as clicking anchor links or updating the
		 * window.location.hash. Use did-navigate-in-page event for this purpose.
5574 5575
		 */
		on(event: 'did-navigate', listener: (event: Event,
5576 5577 5578 5579 5580 5581 5582 5583 5584
			url: string,
			/**
			 * -1 for non HTTP navigations
			 */
			httpResponseCode: number,
			/**
			 * empty for non HTTP navigations
			 */
			httpStatusText: string) => void): this;
5585
		once(event: 'did-navigate', listener: (event: Event,
5586 5587 5588 5589 5590 5591 5592 5593 5594
			url: string,
			/**
			 * -1 for non HTTP navigations
			 */
			httpResponseCode: number,
			/**
			 * empty for non HTTP navigations
			 */
			httpStatusText: string) => void): this;
5595
		addListener(event: 'did-navigate', listener: (event: Event,
5596 5597 5598 5599 5600 5601 5602 5603 5604
			url: string,
			/**
			 * -1 for non HTTP navigations
			 */
			httpResponseCode: number,
			/**
			 * empty for non HTTP navigations
			 */
			httpStatusText: string) => void): this;
5605
		removeListener(event: 'did-navigate', listener: (event: Event,
5606 5607 5608 5609 5610 5611 5612 5613 5614
			url: string,
			/**
			 * -1 for non HTTP navigations
			 */
			httpResponseCode: number,
			/**
			 * empty for non HTTP navigations
			 */
			httpStatusText: string) => void): this;
5615
		/**
5616 5617 5618 5619
		 * Emitted when an in-page navigation happened in any frame. When in-page
		 * navigation happens, the page URL changes but does not cause navigation outside
		 * of the page. Examples of this occurring are when anchor links are clicked or
		 * when the DOM hashchange event is triggered.
5620 5621 5622
		 */
		on(event: 'did-navigate-in-page', listener: (event: Event,
			url: string,
5623 5624 5625
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5626 5627
		once(event: 'did-navigate-in-page', listener: (event: Event,
			url: string,
5628 5629 5630
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5631 5632
		addListener(event: 'did-navigate-in-page', listener: (event: Event,
			url: string,
5633 5634 5635
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5636 5637
		removeListener(event: 'did-navigate-in-page', listener: (event: Event,
			url: string,
5638 5639 5640
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669
		/**
		 * Emitted after a server side redirect occurs during navigation.  For example a
		 * 302 redirect. This event can not be prevented, if you want to prevent redirects
		 * you should checkout out the will-redirect event above.
		 */
		on(event: 'did-redirect-navigation', listener: (event: Event,
			url: string,
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
		once(event: 'did-redirect-navigation', listener: (event: Event,
			url: string,
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
		addListener(event: 'did-redirect-navigation', listener: (event: Event,
			url: string,
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
		removeListener(event: 'did-redirect-navigation', listener: (event: Event,
			url: string,
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5670 5671 5672 5673 5674 5675 5676
		/**
		 * Corresponds to the points in time when the spinner of the tab started spinning.
		 */
		on(event: 'did-start-loading', listener: Function): this;
		once(event: 'did-start-loading', listener: Function): this;
		addListener(event: 'did-start-loading', listener: Function): this;
		removeListener(event: 'did-start-loading', listener: Function): this;
5677 5678 5679 5680
		/**
		 * Emitted when any frame (including main) starts navigating. isInplace will be
		 * true for in-page navigations.
		 */
5681 5682
		on(event: 'did-start-navigation', listener: (event: Event,
			url: string,
5683 5684 5685 5686
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5687 5688
		once(event: 'did-start-navigation', listener: (event: Event,
			url: string,
5689 5690 5691 5692
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5693 5694
		addListener(event: 'did-start-navigation', listener: (event: Event,
			url: string,
5695 5696 5697 5698
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5699 5700
		removeListener(event: 'did-start-navigation', listener: (event: Event,
			url: string,
5701 5702 5703 5704
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782
		/**
		 * Corresponds to the points in time when the spinner of the tab stopped spinning.
		 */
		on(event: 'did-stop-loading', listener: Function): this;
		once(event: 'did-stop-loading', listener: Function): this;
		addListener(event: 'did-stop-loading', listener: Function): this;
		removeListener(event: 'did-stop-loading', listener: Function): this;
		/**
		 * Emitted when the document in the given frame is loaded.
		 */
		on(event: 'dom-ready', listener: (event: Event) => void): this;
		once(event: 'dom-ready', listener: (event: Event) => void): this;
		addListener(event: 'dom-ready', listener: (event: Event) => void): this;
		removeListener(event: 'dom-ready', listener: (event: Event) => void): this;
		/**
		 * Emitted when a result is available for [webContents.findInPage] request.
		 */
		on(event: 'found-in-page', listener: (event: Event,
			result: Result) => void): this;
		once(event: 'found-in-page', listener: (event: Event,
			result: Result) => void): this;
		addListener(event: 'found-in-page', listener: (event: Event,
			result: Result) => void): this;
		removeListener(event: 'found-in-page', listener: (event: Event,
			result: Result) => void): this;
		/**
		 * Emitted when webContents wants to do basic auth. The usage is the same with the
		 * login event of app.
		 */
		on(event: 'login', listener: (event: Event,
			request: Request,
			authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
		once(event: 'login', listener: (event: Event,
			request: Request,
			authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
		addListener(event: 'login', listener: (event: Event,
			request: Request,
			authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
		removeListener(event: 'login', listener: (event: Event,
			request: Request,
			authInfo: AuthInfo,
			callback: (username: string, password: string) => void) => void): this;
		/**
		 * Emitted when media is paused or done playing.
		 */
		on(event: 'media-paused', listener: Function): this;
		once(event: 'media-paused', listener: Function): this;
		addListener(event: 'media-paused', listener: Function): this;
		removeListener(event: 'media-paused', listener: Function): this;
		/**
		 * Emitted when media starts playing.
		 */
		on(event: 'media-started-playing', listener: Function): this;
		once(event: 'media-started-playing', listener: Function): this;
		addListener(event: 'media-started-playing', listener: Function): this;
		removeListener(event: 'media-started-playing', listener: Function): this;
		/**
		 * Emitted when the page requests to open a new window for a url. It could be
		 * requested by window.open or an external link like <a target='_blank'>. By
		 * default a new BrowserWindow will be created for the url. Calling
		 * event.preventDefault() will prevent Electron from automatically creating a new
		 * BrowserWindow. If you call event.preventDefault() and manually create a new
		 * BrowserWindow then you must set event.newGuest to reference the new
		 * BrowserWindow instance, failing to do so may result in unexpected behavior. For
		 * example:
		 */
		on(event: 'new-window', listener: (event: Event,
			url: string,
			frameName: string,
			/**
			 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
			 * `save-to-disk` and `other`.
			 */
			disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
			/**
5783
			 * The options which will be used for creating the new .
5784 5785 5786 5787 5788 5789
			 */
			options: any,
			/**
			 * The non-standard features (features not handled by Chromium or Electron) given
			 * to `window.open()`.
			 */
5790 5791 5792 5793 5794 5795
			additionalFeatures: string[],
			/**
			 * The referrer that will be passed to the new window. May or may not result in the
			 * `Referer` header being sent, depending on the referrer policy.
			 */
			referrer: Referrer) => void): this;
5796 5797 5798 5799 5800 5801 5802 5803 5804
		once(event: 'new-window', listener: (event: Event,
			url: string,
			frameName: string,
			/**
			 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
			 * `save-to-disk` and `other`.
			 */
			disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
			/**
5805
			 * The options which will be used for creating the new .
5806 5807 5808 5809 5810 5811
			 */
			options: any,
			/**
			 * The non-standard features (features not handled by Chromium or Electron) given
			 * to `window.open()`.
			 */
5812 5813 5814 5815 5816 5817
			additionalFeatures: string[],
			/**
			 * The referrer that will be passed to the new window. May or may not result in the
			 * `Referer` header being sent, depending on the referrer policy.
			 */
			referrer: Referrer) => void): this;
5818 5819 5820 5821 5822 5823 5824 5825 5826
		addListener(event: 'new-window', listener: (event: Event,
			url: string,
			frameName: string,
			/**
			 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
			 * `save-to-disk` and `other`.
			 */
			disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
			/**
5827
			 * The options which will be used for creating the new .
5828 5829 5830 5831 5832 5833
			 */
			options: any,
			/**
			 * The non-standard features (features not handled by Chromium or Electron) given
			 * to `window.open()`.
			 */
5834 5835 5836 5837 5838 5839
			additionalFeatures: string[],
			/**
			 * The referrer that will be passed to the new window. May or may not result in the
			 * `Referer` header being sent, depending on the referrer policy.
			 */
			referrer: Referrer) => void): this;
5840 5841 5842 5843 5844 5845 5846 5847 5848
		removeListener(event: 'new-window', listener: (event: Event,
			url: string,
			frameName: string,
			/**
			 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
			 * `save-to-disk` and `other`.
			 */
			disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
			/**
5849
			 * The options which will be used for creating the new .
5850 5851 5852 5853 5854 5855
			 */
			options: any,
			/**
			 * The non-standard features (features not handled by Chromium or Electron) given
			 * to `window.open()`.
			 */
5856 5857 5858 5859 5860 5861
			additionalFeatures: string[],
			/**
			 * The referrer that will be passed to the new window. May or may not result in the
			 * `Referer` header being sent, depending on the referrer policy.
			 */
			referrer: Referrer) => void): this;
5862 5863 5864 5865 5866
		/**
		 * Emitted when page receives favicon urls.
		 */
		on(event: 'page-favicon-updated', listener: (event: Event,
			/**
5867
			 * Array of URLs.
5868 5869 5870 5871
			 */
			favicons: string[]) => void): this;
		once(event: 'page-favicon-updated', listener: (event: Event,
			/**
5872
			 * Array of URLs.
5873 5874 5875 5876
			 */
			favicons: string[]) => void): this;
		addListener(event: 'page-favicon-updated', listener: (event: Event,
			/**
5877
			 * Array of URLs.
5878 5879 5880 5881
			 */
			favicons: string[]) => void): this;
		removeListener(event: 'page-favicon-updated', listener: (event: Event,
			/**
5882
			 * Array of URLs.
5883 5884
			 */
			favicons: string[]) => void): this;
B
Benjamin Pasero 已提交
5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900
		/**
		 * Fired when page title is set during navigation. explicitSet is false when title
		 * is synthesized from file url.
		 */
		on(event: 'page-title-updated', listener: (event: Event,
			title: string,
			explicitSet: boolean) => void): this;
		once(event: 'page-title-updated', listener: (event: Event,
			title: string,
			explicitSet: boolean) => void): this;
		addListener(event: 'page-title-updated', listener: (event: Event,
			title: string,
			explicitSet: boolean) => void): this;
		removeListener(event: 'page-title-updated', listener: (event: Event,
			title: string,
			explicitSet: boolean) => void): this;
5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930
		/**
		 * Emitted when a new frame is generated. Only the dirty area is passed in the
		 * buffer.
		 */
		on(event: 'paint', listener: (event: Event,
			dirtyRect: Rectangle,
			/**
			 * The image data of the whole frame.
			 */
			image: NativeImage) => void): this;
		once(event: 'paint', listener: (event: Event,
			dirtyRect: Rectangle,
			/**
			 * The image data of the whole frame.
			 */
			image: NativeImage) => void): this;
		addListener(event: 'paint', listener: (event: Event,
			dirtyRect: Rectangle,
			/**
			 * The image data of the whole frame.
			 */
			image: NativeImage) => void): this;
		removeListener(event: 'paint', listener: (event: Event,
			dirtyRect: Rectangle,
			/**
			 * The image data of the whole frame.
			 */
			image: NativeImage) => void): this;
		/**
		 * Emitted when a plugin process has crashed.
B
Benjamin Pasero 已提交
5931
		 */
5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943
		on(event: 'plugin-crashed', listener: (event: Event,
			name: string,
			version: string) => void): this;
		once(event: 'plugin-crashed', listener: (event: Event,
			name: string,
			version: string) => void): this;
		addListener(event: 'plugin-crashed', listener: (event: Event,
			name: string,
			version: string) => void): this;
		removeListener(event: 'plugin-crashed', listener: (event: Event,
			name: string,
			version: string) => void): this;
5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013
		/**
		 * Emitted when remote.getBuiltin() is called in the renderer process. Calling
		 * event.preventDefault() will prevent the module from being returned. Custom value
		 * can be returned by setting event.returnValue.
		 */
		on(event: 'remote-get-builtin', listener: (event: Event,
			moduleName: string) => void): this;
		once(event: 'remote-get-builtin', listener: (event: Event,
			moduleName: string) => void): this;
		addListener(event: 'remote-get-builtin', listener: (event: Event,
			moduleName: string) => void): this;
		removeListener(event: 'remote-get-builtin', listener: (event: Event,
			moduleName: string) => void): this;
		/**
		 * Emitted when remote.getCurrentWebContents() is called in the renderer process.
		 * Calling event.preventDefault() will prevent the object from being returned.
		 * Custom value can be returned by setting event.returnValue.
		 */
		on(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this;
		once(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this;
		addListener(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this;
		removeListener(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this;
		/**
		 * Emitted when remote.getCurrentWindow() is called in the renderer process.
		 * Calling event.preventDefault() will prevent the object from being returned.
		 * Custom value can be returned by setting event.returnValue.
		 */
		on(event: 'remote-get-current-window', listener: (event: Event) => void): this;
		once(event: 'remote-get-current-window', listener: (event: Event) => void): this;
		addListener(event: 'remote-get-current-window', listener: (event: Event) => void): this;
		removeListener(event: 'remote-get-current-window', listener: (event: Event) => void): this;
		/**
		 * Emitted when remote.getGlobal() is called in the renderer process. Calling
		 * event.preventDefault() will prevent the global from being returned. Custom value
		 * can be returned by setting event.returnValue.
		 */
		on(event: 'remote-get-global', listener: (event: Event,
			globalName: string) => void): this;
		once(event: 'remote-get-global', listener: (event: Event,
			globalName: string) => void): this;
		addListener(event: 'remote-get-global', listener: (event: Event,
			globalName: string) => void): this;
		removeListener(event: 'remote-get-global', listener: (event: Event,
			globalName: string) => void): this;
		/**
		 * Emitted when <webview>.getWebContents() is called in the renderer process.
		 * Calling event.preventDefault() will prevent the object from being returned.
		 * Custom value can be returned by setting event.returnValue.
		 */
		on(event: 'remote-get-guest-web-contents', listener: (event: Event,
			guestWebContents: WebContents) => void): this;
		once(event: 'remote-get-guest-web-contents', listener: (event: Event,
			guestWebContents: WebContents) => void): this;
		addListener(event: 'remote-get-guest-web-contents', listener: (event: Event,
			guestWebContents: WebContents) => void): this;
		removeListener(event: 'remote-get-guest-web-contents', listener: (event: Event,
			guestWebContents: WebContents) => void): this;
		/**
		 * Emitted when remote.require() is called in the renderer process. Calling
		 * event.preventDefault() will prevent the module from being returned. Custom value
		 * can be returned by setting event.returnValue.
		 */
		on(event: 'remote-require', listener: (event: Event,
			moduleName: string) => void): this;
		once(event: 'remote-require', listener: (event: Event,
			moduleName: string) => void): this;
		addListener(event: 'remote-require', listener: (event: Event,
			moduleName: string) => void): this;
		removeListener(event: 'remote-require', listener: (event: Event,
			moduleName: string) => void): this;
6014 6015 6016 6017 6018 6019 6020
		/**
		 * Emitted when the unresponsive web page becomes responsive again.
		 */
		on(event: 'responsive', listener: Function): this;
		once(event: 'responsive', listener: Function): this;
		addListener(event: 'responsive', listener: Function): this;
		removeListener(event: 'responsive', listener: Function): this;
6021 6022 6023
		/**
		 * Emitted when bluetooth device needs to be selected on call to
		 * navigator.bluetooth.requestDevice. To use navigator.bluetooth api webBluetooth
6024 6025
		 * should be enabled. If event.preventDefault is not called, first available device
		 * will be selected. callback should be called with deviceId to be selected,
6026
		 * passing empty string to callback will cancel the request.
B
Benjamin Pasero 已提交
6027
		 */
6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042
		on(event: 'select-bluetooth-device', listener: (event: Event,
			devices: BluetoothDevice[],
			callback: (deviceId: string) => void) => void): this;
		once(event: 'select-bluetooth-device', listener: (event: Event,
			devices: BluetoothDevice[],
			callback: (deviceId: string) => void) => void): this;
		addListener(event: 'select-bluetooth-device', listener: (event: Event,
			devices: BluetoothDevice[],
			callback: (deviceId: string) => void) => void): this;
		removeListener(event: 'select-bluetooth-device', listener: (event: Event,
			devices: BluetoothDevice[],
			callback: (deviceId: string) => void) => void): this;
		/**
		 * Emitted when a client certificate is requested. The usage is the same with the
		 * select-client-certificate event of app.
B
Benjamin Pasero 已提交
6043
		 */
6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059
		on(event: 'select-client-certificate', listener: (event: Event,
			url: string,
			certificateList: Certificate[],
			callback: (certificate: Certificate) => void) => void): this;
		once(event: 'select-client-certificate', listener: (event: Event,
			url: string,
			certificateList: Certificate[],
			callback: (certificate: Certificate) => void) => void): this;
		addListener(event: 'select-client-certificate', listener: (event: Event,
			url: string,
			certificateList: Certificate[],
			callback: (certificate: Certificate) => void) => void): this;
		removeListener(event: 'select-client-certificate', listener: (event: Event,
			url: string,
			certificateList: Certificate[],
			callback: (certificate: Certificate) => void) => void): this;
6060 6061 6062 6063 6064 6065 6066
		/**
		 * Emitted when the web page becomes unresponsive.
		 */
		on(event: 'unresponsive', listener: Function): this;
		once(event: 'unresponsive', listener: Function): this;
		addListener(event: 'unresponsive', listener: Function): this;
		removeListener(event: 'unresponsive', listener: Function): this;
B
Benjamin Pasero 已提交
6067
		/**
6068
		 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
B
Benjamin Pasero 已提交
6069
		 */
6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092
		on(event: 'update-target-url', listener: (event: Event,
			url: string) => void): this;
		once(event: 'update-target-url', listener: (event: Event,
			url: string) => void): this;
		addListener(event: 'update-target-url', listener: (event: Event,
			url: string) => void): this;
		removeListener(event: 'update-target-url', listener: (event: Event,
			url: string) => void): this;
		/**
		 * Emitted when a <webview>'s web contents is being attached to this web contents.
		 * Calling event.preventDefault() will destroy the guest page. This event can be
		 * used to configure webPreferences for the webContents of a <webview> before it's
		 * loaded, and provides the ability to set settings that can't be set via <webview>
		 * attributes. Note: The specified preload script option will be appear as
		 * preloadURL (not preload) in the webPreferences object emitted with this event.
		 */
		on(event: 'will-attach-webview', listener: (event: Event,
			/**
			 * The web preferences that will be used by the guest page. This object can be
			 * modified to adjust the preferences for the guest page.
			 */
			webPreferences: any,
			/**
6093
			 * The other `
6094 6095 6096 6097 6098 6099 6100 6101 6102
			 */
			params: any) => void): this;
		once(event: 'will-attach-webview', listener: (event: Event,
			/**
			 * The web preferences that will be used by the guest page. This object can be
			 * modified to adjust the preferences for the guest page.
			 */
			webPreferences: any,
			/**
6103
			 * The other `
6104 6105 6106 6107 6108 6109 6110 6111 6112
			 */
			params: any) => void): this;
		addListener(event: 'will-attach-webview', listener: (event: Event,
			/**
			 * The web preferences that will be used by the guest page. This object can be
			 * modified to adjust the preferences for the guest page.
			 */
			webPreferences: any,
			/**
6113
			 * The other `
6114 6115 6116 6117 6118 6119 6120 6121 6122
			 */
			params: any) => void): this;
		removeListener(event: 'will-attach-webview', listener: (event: Event,
			/**
			 * The web preferences that will be used by the guest page. This object can be
			 * modified to adjust the preferences for the guest page.
			 */
			webPreferences: any,
			/**
6123
			 * The other `
6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151
			 */
			params: any) => void): this;
		/**
		 * Emitted when a user or the page wants to start navigation. It can happen when
		 * the window.location object is changed or a user clicks a link in the page. This
		 * event will not emit when the navigation is started programmatically with APIs
		 * like webContents.loadURL and webContents.back. It is also not emitted for
		 * in-page navigations, such as clicking anchor links or updating the
		 * window.location.hash. Use did-navigate-in-page event for this purpose. Calling
		 * event.preventDefault() will prevent the navigation.
		 */
		on(event: 'will-navigate', listener: (event: Event,
			url: string) => void): this;
		once(event: 'will-navigate', listener: (event: Event,
			url: string) => void): this;
		addListener(event: 'will-navigate', listener: (event: Event,
			url: string) => void): this;
		removeListener(event: 'will-navigate', listener: (event: Event,
			url: string) => void): this;
		/**
		 * Emitted when a beforeunload event handler is attempting to cancel a page unload.
		 * Calling event.preventDefault() will ignore the beforeunload event handler and
		 * allow the page to be unloaded.
		 */
		on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
		once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
		addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
		removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181
		/**
		 * Emitted as a server side redirect occurs during navigation.  For example a 302
		 * redirect. This event will be emitted after did-start-navigation and always
		 * before the did-redirect-navigation event for the same navigation. Calling
		 * event.preventDefault() will prevent the navigation (not just the redirect).
		 */
		on(event: 'will-redirect', listener: (event: Event,
			url: string,
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
		once(event: 'will-redirect', listener: (event: Event,
			url: string,
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
		addListener(event: 'will-redirect', listener: (event: Event,
			url: string,
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
		removeListener(event: 'will-redirect', listener: (event: Event,
			url: string,
			isInPlace: boolean,
			isMainFrame: boolean,
			frameProcessId: number,
			frameRoutingId: number) => void): this;
6182 6183 6184
		/**
		 * Adds the specified path to DevTools workspace. Must be used after DevTools
		 * creation:
B
Benjamin Pasero 已提交
6185
		 */
6186
		addWorkSpace(path: string): void;
B
Benjamin Pasero 已提交
6187
		/**
6188
		 * Begin subscribing for presentation events and captured frames, the callback will
6189 6190 6191 6192 6193 6194 6195
		 * be called with callback(image, dirtyRect) when there is a presentation event.
		 * The image is an instance of NativeImage that stores the captured frame. The
		 * dirtyRect is an object with x, y, width, height properties that describes which
		 * part of the page was repainted. If onlyDirty is set to true, image will only
		 * contain the repainted area. onlyDirty defaults to false.
		 */
		beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
6196 6197
		/**
		 * Begin subscribing for presentation events and captured frames, the callback will
6198 6199 6200 6201 6202 6203 6204
		 * be called with callback(image, dirtyRect) when there is a presentation event.
		 * The image is an instance of NativeImage that stores the captured frame. The
		 * dirtyRect is an object with x, y, width, height properties that describes which
		 * part of the page was repainted. If onlyDirty is set to true, image will only
		 * contain the repainted area. onlyDirty defaults to false.
		 */
		beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
6205 6206 6207
		canGoBack(): boolean;
		canGoForward(): boolean;
		canGoToOffset(offset: number): boolean;
B
Benjamin Pasero 已提交
6208
		/**
6209 6210 6211
		 * Captures a snapshot of the page within rect. Upon completion callback will be
		 * called with callback(image). The image is an instance of NativeImage that stores
		 * data of the snapshot. Omitting rect will capture the whole visible page.
B
Benjamin Pasero 已提交
6212
		 */
6213
		capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void;
B
Benjamin Pasero 已提交
6214
		/**
6215 6216 6217
		 * Captures a snapshot of the page within rect. Upon completion callback will be
		 * called with callback(image). The image is an instance of NativeImage that stores
		 * data of the snapshot. Omitting rect will capture the whole visible page.
B
Benjamin Pasero 已提交
6218
		 */
6219
		capturePage(callback: (image: NativeImage) => void): void;
B
Benjamin Pasero 已提交
6220
		/**
6221
		 * Clears the navigation history.
B
Benjamin Pasero 已提交
6222
		 */
6223
		clearHistory(): void;
B
Benjamin Pasero 已提交
6224
		/**
6225
		 * Closes the devtools.
B
Benjamin Pasero 已提交
6226
		 */
6227
		closeDevTools(): void;
B
Benjamin Pasero 已提交
6228
		/**
6229
		 * Executes the editing command copy in web page.
B
Benjamin Pasero 已提交
6230
		 */
6231
		copy(): void;
B
Benjamin Pasero 已提交
6232
		/**
6233
		 * Copy the image at the given position to the clipboard.
B
Benjamin Pasero 已提交
6234
		 */
6235
		copyImageAt(x: number, y: number): void;
B
Benjamin Pasero 已提交
6236
		/**
6237
		 * Executes the editing command cut in web page.
B
Benjamin Pasero 已提交
6238
		 */
6239
		cut(): void;
B
Benjamin Pasero 已提交
6240
		/**
6241
		 * Executes the editing command delete in web page.
B
Benjamin Pasero 已提交
6242
		 */
6243
		delete(): void;
B
Benjamin Pasero 已提交
6244
		/**
6245
		 * Disable device emulation enabled by webContents.enableDeviceEmulation.
B
Benjamin Pasero 已提交
6246
		 */
6247
		disableDeviceEmulation(): void;
B
Benjamin Pasero 已提交
6248
		/**
6249 6250
		 * Initiates a download of the resource at url without navigating. The
		 * will-download event of session will be triggered.
B
Benjamin Pasero 已提交
6251
		 */
6252
		downloadURL(url: string): void;
B
Benjamin Pasero 已提交
6253
		/**
6254
		 * Enable device emulation with the given parameters.
B
Benjamin Pasero 已提交
6255
		 */
6256
		enableDeviceEmulation(parameters: Parameters): void;
B
Benjamin Pasero 已提交
6257
		/**
6258
		 * End subscribing for frame presentation events.
B
Benjamin Pasero 已提交
6259
		 */
6260
		endFrameSubscription(): void;
B
Benjamin Pasero 已提交
6261
		/**
6262 6263 6264 6265
		 * Evaluates code in page. In the browser window some HTML APIs like
		 * requestFullScreen can only be invoked by a gesture from the user. Setting
		 * userGesture to true will remove this limitation. If the result of the executed
		 * code is a promise the callback result will be the resolved value of the promise.
6266
		 * We recommend that you use the returned Promise to handle code that results in a
6267
		 * Promise.
B
Benjamin Pasero 已提交
6268
		 */
6269
		executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise<any>;
B
Benjamin Pasero 已提交
6270
		/**
6271 6272
		 * Starts a request to find all matches for the text in the web page. The result of
		 * the request can be obtained by subscribing to found-in-page event.
B
Benjamin Pasero 已提交
6273
		 */
6274
		findInPage(text: string, options?: FindInPageOptions): number;
6275
		/**
B
Benjamin Pasero 已提交
6276
		 * Focuses the web page.
6277
		 */
B
Benjamin Pasero 已提交
6278
		focus(): void;
6279 6280
		getFrameRate(): number;
		getOSProcessId(): number;
6281
		/**
6282
		 * Get the system printer list.
6283
		 */
6284
		getPrinters(): PrinterInfo[];
6285
		getProcessId(): number;
6286
		getTitle(): string;
6287
		getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
6288 6289 6290
		getURL(): string;
		getUserAgent(): string;
		getWebRTCIPHandlingPolicy(): string;
6291
		/**
6292 6293
		 * Sends a request to get current zoom factor, the callback will be called with
		 * callback(zoomFactor).
6294
		 */
6295
		getZoomFactor(callback: (zoomFactor: number) => void): void;
J
Joao Moreno 已提交
6296
		/**
6297 6298
		 * Sends a request to get current zoom level, the callback will be called with
		 * callback(zoomLevel).
J
Joao Moreno 已提交
6299
		 */
6300
		getZoomLevel(callback: (zoomLevel: number) => void): void;
J
Joao Moreno 已提交
6301
		/**
6302
		 * Makes the browser go back a web page.
J
Joao Moreno 已提交
6303
		 */
6304
		goBack(): void;
J
Joao Moreno 已提交
6305
		/**
6306
		 * Makes the browser go forward a web page.
J
Joao Moreno 已提交
6307
		 */
6308
		goForward(): void;
J
Joao Moreno 已提交
6309
		/**
6310
		 * Navigates browser to the specified absolute web page index.
J
Joao Moreno 已提交
6311
		 */
6312
		goToIndex(index: number): void;
J
Joao Moreno 已提交
6313
		/**
6314
		 * Navigates to the specified offset from the "current entry".
J
Joao Moreno 已提交
6315
		 */
6316
		goToOffset(offset: number): void;
J
Joao Moreno 已提交
6317
		/**
6318 6319
		 * Checks if any ServiceWorker is registered and returns a boolean as response to
		 * callback.
J
Joao Moreno 已提交
6320
		 */
6321
		hasServiceWorker(callback: (hasWorker: boolean) => void): void;
J
Joao Moreno 已提交
6322
		/**
6323
		 * Injects CSS into the current web page.
J
Joao Moreno 已提交
6324
		 */
6325
		insertCSS(css: string): void;
J
Joao Moreno 已提交
6326
		/**
6327
		 * Inserts text to the focused element.
J
Joao Moreno 已提交
6328
		 */
6329
		insertText(text: string): void;
J
Joao Moreno 已提交
6330
		/**
6331
		 * Starts inspecting element at position (x, y).
J
Joao Moreno 已提交
6332
		 */
6333
		inspectElement(x: number, y: number): void;
J
Joao Moreno 已提交
6334
		/**
6335
		 * Opens the developer tools for the service worker context.
J
Joao Moreno 已提交
6336
		 */
6337
		inspectServiceWorker(): void;
J
Joao Moreno 已提交
6338
		/**
6339 6340 6341
		 * Schedules a full repaint of the window this web contents is in. If offscreen
		 * rendering is enabled invalidates the frame and generates a new one through the
		 * 'paint' event.
J
Joao Moreno 已提交
6342
		 */
6343 6344 6345
		invalidate(): void;
		isAudioMuted(): boolean;
		isCrashed(): boolean;
6346
		isCurrentlyAudible(): boolean;
6347 6348 6349 6350 6351 6352 6353 6354 6355
		isDestroyed(): boolean;
		isDevToolsFocused(): boolean;
		isDevToolsOpened(): boolean;
		isFocused(): boolean;
		isLoading(): boolean;
		isLoadingMainFrame(): boolean;
		isOffscreen(): boolean;
		isPainting(): boolean;
		isWaitingForResponse(): boolean;
6356 6357 6358 6359 6360
		/**
		 * Loads the given file in the window, filePath should be a path to an HTML file
		 * relative to the root of your application.  For instance an app structure like
		 * this: Would require code like this
		 */
6361
		loadFile(filePath: string, options?: LoadFileOptions): void;
J
Joao Moreno 已提交
6362
		/**
6363 6364 6365
		 * Loads the url in the window. The url must contain the protocol prefix, e.g. the
		 * http:// or file://. If the load should bypass http cache then use the pragma
		 * header to achieve it.
J
Joao Moreno 已提交
6366
		 */
6367
		loadURL(url: string, options?: LoadURLOptions): void;
J
Joao Moreno 已提交
6368
		/**
6369 6370 6371
		 * Opens the devtools. When contents is a <webview> tag, the mode would be detach
		 * by default, explicitly passing an empty mode can force using last used dock
		 * state.
J
Joao Moreno 已提交
6372
		 */
6373
		openDevTools(options?: OpenDevToolsOptions): void;
J
Joao Moreno 已提交
6374
		/**
6375
		 * Executes the editing command paste in web page.
J
Joao Moreno 已提交
6376
		 */
6377
		paste(): void;
J
Joao Moreno 已提交
6378
		/**
6379
		 * Executes the editing command pasteAndMatchStyle in web page.
J
Joao Moreno 已提交
6380
		 */
6381
		pasteAndMatchStyle(): void;
J
Joao Moreno 已提交
6382
		/**
6383 6384 6385
		 * Prints window's web page. When silent is set to true, Electron will pick the
		 * system's default printer if deviceName is empty and the default settings for
		 * printing. Calling window.print() in web page is equivalent to calling
6386 6387
		 * webContents.print({ silent: false, printBackground: false, deviceName: '' }).
		 * Use page-break-before: always; CSS style to force to print to a new page.
J
Joao Moreno 已提交
6388
		 */
6389
		print(options?: PrintOptions, callback?: (success: boolean) => void): void;
J
Joao Moreno 已提交
6390
		/**
6391 6392 6393 6394 6395 6396
		 * Prints window's web page as PDF with Chromium's preview printing custom
		 * settings. The callback will be called with callback(error, data) on completion.
		 * The data is a Buffer that contains the generated PDF data. The landscape will be
		 * ignored if @page CSS at-rule is used in the web page. By default, an empty
		 * options will be regarded as: Use page-break-before: always; CSS style to force
		 * to print to a new page. An example of webContents.printToPDF:
J
Joao Moreno 已提交
6397
		 */
6398
		printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void;
J
Joao Moreno 已提交
6399
		/**
6400
		 * Executes the editing command redo in web page.
J
Joao Moreno 已提交
6401
		 */
6402
		redo(): void;
J
Joao Moreno 已提交
6403
		/**
6404
		 * Reloads the current web page.
J
Joao Moreno 已提交
6405
		 */
6406
		reload(): void;
J
Joao Moreno 已提交
6407
		/**
6408
		 * Reloads current page and ignores cache.
J
Joao Moreno 已提交
6409
		 */
6410
		reloadIgnoringCache(): void;
J
Joao Moreno 已提交
6411
		/**
6412
		 * Removes the specified path from DevTools workspace.
J
Joao Moreno 已提交
6413
		 */
6414
		removeWorkSpace(path: string): void;
J
Joao Moreno 已提交
6415
		/**
6416
		 * Executes the editing command replace in web page.
J
Joao Moreno 已提交
6417
		 */
6418
		replace(text: string): void;
J
Joao Moreno 已提交
6419
		/**
6420
		 * Executes the editing command replaceMisspelling in web page.
J
Joao Moreno 已提交
6421
		 */
6422 6423
		replaceMisspelling(text: string): void;
		savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML', callback: (error: Error) => void): boolean;
J
Joao Moreno 已提交
6424
		/**
6425
		 * Executes the editing command selectAll in web page.
J
Joao Moreno 已提交
6426
		 */
6427
		selectAll(): void;
J
Joao Moreno 已提交
6428
		/**
6429 6430 6431 6432 6433
		 * Send an asynchronous message to renderer process via channel, you can also send
		 * arbitrary arguments. Arguments will be serialized in JSON internally and hence
		 * no functions or prototype chain will be included. The renderer process can
		 * handle the message by listening to channel with the ipcRenderer module. An
		 * example of sending messages from the main process to the renderer process:
J
Joao Moreno 已提交
6434
		 */
6435
		send(channel: string, ...args: any[]): void;
J
Joao Moreno 已提交
6436
		/**
6437 6438 6439 6440 6441
		 * Sends an input event to the page. Note: The BrowserWindow containing the
		 * contents needs to be focused for sendInputEvent() to work. For keyboard events,
		 * the event object also have following properties: For mouse events, the event
		 * object also have following properties: For the mouseWheel event, the event
		 * object also have following properties:
J
Joao Moreno 已提交
6442
		 */
6443
		sendInputEvent(event: Event): void;
J
Joao Moreno 已提交
6444
		/**
6445
		 * Mute the audio on the current web page.
J
Joao Moreno 已提交
6446
		 */
6447
		setAudioMuted(muted: boolean): void;
6448 6449 6450 6451 6452
		/**
		 * Controls whether or not this WebContents will throttle animations and timers
		 * when the page becomes backgrounded. This also affects the Page Visibility API.
		 */
		setBackgroundThrottling(allowed: boolean): void;
6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465
		/**
		 * Uses the devToolsWebContents as the target WebContents to show devtools. The
		 * devToolsWebContents must not have done any navigation, and it should not be used
		 * for other purposes after the call. By default Electron manages the devtools by
		 * creating an internal WebContents with native view, which developers have very
		 * limited control of. With the setDevToolsWebContents method, developers can use
		 * any WebContents to show the devtools in it, including BrowserWindow, BrowserView
		 * and <webview> tag. Note that closing the devtools does not destroy the
		 * devToolsWebContents, it is caller's responsibility to destroy
		 * devToolsWebContents. An example of showing devtools in a <webview> tag: An
		 * example of showing devtools in a BrowserWindow:
		 */
		setDevToolsWebContents(devToolsWebContents: WebContents): void;
J
Joao Moreno 已提交
6466
		/**
6467 6468
		 * If offscreen rendering is enabled sets the frame rate to the specified number.
		 * Only values between 1 and 60 are accepted.
J
Joao Moreno 已提交
6469
		 */
6470
		setFrameRate(fps: number): void;
J
Joao Moreno 已提交
6471
		/**
B
Benjamin Pasero 已提交
6472
		 * Ignore application menu shortcuts while this web contents is focused.
J
Joao Moreno 已提交
6473
		 */
B
Benjamin Pasero 已提交
6474
		setIgnoreMenuShortcuts(ignore: boolean): void;
J
Joao Moreno 已提交
6475
		/**
6476
		 * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
J
Joao Moreno 已提交
6477
		 */
6478
		setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
J
Joao Moreno 已提交
6479
		/**
6480
		 * Overrides the user agent for this web page.
J
Joao Moreno 已提交
6481
		 */
6482
		setUserAgent(userAgent: string): void;
B
Benjamin Pasero 已提交
6483
		/**
6484
		 * Sets the maximum and minimum pinch-to-zoom level.
B
Benjamin Pasero 已提交
6485
		 */
6486
		setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
B
Benjamin Pasero 已提交
6487
		/**
6488
		 * Setting the WebRTC IP handling policy allows you to control which IPs are
6489
		 * exposed via WebRTC. See BrowserLeaks for more details.
B
Benjamin Pasero 已提交
6490
		 */
6491
		setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
B
Benjamin Pasero 已提交
6492
		/**
6493 6494
		 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
		 * divided by 100, so 300% = 3.0.
B
Benjamin Pasero 已提交
6495
		 */
6496
		setZoomFactor(factor: number): void;
B
Benjamin Pasero 已提交
6497
		/**
6498 6499
		 * Changes the zoom level to the specified level. The original size is 0 and each
		 * increment above or below represents zooming 20% larger or smaller to default
6500 6501
		 * limits of 300% and 50% of original size, respectively. The formula for this is
		 * scale := 1.2 ^ level.
B
Benjamin Pasero 已提交
6502
		 */
6503
		setZoomLevel(level: number): void;
B
Benjamin Pasero 已提交
6504
		/**
6505
		 * Shows pop-up dictionary that searches the selected word on the page.
B
Benjamin Pasero 已提交
6506
		 */
6507
		showDefinitionForSelection(): void;
B
Benjamin Pasero 已提交
6508
		/**
6509 6510 6511
		 * Sets the item as dragging item for current drag-drop operation, file is the
		 * absolute path of the file to be dragged, and icon is the image showing under the
		 * cursor when dragging.
B
Benjamin Pasero 已提交
6512
		 */
6513
		startDrag(item: Item): void;
B
Benjamin Pasero 已提交
6514
		/**
6515
		 * If offscreen rendering is enabled and not painting, start painting.
B
Benjamin Pasero 已提交
6516
		 */
6517
		startPainting(): void;
B
Benjamin Pasero 已提交
6518
		/**
6519
		 * Stops any pending navigation.
B
Benjamin Pasero 已提交
6520
		 */
6521
		stop(): void;
B
Benjamin Pasero 已提交
6522
		/**
6523
		 * Stops any findInPage request for the webContents with the provided action.
B
Benjamin Pasero 已提交
6524
		 */
6525
		stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
B
Benjamin Pasero 已提交
6526
		/**
6527
		 * If offscreen rendering is enabled and painting, stop painting.
B
Benjamin Pasero 已提交
6528
		 */
6529
		stopPainting(): void;
6530 6531 6532 6533
		/**
		 * Takes a V8 heap snapshot and saves it to filePath.
		 */
		takeHeapSnapshot(filePath: string): Promise<void>;
B
Benjamin Pasero 已提交
6534
		/**
6535
		 * Toggles the developer tools.
B
Benjamin Pasero 已提交
6536
		 */
6537
		toggleDevTools(): void;
B
Benjamin Pasero 已提交
6538
		/**
6539
		 * Executes the editing command undo in web page.
B
Benjamin Pasero 已提交
6540
		 */
6541
		undo(): void;
B
Benjamin Pasero 已提交
6542
		/**
6543 6544 6545
		 * Unregisters any ServiceWorker if present and returns a boolean as response to
		 * callback when the JS promise is fulfilled or false when the JS promise is
		 * rejected.
B
Benjamin Pasero 已提交
6546
		 */
6547
		unregisterServiceWorker(callback: (success: boolean) => void): void;
B
Benjamin Pasero 已提交
6548
		/**
6549
		 * Executes the editing command unselect in web page.
B
Benjamin Pasero 已提交
6550
		 */
6551 6552 6553 6554 6555 6556
		unselect(): void;
		debugger: Debugger;
		devToolsWebContents: WebContents;
		hostWebContents: WebContents;
		id: number;
		session: Session;
B
Benjamin Pasero 已提交
6557 6558
	}

6559 6560
	interface WebFrame extends EventEmitter {

6561
		// Docs: http://electronjs.org/docs/api/web-frame
B
Benjamin Pasero 已提交
6562 6563

		/**
6564 6565 6566 6567 6568 6569
		 * Attempts to free memory that is no longer being used (like images from a
		 * previous navigation). Note that blindly calling this method probably makes
		 * Electron slower since it will have to refill these emptied caches, you should
		 * only call it if an event in your app has occurred that makes you think your page
		 * is actually using less memory (i.e. you have navigated from a super heavy page
		 * to a mostly empty one, and intend to stay there).
B
Benjamin Pasero 已提交
6570
		 */
6571
		clearCache(): void;
B
Benjamin Pasero 已提交
6572
		/**
6573 6574 6575
		 * Evaluates code in page. In the browser window some HTML APIs like
		 * requestFullScreen can only be invoked by a gesture from the user. Setting
		 * userGesture to true will remove this limitation.
B
Benjamin Pasero 已提交
6576
		 */
6577
		executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise<any>;
6578
		/**
6579
		 * Work like executeJavaScript but evaluates scripts in an isolated context.
6580 6581
		 */
		executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any) => void): void;
6582 6583 6584
		findFrameByName(name: string): WebFrame;
		findFrameByRoutingId(routingId: number): WebFrame;
		getFrameForSelector(selector: string): WebFrame;
B
Benjamin Pasero 已提交
6585
		/**
6586 6587
		 * Returns an object describing usage information of Blink's internal memory
		 * caches. This will generate:
B
Benjamin Pasero 已提交
6588
		 */
6589 6590 6591
		getResourceUsage(): ResourceUsage;
		getZoomFactor(): number;
		getZoomLevel(): number;
B
Benjamin Pasero 已提交
6592
		/**
6593
		 * Inserts text to the focused element.
B
Benjamin Pasero 已提交
6594
		 */
6595
		insertText(text: string): void;
B
Benjamin Pasero 已提交
6596
		/**
6597 6598
		 * Resources will be loaded from this scheme regardless of the current page's
		 * Content Security Policy.
B
Benjamin Pasero 已提交
6599
		 */
6600
		registerURLSchemeAsBypassingCSP(scheme: string): void;
B
Benjamin Pasero 已提交
6601
		/**
6602 6603 6604 6605
		 * Registers the scheme as secure, bypasses content security policy for resources,
		 * allows registering ServiceWorker and supports fetch API. Specify an option with
		 * the value of false to omit it from the registration. An example of registering a
		 * privileged scheme, without bypassing Content Security Policy:
B
Benjamin Pasero 已提交
6606
		 */
6607
		registerURLSchemeAsPrivileged(scheme: string, options?: RegisterURLSchemeAsPrivilegedOptions): void;
6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619
		/**
		 * Set the content security policy of the isolated world.
		 */
		setIsolatedWorldContentSecurityPolicy(worldId: number, csp: string): void;
		/**
		 * Set the name of the isolated world. Useful in devtools.
		 */
		setIsolatedWorldHumanReadableName(worldId: number, name: string): void;
		/**
		 * Set the security origin of the isolated world.
		 */
		setIsolatedWorldSecurityOrigin(worldId: number, securityOrigin: string): void;
B
Benjamin Pasero 已提交
6620
		/**
6621
		 * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
B
Benjamin Pasero 已提交
6622
		 */
6623
		setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
B
Benjamin Pasero 已提交
6624
		/**
6625 6626 6627
		 * Sets a provider for spell checking in input fields and text areas. The provider
		 * must be an object that has a spellCheck method that returns whether the word
		 * passed is correctly spelled. An example of using node-spellchecker as provider:
B
Benjamin Pasero 已提交
6628
		 */
6629
		setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: Provider): void;
B
Benjamin Pasero 已提交
6630
		/**
6631
		 * Sets the maximum and minimum pinch-to-zoom level.
B
Benjamin Pasero 已提交
6632
		 */
6633
		setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
B
Benjamin Pasero 已提交
6634
		/**
6635 6636
		 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
		 * divided by 100, so 300% = 3.0.
B
Benjamin Pasero 已提交
6637
		 */
6638
		setZoomFactor(factor: number): void;
B
Benjamin Pasero 已提交
6639
		/**
6640 6641 6642
		 * Changes the zoom level to the specified level. The original size is 0 and each
		 * increment above or below represents zooming 20% larger or smaller to default
		 * limits of 300% and 50% of original size, respectively.
B
Benjamin Pasero 已提交
6643
		 */
6644
		setZoomLevel(level: number): void;
6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677
		/**
		 * A WebFrame representing the first child frame of webFrame, the property would be
		 * null if webFrame has no children or if first child is not in the current
		 * renderer process.
		 */
		firstChild?: WebFrame;
		/**
		 * A WebFrame representing next sibling frame, the property would be null if
		 * webFrame is the last frame in its parent or if the next sibling is not in the
		 * current renderer process.
		 */
		nextSibling?: WebFrame;
		/**
		 * A WebFrame representing the frame which opened webFrame, the property would be
		 * null if there's no opener or opener is not in the current renderer process.
		 */
		opener?: WebFrame;
		/**
		 * A WebFrame representing parent frame of webFrame, the property would be null if
		 * webFrame is top or parent is not in the current renderer process.
		 */
		parent?: WebFrame;
		/**
		 * An Integer representing the unique frame id in the current renderer process.
		 * Distinct WebFrame instances that refer to the same underlying frame will have
		 * the same routingId.
		 */
		routingId?: number;
		/**
		 * A WebFrame representing top frame in frame hierarchy to which webFrame belongs,
		 * the property would be null if top frame is not in the current renderer process.
		 */
		top?: WebFrame;
B
Benjamin Pasero 已提交
6678 6679
	}

6680 6681
	class WebRequest extends EventEmitter {

6682
		// Docs: http://electronjs.org/docs/api/web-request
B
Benjamin Pasero 已提交
6683

6684 6685 6686 6687 6688
		/**
		 * The listener will be called with listener(details) when a server initiated
		 * redirect is about to occur.
		 */
		onBeforeRedirect(listener: (details: OnBeforeRedirectDetails) => void): void;
B
Benjamin Pasero 已提交
6689
		/**
6690 6691
		 * The listener will be called with listener(details) when a server initiated
		 * redirect is about to occur.
B
Benjamin Pasero 已提交
6692
		 */
6693
		onBeforeRedirect(filter: OnBeforeRedirectFilter, listener: (details: OnBeforeRedirectDetails) => void): void;
6694 6695 6696 6697 6698 6699
		/**
		 * The listener will be called with listener(details, callback) when a request is
		 * about to occur. The uploadData is an array of UploadData objects. The callback
		 * has to be called with an response object.
		 */
		onBeforeRequest(listener: (details: OnBeforeRequestDetails, callback: (response: Response) => void) => void): void;
B
Benjamin Pasero 已提交
6700
		/**
6701 6702 6703
		 * The listener will be called with listener(details, callback) when a request is
		 * about to occur. The uploadData is an array of UploadData objects. The callback
		 * has to be called with an response object.
B
Benjamin Pasero 已提交
6704
		 */
6705
		onBeforeRequest(filter: OnBeforeRequestFilter, listener: (details: OnBeforeRequestDetails, callback: (response: Response) => void) => void): void;
B
Benjamin Pasero 已提交
6706
		/**
6707 6708 6709 6710
		 * The listener will be called with listener(details, callback) before sending an
		 * HTTP request, once the request headers are available. This may occur after a TCP
		 * connection is made to the server, but before any http data is sent. The callback
		 * has to be called with an response object.
B
Benjamin Pasero 已提交
6711
		 */
B
Benjamin Pasero 已提交
6712
		onBeforeSendHeaders(filter: OnBeforeSendHeadersFilter, listener: (details: OnBeforeSendHeadersDetails, callback: (response: OnBeforeSendHeadersResponse) => void) => void): void;
6713 6714 6715 6716 6717 6718
		/**
		 * The listener will be called with listener(details, callback) before sending an
		 * HTTP request, once the request headers are available. This may occur after a TCP
		 * connection is made to the server, but before any http data is sent. The callback
		 * has to be called with an response object.
		 */
B
Benjamin Pasero 已提交
6719
		onBeforeSendHeaders(listener: (details: OnBeforeSendHeadersDetails, callback: (response: OnBeforeSendHeadersResponse) => void) => void): void;
B
Benjamin Pasero 已提交
6720
		/**
6721
		 * The listener will be called with listener(details) when a request is completed.
B
Benjamin Pasero 已提交
6722
		 */
6723
		onCompleted(filter: OnCompletedFilter, listener: (details: OnCompletedDetails) => void): void;
6724 6725 6726 6727 6728 6729 6730 6731
		/**
		 * The listener will be called with listener(details) when a request is completed.
		 */
		onCompleted(listener: (details: OnCompletedDetails) => void): void;
		/**
		 * The listener will be called with listener(details) when an error occurs.
		 */
		onErrorOccurred(listener: (details: OnErrorOccurredDetails) => void): void;
B
Benjamin Pasero 已提交
6732
		/**
6733
		 * The listener will be called with listener(details) when an error occurs.
B
Benjamin Pasero 已提交
6734
		 */
6735
		onErrorOccurred(filter: OnErrorOccurredFilter, listener: (details: OnErrorOccurredDetails) => void): void;
B
Benjamin Pasero 已提交
6736
		/**
6737 6738 6739
		 * The listener will be called with listener(details, callback) when HTTP response
		 * headers of a request have been received. The callback has to be called with an
		 * response object.
B
Benjamin Pasero 已提交
6740
		 */
B
Benjamin Pasero 已提交
6741
		onHeadersReceived(filter: OnHeadersReceivedFilter, listener: (details: OnHeadersReceivedDetails, callback: (response: OnHeadersReceivedResponse) => void) => void): void;
6742 6743 6744 6745 6746
		/**
		 * The listener will be called with listener(details, callback) when HTTP response
		 * headers of a request have been received. The callback has to be called with an
		 * response object.
		 */
B
Benjamin Pasero 已提交
6747
		onHeadersReceived(listener: (details: OnHeadersReceivedDetails, callback: (response: OnHeadersReceivedResponse) => void) => void): void;
6748 6749 6750 6751 6752 6753
		/**
		 * The listener will be called with listener(details) when first byte of the
		 * response body is received. For HTTP requests, this means that the status line
		 * and response headers are available.
		 */
		onResponseStarted(listener: (details: OnResponseStartedDetails) => void): void;
B
Benjamin Pasero 已提交
6754
		/**
6755 6756 6757
		 * The listener will be called with listener(details) when first byte of the
		 * response body is received. For HTTP requests, this means that the status line
		 * and response headers are available.
B
Benjamin Pasero 已提交
6758
		 */
6759
		onResponseStarted(filter: OnResponseStartedFilter, listener: (details: OnResponseStartedDetails) => void): void;
B
Benjamin Pasero 已提交
6760
		/**
6761 6762 6763
		 * The listener will be called with listener(details) just before a request is
		 * going to be sent to the server, modifications of previous onBeforeSendHeaders
		 * response are visible by the time this listener is fired.
B
Benjamin Pasero 已提交
6764
		 */
6765
		onSendHeaders(filter: OnSendHeadersFilter, listener: (details: OnSendHeadersDetails) => void): void;
6766 6767 6768 6769 6770 6771 6772 6773 6774 6775
		/**
		 * The listener will be called with listener(details) just before a request is
		 * going to be sent to the server, modifications of previous onBeforeSendHeaders
		 * response are visible by the time this listener is fired.
		 */
		onSendHeaders(listener: (details: OnSendHeadersDetails) => void): void;
	}

	interface WebSource {

6776
		// Docs: http://electronjs.org/docs/api/structures/web-source
6777 6778 6779 6780 6781 6782 6783

		code: string;
		/**
		 * Default is 1.
		 */
		startLine?: number;
		url?: string;
B
Benjamin Pasero 已提交
6784 6785
	}

6786 6787
	interface WebviewTag extends HTMLElement {

6788
		// Docs: http://electronjs.org/docs/api/webview-tag
B
Benjamin Pasero 已提交
6789 6790

		/**
6791 6792 6793
		 * Fired when a load has committed. This includes navigation within the current
		 * document as well as subframe document-level loads, but does not include
		 * asynchronous resource loads.
B
Benjamin Pasero 已提交
6794
		 */
6795 6796
		addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
B
Benjamin Pasero 已提交
6797
		/**
6798 6799
		 * Fired when the navigation is done, i.e. the spinner of the tab will stop
		 * spinning, and the onload event is dispatched.
B
Benjamin Pasero 已提交
6800
		 */
6801 6802
		addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6803
		/**
6804 6805
		 * This event is like did-finish-load, but fired when the load failed or was
		 * cancelled, e.g. window.stop() is invoked.
B
Benjamin Pasero 已提交
6806
		 */
6807 6808
		addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
B
Benjamin Pasero 已提交
6809
		/**
6810
		 * Fired when a frame has done navigation.
B
Benjamin Pasero 已提交
6811
		 */
6812 6813
		addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
B
Benjamin Pasero 已提交
6814
		/**
6815
		 * Corresponds to the points in time when the spinner of the tab starts spinning.
B
Benjamin Pasero 已提交
6816
		 */
6817 6818
		addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6819
		/**
6820
		 * Corresponds to the points in time when the spinner of the tab stops spinning.
B
Benjamin Pasero 已提交
6821
		 */
6822 6823
		addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6824
		/**
6825
		 * Fired when document in the given frame is loaded.
B
Benjamin Pasero 已提交
6826
		 */
6827 6828
		addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6829
		/**
6830 6831
		 * Fired when page title is set during navigation. explicitSet is false when title
		 * is synthesized from file url.
B
Benjamin Pasero 已提交
6832
		 */
6833 6834
		addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
B
Benjamin Pasero 已提交
6835
		/**
6836
		 * Fired when page receives favicon urls.
B
Benjamin Pasero 已提交
6837
		 */
6838 6839
		addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
B
Benjamin Pasero 已提交
6840
		/**
6841
		 * Fired when page enters fullscreen triggered by HTML API.
B
Benjamin Pasero 已提交
6842
		 */
6843 6844
		addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6845
		/**
6846
		 * Fired when page leaves fullscreen triggered by HTML API.
B
Benjamin Pasero 已提交
6847
		 */
6848 6849
		addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6850
		/**
6851 6852 6853
		 * Fired when the guest window logs a console message. The following example code
		 * forwards all log messages to the embedder's console without regard for log level
		 * or other properties.
B
Benjamin Pasero 已提交
6854
		 */
6855 6856
		addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
B
Benjamin Pasero 已提交
6857
		/**
6858
		 * Fired when a result is available for webview.findInPage request.
B
Benjamin Pasero 已提交
6859
		 */
6860 6861
		addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
B
Benjamin Pasero 已提交
6862
		/**
6863 6864
		 * Fired when the guest page attempts to open a new browser window. The following
		 * example code opens the new url in system's default browser.
B
Benjamin Pasero 已提交
6865
		 */
6866 6867
		addEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void): this;
B
Benjamin Pasero 已提交
6868
		/**
6869 6870 6871 6872 6873 6874 6875
		 * Emitted when a user or the page wants to start navigation. It can happen when
		 * the window.location object is changed or a user clicks a link in the page. This
		 * event will not emit when the navigation is started programmatically with APIs
		 * like <webview>.loadURL and <webview>.back. It is also not emitted during in-page
		 * navigation, such as clicking anchor links or updating the window.location.hash.
		 * Use did-navigate-in-page event for this purpose. Calling event.preventDefault()
		 * does NOT have any effect.
B
Benjamin Pasero 已提交
6876
		 */
6877 6878
		addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
B
Benjamin Pasero 已提交
6879
		/**
6880 6881 6882
		 * Emitted when a navigation is done. This event is not emitted for in-page
		 * navigations, such as clicking anchor links or updating the window.location.hash.
		 * Use did-navigate-in-page event for this purpose.
B
Benjamin Pasero 已提交
6883
		 */
6884 6885
		addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
B
Benjamin Pasero 已提交
6886
		/**
6887 6888 6889 6890
		 * Emitted when an in-page navigation happened. When in-page navigation happens,
		 * the page URL changes but does not cause navigation outside of the page. Examples
		 * of this occurring are when anchor links are clicked or when the DOM hashchange
		 * event is triggered.
B
Benjamin Pasero 已提交
6891
		 */
6892 6893
		addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
B
Benjamin Pasero 已提交
6894
		/**
6895 6896
		 * Fired when the guest page attempts to close itself. The following example code
		 * navigates the webview to about:blank when the guest attempts to close itself.
B
Benjamin Pasero 已提交
6897
		 */
6898 6899
		addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'close', listener: (event: Event) => void): this;
6900
		/**
6901
		 * Fired when the guest page has sent an asynchronous message to embedder page.
6902 6903
		 * With sendToHost method and ipc-message event you can communicate between guest
		 * page and embedder page:
6904
		 */
6905 6906
		addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
B
Benjamin Pasero 已提交
6907
		/**
6908
		 * Fired when the renderer process is crashed.
B
Benjamin Pasero 已提交
6909
		 */
6910 6911
		addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'crashed', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6912
		/**
6913
		 * Fired when a plugin process is crashed.
B
Benjamin Pasero 已提交
6914
		 */
6915 6916
		addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
B
Benjamin Pasero 已提交
6917
		/**
6918
		 * Fired when the WebContents is destroyed.
B
Benjamin Pasero 已提交
6919
		 */
6920 6921
		addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'destroyed', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6922
		/**
6923
		 * Emitted when media starts playing.
B
Benjamin Pasero 已提交
6924
		 */
6925 6926
		addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6927
		/**
6928
		 * Emitted when media is paused or done playing.
B
Benjamin Pasero 已提交
6929
		 */
6930 6931
		addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'media-paused', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6932
		/**
6933 6934
		 * Emitted when a page's theme color changes. This is usually due to encountering a
		 * meta tag:
B
Benjamin Pasero 已提交
6935
		 */
6936 6937
		addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
B
Benjamin Pasero 已提交
6938
		/**
6939
		 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
B
Benjamin Pasero 已提交
6940
		 */
6941 6942
		addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
		removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
B
Benjamin Pasero 已提交
6943
		/**
6944
		 * Emitted when DevTools is opened.
B
Benjamin Pasero 已提交
6945
		 */
6946 6947
		addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6948
		/**
6949
		 * Emitted when DevTools is closed.
B
Benjamin Pasero 已提交
6950
		 */
6951 6952
		addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this;
B
Benjamin Pasero 已提交
6953
		/**
6954
		 * Emitted when DevTools is focused / opened.
B
Benjamin Pasero 已提交
6955
		 */
6956 6957
		addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this;
		removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this;
6958 6959 6960 6961
		addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
		addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
		removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
		removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
6962 6963 6964
		canGoBack(): boolean;
		canGoForward(): boolean;
		canGoToOffset(offset: number): boolean;
B
Benjamin Pasero 已提交
6965
		/**
6966 6967
		 * Captures a snapshot of the webview's page. Same as
		 * webContents.capturePage([rect, ]callback).
B
Benjamin Pasero 已提交
6968
		 */
6969
		capturePage(callback: (image: NativeImage) => void): void;
B
Benjamin Pasero 已提交
6970
		/**
6971 6972
		 * Captures a snapshot of the webview's page. Same as
		 * webContents.capturePage([rect, ]callback).
B
Benjamin Pasero 已提交
6973
		 */
6974
		capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void;
B
Benjamin Pasero 已提交
6975
		/**
6976
		 * Clears the navigation history.
B
Benjamin Pasero 已提交
6977
		 */
6978
		clearHistory(): void;
B
Benjamin Pasero 已提交
6979
		/**
6980
		 * Closes the DevTools window of guest page.
B
Benjamin Pasero 已提交
6981
		 */
6982
		closeDevTools(): void;
B
Benjamin Pasero 已提交
6983
		/**
6984
		 * Executes editing command copy in page.
B
Benjamin Pasero 已提交
6985
		 */
6986
		copy(): void;
B
Benjamin Pasero 已提交
6987
		/**
6988
		 * Executes editing command cut in page.
B
Benjamin Pasero 已提交
6989
		 */
6990
		cut(): void;
B
Benjamin Pasero 已提交
6991
		/**
6992
		 * Executes editing command delete in page.
B
Benjamin Pasero 已提交
6993
		 */
6994
		delete(): void;
6995 6996 6997 6998
		/**
		 * Initiates a download of the resource at url without navigating.
		 */
		downloadURL(url: string): void;
B
Benjamin Pasero 已提交
6999
		/**
7000 7001 7002
		 * Evaluates code in page. If userGesture is set, it will create the user gesture
		 * context in the page. HTML APIs like requestFullScreen, which require user
		 * action, can take advantage of this option for automation.
B
Benjamin Pasero 已提交
7003
		 */
7004
		executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void;
7005
		/**
7006 7007
		 * Starts a request to find all matches for the text in the web page. The result of
		 * the request can be obtained by subscribing to found-in-page event.
7008
		 */
7009
		findInPage(text: string, options?: FindInPageOptions): number;
7010 7011 7012
		getTitle(): string;
		getURL(): string;
		getUserAgent(): string;
7013 7014 7015 7016
		/**
		 * It depends on the remote module, it is therefore not available when this module
		 * is disabled.
		 */
7017
		getWebContents(): WebContents;
7018 7019 7020 7021 7022 7023 7024 7025 7026 7027
		/**
		 * Sends a request to get current zoom factor, the callback will be called with
		 * callback(zoomFactor).
		 */
		getZoomFactor(callback: (zoomFactor: number) => void): void;
		/**
		 * Sends a request to get current zoom level, the callback will be called with
		 * callback(zoomLevel).
		 */
		getZoomLevel(callback: (zoomLevel: number) => void): void;
B
Benjamin Pasero 已提交
7028
		/**
7029
		 * Makes the guest page go back.
B
Benjamin Pasero 已提交
7030
		 */
7031
		goBack(): void;
B
Benjamin Pasero 已提交
7032
		/**
7033
		 * Makes the guest page go forward.
B
Benjamin Pasero 已提交
7034
		 */
7035
		goForward(): void;
B
Benjamin Pasero 已提交
7036
		/**
7037
		 * Navigates to the specified absolute index.
B
Benjamin Pasero 已提交
7038
		 */
7039
		goToIndex(index: number): void;
B
Benjamin Pasero 已提交
7040
		/**
7041
		 * Navigates to the specified offset from the "current entry".
B
Benjamin Pasero 已提交
7042
		 */
7043
		goToOffset(offset: number): void;
B
Benjamin Pasero 已提交
7044
		/**
7045
		 * Injects CSS into the guest page.
B
Benjamin Pasero 已提交
7046
		 */
7047
		insertCSS(css: string): void;
B
Benjamin Pasero 已提交
7048
		/**
7049
		 * Inserts text to the focused element.
B
Benjamin Pasero 已提交
7050
		 */
7051
		insertText(text: string): void;
B
Benjamin Pasero 已提交
7052
		/**
7053
		 * Starts inspecting element at position (x, y) of guest page.
B
Benjamin Pasero 已提交
7054
		 */
7055
		inspectElement(x: number, y: number): void;
B
Benjamin Pasero 已提交
7056
		/**
7057
		 * Opens the DevTools for the service worker context present in the guest page.
B
Benjamin Pasero 已提交
7058
		 */
7059 7060 7061
		inspectServiceWorker(): void;
		isAudioMuted(): boolean;
		isCrashed(): boolean;
7062
		isCurrentlyAudible(): boolean;
7063 7064 7065
		isDevToolsFocused(): boolean;
		isDevToolsOpened(): boolean;
		isLoading(): boolean;
7066
		isLoadingMainFrame(): boolean;
7067
		isWaitingForResponse(): boolean;
B
Benjamin Pasero 已提交
7068
		/**
7069 7070
		 * Loads the url in the webview, the url must contain the protocol prefix, e.g. the
		 * http:// or file://.
B
Benjamin Pasero 已提交
7071
		 */
7072
		loadURL(url: string, options?: LoadURLOptions): void;
B
Benjamin Pasero 已提交
7073
		/**
7074
		 * Opens a DevTools window for guest page.
B
Benjamin Pasero 已提交
7075
		 */
7076
		openDevTools(): void;
B
Benjamin Pasero 已提交
7077
		/**
7078
		 * Executes editing command paste in page.
B
Benjamin Pasero 已提交
7079
		 */
7080
		paste(): void;
B
Benjamin Pasero 已提交
7081
		/**
7082
		 * Executes editing command pasteAndMatchStyle in page.
B
Benjamin Pasero 已提交
7083
		 */
7084
		pasteAndMatchStyle(): void;
B
Benjamin Pasero 已提交
7085
		/**
7086
		 * Prints webview's web page. Same as webContents.print([options]).
B
Benjamin Pasero 已提交
7087
		 */
7088
		print(options?: PrintOptions): void;
B
Benjamin Pasero 已提交
7089
		/**
7090 7091
		 * Prints webview's web page as PDF, Same as webContents.printToPDF(options,
		 * callback).
B
Benjamin Pasero 已提交
7092
		 */
7093
		printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void;
B
Benjamin Pasero 已提交
7094
		/**
7095
		 * Executes editing command redo in page.
B
Benjamin Pasero 已提交
7096
		 */
7097
		redo(): void;
B
Benjamin Pasero 已提交
7098
		/**
7099
		 * Reloads the guest page.
B
Benjamin Pasero 已提交
7100
		 */
7101
		reload(): void;
B
Benjamin Pasero 已提交
7102
		/**
7103
		 * Reloads the guest page and ignores cache.
B
Benjamin Pasero 已提交
7104
		 */
7105
		reloadIgnoringCache(): void;
B
Benjamin Pasero 已提交
7106
		/**
7107
		 * Executes editing command replace in page.
B
Benjamin Pasero 已提交
7108
		 */
7109
		replace(text: string): void;
B
Benjamin Pasero 已提交
7110
		/**
7111
		 * Executes editing command replaceMisspelling in page.
B
Benjamin Pasero 已提交
7112
		 */
7113
		replaceMisspelling(text: string): void;
B
Benjamin Pasero 已提交
7114
		/**
7115
		 * Executes editing command selectAll in page.
B
Benjamin Pasero 已提交
7116
		 */
7117
		selectAll(): void;
B
Benjamin Pasero 已提交
7118
		/**
7119 7120 7121 7122
		 * Send an asynchronous message to renderer process via channel, you can also send
		 * arbitrary arguments. The renderer process can handle the message by listening to
		 * the channel event with the ipcRenderer module. See webContents.send for
		 * examples.
B
Benjamin Pasero 已提交
7123
		 */
7124
		send(channel: string, ...args: any[]): void;
B
Benjamin Pasero 已提交
7125
		/**
7126 7127
		 * Sends an input event to the page. See webContents.sendInputEvent for detailed
		 * description of event object.
B
Benjamin Pasero 已提交
7128
		 */
7129
		sendInputEvent(event: any): void;
B
Benjamin Pasero 已提交
7130
		/**
7131
		 * Set guest page muted.
B
Benjamin Pasero 已提交
7132
		 */
7133
		setAudioMuted(muted: boolean): void;
7134 7135 7136 7137
		/**
		 * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
		 */
		setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
B
Benjamin Pasero 已提交
7138
		/**
7139
		 * Overrides the user agent for the guest page.
B
Benjamin Pasero 已提交
7140
		 */
7141
		setUserAgent(userAgent: string): void;
7142 7143 7144 7145
		/**
		 * Sets the maximum and minimum pinch-to-zoom level.
		 */
		setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
B
Benjamin Pasero 已提交
7146
		/**
7147 7148
		 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
		 * divided by 100, so 300% = 3.0.
B
Benjamin Pasero 已提交
7149
		 */
7150
		setZoomFactor(factor: number): void;
B
Benjamin Pasero 已提交
7151
		/**
7152 7153
		 * Changes the zoom level to the specified level. The original size is 0 and each
		 * increment above or below represents zooming 20% larger or smaller to default
7154 7155
		 * limits of 300% and 50% of original size, respectively. The formula for this is
		 * scale := 1.2 ^ level.
B
Benjamin Pasero 已提交
7156
		 */
7157
		setZoomLevel(level: number): void;
B
Benjamin Pasero 已提交
7158
		/**
7159
		 * Shows pop-up dictionary that searches the selected word on the page.
B
Benjamin Pasero 已提交
7160
		 */
7161
		showDefinitionForSelection(): void;
B
Benjamin Pasero 已提交
7162
		/**
7163
		 * Stops any pending navigation.
B
Benjamin Pasero 已提交
7164
		 */
7165
		stop(): void;
B
Benjamin Pasero 已提交
7166
		/**
7167
		 * Stops any findInPage request for the webview with the provided action.
B
Benjamin Pasero 已提交
7168
		 */
7169
		stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
B
Benjamin Pasero 已提交
7170
		/**
7171
		 * Executes editing command undo in page.
B
Benjamin Pasero 已提交
7172
		 */
7173
		undo(): void;
B
Benjamin Pasero 已提交
7174
		/**
7175
		 * Executes editing command unselect in page.
B
Benjamin Pasero 已提交
7176
		 */
7177
		unselect(): void;
B
Benjamin Pasero 已提交
7178
		/**
7179 7180
		 * When this attribute is present the guest page will be allowed to open new
		 * windows. Popups are disabled by default.
B
Benjamin Pasero 已提交
7181
		 */
7182
		// allowpopups?: string; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ###
B
Benjamin Pasero 已提交
7183
		/**
7184 7185 7186 7187 7188
		 * When this attribute is present the webview container will automatically resize
		 * within the bounds specified by the attributes minwidth, minheight, maxwidth, and
		 * maxheight. These constraints do not impact the webview unless autosize is
		 * enabled. When autosize is enabled, the webview container size cannot be less
		 * than the minimum values or greater than the maximum.
B
Benjamin Pasero 已提交
7189
		 */
7190
		autosize?: string;
B
Benjamin Pasero 已提交
7191
		/**
7192 7193 7194
		 * A list of strings which specifies the blink features to be disabled separated by
		 * ,. The full list of supported feature strings can be found in the
		 * RuntimeEnabledFeatures.json5 file.
B
Benjamin Pasero 已提交
7195
		 */
7196
		disableblinkfeatures?: string;
B
Benjamin Pasero 已提交
7197
		/**
7198 7199
		 * When this attribute is present the guest page will have web security disabled.
		 * Web security is enabled by default.
B
Benjamin Pasero 已提交
7200
		 */
7201
		// disablewebsecurity?: string; ### VSCODE CHANGE(https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ###
B
Benjamin Pasero 已提交
7202
		/**
7203 7204 7205
		 * A list of strings which specifies the blink features to be enabled separated by
		 * ,. The full list of supported feature strings can be found in the
		 * RuntimeEnabledFeatures.json5 file.
B
Benjamin Pasero 已提交
7206
		 */
7207
		enableblinkfeatures?: string;
7208 7209 7210 7211 7212
		/**
		 * When this attribute is false the guest page in webview will not have access to
		 * the remote module. The remote module is avaiable by default.
		 */
		enableremotemodule?: string;
B
Benjamin Pasero 已提交
7213
		/**
7214
		 * Sets the referrer URL for the guest page.
B
Benjamin Pasero 已提交
7215
		 */
7216
		httpreferrer?: string;
B
Benjamin Pasero 已提交
7217
		/**
7218 7219 7220
		 * When this attribute is present the guest page in webview will have node
		 * integration and can use node APIs like require and process to access low level
		 * system resources. Node integration is disabled by default in the guest page.
B
Benjamin Pasero 已提交
7221
		 */
7222
		nodeintegration?: string;
B
Benjamin Pasero 已提交
7223
		/**
7224 7225 7226 7227 7228 7229 7230 7231
		 * Sets the session used by the page. If partition starts with persist:, the page
		 * will use a persistent session available to all pages in the app with the same
		 * partition. if there is no persist: prefix, the page will use an in-memory
		 * session. By assigning the same partition, multiple pages can share the same
		 * session. If the partition is unset then default session of the app will be used.
		 * This value can only be modified before the first navigation, since the session
		 * of an active renderer process cannot change. Subsequent attempts to modify the
		 * value will fail with a DOM exception.
B
Benjamin Pasero 已提交
7232
		 */
7233
		partition?: string;
B
Benjamin Pasero 已提交
7234
		/**
7235 7236
		 * When this attribute is present the guest page in webview will be able to use
		 * browser plugins. Plugins are disabled by default.
B
Benjamin Pasero 已提交
7237
		 */
7238
		plugins?: string;
B
Benjamin Pasero 已提交
7239
		/**
7240 7241 7242 7243 7244 7245 7246
		 * Specifies a script that will be loaded before other scripts run in the guest
		 * page. The protocol of script's URL must be either file: or asar:, because it
		 * will be loaded by require in guest page under the hood. When the guest page
		 * doesn't have node integration this script will still have access to all Node
		 * APIs, but global objects injected by Node will be deleted after this script has
		 * finished executing. Note: This option will be appear as preloadURL (not preload)
		 * in the webPreferences specified to the will-attach-webview event.
B
Benjamin Pasero 已提交
7247
		 */
7248
		preload?: string;
B
Benjamin Pasero 已提交
7249
		/**
7250 7251 7252
		 * Returns the visible URL. Writing to this attribute initiates top-level
		 * navigation. Assigning src its own value will reload the current page. The src
		 * attribute can also accept data URLs, such as data:text/plain,Hello, world!.
B
Benjamin Pasero 已提交
7253
		 */
7254
		src?: string;
B
Benjamin Pasero 已提交
7255
		/**
7256 7257
		 * Sets the user agent for the guest page before the page is navigated to. Once the
		 * page is loaded, use the setUserAgent method to change the user agent.
B
Benjamin Pasero 已提交
7258
		 */
7259
		useragent?: string;
B
Benjamin Pasero 已提交
7260
		/**
7261 7262 7263 7264 7265 7266
		 * A list of strings which specifies the web preferences to be set on the webview,
		 * separated by ,. The full list of supported preference strings can be found in
		 * BrowserWindow. The string follows the same format as the features string in
		 * window.open. A name by itself is given a true boolean value. A preference can be
		 * set to another value by including an =, followed by the value. Special values
		 * yes and 1 are interpreted as true, while no and 0 are interpreted as false.
B
Benjamin Pasero 已提交
7267
		 */
7268
		webpreferences?: string;
B
Benjamin Pasero 已提交
7269 7270
	}

7271
	interface AboutPanelOptionsOptions {
B
Benjamin Pasero 已提交
7272
		/**
7273
		 * The app's name.
B
Benjamin Pasero 已提交
7274
		 */
7275
		applicationName?: string;
B
Benjamin Pasero 已提交
7276
		/**
7277
		 * The app's version.
B
Benjamin Pasero 已提交
7278
		 */
7279
		applicationVersion?: string;
B
Benjamin Pasero 已提交
7280
		/**
7281
		 * Copyright information.
B
Benjamin Pasero 已提交
7282
		 */
7283
		copyright?: string;
B
Benjamin Pasero 已提交
7284
		/**
7285
		 * Credit information.
B
Benjamin Pasero 已提交
7286
		 */
7287
		credits?: string;
B
Benjamin Pasero 已提交
7288
		/**
7289
		 * The app's build version number.
B
Benjamin Pasero 已提交
7290
		 */
7291 7292 7293 7294
		version?: string;
	}

	interface AddRepresentationOptions {
B
Benjamin Pasero 已提交
7295
		/**
7296
		 * The scale factor to add the image representation for.
B
Benjamin Pasero 已提交
7297
		 */
7298
		scaleFactor: number;
B
Benjamin Pasero 已提交
7299
		/**
7300
		 * Defaults to 0. Required if a bitmap buffer is specified as buffer.
B
Benjamin Pasero 已提交
7301
		 */
7302
		width?: number;
B
Benjamin Pasero 已提交
7303
		/**
7304
		 * Defaults to 0. Required if a bitmap buffer is specified as buffer.
B
Benjamin Pasero 已提交
7305
		 */
7306
		height?: number;
B
Benjamin Pasero 已提交
7307
		/**
7308
		 * The buffer containing the raw image data.
B
Benjamin Pasero 已提交
7309
		 */
7310
		buffer?: Buffer;
B
Benjamin Pasero 已提交
7311
		/**
7312
		 * The data URL containing either a base 64 encoded PNG or JPEG image.
B
Benjamin Pasero 已提交
7313
		 */
7314
		dataURL?: string;
B
Benjamin Pasero 已提交
7315 7316
	}

7317
	interface AppDetailsOptions {
B
Benjamin Pasero 已提交
7318
		/**
7319
		 * Window's . It has to be set, otherwise the other options will have no effect.
7320
		 */
7321
		appId?: string;
7322
		/**
7323
		 * Window's .
7324
		 */
7325
		appIconPath?: string;
7326
		/**
7327 7328
		 * Index of the icon in appIconPath. Ignored when appIconPath is not set. Default
		 * is 0.
7329
		 */
7330
		appIconIndex?: number;
7331
		/**
7332
		 * Window's .
B
Benjamin Pasero 已提交
7333
		 */
7334
		relaunchCommand?: string;
B
Benjamin Pasero 已提交
7335
		/**
7336
		 * Window's .
B
Benjamin Pasero 已提交
7337
		 */
7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349
		relaunchDisplayName?: string;
	}

	interface AuthInfo {
		isProxy: boolean;
		scheme: string;
		host: string;
		port: number;
		realm: string;
	}

	interface AutoResizeOptions {
B
Benjamin Pasero 已提交
7350
		/**
7351 7352
		 * If true, the view's width will grow and shrink together with the window. false
		 * by default.
B
Benjamin Pasero 已提交
7353
		 */
7354
		width: boolean;
B
Benjamin Pasero 已提交
7355
		/**
7356 7357
		 * If true, the view's height will grow and shrink together with the window. false
		 * by default.
B
Benjamin Pasero 已提交
7358
		 */
7359
		height: boolean;
B
Benjamin Pasero 已提交
7360 7361
	}

7362
	interface BitmapOptions {
B
Benjamin Pasero 已提交
7363
		/**
7364
		 * Defaults to 1.0.
B
Benjamin Pasero 已提交
7365
		 */
7366 7367
		scaleFactor?: number;
	}
B
Benjamin Pasero 已提交
7368

7369
	interface BrowserViewConstructorOptions {
B
Benjamin Pasero 已提交
7370
		/**
7371
		 * See .
B
Benjamin Pasero 已提交
7372
		 */
7373 7374 7375 7376
		webPreferences?: WebPreferences;
	}

	interface BrowserWindowConstructorOptions {
B
Benjamin Pasero 已提交
7377
		/**
7378
		 * Window's width in pixels. Default is 800.
B
Benjamin Pasero 已提交
7379
		 */
7380
		width?: number;
B
Benjamin Pasero 已提交
7381
		/**
7382
		 * Window's height in pixels. Default is 600.
B
Benjamin Pasero 已提交
7383
		 */
7384
		height?: number;
B
Benjamin Pasero 已提交
7385
		/**
7386 7387
		 * ( if y is used) Window's left offset from screen. Default is to center the
		 * window.
B
Benjamin Pasero 已提交
7388
		 */
7389
		x?: number;
B
Benjamin Pasero 已提交
7390
		/**
7391 7392
		 * ( if x is used) Window's top offset from screen. Default is to center the
		 * window.
B
Benjamin Pasero 已提交
7393
		 */
7394
		y?: number;
7395
		/**
7396 7397 7398
		 * The width and height would be used as web page's size, which means the actual
		 * window's size will include window frame's size and be slightly larger. Default
		 * is false.
7399
		 */
7400
		useContentSize?: boolean;
7401
		/**
7402
		 * Show window in the center of the screen.
7403
		 */
7404
		center?: boolean;
7405
		/**
7406
		 * Window's minimum width. Default is 0.
7407
		 */
7408
		minWidth?: number;
B
Benjamin Pasero 已提交
7409
		/**
7410
		 * Window's minimum height. Default is 0.
B
Benjamin Pasero 已提交
7411
		 */
7412
		minHeight?: number;
B
Benjamin Pasero 已提交
7413
		/**
7414
		 * Window's maximum width. Default is no limit.
B
Benjamin Pasero 已提交
7415
		 */
7416
		maxWidth?: number;
B
Benjamin Pasero 已提交
7417
		/**
7418
		 * Window's maximum height. Default is no limit.
B
Benjamin Pasero 已提交
7419
		 */
7420
		maxHeight?: number;
B
Benjamin Pasero 已提交
7421
		/**
7422
		 * Whether window is resizable. Default is true.
B
Benjamin Pasero 已提交
7423
		 */
7424
		resizable?: boolean;
B
Benjamin Pasero 已提交
7425
		/**
7426
		 * Whether window is movable. This is not implemented on Linux. Default is true.
B
Benjamin Pasero 已提交
7427
		 */
7428
		movable?: boolean;
B
Benjamin Pasero 已提交
7429
		/**
7430 7431
		 * Whether window is minimizable. This is not implemented on Linux. Default is
		 * true.
B
Benjamin Pasero 已提交
7432
		 */
7433
		minimizable?: boolean;
B
Benjamin Pasero 已提交
7434
		/**
7435 7436
		 * Whether window is maximizable. This is not implemented on Linux. Default is
		 * true.
B
Benjamin Pasero 已提交
7437
		 */
7438
		maximizable?: boolean;
B
Benjamin Pasero 已提交
7439
		/**
7440
		 * Whether window is closable. This is not implemented on Linux. Default is true.
B
Benjamin Pasero 已提交
7441
		 */
7442
		closable?: boolean;
B
Benjamin Pasero 已提交
7443
		/**
7444 7445 7446 7447
		 * Whether the window can be focused. Default is true. On Windows setting
		 * focusable: false also implies setting skipTaskbar: true. On Linux setting
		 * focusable: false makes the window stop interacting with wm, so the window will
		 * always stay on top in all workspaces.
B
Benjamin Pasero 已提交
7448
		 */
7449
		focusable?: boolean;
B
Benjamin Pasero 已提交
7450
		/**
7451
		 * Whether the window should always stay on top of other windows. Default is false.
B
Benjamin Pasero 已提交
7452
		 */
7453
		alwaysOnTop?: boolean;
B
Benjamin Pasero 已提交
7454
		/**
7455 7456
		 * Whether the window should show in fullscreen. When explicitly set to false the
		 * fullscreen button will be hidden or disabled on macOS. Default is false.
B
Benjamin Pasero 已提交
7457
		 */
7458
		fullscreen?: boolean;
B
Benjamin Pasero 已提交
7459
		/**
7460 7461 7462
		 * Whether the window can be put into fullscreen mode. On macOS, also whether the
		 * maximize/zoom button should toggle full screen mode or maximize window. Default
		 * is true.
B
Benjamin Pasero 已提交
7463
		 */
7464
		fullscreenable?: boolean;
7465 7466 7467 7468
		/**
		 * Use pre-Lion fullscreen on macOS. Default is false.
		 */
		simpleFullscreen?: boolean;
B
Benjamin Pasero 已提交
7469
		/**
7470
		 * Whether to show the window in taskbar. Default is false.
B
Benjamin Pasero 已提交
7471
		 */
7472
		skipTaskbar?: boolean;
B
Benjamin Pasero 已提交
7473
		/**
7474
		 * The kiosk mode. Default is false.
B
Benjamin Pasero 已提交
7475
		 */
7476
		kiosk?: boolean;
B
Benjamin Pasero 已提交
7477
		/**
7478
		 * Default window title. Default is "Electron".
B
Benjamin Pasero 已提交
7479
		 */
7480
		title?: string;
B
Benjamin Pasero 已提交
7481
		/**
7482 7483 7484
		 * The window icon. On Windows it is recommended to use ICO icons to get best
		 * visual effects, you can also leave it undefined so the executable's icon will be
		 * used.
B
Benjamin Pasero 已提交
7485
		 */
7486
		icon?: (NativeImage) | (string);
B
Benjamin Pasero 已提交
7487
		/**
7488
		 * Whether window should be shown when created. Default is true.
B
Benjamin Pasero 已提交
7489
		 */
7490
		show?: boolean;
B
Benjamin Pasero 已提交
7491
		/**
7492
		 * Specify false to create a . Default is true.
B
Benjamin Pasero 已提交
7493
		 */
7494
		frame?: boolean;
B
Benjamin Pasero 已提交
7495
		/**
7496
		 * Specify parent window. Default is null.
B
Benjamin Pasero 已提交
7497
		 */
7498
		parent?: BrowserWindow;
B
Benjamin Pasero 已提交
7499
		/**
7500 7501
		 * Whether this is a modal window. This only works when the window is a child
		 * window. Default is false.
B
Benjamin Pasero 已提交
7502
		 */
7503
		modal?: boolean;
B
Benjamin Pasero 已提交
7504
		/**
7505 7506
		 * Whether the web view accepts a single mouse-down event that simultaneously
		 * activates the window. Default is false.
B
Benjamin Pasero 已提交
7507
		 */
7508
		acceptFirstMouse?: boolean;
B
Benjamin Pasero 已提交
7509
		/**
7510
		 * Whether to hide cursor when typing. Default is false.
B
Benjamin Pasero 已提交
7511
		 */
7512
		disableAutoHideCursor?: boolean;
B
Benjamin Pasero 已提交
7513
		/**
7514
		 * Auto hide the menu bar unless the Alt key is pressed. Default is false.
B
Benjamin Pasero 已提交
7515
		 */
7516
		autoHideMenuBar?: boolean;
7517
		/**
7518
		 * Enable the window to be resized larger than screen. Default is false.
7519
		 */
7520
		enableLargerThanScreen?: boolean;
B
Benjamin Pasero 已提交
7521
		/**
7522
		 * Window's background color as a hexadecimal value, like #66CD00 or #FFF or
7523 7524
		 * #80FFFFFF (alpha is supported if transparent is set to true). Default is #FFF
		 * (white).
B
Benjamin Pasero 已提交
7525
		 */
7526
		backgroundColor?: string;
B
Benjamin Pasero 已提交
7527
		/**
7528 7529
		 * Whether window should have a shadow. This is only implemented on macOS. Default
		 * is true.
B
Benjamin Pasero 已提交
7530
		 */
7531
		hasShadow?: boolean;
7532 7533 7534 7535 7536
		/**
		 * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
		 * (fully opaque). This is only implemented on Windows and macOS.
		 */
		opacity?: number;
B
Benjamin Pasero 已提交
7537
		/**
7538 7539
		 * Forces using dark theme for the window, only works on some GTK+3 desktop
		 * environments. Default is false.
B
Benjamin Pasero 已提交
7540
		 */
7541
		darkTheme?: boolean;
B
Benjamin Pasero 已提交
7542
		/**
7543
		 * Makes the window . Default is false.
B
Benjamin Pasero 已提交
7544
		 */
7545
		transparent?: boolean;
B
Benjamin Pasero 已提交
7546
		/**
7547
		 * The type of window, default is normal window. See more about this below.
B
Benjamin Pasero 已提交
7548
		 */
7549
		type?: string;
B
Benjamin Pasero 已提交
7550
		/**
7551
		 * The style of window title bar. Default is default. Possible values are:
B
Benjamin Pasero 已提交
7552
		 */
7553
		titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
B
Benjamin Pasero 已提交
7554
		/**
7555
		 * Shows the title in the title bar in full screen mode on macOS for all
B
Benjamin Pasero 已提交
7556
		 * titleBarStyle options. Default is false.
B
Benjamin Pasero 已提交
7557
		 */
B
Benjamin Pasero 已提交
7558
		fullscreenWindowTitle?: boolean;
B
Benjamin Pasero 已提交
7559
		/**
7560 7561 7562
		 * Use WS_THICKFRAME style for frameless windows on Windows, which adds standard
		 * window frame. Setting it to false will remove window shadow and window
		 * animations. Default is true.
B
Benjamin Pasero 已提交
7563
		 */
7564
		thickFrame?: boolean;
B
Benjamin Pasero 已提交
7565
		/**
7566 7567
		 * Add a type of vibrancy effect to the window, only on macOS. Can be
		 * appearance-based, light, dark, titlebar, selection, menu, popover, sidebar,
7568 7569
		 * medium-light or ultra-dark. Please note that using frame: false in combination
		 * with a vibrancy value requires that you use a non-default titleBarStyle as well.
B
Benjamin Pasero 已提交
7570
		 */
7571
		vibrancy?: ('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark');
B
Benjamin Pasero 已提交
7572
		/**
7573 7574 7575 7576 7577
		 * Controls the behavior on macOS when option-clicking the green stoplight button
		 * on the toolbar or by clicking the Window > Zoom menu item. If true, the window
		 * will grow to the preferred width of the web page when zoomed, false will cause
		 * it to zoom to the width of the screen. This will also affect the behavior when
		 * calling maximize() directly. Default is false.
B
Benjamin Pasero 已提交
7578
		 */
7579
		zoomToPageWidth?: boolean;
B
Benjamin Pasero 已提交
7580
		/**
7581
		 * Tab group name, allows opening the window as a native tab on macOS 10.12+.
B
Benjamin Pasero 已提交
7582 7583 7584
		 * Windows with the same tabbing identifier will be grouped together. This also
		 * adds a native new tab button to your window's tab bar and allows your app and
		 * window to receive the new-window-for-tab event.
B
Benjamin Pasero 已提交
7585
		 */
7586
		tabbingIdentifier?: string;
B
Benjamin Pasero 已提交
7587
		/**
7588
		 * Settings of web page's features.
B
Benjamin Pasero 已提交
7589
		 */
7590 7591 7592 7593
		webPreferences?: WebPreferences;
	}

	interface CertificateTrustDialogOptions {
B
Benjamin Pasero 已提交
7594
		/**
7595
		 * The certificate to trust/import.
B
Benjamin Pasero 已提交
7596
		 */
7597
		certificate: Certificate;
B
Benjamin Pasero 已提交
7598
		/**
7599
		 * The message to display to the user.
B
Benjamin Pasero 已提交
7600
		 */
7601 7602 7603 7604 7605 7606
		message: string;
	}

	interface CertificateVerifyProcRequest {
		hostname: string;
		certificate: Certificate;
B
Benjamin Pasero 已提交
7607
		/**
7608
		 * Verification result from chromium.
B
Benjamin Pasero 已提交
7609
		 */
7610 7611 7612 7613 7614
		verificationResult: string;
		/**
		 * Error code.
		 */
		errorCode: number;
7615 7616 7617
	}

	interface ClearStorageDataOptions {
B
Benjamin Pasero 已提交
7618
		/**
7619
		 * Should follow window.location.origin’s representation scheme://host:port.
B
Benjamin Pasero 已提交
7620
		 */
B
Benjamin Pasero 已提交
7621
		origin?: string;
B
Benjamin Pasero 已提交
7622
		/**
7623
		 * The types of storages to clear, can contain: appcache, cookies, filesystem,
7624
		 * indexdb, localstorage, shadercache, websql, serviceworkers, cachestorage.
B
Benjamin Pasero 已提交
7625
		 */
B
Benjamin Pasero 已提交
7626
		storages?: string[];
B
Benjamin Pasero 已提交
7627
		/**
7628
		 * The types of quotas to clear, can contain: temporary, persistent, syncable.
B
Benjamin Pasero 已提交
7629
		 */
B
Benjamin Pasero 已提交
7630
		quotas?: string[];
7631 7632 7633
	}

	interface CommandLine {
B
Benjamin Pasero 已提交
7634
		/**
7635 7636 7637
		 * Append a switch (with optional value) to Chromium's command line. Note: This
		 * will not affect process.argv, and is mainly used by developers to control some
		 * low-level Chromium behaviors.
B
Benjamin Pasero 已提交
7638
		 */
7639
		appendSwitch: (the_switch: string, value?: string) => void;
B
Benjamin Pasero 已提交
7640
		/**
7641 7642
		 * Append an argument to Chromium's command line. The argument will be quoted
		 * correctly. Note: This will not affect process.argv.
B
Benjamin Pasero 已提交
7643
		 */
7644 7645 7646 7647
		appendArgument: (value: string) => void;
	}

	interface Config {
B
Benjamin Pasero 已提交
7648
		/**
7649
		 * The URL associated with the PAC file.
B
Benjamin Pasero 已提交
7650
		 */
7651
		pacScript: string;
B
Benjamin Pasero 已提交
7652
		/**
7653
		 * Rules indicating which proxies to use.
B
Benjamin Pasero 已提交
7654
		 */
7655
		proxyRules: string;
B
Benjamin Pasero 已提交
7656
		/**
7657
		 * Rules indicating which URLs should bypass the proxy settings.
B
Benjamin Pasero 已提交
7658
		 */
7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669
		proxyBypassRules: string;
	}

	interface ConsoleMessageEvent extends Event {
		level: number;
		message: string;
		line: number;
		sourceId: string;
	}

	interface ContextMenuParams {
B
Benjamin Pasero 已提交
7670
		/**
7671
		 * x coordinate.
B
Benjamin Pasero 已提交
7672
		 */
7673
		x: number;
B
Benjamin Pasero 已提交
7674
		/**
7675
		 * y coordinate.
B
Benjamin Pasero 已提交
7676
		 */
7677
		y: number;
B
Benjamin Pasero 已提交
7678
		/**
7679
		 * URL of the link that encloses the node the context menu was invoked on.
B
Benjamin Pasero 已提交
7680
		 */
7681
		linkURL: string;
B
Benjamin Pasero 已提交
7682
		/**
7683 7684
		 * Text associated with the link. May be an empty string if the contents of the
		 * link are an image.
B
Benjamin Pasero 已提交
7685
		 */
7686
		linkText: string;
B
Benjamin Pasero 已提交
7687
		/**
7688
		 * URL of the top level page that the context menu was invoked on.
B
Benjamin Pasero 已提交
7689
		 */
7690
		pageURL: string;
B
Benjamin Pasero 已提交
7691
		/**
7692
		 * URL of the subframe that the context menu was invoked on.
B
Benjamin Pasero 已提交
7693
		 */
7694
		frameURL: string;
B
Benjamin Pasero 已提交
7695
		/**
7696 7697
		 * Source URL for the element that the context menu was invoked on. Elements with
		 * source URLs are images, audio and video.
B
Benjamin Pasero 已提交
7698
		 */
7699
		srcURL: string;
B
Benjamin Pasero 已提交
7700
		/**
7701 7702
		 * Type of the node the context menu was invoked on. Can be none, image, audio,
		 * video, canvas, file or plugin.
B
Benjamin Pasero 已提交
7703
		 */
7704
		mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
B
Benjamin Pasero 已提交
7705
		/**
7706
		 * Whether the context menu was invoked on an image which has non-empty contents.
B
Benjamin Pasero 已提交
7707
		 */
7708
		hasImageContents: boolean;
B
Benjamin Pasero 已提交
7709
		/**
7710
		 * Whether the context is editable.
B
Benjamin Pasero 已提交
7711
		 */
7712
		isEditable: boolean;
B
Benjamin Pasero 已提交
7713
		/**
7714
		 * Text of the selection that the context menu was invoked on.
B
Benjamin Pasero 已提交
7715
		 */
7716
		selectionText: string;
B
Benjamin Pasero 已提交
7717
		/**
7718
		 * Title or alt text of the selection that the context was invoked on.
B
Benjamin Pasero 已提交
7719
		 */
7720
		titleText: string;
B
Benjamin Pasero 已提交
7721
		/**
7722
		 * The misspelled word under the cursor, if any.
B
Benjamin Pasero 已提交
7723
		 */
7724
		misspelledWord: string;
B
Benjamin Pasero 已提交
7725
		/**
7726
		 * The character encoding of the frame on which the menu was invoked.
B
Benjamin Pasero 已提交
7727
		 */
7728
		frameCharset: string;
B
Benjamin Pasero 已提交
7729
		/**
7730 7731
		 * If the context menu was invoked on an input field, the type of that field.
		 * Possible values are none, plainText, password, other.
B
Benjamin Pasero 已提交
7732
		 */
7733
		inputFieldType: string;
B
Benjamin Pasero 已提交
7734
		/**
7735 7736
		 * Input source that invoked the context menu. Can be none, mouse, keyboard, touch
		 * or touchMenu.
B
Benjamin Pasero 已提交
7737
		 */
7738
		menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu');
B
Benjamin Pasero 已提交
7739
		/**
7740
		 * The flags for the media element the context menu was invoked on.
B
Benjamin Pasero 已提交
7741
		 */
7742
		mediaFlags: MediaFlags;
B
Benjamin Pasero 已提交
7743
		/**
7744 7745
		 * These flags indicate whether the renderer believes it is able to perform the
		 * corresponding action.
B
Benjamin Pasero 已提交
7746
		 */
7747 7748 7749 7750
		editFlags: EditFlags;
	}

	interface CrashReporterStartOptions {
7751
		companyName: string;
B
Benjamin Pasero 已提交
7752
		/**
7753
		 * URL that crash reports will be sent to as POST.
B
Benjamin Pasero 已提交
7754
		 */
7755
		submitURL: string;
B
Benjamin Pasero 已提交
7756
		/**
7757
		 * Defaults to app.getName().
B
Benjamin Pasero 已提交
7758
		 */
7759
		productName?: string;
B
Benjamin Pasero 已提交
7760
		/**
7761
		 * Whether crash reports should be sent to the server Default is true.
B
Benjamin Pasero 已提交
7762
		 */
7763
		uploadToServer?: boolean;
B
Benjamin Pasero 已提交
7764
		/**
7765
		 * Default is false.
J
Joao Moreno 已提交
7766
		 */
7767
		ignoreSystemCrashHandler?: boolean;
J
Joao Moreno 已提交
7768
		/**
7769
		 * An object you can define that will be sent along with the report. Only string
B
Benjamin Pasero 已提交
7770 7771
		 * properties are sent correctly. Nested objects are not supported and the property
		 * names and values must be less than 64 characters long.
B
Benjamin Pasero 已提交
7772
		 */
7773
		extra?: Extra;
B
Benjamin Pasero 已提交
7774
		/**
7775 7776
		 * Directory to store the crashreports temporarily (only used when the crash
		 * reporter is started via process.crashReporter.start).
B
Benjamin Pasero 已提交
7777
		 */
7778 7779 7780 7781
		crashesDirectory?: string;
	}

	interface CreateFromBufferOptions {
B
Benjamin Pasero 已提交
7782
		/**
7783
		 * Required for bitmap buffers.
B
Benjamin Pasero 已提交
7784
		 */
7785
		width?: number;
B
Benjamin Pasero 已提交
7786
		/**
7787
		 * Required for bitmap buffers.
B
Benjamin Pasero 已提交
7788
		 */
7789
		height?: number;
B
Benjamin Pasero 已提交
7790
		/**
7791
		 * Defaults to 1.0.
B
Benjamin Pasero 已提交
7792
		 */
7793 7794 7795 7796
		scaleFactor?: number;
	}

	interface CreateInterruptedDownloadOptions {
B
Benjamin Pasero 已提交
7797
		/**
7798
		 * Absolute path of the download.
B
Benjamin Pasero 已提交
7799
		 */
7800
		path: string;
B
Benjamin Pasero 已提交
7801
		/**
7802
		 * Complete URL chain for the download.
B
Benjamin Pasero 已提交
7803
		 */
7804 7805
		urlChain: string[];
		mimeType?: string;
B
Benjamin Pasero 已提交
7806
		/**
7807
		 * Start range for the download.
B
Benjamin Pasero 已提交
7808
		 */
7809
		offset: number;
B
Benjamin Pasero 已提交
7810
		/**
7811
		 * Total length of the download.
B
Benjamin Pasero 已提交
7812
		 */
7813
		length: number;
B
Benjamin Pasero 已提交
7814
		/**
7815
		 * Last-Modified header value.
B
Benjamin Pasero 已提交
7816
		 */
7817
		lastModified: string;
B
Benjamin Pasero 已提交
7818
		/**
7819
		 * ETag header value.
B
Benjamin Pasero 已提交
7820
		 */
7821
		eTag: string;
B
Benjamin Pasero 已提交
7822
		/**
7823
		 * Time when download was started in number of seconds since UNIX epoch.
B
Benjamin Pasero 已提交
7824
		 */
7825 7826 7827 7828 7829 7830 7831 7832
		startTime?: number;
	}

	interface Data {
		text?: string;
		html?: string;
		image?: NativeImage;
		rtf?: string;
B
Benjamin Pasero 已提交
7833
		/**
7834
		 * The title of the url at text.
B
Benjamin Pasero 已提交
7835
		 */
7836 7837 7838 7839
		bookmark?: string;
	}

	interface Details {
B
Benjamin Pasero 已提交
7840
		/**
7841
		 * The url to associate the cookie with.
B
Benjamin Pasero 已提交
7842
		 */
7843
		url: string;
B
Benjamin Pasero 已提交
7844
		/**
7845
		 * The name of the cookie. Empty by default if omitted.
B
Benjamin Pasero 已提交
7846
		 */
7847
		name?: string;
B
Benjamin Pasero 已提交
7848
		/**
7849
		 * The value of the cookie. Empty by default if omitted.
B
Benjamin Pasero 已提交
7850
		 */
7851
		value?: string;
B
Benjamin Pasero 已提交
7852
		/**
7853 7854
		 * The domain of the cookie; this will be normalized with a preceding dot so that
		 * it's also valid for subdomains. Empty by default if omitted.
B
Benjamin Pasero 已提交
7855
		 */
7856
		domain?: string;
B
Benjamin Pasero 已提交
7857
		/**
7858
		 * The path of the cookie. Empty by default if omitted.
B
Benjamin Pasero 已提交
7859
		 */
7860
		path?: string;
B
Benjamin Pasero 已提交
7861
		/**
7862
		 * Whether the cookie should be marked as Secure. Defaults to false.
B
Benjamin Pasero 已提交
7863
		 */
7864
		secure?: boolean;
B
Benjamin Pasero 已提交
7865
		/**
7866
		 * Whether the cookie should be marked as HTTP only. Defaults to false.
B
Benjamin Pasero 已提交
7867
		 */
7868
		httpOnly?: boolean;
B
Benjamin Pasero 已提交
7869
		/**
7870 7871 7872
		 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
		 * If omitted then the cookie becomes a session cookie and will not be retained
		 * between sessions.
B
Benjamin Pasero 已提交
7873
		 */
7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904
		expirationDate?: number;
	}

	interface DevToolsExtensions {
	}

	interface DidChangeThemeColorEvent extends Event {
		themeColor: string;
	}

	interface DidFailLoadEvent extends Event {
		errorCode: number;
		errorDescription: string;
		validatedURL: string;
		isMainFrame: boolean;
	}

	interface DidFrameFinishLoadEvent extends Event {
		isMainFrame: boolean;
	}

	interface DidNavigateEvent extends Event {
		url: string;
	}

	interface DidNavigateInPageEvent extends Event {
		isMainFrame: boolean;
		url: string;
	}

	interface DisplayBalloonOptions {
7905 7906 7907
		/**
		 * -
		 */
7908
		icon?: (NativeImage) | (string);
7909 7910
		title: string;
		content: string;
7911 7912 7913
	}

	interface Dock {
B
Benjamin Pasero 已提交
7914
		/**
7915 7916 7917 7918
		 * When critical is passed, the dock icon will bounce until either the application
		 * becomes active or the request is canceled. When informational is passed, the
		 * dock icon will bounce for one second. However, the request remains active until
		 * either the application becomes active or the request is canceled.
B
Benjamin Pasero 已提交
7919
		 */
7920
		bounce: (type?: 'critical' | 'informational') => number;
B
Benjamin Pasero 已提交
7921
		/**
7922
		 * Cancel the bounce of id.
B
Benjamin Pasero 已提交
7923
		 */
7924
		cancelBounce: (id: number) => void;
B
Benjamin Pasero 已提交
7925
		/**
7926
		 * Bounces the Downloads stack if the filePath is inside the Downloads folder.
B
Benjamin Pasero 已提交
7927
		 */
7928
		downloadFinished: (filePath: string) => void;
B
Benjamin Pasero 已提交
7929
		/**
7930
		 * Sets the string to be displayed in the dock’s badging area.
B
Benjamin Pasero 已提交
7931
		 */
7932 7933
		setBadge: (text: string) => void;
		getBadge: () => string;
B
Benjamin Pasero 已提交
7934
		/**
7935
		 * Hides the dock icon.
B
Benjamin Pasero 已提交
7936
		 */
7937
		hide: () => void;
B
Benjamin Pasero 已提交
7938
		/**
7939
		 * Shows the dock icon.
B
Benjamin Pasero 已提交
7940
		 */
7941 7942
		show: () => void;
		isVisible: () => boolean;
B
Benjamin Pasero 已提交
7943
		/**
7944
		 * Sets the application's dock menu.
B
Benjamin Pasero 已提交
7945
		 */
7946
		setMenu: (menu: Menu) => void;
B
Benjamin Pasero 已提交
7947
		/**
7948
		 * Sets the image associated with this dock icon.
B
Benjamin Pasero 已提交
7949
		 */
7950
		setIcon: (image: (NativeImage) | (string)) => void;
7951 7952 7953
	}

	interface EnableNetworkEmulationOptions {
B
Benjamin Pasero 已提交
7954
		/**
7955
		 * Whether to emulate network outage. Defaults to false.
B
Benjamin Pasero 已提交
7956
		 */
7957
		offline?: boolean;
B
Benjamin Pasero 已提交
7958
		/**
7959
		 * RTT in ms. Defaults to 0 which will disable latency throttling.
B
Benjamin Pasero 已提交
7960
		 */
7961
		latency?: number;
B
Benjamin Pasero 已提交
7962
		/**
7963
		 * Download rate in Bps. Defaults to 0 which will disable download throttling.
B
Benjamin Pasero 已提交
7964
		 */
7965
		downloadThroughput?: number;
B
Benjamin Pasero 已提交
7966
		/**
7967
		 * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
B
Benjamin Pasero 已提交
7968
		 */
7969 7970 7971
		uploadThroughput?: number;
	}

B
Benjamin Pasero 已提交
7972 7973 7974
	interface Extensions {
	}

7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986
	interface FeedURLOptions {
		url: string;
		/**
		 * HTTP request headers.
		 */
		headers?: Headers;
		/**
		 * Either json or default, see the README for more information.
		 */
		serverType?: string;
	}

7987 7988 7989 7990 7991
	interface FileIconOptions {
		size: ('small' | 'normal' | 'large');
	}

	interface Filter {
B
Benjamin Pasero 已提交
7992
		/**
7993 7994
		 * Retrieves cookies which are associated with url. Empty implies retrieving
		 * cookies of all urls.
B
Benjamin Pasero 已提交
7995
		 */
7996
		url?: string;
B
Benjamin Pasero 已提交
7997
		/**
7998
		 * Filters cookies by name.
B
Benjamin Pasero 已提交
7999
		 */
8000
		name?: string;
B
Benjamin Pasero 已提交
8001
		/**
8002
		 * Retrieves cookies whose domains match or are subdomains of domains.
B
Benjamin Pasero 已提交
8003
		 */
8004
		domain?: string;
B
Benjamin Pasero 已提交
8005
		/**
8006
		 * Retrieves cookies whose path matches path.
B
Benjamin Pasero 已提交
8007
		 */
8008
		path?: string;
B
Benjamin Pasero 已提交
8009
		/**
8010
		 * Filters cookies by their Secure property.
B
Benjamin Pasero 已提交
8011
		 */
8012
		secure?: boolean;
B
Benjamin Pasero 已提交
8013
		/**
8014
		 * Filters out session or persistent cookies.
B
Benjamin Pasero 已提交
8015
		 */
8016 8017 8018 8019
		session?: boolean;
	}

	interface FindInPageOptions {
B
Benjamin Pasero 已提交
8020
		/**
8021
		 * Whether to search forward or backward, defaults to true.
B
Benjamin Pasero 已提交
8022
		 */
8023
		forward?: boolean;
B
Benjamin Pasero 已提交
8024
		/**
8025
		 * Whether the operation is first request or a follow up, defaults to false.
B
Benjamin Pasero 已提交
8026
		 */
8027
		findNext?: boolean;
B
Benjamin Pasero 已提交
8028
		/**
8029
		 * Whether search should be case-sensitive, defaults to false.
B
Benjamin Pasero 已提交
8030
		 */
8031
		matchCase?: boolean;
B
Benjamin Pasero 已提交
8032
		/**
8033
		 * Whether to look only at the start of words. defaults to false.
B
Benjamin Pasero 已提交
8034
		 */
8035
		wordStart?: boolean;
B
Benjamin Pasero 已提交
8036
		/**
8037 8038 8039
		 * When combined with wordStart, accepts a match in the middle of a word if the
		 * match begins with an uppercase letter followed by a lowercase or non-letter.
		 * Accepts several other intra-word matches, defaults to false.
B
Benjamin Pasero 已提交
8040
		 */
8041 8042 8043 8044 8045 8046 8047 8048
		medialCapitalAsWordStart?: boolean;
	}

	interface FoundInPageEvent extends Event {
		result: FoundInPageResult;
	}

	interface FromPartitionOptions {
B
Benjamin Pasero 已提交
8049
		/**
8050
		 * Whether to enable cache.
B
Benjamin Pasero 已提交
8051
		 */
8052 8053 8054 8055
		cache: boolean;
	}

	interface Header {
B
Benjamin Pasero 已提交
8056
		/**
8057
		 * Specify an extra header name.
B
Benjamin Pasero 已提交
8058
		 */
8059 8060 8061
		name: string;
	}

8062 8063 8064
	interface Headers {
	}

8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076
	interface HeapStatistics {
		totalHeapSize: number;
		totalHeapSizeExecutable: number;
		totalPhysicalSize: number;
		totalAvailableSize: number;
		usedHeapSize: number;
		heapSizeLimit: number;
		mallocedMemory: number;
		peakMallocedMemory: number;
		doesZapGarbage: boolean;
	}

8077 8078 8079 8080 8081 8082 8083 8084 8085
	interface IgnoreMouseEventsOptions {
		/**
		 * If true, forwards mouse move messages to Chromium, enabling mouse related events
		 * such as mouseleave. Only used when ignore is true. If ignore is false,
		 * forwarding is always disabled regardless of this value.
		 */
		forward?: boolean;
	}

8086
	interface ImportCertificateOptions {
B
Benjamin Pasero 已提交
8087
		/**
8088
		 * Path for the pkcs12 file.
B
Benjamin Pasero 已提交
8089
		 */
8090
		certificate: string;
B
Benjamin Pasero 已提交
8091
		/**
8092
		 * Passphrase for the certificate.
B
Benjamin Pasero 已提交
8093
		 */
8094 8095 8096 8097
		password: string;
	}

	interface Input {
B
Benjamin Pasero 已提交
8098
		/**
8099
		 * Either keyUp or keyDown.
B
Benjamin Pasero 已提交
8100
		 */
8101
		type: string;
B
Benjamin Pasero 已提交
8102
		/**
8103
		 * Equivalent to .
B
Benjamin Pasero 已提交
8104
		 */
8105
		key: string;
B
Benjamin Pasero 已提交
8106
		/**
8107
		 * Equivalent to .
B
Benjamin Pasero 已提交
8108
		 */
8109
		code: string;
B
Benjamin Pasero 已提交
8110
		/**
8111
		 * Equivalent to .
B
Benjamin Pasero 已提交
8112
		 */
8113
		isAutoRepeat: boolean;
B
Benjamin Pasero 已提交
8114
		/**
8115
		 * Equivalent to .
B
Benjamin Pasero 已提交
8116
		 */
8117
		shift: boolean;
B
Benjamin Pasero 已提交
8118
		/**
8119
		 * Equivalent to .
B
Benjamin Pasero 已提交
8120
		 */
8121
		control: boolean;
B
Benjamin Pasero 已提交
8122
		/**
8123
		 * Equivalent to .
B
Benjamin Pasero 已提交
8124
		 */
8125
		alt: boolean;
B
Benjamin Pasero 已提交
8126
		/**
8127
		 * Equivalent to .
B
Benjamin Pasero 已提交
8128
		 */
8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147
		meta: boolean;
	}

	interface InterceptBufferProtocolRequest {
		url: string;
		referrer: string;
		method: string;
		uploadData: UploadData[];
	}

	interface InterceptFileProtocolRequest {
		url: string;
		referrer: string;
		method: string;
		uploadData: UploadData[];
	}

	interface InterceptHttpProtocolRequest {
		url: string;
8148
		headers: Headers;
8149 8150 8151 8152 8153
		referrer: string;
		method: string;
		uploadData: UploadData[];
	}

8154 8155 8156 8157 8158 8159 8160 8161
	interface InterceptStreamProtocolRequest {
		url: string;
		headers: Headers;
		referrer: string;
		method: string;
		uploadData: UploadData[];
	}

8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174
	interface InterceptStringProtocolRequest {
		url: string;
		referrer: string;
		method: string;
		uploadData: UploadData[];
	}

	interface IpcMessageEvent extends Event {
		channel: string;
		args: any[];
	}

	interface Item {
B
Benjamin Pasero 已提交
8175
		/**
8176
		 * or files Array The path(s) to the file(s) being dragged.
B
Benjamin Pasero 已提交
8177
		 */
8178
		file: string;
B
Benjamin Pasero 已提交
8179
		/**
8180
		 * The image must be non-empty on macOS.
B
Benjamin Pasero 已提交
8181
		 */
8182 8183 8184 8185
		icon: NativeImage;
	}

	interface JumpListSettings {
B
Benjamin Pasero 已提交
8186
		/**
8187 8188
		 * The minimum number of items that will be shown in the Jump List (for a more
		 * detailed description of this value see the ).
B
Benjamin Pasero 已提交
8189
		 */
8190
		minItems: number;
B
Benjamin Pasero 已提交
8191
		/**
8192 8193 8194 8195
		 * Array of JumpListItem objects that correspond to items that the user has
		 * explicitly removed from custom categories in the Jump List. These items must not
		 * be re-added to the Jump List in the call to app.setJumpList(), Windows will not
		 * display any custom category that contains any of the removed items.
B
Benjamin Pasero 已提交
8196
		 */
8197 8198 8199 8200 8201 8202 8203 8204
		removedItems: JumpListItem[];
	}

	interface LoadCommitEvent extends Event {
		url: string;
		isMainFrame: boolean;
	}

8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219
	interface LoadFileOptions {
		/**
		 * Passed to url.format().
		 */
		query?: Query;
		/**
		 * Passed to url.format().
		 */
		search?: string;
		/**
		 * Passed to url.format().
		 */
		hash?: string;
	}

8220
	interface LoadURLOptions {
B
Benjamin Pasero 已提交
8221
		/**
8222
		 * An HTTP Referrer url.
B
Benjamin Pasero 已提交
8223
		 */
8224
		httpReferrer?: (string) | (Referrer);
B
Benjamin Pasero 已提交
8225
		/**
8226
		 * A user agent originating the request.
B
Benjamin Pasero 已提交
8227
		 */
8228
		userAgent?: string;
B
Benjamin Pasero 已提交
8229
		/**
8230
		 * Extra headers separated by "\n"
B
Benjamin Pasero 已提交
8231
		 */
8232
		extraHeaders?: string;
8233
		postData?: (UploadRawData[]) | (UploadFile[]) | (UploadBlob[]);
B
Benjamin Pasero 已提交
8234
		/**
8235 8236 8237
		 * Base url (with trailing path separator) for files to be loaded by the data url.
		 * This is needed only if the specified url is a data url and needs to load other
		 * files.
B
Benjamin Pasero 已提交
8238
		 */
8239 8240 8241 8242 8243
		baseURLForDataURL?: string;
	}

	interface LoginItemSettings {
		options?: Options;
B
Benjamin Pasero 已提交
8244
		/**
8245
		 * true if the app is set to open at login.
B
Benjamin Pasero 已提交
8246
		 */
8247
		openAtLogin: boolean;
B
Benjamin Pasero 已提交
8248
		/**
8249 8250
		 * true if the app is set to open as hidden at login. This setting is not available
		 * on .
B
Benjamin Pasero 已提交
8251
		 */
8252
		openAsHidden: boolean;
B
Benjamin Pasero 已提交
8253
		/**
8254 8255
		 * true if the app was opened at login automatically. This setting is not available
		 * on .
B
Benjamin Pasero 已提交
8256
		 */
8257
		wasOpenedAtLogin: boolean;
B
Benjamin Pasero 已提交
8258
		/**
8259
		 * true if the app was opened as a hidden login item. This indicates that the app
8260
		 * should not open any windows at startup. This setting is not available on .
B
Benjamin Pasero 已提交
8261
		 */
8262
		wasOpenedAsHidden: boolean;
B
Benjamin Pasero 已提交
8263
		/**
8264 8265
		 * true if the app was opened as a login item that should restore the state from
		 * the previous session. This indicates that the app should restore the windows
8266 8267
		 * that were open the last time the app was closed. This setting is not available
		 * on .
B
Benjamin Pasero 已提交
8268
		 */
8269 8270 8271 8272
		restoreState: boolean;
	}

	interface LoginItemSettingsOptions {
B
Benjamin Pasero 已提交
8273
		/**
8274
		 * The executable path to compare against. Defaults to process.execPath.
B
Benjamin Pasero 已提交
8275
		 */
8276
		path?: string;
B
Benjamin Pasero 已提交
8277
		/**
8278
		 * The command-line arguments to compare against. Defaults to an empty array.
B
Benjamin Pasero 已提交
8279
		 */
8280
		args?: string[];
B
Benjamin Pasero 已提交
8281 8282
	}

8283 8284 8285
	interface MemoryDumpConfig {
	}

8286
	interface MenuItemConstructorOptions {
8287
		/**
8288 8289
		 * Will be called with click(menuItem, browserWindow, event) when the menu item is
		 * clicked.
8290
		 */
8291
		click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void;
B
Benjamin Pasero 已提交
8292
		/**
8293 8294
		 * Define the action of the menu item, when specified the click property will be
		 * ignored. See .
B
Benjamin Pasero 已提交
8295
		 */
8296
		role?: string;
B
Benjamin Pasero 已提交
8297
		/**
8298
		 * Can be normal, separator, submenu, checkbox or radio.
B
Benjamin Pasero 已提交
8299
		 */
8300 8301 8302 8303
		type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
		label?: string;
		sublabel?: string;
		accelerator?: Accelerator;
8304
		icon?: (NativeImage) | (string);
B
Benjamin Pasero 已提交
8305
		/**
8306
		 * If false, the menu item will be greyed out and unclickable.
B
Benjamin Pasero 已提交
8307
		 */
8308
		enabled?: boolean;
B
Benjamin Pasero 已提交
8309
		/**
8310
		 * If false, the menu item will be entirely hidden.
B
Benjamin Pasero 已提交
8311
		 */
8312
		visible?: boolean;
B
Benjamin Pasero 已提交
8313
		/**
8314
		 * Should only be specified for checkbox or radio type menu items.
B
Benjamin Pasero 已提交
8315
		 */
8316
		checked?: boolean;
B
Benjamin Pasero 已提交
8317 8318 8319 8320 8321
		/**
		 * If false, the accelerator won't be registered with the system, but it will still
		 * be displayed. Defaults to true.
		 */
		registerAccelerator?: boolean;
B
Benjamin Pasero 已提交
8322
		/**
8323
		 * Should be specified for submenu type menu items. If submenu is specified, the
8324
		 * type: 'submenu' can be omitted. If the value is not a then it will be
8325
		 * automatically converted to one using Menu.buildFromTemplate.
B
Benjamin Pasero 已提交
8326
		 */
8327
		submenu?: (MenuItemConstructorOptions[]) | (Menu);
B
Benjamin Pasero 已提交
8328
		/**
8329 8330
		 * Unique within a single menu. If defined then it can be used as a reference to
		 * this item by the position attribute.
B
Benjamin Pasero 已提交
8331
		 */
8332
		id?: string;
B
Benjamin Pasero 已提交
8333
		/**
8334 8335 8336 8337 8338 8339 8340 8341 8342
		 * Inserts this item before the item with the specified label. If the referenced
		 * item doesn't exist the item will be inserted at the end of the menu. Also
		 * implies that the menu item in question should be placed in the same “group” as
		 * the item.
		 */
		before?: string[];
		/**
		 * Inserts this item after the item with the specified label. If the referenced
		 * item doesn't exist the item will be inserted at the end of the menu.
B
Benjamin Pasero 已提交
8343
		 */
8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356
		after?: string[];
		/**
		 * Provides a means for a single context menu to declare the placement of their
		 * containing group before the containing group of the item with the specified
		 * label.
		 */
		beforeGroupContaining?: string[];
		/**
		 * Provides a means for a single context menu to declare the placement of their
		 * containing group after the containing group of the item with the specified
		 * label.
		 */
		afterGroupContaining?: string[];
B
Benjamin Pasero 已提交
8357 8358
	}

8359
	interface MessageBoxOptions {
B
Benjamin Pasero 已提交
8360
		/**
8361 8362 8363
		 * Can be "none", "info", "error", "question" or "warning". On Windows, "question"
		 * displays the same icon as "info", unless you set an icon using the "icon"
		 * option. On macOS, both "warning" and "error" display the same warning icon.
B
Benjamin Pasero 已提交
8364
		 */
8365
		type?: string;
B
Benjamin Pasero 已提交
8366
		/**
8367 8368
		 * Array of texts for buttons. On Windows, an empty array will result in one button
		 * labeled "OK".
B
Benjamin Pasero 已提交
8369
		 */
8370
		buttons?: string[];
B
Benjamin Pasero 已提交
8371
		/**
8372 8373
		 * Index of the button in the buttons array which will be selected by default when
		 * the message box opens.
B
Benjamin Pasero 已提交
8374
		 */
8375
		defaultId?: number;
B
Benjamin Pasero 已提交
8376
		/**
8377
		 * Title of the message box, some platforms will not show it.
B
Benjamin Pasero 已提交
8378
		 */
8379
		title?: string;
B
Benjamin Pasero 已提交
8380
		/**
8381
		 * Content of the message box.
B
Benjamin Pasero 已提交
8382
		 */
8383
		message: string;
B
Benjamin Pasero 已提交
8384
		/**
8385
		 * Extra information of the message.
B
Benjamin Pasero 已提交
8386
		 */
8387
		detail?: string;
B
Benjamin Pasero 已提交
8388
		/**
8389 8390
		 * If provided, the message box will include a checkbox with the given label. The
		 * checkbox state can be inspected only when using callback.
B
Benjamin Pasero 已提交
8391
		 */
8392
		checkboxLabel?: string;
B
Benjamin Pasero 已提交
8393
		/**
8394
		 * Initial checked state of the checkbox. false by default.
B
Benjamin Pasero 已提交
8395
		 */
8396 8397
		checkboxChecked?: boolean;
		icon?: NativeImage;
B
Benjamin Pasero 已提交
8398
		/**
8399 8400 8401
		 * The index of the button to be used to cancel the dialog, via the Esc key. By
		 * default this is assigned to the first button with "cancel" or "no" as the label.
		 * If no such labeled buttons exist and this option is not set, 0 will be used as
8402
		 * the return value or callback response.
B
Benjamin Pasero 已提交
8403
		 */
8404
		cancelId?: number;
B
Benjamin Pasero 已提交
8405
		/**
8406 8407 8408 8409
		 * On Windows Electron will try to figure out which one of the buttons are common
		 * buttons (like "Cancel" or "Yes"), and show the others as command links in the
		 * dialog. This can make the dialog appear in the style of modern Windows apps. If
		 * you don't like this behavior, you can set noLink to true.
B
Benjamin Pasero 已提交
8410
		 */
8411
		noLink?: boolean;
B
Benjamin Pasero 已提交
8412
		/**
8413 8414 8415 8416 8417 8418 8419
		 * Normalize the keyboard access keys across platforms. Default is false. Enabling
		 * this assumes & is used in the button labels for the placement of the keyboard
		 * shortcut access key and labels will be converted so they work correctly on each
		 * platform, & characters are removed on macOS, converted to _ on Linux, and left
		 * untouched on Windows. For example, a button label of Vie&w will be converted to
		 * Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and
		 * Linux.
B
Benjamin Pasero 已提交
8420
		 */
8421
		normalizeAccessKeys?: boolean;
B
Benjamin Pasero 已提交
8422 8423
	}

8424 8425 8426
	interface NewWindowEvent extends Event {
		url: string;
		frameName: string;
B
Benjamin Pasero 已提交
8427
		/**
8428 8429
		 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
		 * `save-to-disk` and `other`.
B
Benjamin Pasero 已提交
8430
		 */
8431
		disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
B
Benjamin Pasero 已提交
8432
		/**
8433
		 * The options which should be used for creating the new .
B
Benjamin Pasero 已提交
8434
		 */
8435
		options: Options;
B
Benjamin Pasero 已提交
8436 8437
	}

8438
	interface NotificationConstructorOptions {
B
Benjamin Pasero 已提交
8439
		/**
8440
		 * A title for the notification, which will be shown at the top of the notification
8441
		 * window when it is shown.
B
Benjamin Pasero 已提交
8442
		 */
8443
		title: string;
B
Benjamin Pasero 已提交
8444
		/**
B
Benjamin Pasero 已提交
8445
		 * A subtitle for the notification, which will be displayed below the title.
B
Benjamin Pasero 已提交
8446
		 */
B
Benjamin Pasero 已提交
8447
		subtitle?: string;
B
Benjamin Pasero 已提交
8448
		/**
B
Benjamin Pasero 已提交
8449
		 * The body text of the notification, which will be displayed below the title or
8450
		 * subtitle.
B
Benjamin Pasero 已提交
8451
		 */
8452
		body: string;
B
Benjamin Pasero 已提交
8453
		/**
8454
		 * Whether or not to emit an OS notification noise when showing the notification.
B
Benjamin Pasero 已提交
8455
		 */
8456
		silent?: boolean;
B
Benjamin Pasero 已提交
8457
		/**
8458
		 * An icon to use in the notification.
B
Benjamin Pasero 已提交
8459
		 */
8460
		icon?: (string) | (NativeImage);
B
Benjamin Pasero 已提交
8461
		/**
8462
		 * Whether or not to add an inline reply option to the notification.
B
Benjamin Pasero 已提交
8463
		 */
8464
		hasReply?: boolean;
B
Benjamin Pasero 已提交
8465
		/**
8466
		 * The placeholder to write in the inline reply input field.
B
Benjamin Pasero 已提交
8467
		 */
8468
		replyPlaceholder?: string;
B
Benjamin Pasero 已提交
8469
		/**
B
Benjamin Pasero 已提交
8470
		 * The name of the sound file to play when the notification is shown.
B
Benjamin Pasero 已提交
8471
		 */
B
Benjamin Pasero 已提交
8472
		sound?: string;
B
Benjamin Pasero 已提交
8473
		/**
B
Benjamin Pasero 已提交
8474
		 * Actions to add to the notification. Please read the available actions and
8475
		 * limitations in the NotificationAction documentation.
B
Benjamin Pasero 已提交
8476
		 */
B
Benjamin Pasero 已提交
8477
		actions?: NotificationAction[];
8478 8479 8480 8481 8482
		/**
		 * A custom title for the close button of an alert. An empty string will cause the
		 * default localized text to be used.
		 */
		closeButtonText?: string;
B
Benjamin Pasero 已提交
8483 8484
	}

8485
	interface OnBeforeRedirectDetails {
8486
		id: number;
8487 8488
		url: string;
		method: string;
8489
		webContentsId?: number;
8490 8491 8492 8493
		resourceType: string;
		timestamp: number;
		redirectURL: string;
		statusCode: number;
B
Benjamin Pasero 已提交
8494
		/**
8495
		 * The server IP address that the request was actually sent to.
B
Benjamin Pasero 已提交
8496
		 */
8497 8498 8499 8500 8501 8502
		ip?: string;
		fromCache: boolean;
		responseHeaders: ResponseHeaders;
	}

	interface OnBeforeRedirectFilter {
B
Benjamin Pasero 已提交
8503
		/**
8504 8505
		 * Array of URL patterns that will be used to filter out the requests that do not
		 * match the URL patterns.
B
Benjamin Pasero 已提交
8506
		 */
8507 8508 8509 8510 8511 8512 8513
		urls: string[];
	}

	interface OnBeforeRequestDetails {
		id: number;
		url: string;
		method: string;
8514
		webContentsId?: number;
8515 8516 8517 8518 8519 8520
		resourceType: string;
		timestamp: number;
		uploadData: UploadData[];
	}

	interface OnBeforeRequestFilter {
B
Benjamin Pasero 已提交
8521
		/**
8522 8523
		 * Array of URL patterns that will be used to filter out the requests that do not
		 * match the URL patterns.
B
Benjamin Pasero 已提交
8524
		 */
8525
		urls: string[];
B
Benjamin Pasero 已提交
8526 8527
	}

B
Benjamin Pasero 已提交
8528 8529 8530 8531 8532 8533 8534 8535 8536 8537
	interface OnBeforeSendHeadersDetails {
		id: number;
		url: string;
		method: string;
		webContentsId?: number;
		resourceType: string;
		timestamp: number;
		requestHeaders: RequestHeaders;
	}

8538
	interface OnBeforeSendHeadersFilter {
B
Benjamin Pasero 已提交
8539
		/**
8540 8541
		 * Array of URL patterns that will be used to filter out the requests that do not
		 * match the URL patterns.
B
Benjamin Pasero 已提交
8542
		 */
8543 8544 8545
		urls: string[];
	}

B
Benjamin Pasero 已提交
8546 8547 8548 8549 8550 8551 8552 8553
	interface OnBeforeSendHeadersResponse {
		cancel?: boolean;
		/**
		 * When provided, request will be made with these headers.
		 */
		requestHeaders?: RequestHeaders;
	}

8554 8555 8556 8557
	interface OnCompletedDetails {
		id: number;
		url: string;
		method: string;
8558
		webContentsId?: number;
8559
		resourceType: string;
8560
		referrer: string;
8561 8562 8563 8564 8565 8566 8567 8568
		timestamp: number;
		responseHeaders: ResponseHeaders;
		fromCache: boolean;
		statusCode: number;
		statusLine: string;
	}

	interface OnCompletedFilter {
B
Benjamin Pasero 已提交
8569
		/**
8570 8571
		 * Array of URL patterns that will be used to filter out the requests that do not
		 * match the URL patterns.
B
Benjamin Pasero 已提交
8572
		 */
8573
		urls: string[];
B
Benjamin Pasero 已提交
8574 8575
	}

8576 8577
	interface OnErrorOccurredDetails {
		id: number;
B
Benjamin Pasero 已提交
8578
		url: string;
8579
		method: string;
8580
		webContentsId?: number;
8581 8582 8583
		resourceType: string;
		timestamp: number;
		fromCache: boolean;
B
Benjamin Pasero 已提交
8584
		/**
8585
		 * The error description.
B
Benjamin Pasero 已提交
8586
		 */
8587
		error: string;
B
Benjamin Pasero 已提交
8588 8589
	}

8590
	interface OnErrorOccurredFilter {
B
Benjamin Pasero 已提交
8591
		/**
8592 8593
		 * Array of URL patterns that will be used to filter out the requests that do not
		 * match the URL patterns.
B
Benjamin Pasero 已提交
8594
		 */
8595
		urls: string[];
B
Benjamin Pasero 已提交
8596 8597
	}

B
Benjamin Pasero 已提交
8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609
	interface OnHeadersReceivedDetails {
		id: number;
		url: string;
		method: string;
		webContentsId?: number;
		resourceType: string;
		timestamp: number;
		statusLine: string;
		statusCode: number;
		responseHeaders: ResponseHeaders;
	}

8610
	interface OnHeadersReceivedFilter {
B
Benjamin Pasero 已提交
8611
		/**
8612 8613
		 * Array of URL patterns that will be used to filter out the requests that do not
		 * match the URL patterns.
B
Benjamin Pasero 已提交
8614
		 */
8615 8616 8617
		urls: string[];
	}

B
Benjamin Pasero 已提交
8618
	interface OnHeadersReceivedResponse {
8619
		cancel?: boolean;
B
Benjamin Pasero 已提交
8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630
		/**
		 * When provided, the server is assumed to have responded with these headers.
		 */
		responseHeaders?: ResponseHeaders;
		/**
		 * Should be provided when overriding responseHeaders to change header status
		 * otherwise original response header's status will be used.
		 */
		statusLine?: string;
	}

8631 8632 8633 8634
	interface OnResponseStartedDetails {
		id: number;
		url: string;
		method: string;
8635
		webContentsId?: number;
8636 8637 8638
		resourceType: string;
		timestamp: number;
		responseHeaders: ResponseHeaders;
B
Benjamin Pasero 已提交
8639
		/**
8640
		 * Indicates whether the response was fetched from disk cache.
B
Benjamin Pasero 已提交
8641
		 */
8642 8643 8644 8645 8646 8647
		fromCache: boolean;
		statusCode: number;
		statusLine: string;
	}

	interface OnResponseStartedFilter {
B
Benjamin Pasero 已提交
8648
		/**
8649 8650
		 * Array of URL patterns that will be used to filter out the requests that do not
		 * match the URL patterns.
B
Benjamin Pasero 已提交
8651
		 */
8652
		urls: string[];
B
Benjamin Pasero 已提交
8653 8654
	}

8655 8656
	interface OnSendHeadersDetails {
		id: number;
B
Benjamin Pasero 已提交
8657
		url: string;
8658
		method: string;
8659
		webContentsId?: number;
8660 8661 8662
		resourceType: string;
		timestamp: number;
		requestHeaders: RequestHeaders;
B
Benjamin Pasero 已提交
8663 8664
	}

8665
	interface OnSendHeadersFilter {
B
Benjamin Pasero 已提交
8666
		/**
8667 8668
		 * Array of URL patterns that will be used to filter out the requests that do not
		 * match the URL patterns.
B
Benjamin Pasero 已提交
8669
		 */
8670 8671 8672 8673
		urls: string[];
	}

	interface OpenDevToolsOptions {
B
Benjamin Pasero 已提交
8674
		/**
8675 8676 8677
		 * Opens the devtools with specified dock state, can be right, bottom, undocked,
		 * detach. Defaults to last used dock state. In undocked mode it's possible to dock
		 * back. In detach mode it's not.
B
Benjamin Pasero 已提交
8678
		 */
8679
		mode: ('right' | 'bottom' | 'undocked' | 'detach');
B
Benjamin Pasero 已提交
8680 8681
	}

8682 8683 8684
	interface OpenDialogOptions {
		title?: string;
		defaultPath?: string;
B
Benjamin Pasero 已提交
8685
		/**
8686 8687
		 * Custom label for the confirmation button, when left empty the default label will
		 * be used.
B
Benjamin Pasero 已提交
8688
		 */
8689 8690
		buttonLabel?: string;
		filters?: FileFilter[];
B
Benjamin Pasero 已提交
8691
		/**
8692 8693
		 * Contains which features the dialog should use. The following values are
		 * supported:
B
Benjamin Pasero 已提交
8694
		 */
B
Benjamin Pasero 已提交
8695
		properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'>;
B
Benjamin Pasero 已提交
8696
		/**
8697
		 * Message to display above input boxes.
B
Benjamin Pasero 已提交
8698
		 */
8699
		message?: string;
8700 8701 8702 8703
		/**
		 * Create when packaged for the Mac App Store.
		 */
		securityScopedBookmarks?: boolean;
B
Benjamin Pasero 已提交
8704 8705
	}

8706
	interface OpenExternalOptions {
B
Benjamin Pasero 已提交
8707
		/**
8708
		 * true to bring the opened application to the foreground. The default is true.
B
Benjamin Pasero 已提交
8709
		 */
8710 8711 8712 8713 8714
		activate?: boolean;
		/**
		 * The working directory.
		 */
		workingDirectory?: string;
8715 8716 8717
	}

	interface PageFaviconUpdatedEvent extends Event {
B
Benjamin Pasero 已提交
8718
		/**
8719
		 * Array of URLs.
B
Benjamin Pasero 已提交
8720
		 */
8721 8722 8723 8724 8725 8726
		favicons: string[];
	}

	interface PageTitleUpdatedEvent extends Event {
		title: string;
		explicitSet: boolean;
B
Benjamin Pasero 已提交
8727 8728
	}

8729
	interface Parameters {
B
Benjamin Pasero 已提交
8730
		/**
8731
		 * Specify the screen type to emulate (default: desktop):
B
Benjamin Pasero 已提交
8732
		 */
8733
		screenPosition: ('desktop' | 'mobile');
B
Benjamin Pasero 已提交
8734
		/**
8735
		 * Set the emulated screen size (screenPosition == mobile).
B
Benjamin Pasero 已提交
8736
		 */
8737
		screenSize: Size;
B
Benjamin Pasero 已提交
8738
		/**
8739 8740
		 * Position the view on the screen (screenPosition == mobile) (default: { x: 0, y:
		 * 0 }).
B
Benjamin Pasero 已提交
8741
		 */
8742
		viewPosition: Point;
B
Benjamin Pasero 已提交
8743 8744
		/**
		 * Set the device scale factor (if zero defaults to original device scale factor)
8745
		 * (default: 0).
B
Benjamin Pasero 已提交
8746 8747 8748
		 */
		deviceScaleFactor: number;
		/**
8749
		 * Set the emulated view size (empty means no override)
B
Benjamin Pasero 已提交
8750
		 */
8751
		viewSize: Size;
8752 8753
		/**
		 * Scale of emulated view inside available space (not in fit to view mode)
8754
		 * (default: 1).
8755 8756
		 */
		scale: number;
B
Benjamin Pasero 已提交
8757 8758
	}

8759
	interface Payment {
8760 8761 8762
		/**
		 * The identifier of the purchased product.
		 */
8763
		productIdentifier: string;
8764 8765 8766
		/**
		 * The quantity purchased.
		 */
8767 8768 8769
		quantity: number;
	}

8770 8771 8772 8773 8774 8775 8776 8777 8778
	interface PermissionCheckHandlerDetails {
		/**
		 * The security orign of the media check.
		 */
		securityOrigin: string;
		/**
		 * The type of media access being requested, can be video, audio or unknown
		 */
		mediaType: ('video' | 'audio' | 'unknown');
D
deepak1556 已提交
8779 8780 8781 8782 8783 8784 8785 8786
		/**
		 * The last URL the requesting frame loaded
		 */
		requestingUrl: string;
		/**
		 * Whether the frame making the request is the main frame
		 */
		isMainFrame: boolean;
8787 8788
	}

8789 8790 8791 8792
	interface PermissionRequestHandlerDetails {
		/**
		 * The url of the openExternal request.
		 */
D
deepak1556 已提交
8793
		externalURL?: string;
8794 8795 8796
		/**
		 * The types of media access being requested, elements can be video or audio
		 */
D
deepak1556 已提交
8797 8798 8799 8800 8801 8802 8803 8804 8805
		mediaTypes?: Array<'video' | 'audio'>;
		/**
		 * The last URL the requesting frame loaded
		 */
		requestingUrl: string;
		/**
		 * Whether the frame making the request is the main frame
		 */
		isMainFrame: boolean;
8806 8807
	}

8808 8809 8810
	interface PluginCrashedEvent extends Event {
		name: string;
		version: string;
B
Benjamin Pasero 已提交
8811 8812
	}

8813
	interface PopupOptions {
8814 8815 8816 8817
		/**
		 * Default is the focused window.
		 */
		window?: BrowserWindow;
B
Benjamin Pasero 已提交
8818
		/**
8819
		 * Default is the current mouse cursor position. Must be declared if y is declared.
B
Benjamin Pasero 已提交
8820
		 */
8821
		x?: number;
B
Benjamin Pasero 已提交
8822
		/**
8823
		 * Default is the current mouse cursor position. Must be declared if x is declared.
B
Benjamin Pasero 已提交
8824
		 */
8825
		y?: number;
B
Benjamin Pasero 已提交
8826
		/**
8827 8828
		 * The index of the menu item to be positioned under the mouse cursor at the
		 * specified coordinates. Default is -1.
B
Benjamin Pasero 已提交
8829
		 */
8830
		positioningItem?: number;
8831 8832 8833 8834
		/**
		 * Called when menu is closed.
		 */
		callback?: () => void;
B
Benjamin Pasero 已提交
8835 8836
	}

8837
	interface PrintOptions {
B
Benjamin Pasero 已提交
8838
		/**
8839
		 * Don't ask user for print settings. Default is false.
B
Benjamin Pasero 已提交
8840
		 */
B
Benjamin Pasero 已提交
8841
		silent?: boolean;
B
Benjamin Pasero 已提交
8842
		/**
8843
		 * Also prints the background color and image of the web page. Default is false.
B
Benjamin Pasero 已提交
8844
		 */
B
Benjamin Pasero 已提交
8845
		printBackground?: boolean;
B
Benjamin Pasero 已提交
8846
		/**
8847
		 * Set the printer device name to use. Default is ''.
B
Benjamin Pasero 已提交
8848
		 */
8849 8850 8851 8852
		deviceName?: string;
	}

	interface PrintToPDFOptions {
B
Benjamin Pasero 已提交
8853
		/**
8854 8855
		 * Specifies the type of margins to use. Uses 0 for default margin, 1 for no
		 * margin, and 2 for minimum margin.
B
Benjamin Pasero 已提交
8856
		 */
8857
		marginsType?: number;
B
Benjamin Pasero 已提交
8858
		/**
8859 8860
		 * Specify page size of the generated PDF. Can be A3, A4, A5, Legal, Letter,
		 * Tabloid or an Object containing height and width in microns.
B
Benjamin Pasero 已提交
8861
		 */
8862
		pageSize?: (string) | (Size);
B
Benjamin Pasero 已提交
8863
		/**
8864
		 * Whether to print CSS backgrounds.
B
Benjamin Pasero 已提交
8865
		 */
8866
		printBackground?: boolean;
B
Benjamin Pasero 已提交
8867
		/**
8868
		 * Whether to print selection only.
B
Benjamin Pasero 已提交
8869
		 */
8870
		printSelectionOnly?: boolean;
B
Benjamin Pasero 已提交
8871
		/**
8872
		 * true for landscape, false for portrait.
B
Benjamin Pasero 已提交
8873
		 */
8874 8875 8876 8877
		landscape?: boolean;
	}

	interface ProcessMemoryInfo {
B
Benjamin Pasero 已提交
8878
		/**
8879
		 * and The amount of memory currently pinned to actual physical RAM in Kilobytes.
B
Benjamin Pasero 已提交
8880
		 */
8881
		residentSet: number;
B
Benjamin Pasero 已提交
8882
		/**
8883
		 * The amount of memory not shared by other processes, such as JS heap or HTML
8884
		 * content in Kilobytes.
B
Benjamin Pasero 已提交
8885
		 */
8886
		private: number;
B
Benjamin Pasero 已提交
8887
		/**
8888
		 * The amount of memory shared between processes, typically memory consumed by the
8889
		 * Electron code itself in Kilobytes.
B
Benjamin Pasero 已提交
8890
		 */
8891
		shared: number;
8892 8893 8894
	}

	interface ProgressBarOptions {
B
Benjamin Pasero 已提交
8895
		/**
8896
		 * Mode for the progress bar. Can be none, normal, indeterminate, error or paused.
B
Benjamin Pasero 已提交
8897
		 */
8898
		mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
B
Benjamin Pasero 已提交
8899 8900
	}

8901 8902
	interface Provider {
		/**
8903
		 * Returns Boolean.
8904 8905
		 */
		spellCheck: (text: string) => void;
B
Benjamin Pasero 已提交
8906 8907
	}

8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931
	interface ReadBookmark {
		title: string;
		url: string;
	}

	interface RedirectRequest {
		url: string;
		method: string;
		session?: Session;
		uploadData?: UploadData;
	}

	interface RegisterBufferProtocolRequest {
		url: string;
		referrer: string;
		method: string;
		uploadData: UploadData[];
	}

	interface RegisterFileProtocolRequest {
		url: string;
		referrer: string;
		method: string;
		uploadData: UploadData[];
B
Benjamin Pasero 已提交
8932 8933
	}

8934 8935
	interface RegisterHttpProtocolRequest {
		url: string;
8936
		headers: Headers;
8937 8938 8939 8940 8941 8942 8943 8944 8945 8946
		referrer: string;
		method: string;
		uploadData: UploadData[];
	}

	interface RegisterStandardSchemesOptions {
		/**
		 * true to register the scheme as secure. Default false.
		 */
		secure?: boolean;
B
Benjamin Pasero 已提交
8947 8948
	}

8949 8950 8951 8952 8953 8954 8955 8956
	interface RegisterStreamProtocolRequest {
		url: string;
		headers: Headers;
		referrer: string;
		method: string;
		uploadData: UploadData[];
	}

8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967
	interface RegisterStringProtocolRequest {
		url: string;
		referrer: string;
		method: string;
		uploadData: UploadData[];
	}

	interface RegisterURLSchemeAsPrivilegedOptions {
		/**
		 * Default true.
		 */
J
Joao Moreno 已提交
8968
		secure?: boolean;
8969 8970 8971
		/**
		 * Default true.
		 */
J
Joao Moreno 已提交
8972
		bypassCSP?: boolean;
8973 8974 8975
		/**
		 * Default true.
		 */
J
Joao Moreno 已提交
8976
		allowServiceWorkers?: boolean;
8977 8978 8979
		/**
		 * Default true.
		 */
J
Joao Moreno 已提交
8980
		supportFetchAPI?: boolean;
8981 8982 8983
		/**
		 * Default true.
		 */
J
Joao Moreno 已提交
8984 8985 8986
		corsEnabled?: boolean;
	}

8987 8988 8989 8990
	interface RelaunchOptions {
		args?: string[];
		execPath?: string;
	}
B
Benjamin Pasero 已提交
8991

8992 8993 8994 8995 8996
	interface Request {
		method: string;
		url: string;
		referrer: string;
	}
B
Benjamin Pasero 已提交
8997

8998
	interface ResizeOptions {
B
Benjamin Pasero 已提交
8999
		/**
9000
		 * Defaults to the image's width.
B
Benjamin Pasero 已提交
9001
		 */
9002
		width?: number;
B
Benjamin Pasero 已提交
9003
		/**
9004
		 * Defaults to the image's height.
B
Benjamin Pasero 已提交
9005
		 */
9006
		height?: number;
B
Benjamin Pasero 已提交
9007
		/**
9008 9009 9010 9011 9012
		 * The desired quality of the resize image. Possible values are good, better or
		 * best. The default is best. These values express a desired quality/speed
		 * tradeoff. They are translated into an algorithm-specific method that depends on
		 * the capabilities (CPU, GPU) of the underlying platform. It is possible for all
		 * three methods to be mapped to the same algorithm on a given platform.
B
Benjamin Pasero 已提交
9013
		 */
9014 9015 9016 9017 9018
		quality?: string;
	}

	interface ResourceUsage {
		images: MemoryUsageDetails;
9019
		scripts: MemoryUsageDetails;
9020 9021 9022 9023 9024 9025 9026 9027
		cssStyleSheets: MemoryUsageDetails;
		xslStyleSheets: MemoryUsageDetails;
		fonts: MemoryUsageDetails;
		other: MemoryUsageDetails;
	}

	interface Response {
		cancel?: boolean;
B
Benjamin Pasero 已提交
9028
		/**
9029 9030
		 * The original request is prevented from being sent or completed and is instead
		 * redirected to the given URL.
B
Benjamin Pasero 已提交
9031
		 */
9032 9033 9034 9035 9036
		redirectURL?: string;
	}

	interface Result {
		requestId: number;
B
Benjamin Pasero 已提交
9037
		/**
9038
		 * Position of the active match.
B
Benjamin Pasero 已提交
9039
		 */
9040
		activeMatchOrdinal: number;
B
Benjamin Pasero 已提交
9041
		/**
9042
		 * Number of Matches.
B
Benjamin Pasero 已提交
9043
		 */
9044
		matches: number;
B
Benjamin Pasero 已提交
9045
		/**
9046
		 * Coordinates of first match region.
B
Benjamin Pasero 已提交
9047
		 */
9048 9049 9050 9051 9052 9053
		selectionArea: SelectionArea;
		finalUpdate: boolean;
	}

	interface SaveDialogOptions {
		title?: string;
B
Benjamin Pasero 已提交
9054
		/**
B
Benjamin Pasero 已提交
9055
		 * Absolute directory path, absolute file path, or file name to use by default.
B
Benjamin Pasero 已提交
9056
		 */
9057
		defaultPath?: string;
B
Benjamin Pasero 已提交
9058
		/**
9059 9060
		 * Custom label for the confirmation button, when left empty the default label will
		 * be used.
B
Benjamin Pasero 已提交
9061
		 */
9062 9063
		buttonLabel?: string;
		filters?: FileFilter[];
B
Benjamin Pasero 已提交
9064
		/**
9065
		 * Message to display above text fields.
B
Benjamin Pasero 已提交
9066
		 */
9067
		message?: string;
B
Benjamin Pasero 已提交
9068
		/**
9069
		 * Custom label for the text displayed in front of the filename text field.
B
Benjamin Pasero 已提交
9070
		 */
9071
		nameFieldLabel?: string;
J
Joao Moreno 已提交
9072
		/**
9073
		 * Show the tags input box, defaults to true.
J
Joao Moreno 已提交
9074
		 */
9075
		showsTagField?: boolean;
9076 9077 9078 9079 9080
		/**
		 * Create a when packaged for the Mac App Store. If this option is enabled and the
		 * file doesn't already exist a blank file will be created at the chosen path.
		 */
		securityScopedBookmarks?: boolean;
9081 9082 9083
	}

	interface Settings {
B
Benjamin Pasero 已提交
9084
		/**
9085 9086
		 * true to open the app at login, false to remove the app as a login item. Defaults
		 * to false.
B
Benjamin Pasero 已提交
9087
		 */
9088
		openAtLogin?: boolean;
B
Benjamin Pasero 已提交
9089
		/**
9090 9091
		 * true to open the app as hidden. Defaults to false. The user can edit this
		 * setting from the System Preferences so
9092
		 * app.getLoginItemSettings().wasOpenedAsHidden should be checked when the app is
9093
		 * opened to know the current value. This setting is not available on .
B
Benjamin Pasero 已提交
9094
		 */
9095
		openAsHidden?: boolean;
9096
		/**
B
Benjamin Pasero 已提交
9097
		 * The executable to launch at login. Defaults to process.execPath.
9098
		 */
B
Benjamin Pasero 已提交
9099
		path?: string;
B
Benjamin Pasero 已提交
9100
		/**
B
Benjamin Pasero 已提交
9101 9102
		 * The command-line arguments to pass to the executable. Defaults to an empty
		 * array. Take care to wrap paths in quotes.
B
Benjamin Pasero 已提交
9103
		 */
B
Benjamin Pasero 已提交
9104
		args?: string[];
9105 9106 9107
	}

	interface SourcesOptions {
B
Benjamin Pasero 已提交
9108
		/**
9109 9110
		 * An array of Strings that lists the types of desktop sources to be captured,
		 * available types are screen and window.
B
Benjamin Pasero 已提交
9111
		 */
9112
		types: string[];
B
Benjamin Pasero 已提交
9113
		/**
9114 9115
		 * The size that the media source thumbnail should be scaled to. Default is 150 x
		 * 150.
B
Benjamin Pasero 已提交
9116
		 */
9117 9118 9119 9120 9121 9122 9123 9124 9125
		thumbnailSize?: Size;
	}

	interface StartMonitoringOptions {
		categoryFilter: string;
		traceOptions: string;
	}

	interface SystemMemoryInfo {
B
Benjamin Pasero 已提交
9126
		/**
9127
		 * The total amount of physical memory in Kilobytes available to the system.
B
Benjamin Pasero 已提交
9128
		 */
9129
		total: number;
B
Benjamin Pasero 已提交
9130
		/**
9131
		 * The total amount of memory not being used by applications or disk cache.
B
Benjamin Pasero 已提交
9132
		 */
9133
		free: number;
B
Benjamin Pasero 已提交
9134
		/**
9135
		 * The total amount of swap memory in Kilobytes available to the system.
B
Benjamin Pasero 已提交
9136
		 */
9137
		swapTotal: number;
B
Benjamin Pasero 已提交
9138
		/**
9139
		 * The free amount of swap memory in Kilobytes available to the system.
B
Benjamin Pasero 已提交
9140
		 */
9141 9142 9143 9144
		swapFree: number;
	}

	interface ToBitmapOptions {
B
Benjamin Pasero 已提交
9145
		/**
9146
		 * Defaults to 1.0.
B
Benjamin Pasero 已提交
9147
		 */
9148 9149 9150 9151
		scaleFactor?: number;
	}

	interface ToDataURLOptions {
B
Benjamin Pasero 已提交
9152
		/**
9153
		 * Defaults to 1.0.
B
Benjamin Pasero 已提交
9154
		 */
9155 9156 9157 9158
		scaleFactor?: number;
	}

	interface ToPNGOptions {
B
Benjamin Pasero 已提交
9159
		/**
9160
		 * Defaults to 1.0.
B
Benjamin Pasero 已提交
9161
		 */
9162 9163 9164 9165
		scaleFactor?: number;
	}

	interface TouchBarButtonConstructorOptions {
B
Benjamin Pasero 已提交
9166
		/**
9167
		 * Button text.
B
Benjamin Pasero 已提交
9168
		 */
9169
		label?: string;
B
Benjamin Pasero 已提交
9170
		/**
9171
		 * Button background color in hex format, i.e #ABCDEF.
B
Benjamin Pasero 已提交
9172
		 */
9173
		backgroundColor?: string;
B
Benjamin Pasero 已提交
9174
		/**
9175
		 * Button icon.
B
Benjamin Pasero 已提交
9176
		 */
9177
		icon?: NativeImage;
9178
		/**
9179
		 * Can be left, right or overlay.
9180
		 */
9181
		iconPosition?: ('left' | 'right' | 'overlay');
B
Benjamin Pasero 已提交
9182
		/**
9183
		 * Function to call when the button is clicked.
B
Benjamin Pasero 已提交
9184
		 */
9185 9186 9187 9188
		click?: () => void;
	}

	interface TouchBarColorPickerConstructorOptions {
B
Benjamin Pasero 已提交
9189
		/**
9190
		 * Array of hex color strings to appear as possible colors to select.
B
Benjamin Pasero 已提交
9191
		 */
9192
		availableColors?: string[];
B
Benjamin Pasero 已提交
9193
		/**
9194
		 * The selected hex color in the picker, i.e #ABCDEF.
B
Benjamin Pasero 已提交
9195
		 */
9196
		selectedColor?: string;
B
Benjamin Pasero 已提交
9197
		/**
9198
		 * Function to call when a color is selected.
B
Benjamin Pasero 已提交
9199
		 */
9200 9201 9202
		change?: (color: string) => void;
	}

B
Benjamin Pasero 已提交
9203
	interface TouchBarConstructorOptions {
9204 9205
		items: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
		escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
B
Benjamin Pasero 已提交
9206 9207
	}

9208
	interface TouchBarGroupConstructorOptions {
B
Benjamin Pasero 已提交
9209
		/**
9210
		 * Items to display as a group.
B
Benjamin Pasero 已提交
9211
		 */
9212 9213 9214 9215
		items: TouchBar;
	}

	interface TouchBarLabelConstructorOptions {
B
Benjamin Pasero 已提交
9216
		/**
9217
		 * Text to display.
B
Benjamin Pasero 已提交
9218
		 */
9219
		label?: string;
B
Benjamin Pasero 已提交
9220
		/**
9221
		 * Hex color of text, i.e #ABCDEF.
B
Benjamin Pasero 已提交
9222
		 */
9223 9224 9225 9226
		textColor?: string;
	}

	interface TouchBarPopoverConstructorOptions {
B
Benjamin Pasero 已提交
9227
		/**
9228
		 * Popover button text.
B
Benjamin Pasero 已提交
9229
		 */
9230
		label?: string;
B
Benjamin Pasero 已提交
9231
		/**
9232
		 * Popover button icon.
B
Benjamin Pasero 已提交
9233
		 */
9234
		icon?: NativeImage;
B
Benjamin Pasero 已提交
9235
		/**
9236
		 * Items to display in the popover.
B
Benjamin Pasero 已提交
9237
		 */
9238
		items?: TouchBar;
B
Benjamin Pasero 已提交
9239
		/**
9240 9241
		 * true to display a close button on the left of the popover, false to not show it.
		 * Default is true.
B
Benjamin Pasero 已提交
9242
		 */
9243 9244
		showCloseButton?: boolean;
	}
J
Joao Moreno 已提交
9245

9246
	interface TouchBarScrubberConstructorOptions {
B
Benjamin Pasero 已提交
9247
		/**
9248
		 * An array of items to place in this scrubber.
B
Benjamin Pasero 已提交
9249
		 */
9250
		items: ScrubberItem[];
B
Benjamin Pasero 已提交
9251
		/**
9252
		 * Called when the user taps an item that was not the last tapped item.
9253 9254
		 */
		select: (selectedIndex: number) => void;
B
Benjamin Pasero 已提交
9255
		/**
9256
		 * Called when the user taps any item.
B
Benjamin Pasero 已提交
9257
		 */
9258
		highlight: (highlightedIndex: number) => void;
B
Benjamin Pasero 已提交
9259
		/**
9260
		 * Selected item style. Defaults to null.
B
Benjamin Pasero 已提交
9261
		 */
9262
		selectedStyle: string;
B
Benjamin Pasero 已提交
9263
		/**
9264
		 * Selected overlay item style. Defaults to null.
B
Benjamin Pasero 已提交
9265
		 */
9266
		overlayStyle: string;
B
Benjamin Pasero 已提交
9267
		/**
9268
		 * Defaults to false.
B
Benjamin Pasero 已提交
9269
		 */
9270
		showArrowButtons: boolean;
B
Benjamin Pasero 已提交
9271
		/**
9272
		 * Defaults to free.
B
Benjamin Pasero 已提交
9273
		 */
9274 9275 9276 9277 9278 9279 9280 9281
		mode: string;
		/**
		 * Defaults to true.
		 */
		continuous: boolean;
	}

	interface TouchBarSegmentedControlConstructorOptions {
B
Benjamin Pasero 已提交
9282
		/**
9283
		 * Style of the segments:
B
Benjamin Pasero 已提交
9284
		 */
9285
		segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
B
Benjamin Pasero 已提交
9286
		/**
9287
		 * The selection mode of the control:
B
Benjamin Pasero 已提交
9288
		 */
9289
		mode?: ('single' | 'multiple' | 'buttons');
B
Benjamin Pasero 已提交
9290
		/**
9291
		 * An array of segments to place in this control.
B
Benjamin Pasero 已提交
9292
		 */
9293
		segments: SegmentedControlSegment[];
B
Benjamin Pasero 已提交
9294
		/**
9295 9296
		 * The index of the currently selected segment, will update automatically with user
		 * interaction. When the mode is multiple it will be the last selected item.
B
Benjamin Pasero 已提交
9297
		 */
9298
		selectedIndex?: number;
B
Benjamin Pasero 已提交
9299
		/**
9300
		 * Called when the user selects a new segment.
B
Benjamin Pasero 已提交
9301
		 */
9302 9303 9304 9305
		change: (selectedIndex: number, isSelected: boolean) => void;
	}

	interface TouchBarSliderConstructorOptions {
B
Benjamin Pasero 已提交
9306
		/**
9307
		 * Label text.
B
Benjamin Pasero 已提交
9308
		 */
9309
		label?: string;
B
Benjamin Pasero 已提交
9310
		/**
9311
		 * Selected value.
B
Benjamin Pasero 已提交
9312
		 */
9313
		value?: number;
B
Benjamin Pasero 已提交
9314
		/**
9315
		 * Minimum value.
B
Benjamin Pasero 已提交
9316
		 */
9317
		minValue?: number;
B
Benjamin Pasero 已提交
9318
		/**
9319
		 * Maximum value.
B
Benjamin Pasero 已提交
9320
		 */
9321
		maxValue?: number;
B
Benjamin Pasero 已提交
9322
		/**
9323
		 * Function to call when the slider is changed.
B
Benjamin Pasero 已提交
9324
		 */
9325 9326 9327 9328
		change?: (newValue: number) => void;
	}

	interface TouchBarSpacerConstructorOptions {
B
Benjamin Pasero 已提交
9329
		/**
9330
		 * Size of spacer, possible values are:
B
Benjamin Pasero 已提交
9331
		 */
9332 9333 9334 9335 9336 9337 9338
		size?: ('small' | 'large' | 'flexible');
	}

	interface UpdateTargetUrlEvent extends Event {
		url: string;
	}

9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359
	interface UploadProgress {
		/**
		 * Whether the request is currently active. If this is false no other properties
		 * will be set
		 */
		active: boolean;
		/**
		 * Whether the upload has started. If this is false both current and total will be
		 * set to 0.
		 */
		started: boolean;
		/**
		 * The number of bytes that have been uploaded so far
		 */
		current: number;
		/**
		 * The number of bytes that will be uploaded this request
		 */
		total: number;
	}

9360
	interface Versions {
B
Benjamin Pasero 已提交
9361
		/**
9362
		 * A String representing Chrome's version string.
B
Benjamin Pasero 已提交
9363
		 */
9364
		chrome?: string;
B
Benjamin Pasero 已提交
9365
		/**
B
Benjamin Pasero 已提交
9366
		 * A String representing Electron's version string.
B
Benjamin Pasero 已提交
9367
		 */
B
Benjamin Pasero 已提交
9368
		electron?: string;
9369 9370
	}

9371 9372 9373 9374 9375 9376 9377
	interface VisibleOnAllWorkspacesOptions {
		/**
		 * Sets whether the window should be visible above fullscreen windows
		 */
		visibleOnFullScreen?: boolean;
	}

9378 9379 9380 9381 9382
	interface WillNavigateEvent extends Event {
		url: string;
	}

	interface EditFlags {
B
Benjamin Pasero 已提交
9383
		/**
9384
		 * Whether the renderer believes it can undo.
B
Benjamin Pasero 已提交
9385
		 */
9386
		canUndo: boolean;
B
Benjamin Pasero 已提交
9387
		/**
9388
		 * Whether the renderer believes it can redo.
B
Benjamin Pasero 已提交
9389
		 */
9390
		canRedo: boolean;
B
Benjamin Pasero 已提交
9391
		/**
9392
		 * Whether the renderer believes it can cut.
B
Benjamin Pasero 已提交
9393
		 */
9394
		canCut: boolean;
B
Benjamin Pasero 已提交
9395
		/**
9396
		 * Whether the renderer believes it can copy
B
Benjamin Pasero 已提交
9397
		 */
9398
		canCopy: boolean;
B
Benjamin Pasero 已提交
9399
		/**
9400
		 * Whether the renderer believes it can paste.
B
Benjamin Pasero 已提交
9401
		 */
9402
		canPaste: boolean;
B
Benjamin Pasero 已提交
9403
		/**
9404
		 * Whether the renderer believes it can delete.
B
Benjamin Pasero 已提交
9405
		 */
9406
		canDelete: boolean;
B
Benjamin Pasero 已提交
9407
		/**
9408
		 * Whether the renderer believes it can select all.
B
Benjamin Pasero 已提交
9409
		 */
9410 9411 9412 9413 9414 9415 9416 9417
		canSelectAll: boolean;
	}

	interface Extra {
	}

	interface FoundInPageResult {
		requestId: number;
B
Benjamin Pasero 已提交
9418
		/**
9419
		 * Position of the active match.
B
Benjamin Pasero 已提交
9420
		 */
9421
		activeMatchOrdinal: number;
B
Benjamin Pasero 已提交
9422
		/**
9423
		 * Number of Matches.
B
Benjamin Pasero 已提交
9424
		 */
9425
		matches: number;
B
Benjamin Pasero 已提交
9426
		/**
9427
		 * Coordinates of first match region.
B
Benjamin Pasero 已提交
9428
		 */
9429 9430 9431 9432 9433
		selectionArea: SelectionArea;
		finalUpdate: boolean;
	}

	interface MediaFlags {
B
Benjamin Pasero 已提交
9434
		/**
9435
		 * Whether the media element has crashed.
B
Benjamin Pasero 已提交
9436
		 */
9437
		inError: boolean;
B
Benjamin Pasero 已提交
9438
		/**
9439
		 * Whether the media element is paused.
B
Benjamin Pasero 已提交
9440
		 */
9441
		isPaused: boolean;
B
Benjamin Pasero 已提交
9442
		/**
9443
		 * Whether the media element is muted.
B
Benjamin Pasero 已提交
9444
		 */
9445
		isMuted: boolean;
B
Benjamin Pasero 已提交
9446
		/**
9447
		 * Whether the media element has audio.
B
Benjamin Pasero 已提交
9448
		 */
9449
		hasAudio: boolean;
B
Benjamin Pasero 已提交
9450
		/**
9451
		 * Whether the media element is looping.
B
Benjamin Pasero 已提交
9452
		 */
9453
		isLooping: boolean;
B
Benjamin Pasero 已提交
9454
		/**
9455
		 * Whether the media element's controls are visible.
B
Benjamin Pasero 已提交
9456
		 */
9457
		isControlsVisible: boolean;
B
Benjamin Pasero 已提交
9458
		/**
9459
		 * Whether the media element's controls are toggleable.
B
Benjamin Pasero 已提交
9460
		 */
9461
		canToggleControls: boolean;
B
Benjamin Pasero 已提交
9462
		/**
9463
		 * Whether the media element can be rotated.
B
Benjamin Pasero 已提交
9464
		 */
9465 9466 9467 9468 9469 9470
		canRotate: boolean;
	}

	interface Options {
	}

9471 9472 9473
	interface Query {
	}

9474 9475 9476 9477 9478 9479 9480 9481 9482 9483
	interface RequestHeaders {
	}

	interface ResponseHeaders {
	}

	interface SelectionArea {
	}

	interface WebPreferences {
B
Benjamin Pasero 已提交
9484
		/**
9485 9486
		 * Whether to enable DevTools. If it is set to false, can not use
		 * BrowserWindow.webContents.openDevTools() to open DevTools. Default is true.
B
Benjamin Pasero 已提交
9487
		 */
9488
		devTools?: boolean;
B
Benjamin Pasero 已提交
9489
		/**
9490
		 * Whether node integration is enabled. Default is true.
B
Benjamin Pasero 已提交
9491
		 */
9492
		nodeIntegration?: boolean;
B
Benjamin Pasero 已提交
9493
		/**
9494 9495
		 * Whether node integration is enabled in web workers. Default is false. More about
		 * this can be found in .
B
Benjamin Pasero 已提交
9496
		 */
9497
		nodeIntegrationInWorker?: boolean;
B
Benjamin Pasero 已提交
9498
		/**
9499 9500 9501 9502 9503
		 * Specifies a script that will be loaded before other scripts run in the page.
		 * This script will always have access to node APIs no matter whether node
		 * integration is turned on or off. The value should be the absolute file path to
		 * the script. When node integration is turned off, the preload script can
		 * reintroduce Node global symbols back to the global scope. See example .
B
Benjamin Pasero 已提交
9504
		 */
9505
		preload?: string;
B
Benjamin Pasero 已提交
9506
		/**
9507 9508 9509 9510 9511
		 * If set, this will sandbox the renderer associated with the window, making it
		 * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
		 * This is not the same as the nodeIntegration option and the APIs available to the
		 * preload script are more limited. Read more about the option . This option is
		 * currently experimental and may change or be removed in future Electron releases.
B
Benjamin Pasero 已提交
9512
		 */
9513
		sandbox?: boolean;
9514 9515 9516 9517
		/**
		 * Whether to enable the module. Default is true.
		 */
		enableRemoteModule?: boolean;
B
Benjamin Pasero 已提交
9518
		/**
9519 9520 9521 9522
		 * Sets the session used by the page. Instead of passing the Session object
		 * directly, you can also choose to use the partition option instead, which accepts
		 * a partition string. When both session and partition are provided, session will
		 * be preferred. Default is the default session.
B
Benjamin Pasero 已提交
9523
		 */
9524
		session?: Session;
B
Benjamin Pasero 已提交
9525
		/**
9526 9527 9528 9529 9530 9531
		 * Sets the session used by the page according to the session's partition string.
		 * If partition starts with persist:, the page will use a persistent session
		 * available to all pages in the app with the same partition. If there is no
		 * persist: prefix, the page will use an in-memory session. By assigning the same
		 * partition, multiple pages can share the same session. Default is the default
		 * session.
B
Benjamin Pasero 已提交
9532
		 */
9533
		partition?: string;
9534 9535 9536 9537 9538 9539 9540 9541 9542
		/**
		 * When specified, web pages with the same affinity will run in the same renderer
		 * process. Note that due to reusing the renderer process, certain webPreferences
		 * options will also be shared between the web pages even when you specified
		 * different values for them, including but not limited to preload, sandbox and
		 * nodeIntegration. So it is suggested to use exact same webPreferences for web
		 * pages with the same affinity.
		 */
		affinity?: string;
B
Benjamin Pasero 已提交
9543
		/**
9544
		 * The default zoom factor of the page, 3.0 represents 300%. Default is 1.0.
B
Benjamin Pasero 已提交
9545
		 */
9546
		zoomFactor?: number;
B
Benjamin Pasero 已提交
9547
		/**
9548
		 * Enables JavaScript support. Default is true.
B
Benjamin Pasero 已提交
9549
		 */
9550
		javascript?: boolean;
B
Benjamin Pasero 已提交
9551
		/**
9552 9553 9554
		 * When false, it will disable the same-origin policy (usually using testing
		 * websites by people), and set allowRunningInsecureContent to true if this options
		 * has not been set by user. Default is true.
B
Benjamin Pasero 已提交
9555
		 */
9556
		// webSecurity?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ###
B
Benjamin Pasero 已提交
9557
		/**
9558 9559
		 * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
		 * false.
B
Benjamin Pasero 已提交
9560
		 */
9561
		// allowRunningInsecureContent?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ###
B
Benjamin Pasero 已提交
9562
		/**
9563
		 * Enables image support. Default is true.
B
Benjamin Pasero 已提交
9564
		 */
9565
		images?: boolean;
B
Benjamin Pasero 已提交
9566
		/**
9567
		 * Make TextArea elements resizable. Default is true.
B
Benjamin Pasero 已提交
9568
		 */
9569
		textAreasAreResizable?: boolean;
B
Benjamin Pasero 已提交
9570
		/**
9571
		 * Enables WebGL support. Default is true.
B
Benjamin Pasero 已提交
9572
		 */
9573
		webgl?: boolean;
B
Benjamin Pasero 已提交
9574
		/**
9575
		 * Enables WebAudio support. Default is true.
B
Benjamin Pasero 已提交
9576
		 */
9577
		webaudio?: boolean;
B
Benjamin Pasero 已提交
9578
		/**
9579
		 * Whether plugins should be enabled. Default is false.
B
Benjamin Pasero 已提交
9580
		 */
9581
		plugins?: boolean;
B
Benjamin Pasero 已提交
9582
		/**
9583
		 * Enables Chromium's experimental features. Default is false.
B
Benjamin Pasero 已提交
9584
		 */
9585
		// experimentalFeatures?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ###
B
Benjamin Pasero 已提交
9586
		/**
9587
		 * Enables scroll bounce (rubber banding) effect on macOS. Default is false.
B
Benjamin Pasero 已提交
9588
		 */
9589
		scrollBounce?: boolean;
B
Benjamin Pasero 已提交
9590
		/**
9591 9592
		 * A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to
		 * enable. The full list of supported feature strings can be found in the file.
B
Benjamin Pasero 已提交
9593
		 */
9594
		enableBlinkFeatures?: string;
B
Benjamin Pasero 已提交
9595
		/**
9596 9597
		 * A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to
		 * disable. The full list of supported feature strings can be found in the file.
B
Benjamin Pasero 已提交
9598
		 */
9599
		disableBlinkFeatures?: string;
B
Benjamin Pasero 已提交
9600
		/**
9601
		 * Sets the default font for the font-family.
B
Benjamin Pasero 已提交
9602
		 */
9603
		defaultFontFamily?: DefaultFontFamily;
B
Benjamin Pasero 已提交
9604
		/**
9605
		 * Defaults to 16.
B
Benjamin Pasero 已提交
9606
		 */
9607
		defaultFontSize?: number;
B
Benjamin Pasero 已提交
9608
		/**
9609
		 * Defaults to 13.
B
Benjamin Pasero 已提交
9610
		 */
9611
		defaultMonospaceFontSize?: number;
B
Benjamin Pasero 已提交
9612
		/**
9613
		 * Defaults to 0.
B
Benjamin Pasero 已提交
9614
		 */
9615
		minimumFontSize?: number;
B
Benjamin Pasero 已提交
9616
		/**
9617
		 * Defaults to ISO-8859-1.
B
Benjamin Pasero 已提交
9618
		 */
9619
		defaultEncoding?: string;
B
Benjamin Pasero 已提交
9620
		/**
9621
		 * Whether to throttle animations and timers when the page becomes background. This
9622
		 * also affects the . Defaults to true.
B
Benjamin Pasero 已提交
9623
		 */
9624
		backgroundThrottling?: boolean;
B
Benjamin Pasero 已提交
9625
		/**
9626 9627
		 * Whether to enable offscreen rendering for the browser window. Defaults to false.
		 * See the for more details.
B
Benjamin Pasero 已提交
9628
		 */
9629
		offscreen?: boolean;
B
Benjamin Pasero 已提交
9630
		/**
9631 9632 9633 9634 9635 9636 9637 9638 9639 9640
		 * Whether to run Electron APIs and the specified preload script in a separate
		 * JavaScript context. Defaults to false. The context that the preload script runs
		 * in will still have full access to the document and window globals but it will
		 * use its own set of JavaScript builtins (Array, Object, JSON, etc.) and will be
		 * isolated from any changes made to the global environment by the loaded page. The
		 * Electron API will only be available in the preload script and not the loaded
		 * page. This option should be used when loading potentially untrusted remote
		 * content to ensure the loaded content cannot tamper with the preload script and
		 * any Electron APIs being used. This option uses the same technique used by . You
		 * can access this context in the dev tools by selecting the 'Electron Isolated
9641
		 * Context' entry in the combo box at the top of the Console tab.
9642 9643 9644
		 */
		contextIsolation?: boolean;
		/**
9645 9646 9647
		 * Whether to use native window.open(). If set to true, the webPreferences of child
		 * window will always be the same with parent window, regardless of the parameters
		 * passed to window.open(). Defaults to false. This option is currently
B
Benjamin Pasero 已提交
9648
		 * experimental.
9649 9650 9651 9652
		 */
		nativeWindowOpen?: boolean;
		/**
		 * Whether to enable the . Defaults to the value of the nodeIntegration option. The
9653 9654 9655
		 * preload script configured for the will have node integration enabled when it is
		 * executed so you should ensure remote/untrusted content is not able to create a
		 * tag with a possibly malicious preload script. You can use the
9656
		 * will-attach-webview event on to strip away the preload script and to validate or
9657
		 * alter the 's initial settings.
9658 9659
		 */
		webviewTag?: boolean;
9660 9661 9662 9663 9664
		/**
		 * A list of strings that will be appended to process.argv in the renderer process
		 * of this app. Useful for passing small bits of data down to renderer process
		 * preload scripts.
		 */
9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680
		additionalArguments?: string[];
		/**
		 * Whether to enable browser style consecutive dialog protection. Default is false.
		 */
		safeDialogs?: boolean;
		/**
		 * The message to display when consecutive dialog protection is triggered. If not
		 * defined the default message would be used, note that currently the default
		 * message is in English and not localized.
		 */
		safeDialogsMessage?: string;
		/**
		 * Whether dragging and dropping a file or link onto the page causes a navigation.
		 * Default is false.
		 */
		navigateOnDragDrop?: boolean;
B
Benjamin Pasero 已提交
9681 9682
	}

9683
	interface DefaultFontFamily {
B
Benjamin Pasero 已提交
9684
		/**
9685
		 * Defaults to Times New Roman.
B
Benjamin Pasero 已提交
9686
		 */
9687
		standard?: string;
B
Benjamin Pasero 已提交
9688
		/**
9689
		 * Defaults to Times New Roman.
B
Benjamin Pasero 已提交
9690
		 */
9691
		serif?: string;
B
Benjamin Pasero 已提交
9692
		/**
9693
		 * Defaults to Arial.
B
Benjamin Pasero 已提交
9694
		 */
9695
		sansSerif?: string;
B
Benjamin Pasero 已提交
9696
		/**
9697
		 * Defaults to Courier New.
B
Benjamin Pasero 已提交
9698
		 */
9699
		monospace?: string;
B
Benjamin Pasero 已提交
9700
		/**
9701
		 * Defaults to Script.
B
Benjamin Pasero 已提交
9702
		 */
9703
		cursive?: string;
B
Benjamin Pasero 已提交
9704
		/**
9705
		 * Defaults to Impact.
B
Benjamin Pasero 已提交
9706
		 */
9707
		fantasy?: string;
B
Benjamin Pasero 已提交
9708
	}
9709

B
Benjamin Pasero 已提交
9710 9711
}

9712
declare module 'electron' {
B
Benjamin Pasero 已提交
9713
	export = Electron;
B
Benjamin Pasero 已提交
9714 9715
}

B
Benjamin Pasero 已提交
9716
interface NodeRequireFunction {
B
Benjamin Pasero 已提交
9717
	(moduleName: 'electron'): typeof Electron;
B
Benjamin Pasero 已提交
9718
}
B
Benjamin Pasero 已提交
9719 9720 9721

interface File {
	/**
9722
	 * The real path to the file on the users filesystem
B
Benjamin Pasero 已提交
9723 9724 9725 9726
	 */
	path: string;
}

B
Benjamin Pasero 已提交
9727 9728 9729 9730
declare module 'original-fs' {
	import * as fs from 'fs';
	export = fs;
}
9731 9732 9733 9734

interface Document {
	createElement(tagName: 'webview'): Electron.WebviewTag;
}
B
Benjamin Pasero 已提交
9735 9736

declare namespace NodeJS {
9737
	interface Process extends EventEmitter {
B
Benjamin Pasero 已提交
9738

9739
		// Docs: http://electronjs.org/docs/api/process
B
Benjamin Pasero 已提交
9740

9741
		// ### BEGIN VSCODE MODIFICATION ###
9742 9743 9744 9745 9746 9747 9748 9749 9750 9751
		// /**
		//  * Emitted when Electron has loaded its internal initialization script and is
		//  * beginning to load the web page or the main script. It can be used by the preload
		//  * script to add removed Node global symbols back to the global scope when node
		//  * integration is turned off:
		//  */
		// on(event: 'loaded', listener: Function): this;
		// once(event: 'loaded', listener: Function): this;
		// addListener(event: 'loaded', listener: Function): this;
		// removeListener(event: 'loaded', listener: Function): this;
9752 9753
		// ### END VSCODE MODIFICATION ###

B
Benjamin Pasero 已提交
9754
		/**
9755
		 * Causes the main thread of the current process crash.
B
Benjamin Pasero 已提交
9756
		 */
9757 9758
		crash(): void;
		getCPUUsage(): Electron.CPUUsage;
9759 9760 9761 9762 9763 9764
		/**
		 * Indicates the creation time of the application. The time is represented as
		 * number of milliseconds since epoch. It returns null if it is unable to get the
		 * process creation time.
		 */
		getCreationTime(): (number) | (null);
9765 9766 9767 9768 9769
		/**
		 * Returns an object with V8 heap statistics. Note that all statistics are reported
		 * in Kilobytes.
		 */
		getHeapStatistics(): Electron.HeapStatistics;
9770
		getIOCounters(): Electron.IOCounters;
B
Benjamin Pasero 已提交
9771
		/**
9772
		 * Returns an object giving memory usage statistics about the current process. Note
9773 9774 9775 9776 9777 9778
		 * that all statistics are reported in Kilobytes. This api should be called after
		 * app ready. Chromium does not provide residentSet value for macOS. This is
		 * because macOS performs in-memory compression of pages that haven't been recently
		 * used. As a result the resident set size value is not what one would expect.
		 * private memory is more representative of the actual pre-compression memory usage
		 * of the process on macOS.
B
Benjamin Pasero 已提交
9779
		 */
9780
		getProcessMemoryInfo(): Electron.ProcessMemoryInfo;
B
Benjamin Pasero 已提交
9781
		/**
9782 9783
		 * Returns an object giving memory usage statistics about the entire system. Note
		 * that all statistics are reported in Kilobytes.
B
Benjamin Pasero 已提交
9784
		 */
9785
		getSystemMemoryInfo(): Electron.SystemMemoryInfo;
B
Benjamin Pasero 已提交
9786 9787 9788 9789 9790 9791 9792 9793 9794
		/**
		 * Causes the main thread of the current process hang.
		 */
		hang(): void;
		/**
		 * Sets the file descriptor soft limit to maxDescriptors or the OS hard limit,
		 * whichever is lower for the current process.
		 */
		setFdLimit(maxDescriptors: number): void;
9795 9796 9797 9798
		/**
		 * Takes a V8 heap snapshot and saves it to filePath.
		 */
		takeHeapSnapshot(filePath: string): boolean;
B
Benjamin Pasero 已提交
9799
		/**
9800 9801
		 * A Boolean. When app is started by being passed as parameter to the default app,
		 * this property is true in the main process, otherwise it is undefined.
B
Benjamin Pasero 已提交
9802
		 */
9803
		defaultApp?: boolean;
B
Benjamin Pasero 已提交
9804
		/**
9805 9806
		 * A Boolean. For Mac App Store build, this property is true, for other builds it
		 * is undefined.
B
Benjamin Pasero 已提交
9807
		 */
9808
		mas?: boolean;
B
Benjamin Pasero 已提交
9809
		/**
9810 9811
		 * A Boolean that controls ASAR support inside your application. Setting this to
		 * true will disable the support for asar archives in Node's built-in modules.
B
Benjamin Pasero 已提交
9812
		 */
9813
		noAsar?: boolean;
B
Benjamin Pasero 已提交
9814
		/**
B
Benjamin Pasero 已提交
9815
		 * A Boolean that controls whether or not deprecation warnings are printed to
9816 9817
		 * stderr. Setting this to true will silence deprecation warnings. This property is
		 * used instead of the --no-deprecation command line flag.
B
Benjamin Pasero 已提交
9818
		 */
B
Benjamin Pasero 已提交
9819
		noDeprecation?: boolean;
B
Benjamin Pasero 已提交
9820
		/**
9821
		 * A String representing the path to the resources directory.
B
Benjamin Pasero 已提交
9822
		 */
9823
		resourcesPath?: string;
9824 9825 9826 9827 9828
		/**
		 * A Boolean. When the renderer process is sandboxed, this property is true,
		 * otherwise it is undefined.
		 */
		sandboxed?: boolean;
B
Benjamin Pasero 已提交
9829
		/**
B
Benjamin Pasero 已提交
9830
		 * A Boolean that controls whether or not deprecation warnings will be thrown as
9831
		 * exceptions. Setting this to true will throw errors for deprecations. This
B
Benjamin Pasero 已提交
9832
		 * property is used instead of the --throw-deprecation command line flag.
B
Benjamin Pasero 已提交
9833
		 */
B
Benjamin Pasero 已提交
9834
		throwDeprecation?: boolean;
B
Benjamin Pasero 已提交
9835
		/**
B
Benjamin Pasero 已提交
9836
		 * A Boolean that controls whether or not deprecations printed to stderr include
9837
		 * their stack trace. Setting this to true will print stack traces for
B
Benjamin Pasero 已提交
9838 9839
		 * deprecations. This property is instead of the --trace-deprecation command line
		 * flag.
B
Benjamin Pasero 已提交
9840
		 */
B
Benjamin Pasero 已提交
9841
		traceDeprecation?: boolean;
B
Benjamin Pasero 已提交
9842
		/**
B
Benjamin Pasero 已提交
9843
		 * A Boolean that controls whether or not process warnings printed to stderr
9844 9845
		 * include their stack trace. Setting this to true will print stack traces for
		 * process warnings (including deprecations). This property is instead of the
B
Benjamin Pasero 已提交
9846
		 * --trace-warnings command line flag.
B
Benjamin Pasero 已提交
9847
		 */
B
Benjamin Pasero 已提交
9848
		traceProcessWarnings?: boolean;
B
Benjamin Pasero 已提交
9849
		/**
9850 9851
		 * A String representing the current process's type, can be "browser" (i.e. main
		 * process) or "renderer".
B
Benjamin Pasero 已提交
9852
		 */
9853
		type?: string;
B
Benjamin Pasero 已提交
9854
		/**
9855 9856
		 * A Boolean. If the app is running as a Windows Store app (appx), this property is
		 * true, for otherwise it is undefined.
B
Benjamin Pasero 已提交
9857
		 */
9858
		windowsStore?: boolean;
B
Benjamin Pasero 已提交
9859
	}
9860 9861 9862
	interface ProcessVersions {
		electron: string;
		chrome: string;
B
Benjamin Pasero 已提交
9863
	}
9864
}