UNPKG

529 kBTypeScriptView Raw
1// Type definitions for Electron 7.1.3
2// Project: http://electronjs.org/
3// Definitions by: The Electron Team <https://github.com/electron/electron>
4// Definitions: https://github.com/electron/electron-typescript-definitions
5
6/// <reference types="node" />
7
8type GlobalEvent = Event;
9
10declare namespace Electron {
11 class Accelerator extends String {
12
13 }
14
15 interface CommonInterface {
16 app: App;
17 autoUpdater: AutoUpdater;
18 BrowserView: typeof BrowserView;
19 BrowserWindowProxy: typeof BrowserWindowProxy;
20 BrowserWindow: typeof BrowserWindow;
21 ClientRequest: typeof ClientRequest;
22 clipboard: Clipboard;
23 CommandLine: typeof CommandLine;
24 contentTracing: ContentTracing;
25 contextBridge: ContextBridge;
26 Cookies: typeof Cookies;
27 crashReporter: CrashReporter;
28 Debugger: typeof Debugger;
29 desktopCapturer: DesktopCapturer;
30 dialog: Dialog;
31 Dock: typeof Dock;
32 DownloadItem: typeof DownloadItem;
33 globalShortcut: GlobalShortcut;
34 inAppPurchase: InAppPurchase;
35 IncomingMessage: typeof IncomingMessage;
36 ipcMain: IpcMain;
37 ipcRenderer: IpcRenderer;
38 MenuItem: typeof MenuItem;
39 Menu: typeof Menu;
40 nativeImage: typeof NativeImage;
41 nativeTheme: NativeTheme;
42 netLog: NetLog;
43 net: Net;
44 Notification: typeof Notification;
45 powerMonitor: PowerMonitor;
46 powerSaveBlocker: PowerSaveBlocker;
47 protocol: Protocol;
48 remote: Remote;
49 screen: Screen;
50 session: typeof Session;
51 shell: Shell;
52 systemPreferences: SystemPreferences;
53 TouchBarButton: typeof TouchBarButton;
54 TouchBarColorPicker: typeof TouchBarColorPicker;
55 TouchBarGroup: typeof TouchBarGroup;
56 TouchBarLabel: typeof TouchBarLabel;
57 TouchBarPopover: typeof TouchBarPopover;
58 TouchBarScrubber: typeof TouchBarScrubber;
59 TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
60 TouchBarSlider: typeof TouchBarSlider;
61 TouchBarSpacer: typeof TouchBarSpacer;
62 TouchBar: typeof TouchBar;
63 Tray: typeof Tray;
64 webContents: typeof WebContents;
65 webFrame: WebFrame;
66 WebRequest: typeof WebRequest;
67 webviewTag: WebviewTag;
68 }
69
70 interface MainInterface extends CommonInterface {
71 }
72
73 interface RendererInterface extends CommonInterface {
74 }
75
76 interface AllElectron extends MainInterface, RendererInterface {}
77
78 const app: App;
79 const autoUpdater: AutoUpdater;
80 const clipboard: Clipboard;
81 const contentTracing: ContentTracing;
82 const contextBridge: ContextBridge;
83 const crashReporter: CrashReporter;
84 const desktopCapturer: DesktopCapturer;
85 const dialog: Dialog;
86 const globalShortcut: GlobalShortcut;
87 const inAppPurchase: InAppPurchase;
88 const ipcMain: IpcMain;
89 const ipcRenderer: IpcRenderer;
90 type nativeImage = NativeImage;
91 const nativeImage: typeof NativeImage;
92 const nativeTheme: NativeTheme;
93 const netLog: NetLog;
94 const net: Net;
95 const powerMonitor: PowerMonitor;
96 const powerSaveBlocker: PowerSaveBlocker;
97 const protocol: Protocol;
98 const remote: Remote;
99 const screen: Screen;
100 type session = Session;
101 const session: typeof Session;
102 const shell: Shell;
103 const systemPreferences: SystemPreferences;
104 type webContents = WebContents;
105 const webContents: typeof WebContents;
106 const webFrame: WebFrame;
107 const webviewTag: WebviewTag;
108
109 interface App extends NodeJS.EventEmitter {
110
111 // Docs: http://electronjs.org/docs/api/app
112
113 /**
114 * Emitted when Chrome's accessibility support changes. This event fires when
115 * assistive technologies, such as screen readers, are enabled or disabled. See
116 * https://www.chromium.org/developers/design-documents/accessibility for more
117 * details.
118 *
119 * @platform darwin,win32
120 */
121 on(event: 'accessibility-support-changed', listener: (event: Event,
122 /**
123 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
124 */
125 accessibilitySupportEnabled: boolean) => void): this;
126 once(event: 'accessibility-support-changed', listener: (event: Event,
127 /**
128 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
129 */
130 accessibilitySupportEnabled: boolean) => void): this;
131 addListener(event: 'accessibility-support-changed', listener: (event: Event,
132 /**
133 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
134 */
135 accessibilitySupportEnabled: boolean) => void): this;
136 removeListener(event: 'accessibility-support-changed', listener: (event: Event,
137 /**
138 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
139 */
140 accessibilitySupportEnabled: boolean) => void): this;
141 /**
142 * Emitted when the application is activated. Various actions can trigger this
143 * event, such as launching the application for the first time, attempting to
144 * re-launch the application when it's already running, or clicking on the
145 * application's dock or taskbar icon.
146 *
147 * @platform darwin
148 */
149 on(event: 'activate', listener: (event: Event,
150 hasVisibleWindows: boolean) => void): this;
151 once(event: 'activate', listener: (event: Event,
152 hasVisibleWindows: boolean) => void): this;
153 addListener(event: 'activate', listener: (event: Event,
154 hasVisibleWindows: boolean) => void): this;
155 removeListener(event: 'activate', listener: (event: Event,
156 hasVisibleWindows: boolean) => void): this;
157 /**
158 * Emitted during Handoff after an activity from this device was successfully
159 * resumed on another one.
160 *
161 * @platform darwin
162 */
163 on(event: 'activity-was-continued', listener: (event: Event,
164 /**
165 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
166 */
167 type: string,
168 /**
169 * Contains app-specific state stored by the activity.
170 */
171 userInfo: unknown) => void): this;
172 once(event: 'activity-was-continued', listener: (event: Event,
173 /**
174 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
175 */
176 type: string,
177 /**
178 * Contains app-specific state stored by the activity.
179 */
180 userInfo: unknown) => void): this;
181 addListener(event: 'activity-was-continued', listener: (event: Event,
182 /**
183 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
184 */
185 type: string,
186 /**
187 * Contains app-specific state stored by the activity.
188 */
189 userInfo: unknown) => void): this;
190 removeListener(event: 'activity-was-continued', listener: (event: Event,
191 /**
192 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
193 */
194 type: string,
195 /**
196 * Contains app-specific state stored by the activity.
197 */
198 userInfo: unknown) => void): this;
199 /**
200 * Emitted before the application starts closing its windows. Calling
201 * `event.preventDefault()` will prevent the default behavior, which is terminating
202 * the application.
203 *
204 * **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
205 * then `before-quit` is emitted *after* emitting `close` event on all windows and
206 * closing them.
207 *
208 * **Note:** On Windows, this event will not be emitted if the app is closed due to
209 * a shutdown/restart of the system or a user logout.
210 */
211 on(event: 'before-quit', listener: (event: Event) => void): this;
212 once(event: 'before-quit', listener: (event: Event) => void): this;
213 addListener(event: 'before-quit', listener: (event: Event) => void): this;
214 removeListener(event: 'before-quit', listener: (event: Event) => void): this;
215 /**
216 * Emitted when a browserWindow gets blurred.
217 */
218 on(event: 'browser-window-blur', listener: (event: Event,
219 window: BrowserWindow) => void): this;
220 once(event: 'browser-window-blur', listener: (event: Event,
221 window: BrowserWindow) => void): this;
222 addListener(event: 'browser-window-blur', listener: (event: Event,
223 window: BrowserWindow) => void): this;
224 removeListener(event: 'browser-window-blur', listener: (event: Event,
225 window: BrowserWindow) => void): this;
226 /**
227 * Emitted when a new browserWindow is created.
228 */
229 on(event: 'browser-window-created', listener: (event: Event,
230 window: BrowserWindow) => void): this;
231 once(event: 'browser-window-created', listener: (event: Event,
232 window: BrowserWindow) => void): this;
233 addListener(event: 'browser-window-created', listener: (event: Event,
234 window: BrowserWindow) => void): this;
235 removeListener(event: 'browser-window-created', listener: (event: Event,
236 window: BrowserWindow) => void): this;
237 /**
238 * Emitted when a browserWindow gets focused.
239 */
240 on(event: 'browser-window-focus', listener: (event: Event,
241 window: BrowserWindow) => void): this;
242 once(event: 'browser-window-focus', listener: (event: Event,
243 window: BrowserWindow) => void): this;
244 addListener(event: 'browser-window-focus', listener: (event: Event,
245 window: BrowserWindow) => void): this;
246 removeListener(event: 'browser-window-focus', listener: (event: Event,
247 window: BrowserWindow) => void): this;
248 /**
249 * Emitted when failed to verify the `certificate` for `url`, to trust the
250 * certificate you should prevent the default behavior with
251 * `event.preventDefault()` and call `callback(true)`.
252 */
253 on(event: 'certificate-error', listener: (event: Event,
254 webContents: WebContents,
255 url: string,
256 /**
257 * The error code
258 */
259 error: string,
260 certificate: Certificate,
261 callback: (isTrusted: boolean) => void) => void): this;
262 once(event: 'certificate-error', listener: (event: Event,
263 webContents: WebContents,
264 url: string,
265 /**
266 * The error code
267 */
268 error: string,
269 certificate: Certificate,
270 callback: (isTrusted: boolean) => void) => void): this;
271 addListener(event: 'certificate-error', listener: (event: Event,
272 webContents: WebContents,
273 url: string,
274 /**
275 * The error code
276 */
277 error: string,
278 certificate: Certificate,
279 callback: (isTrusted: boolean) => void) => void): this;
280 removeListener(event: 'certificate-error', listener: (event: Event,
281 webContents: WebContents,
282 url: string,
283 /**
284 * The error code
285 */
286 error: string,
287 certificate: Certificate,
288 callback: (isTrusted: boolean) => void) => void): this;
289 /**
290 * Emitted during Handoff when an activity from a different device wants to be
291 * resumed. You should call `event.preventDefault()` if you want to handle this
292 * event.
293 *
294 * A user activity can be continued only in an app that has the same developer Team
295 * ID as the activity's source app and that supports the activity's type. Supported
296 * activity types are specified in the app's `Info.plist` under the
297 * `NSUserActivityTypes` key.
298 *
299 * @platform darwin
300 */
301 on(event: 'continue-activity', listener: (event: Event,
302 /**
303 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
304 */
305 type: string,
306 /**
307 * Contains app-specific state stored by the activity on another device.
308 */
309 userInfo: unknown) => void): this;
310 once(event: 'continue-activity', listener: (event: Event,
311 /**
312 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
313 */
314 type: string,
315 /**
316 * Contains app-specific state stored by the activity on another device.
317 */
318 userInfo: unknown) => void): this;
319 addListener(event: 'continue-activity', listener: (event: Event,
320 /**
321 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
322 */
323 type: string,
324 /**
325 * Contains app-specific state stored by the activity on another device.
326 */
327 userInfo: unknown) => void): this;
328 removeListener(event: 'continue-activity', listener: (event: Event,
329 /**
330 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
331 */
332 type: string,
333 /**
334 * Contains app-specific state stored by the activity on another device.
335 */
336 userInfo: unknown) => void): this;
337 /**
338 * Emitted during Handoff when an activity from a different device fails to be
339 * resumed.
340 *
341 * @platform darwin
342 */
343 on(event: 'continue-activity-error', listener: (event: Event,
344 /**
345 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
346 */
347 type: string,
348 /**
349 * A string with the error's localized description.
350 */
351 error: string) => void): this;
352 once(event: 'continue-activity-error', listener: (event: Event,
353 /**
354 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
355 */
356 type: string,
357 /**
358 * A string with the error's localized description.
359 */
360 error: string) => void): this;
361 addListener(event: 'continue-activity-error', listener: (event: Event,
362 /**
363 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
364 */
365 type: string,
366 /**
367 * A string with the error's localized description.
368 */
369 error: string) => void): this;
370 removeListener(event: 'continue-activity-error', listener: (event: Event,
371 /**
372 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
373 */
374 type: string,
375 /**
376 * A string with the error's localized description.
377 */
378 error: string) => void): this;
379 /**
380 * Emitted when `desktopCapturer.getSources()` is called in the renderer process of
381 * `webContents`. Calling `event.preventDefault()` will make it return empty
382 * sources.
383 */
384 on(event: 'desktop-capturer-get-sources', listener: (event: Event,
385 webContents: WebContents) => void): this;
386 once(event: 'desktop-capturer-get-sources', listener: (event: Event,
387 webContents: WebContents) => void): this;
388 addListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
389 webContents: WebContents) => void): this;
390 removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
391 webContents: WebContents) => void): this;
392 /**
393 * Emitted whenever there is a GPU info update.
394 */
395 on(event: 'gpu-info-update', listener: Function): this;
396 once(event: 'gpu-info-update', listener: Function): this;
397 addListener(event: 'gpu-info-update', listener: Function): this;
398 removeListener(event: 'gpu-info-update', listener: Function): this;
399 /**
400 * Emitted when the GPU process crashes or is killed.
401 */
402 on(event: 'gpu-process-crashed', listener: (event: Event,
403 killed: boolean) => void): this;
404 once(event: 'gpu-process-crashed', listener: (event: Event,
405 killed: boolean) => void): this;
406 addListener(event: 'gpu-process-crashed', listener: (event: Event,
407 killed: boolean) => void): this;
408 removeListener(event: 'gpu-process-crashed', listener: (event: Event,
409 killed: boolean) => void): this;
410 /**
411 * Emitted when `webContents` wants to do basic auth.
412 *
413 * The default behavior is to cancel all authentications. To override this you
414 * should prevent the default behavior with `event.preventDefault()` and call
415 * `callback(username, password)` with the credentials.
416 *
417 * If `callback` is called without a username or password, the authentication
418 * request will be cancelled and the authentication error will be returned to the
419 * page.
420 */
421 on(event: 'login', listener: (event: Event,
422 webContents: WebContents,
423 authenticationResponseDetails: AuthenticationResponseDetails,
424 authInfo: AuthInfo,
425 callback: (username?: string, password?: string) => void) => void): this;
426 once(event: 'login', listener: (event: Event,
427 webContents: WebContents,
428 authenticationResponseDetails: AuthenticationResponseDetails,
429 authInfo: AuthInfo,
430 callback: (username?: string, password?: string) => void) => void): this;
431 addListener(event: 'login', listener: (event: Event,
432 webContents: WebContents,
433 authenticationResponseDetails: AuthenticationResponseDetails,
434 authInfo: AuthInfo,
435 callback: (username?: string, password?: string) => void) => void): this;
436 removeListener(event: 'login', listener: (event: Event,
437 webContents: WebContents,
438 authenticationResponseDetails: AuthenticationResponseDetails,
439 authInfo: AuthInfo,
440 callback: (username?: string, password?: string) => void) => void): this;
441 /**
442 * Emitted when the user clicks the native macOS new tab button. The new tab button
443 * is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
444 *
445 * @platform darwin
446 */
447 on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
448 once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
449 addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
450 removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
451 /**
452 * Emitted when the user wants to open a file with the application. The `open-file`
453 * event is usually emitted when the application is already open and the OS wants
454 * to reuse the application to open the file. `open-file` is also emitted when a
455 * file is dropped onto the dock and the application is not yet running. Make sure
456 * to listen for the `open-file` event very early in your application startup to
457 * handle this case (even before the `ready` event is emitted).
458 *
459 * You should call `event.preventDefault()` if you want to handle this event.
460 *
461 * On Windows, you have to parse `process.argv` (in the main process) to get the
462 * filepath.
463 *
464 * @platform darwin
465 */
466 on(event: 'open-file', listener: (event: Event,
467 path: string) => void): this;
468 once(event: 'open-file', listener: (event: Event,
469 path: string) => void): this;
470 addListener(event: 'open-file', listener: (event: Event,
471 path: string) => void): this;
472 removeListener(event: 'open-file', listener: (event: Event,
473 path: string) => void): this;
474 /**
475 * Emitted when the user wants to open a URL with the application. Your
476 * application's `Info.plist` file must define the URL scheme within the
477 * `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
478 *
479You should call `event.preventDefault()` if you want to handle this event.
480 *
481 * @platform darwin
482 */
483 on(event: 'open-url', listener: (event: Event,
484 url: string) => void): this;
485 once(event: 'open-url', listener: (event: Event,
486 url: string) => void): this;
487 addListener(event: 'open-url', listener: (event: Event,
488 url: string) => void): this;
489 removeListener(event: 'open-url', listener: (event: Event,
490 url: string) => void): this;
491 /**
492 * Emitted when the application is quitting.
493 *
494 * **Note:** On Windows, this event will not be emitted if the app is closed due to
495 * a shutdown/restart of the system or a user logout.
496 */
497 on(event: 'quit', listener: (event: Event,
498 exitCode: number) => void): this;
499 once(event: 'quit', listener: (event: Event,
500 exitCode: number) => void): this;
501 addListener(event: 'quit', listener: (event: Event,
502 exitCode: number) => void): this;
503 removeListener(event: 'quit', listener: (event: Event,
504 exitCode: number) => void): this;
505 /**
506 * Emitted when Electron has finished initializing. On macOS, `launchInfo` holds
507 * the `userInfo` of the `NSUserNotification` that was used to open the
508 * application, if it was launched from Notification Center. You can call
509 * `app.isReady()` to check if this event has already fired.
510 */
511 on(event: 'ready', listener: (launchInfo: unknown) => void): this;
512 once(event: 'ready', listener: (launchInfo: unknown) => void): this;
513 addListener(event: 'ready', listener: (launchInfo: unknown) => void): this;
514 removeListener(event: 'ready', listener: (launchInfo: unknown) => void): this;
515 /**
516 * Emitted when `remote.getBuiltin()` is called in the renderer process of
517 * `webContents`. Calling `event.preventDefault()` will prevent the module from
518 * being returned. Custom value can be returned by setting `event.returnValue`.
519 */
520 on(event: 'remote-get-builtin', listener: (event: Event,
521 webContents: WebContents,
522 moduleName: string) => void): this;
523 once(event: 'remote-get-builtin', listener: (event: Event,
524 webContents: WebContents,
525 moduleName: string) => void): this;
526 addListener(event: 'remote-get-builtin', listener: (event: Event,
527 webContents: WebContents,
528 moduleName: string) => void): this;
529 removeListener(event: 'remote-get-builtin', listener: (event: Event,
530 webContents: WebContents,
531 moduleName: string) => void): this;
532 /**
533 * Emitted when `remote.getCurrentWebContents()` is called in the renderer process
534 * of `webContents`. Calling `event.preventDefault()` will prevent the object from
535 * being returned. Custom value can be returned by setting `event.returnValue`.
536 */
537 on(event: 'remote-get-current-web-contents', listener: (event: Event,
538 webContents: WebContents) => void): this;
539 once(event: 'remote-get-current-web-contents', listener: (event: Event,
540 webContents: WebContents) => void): this;
541 addListener(event: 'remote-get-current-web-contents', listener: (event: Event,
542 webContents: WebContents) => void): this;
543 removeListener(event: 'remote-get-current-web-contents', listener: (event: Event,
544 webContents: WebContents) => void): this;
545 /**
546 * Emitted when `remote.getCurrentWindow()` is called in the renderer process of
547 * `webContents`. Calling `event.preventDefault()` will prevent the object from
548 * being returned. Custom value can be returned by setting `event.returnValue`.
549 */
550 on(event: 'remote-get-current-window', listener: (event: Event,
551 webContents: WebContents) => void): this;
552 once(event: 'remote-get-current-window', listener: (event: Event,
553 webContents: WebContents) => void): this;
554 addListener(event: 'remote-get-current-window', listener: (event: Event,
555 webContents: WebContents) => void): this;
556 removeListener(event: 'remote-get-current-window', listener: (event: Event,
557 webContents: WebContents) => void): this;
558 /**
559 * Emitted when `remote.getGlobal()` is called in the renderer process of
560 * `webContents`. Calling `event.preventDefault()` will prevent the global from
561 * being returned. Custom value can be returned by setting `event.returnValue`.
562 */
563 on(event: 'remote-get-global', listener: (event: Event,
564 webContents: WebContents,
565 globalName: string) => void): this;
566 once(event: 'remote-get-global', listener: (event: Event,
567 webContents: WebContents,
568 globalName: string) => void): this;
569 addListener(event: 'remote-get-global', listener: (event: Event,
570 webContents: WebContents,
571 globalName: string) => void): this;
572 removeListener(event: 'remote-get-global', listener: (event: Event,
573 webContents: WebContents,
574 globalName: string) => void): this;
575 /**
576 * Emitted when `<webview>.getWebContents()` is called in the renderer process of
577 * `webContents`. Calling `event.preventDefault()` will prevent the object from
578 * being returned. Custom value can be returned by setting `event.returnValue`.
579 */
580 on(event: 'remote-get-guest-web-contents', listener: (event: Event,
581 webContents: WebContents,
582 guestWebContents: WebContents) => void): this;
583 once(event: 'remote-get-guest-web-contents', listener: (event: Event,
584 webContents: WebContents,
585 guestWebContents: WebContents) => void): this;
586 addListener(event: 'remote-get-guest-web-contents', listener: (event: Event,
587 webContents: WebContents,
588 guestWebContents: WebContents) => void): this;
589 removeListener(event: 'remote-get-guest-web-contents', listener: (event: Event,
590 webContents: WebContents,
591 guestWebContents: WebContents) => void): this;
592 /**
593 * Emitted when `remote.require()` is called in the renderer process of
594 * `webContents`. Calling `event.preventDefault()` will prevent the module from
595 * being returned. Custom value can be returned by setting `event.returnValue`.
596 */
597 on(event: 'remote-require', listener: (event: Event,
598 webContents: WebContents,
599 moduleName: string) => void): this;
600 once(event: 'remote-require', listener: (event: Event,
601 webContents: WebContents,
602 moduleName: string) => void): this;
603 addListener(event: 'remote-require', listener: (event: Event,
604 webContents: WebContents,
605 moduleName: string) => void): this;
606 removeListener(event: 'remote-require', listener: (event: Event,
607 webContents: WebContents,
608 moduleName: string) => void): this;
609 /**
610 * Emitted when the renderer process of `webContents` crashes or is killed.
611 */
612 on(event: 'renderer-process-crashed', listener: (event: Event,
613 webContents: WebContents,
614 killed: boolean) => void): this;
615 once(event: 'renderer-process-crashed', listener: (event: Event,
616 webContents: WebContents,
617 killed: boolean) => void): this;
618 addListener(event: 'renderer-process-crashed', listener: (event: Event,
619 webContents: WebContents,
620 killed: boolean) => void): this;
621 removeListener(event: 'renderer-process-crashed', listener: (event: Event,
622 webContents: WebContents,
623 killed: boolean) => void): this;
624 /**
625 * This event will be emitted inside the primary instance of your application when
626 * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
627 *
628 * `argv` is an Array of the second instance's command line arguments, and
629 * `workingDirectory` is its current working directory. Usually applications
630 * respond to this by making their primary window focused and non-minimized.
631 *
632 * This event is guaranteed to be emitted after the `ready` event of `app` gets
633 * emitted.
634 *
635 * **Note:** Extra command line arguments might be added by Chromium, such as
636 * `--original-process-start-time`.
637 */
638 on(event: 'second-instance', listener: (event: Event,
639 /**
640 * An array of the second instance's command line arguments
641 */
642 argv: string[],
643 /**
644 * The second instance's working directory
645 */
646 workingDirectory: string) => void): this;
647 once(event: 'second-instance', listener: (event: Event,
648 /**
649 * An array of the second instance's command line arguments
650 */
651 argv: string[],
652 /**
653 * The second instance's working directory
654 */
655 workingDirectory: string) => void): this;
656 addListener(event: 'second-instance', listener: (event: Event,
657 /**
658 * An array of the second instance's command line arguments
659 */
660 argv: string[],
661 /**
662 * The second instance's working directory
663 */
664 workingDirectory: string) => void): this;
665 removeListener(event: 'second-instance', listener: (event: Event,
666 /**
667 * An array of the second instance's command line arguments
668 */
669 argv: string[],
670 /**
671 * The second instance's working directory
672 */
673 workingDirectory: string) => void): this;
674 /**
675 * Emitted when a client certificate is requested.
676 *
677 * The `url` corresponds to the navigation entry requesting the client certificate
678 * and `callback` can be called with an entry filtered from the list. Using
679 * `event.preventDefault()` prevents the application from using the first
680 * certificate from the store.
681 */
682 on(event: 'select-client-certificate', listener: (event: Event,
683 webContents: WebContents,
684 url: string,
685 certificateList: Certificate[],
686 callback: (certificate?: Certificate) => void) => void): this;
687 once(event: 'select-client-certificate', listener: (event: Event,
688 webContents: WebContents,
689 url: string,
690 certificateList: Certificate[],
691 callback: (certificate?: Certificate) => void) => void): this;
692 addListener(event: 'select-client-certificate', listener: (event: Event,
693 webContents: WebContents,
694 url: string,
695 certificateList: Certificate[],
696 callback: (certificate?: Certificate) => void) => void): this;
697 removeListener(event: 'select-client-certificate', listener: (event: Event,
698 webContents: WebContents,
699 url: string,
700 certificateList: Certificate[],
701 callback: (certificate?: Certificate) => void) => void): this;
702 /**
703 * Emitted when Electron has created a new `session`.
704 */
705 on(event: 'session-created', listener: (session: Session) => void): this;
706 once(event: 'session-created', listener: (session: Session) => void): this;
707 addListener(event: 'session-created', listener: (session: Session) => void): this;
708 removeListener(event: 'session-created', listener: (session: Session) => void): this;
709 /**
710 * Emitted when Handoff is about to be resumed on another device. If you need to
711 * update the state to be transferred, you should call `event.preventDefault()`
712 * immediately, construct a new `userInfo` dictionary and call
713 * `app.updateCurrentActiviy()` in a timely manner. Otherwise, the operation will
714 * fail and `continue-activity-error` will be called.
715 *
716 * @platform darwin
717 */
718 on(event: 'update-activity-state', listener: (event: Event,
719 /**
720 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
721 */
722 type: string,
723 /**
724 * Contains app-specific state stored by the activity.
725 */
726 userInfo: unknown) => void): this;
727 once(event: 'update-activity-state', listener: (event: Event,
728 /**
729 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
730 */
731 type: string,
732 /**
733 * Contains app-specific state stored by the activity.
734 */
735 userInfo: unknown) => void): this;
736 addListener(event: 'update-activity-state', listener: (event: Event,
737 /**
738 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
739 */
740 type: string,
741 /**
742 * Contains app-specific state stored by the activity.
743 */
744 userInfo: unknown) => void): this;
745 removeListener(event: 'update-activity-state', listener: (event: Event,
746 /**
747 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
748 */
749 type: string,
750 /**
751 * Contains app-specific state stored by the activity.
752 */
753 userInfo: unknown) => void): this;
754 /**
755 * Emitted when a new webContents is created.
756 */
757 on(event: 'web-contents-created', listener: (event: Event,
758 webContents: WebContents) => void): this;
759 once(event: 'web-contents-created', listener: (event: Event,
760 webContents: WebContents) => void): this;
761 addListener(event: 'web-contents-created', listener: (event: Event,
762 webContents: WebContents) => void): this;
763 removeListener(event: 'web-contents-created', listener: (event: Event,
764 webContents: WebContents) => void): this;
765 /**
766 * Emitted during Handoff before an activity from a different device wants to be
767 * resumed. You should call `event.preventDefault()` if you want to handle this
768 * event.
769 *
770 * @platform darwin
771 */
772 on(event: 'will-continue-activity', listener: (event: Event,
773 /**
774 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
775 */
776 type: string) => void): this;
777 once(event: 'will-continue-activity', listener: (event: Event,
778 /**
779 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
780 */
781 type: string) => void): this;
782 addListener(event: 'will-continue-activity', listener: (event: Event,
783 /**
784 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
785 */
786 type: string) => void): this;
787 removeListener(event: 'will-continue-activity', listener: (event: Event,
788 /**
789 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
790 */
791 type: string) => void): this;
792 /**
793 * Emitted when the application has finished basic startup. On Windows and Linux,
794 * the `will-finish-launching` event is the same as the `ready` event; on macOS,
795 * this event represents the `applicationWillFinishLaunching` notification of
796 * `NSApplication`. You would usually set up listeners for the `open-file` and
797 * `open-url` events here, and start the crash reporter and auto updater.
798 *
799In most cases, you should do everything in the `ready` event handler.
800 */
801 on(event: 'will-finish-launching', listener: Function): this;
802 once(event: 'will-finish-launching', listener: Function): this;
803 addListener(event: 'will-finish-launching', listener: Function): this;
804 removeListener(event: 'will-finish-launching', listener: Function): this;
805 /**
806 * Emitted when all windows have been closed and the application will quit. Calling
807 * `event.preventDefault()` will prevent the default behaviour, which is
808 * terminating the application.
809 *
810 * See the description of the `window-all-closed` event for the differences between
811 * the `will-quit` and `window-all-closed` events.
812 *
813 * **Note:** On Windows, this event will not be emitted if the app is closed due to
814 * a shutdown/restart of the system or a user logout.
815 */
816 on(event: 'will-quit', listener: (event: Event) => void): this;
817 once(event: 'will-quit', listener: (event: Event) => void): this;
818 addListener(event: 'will-quit', listener: (event: Event) => void): this;
819 removeListener(event: 'will-quit', listener: (event: Event) => void): this;
820 /**
821 * Emitted when all windows have been closed.
822 *
823 * If you do not subscribe to this event and all windows are closed, the default
824 * behavior is to quit the app; however, if you subscribe, you control whether the
825 * app quits or not. If the user pressed `Cmd + Q`, or the developer called
826 * `app.quit()`, Electron will first try to close all the windows and then emit the
827 * `will-quit` event, and in this case the `window-all-closed` event would not be
828 * emitted.
829 */
830 on(event: 'window-all-closed', listener: Function): this;
831 once(event: 'window-all-closed', listener: Function): this;
832 addListener(event: 'window-all-closed', listener: Function): this;
833 removeListener(event: 'window-all-closed', listener: Function): this;
834 /**
835 * Adds `path` to the recent documents list.
836 *
837 * This list is managed by the OS. On Windows, you can visit the list from the task
838 * bar, and on macOS, you can visit it from dock menu.
839 *
840 * @platform darwin,win32
841 */
842 addRecentDocument(path: string): void;
843 /**
844 * Clears the recent documents list.
845 *
846 * @platform darwin,win32
847 */
848 clearRecentDocuments(): void;
849 /**
850 * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
851 * basis if the GPU processes crashes too frequently. This function disables that
852 * behaviour.
853
854This method can only be called before app is ready.
855 */
856 disableDomainBlockingFor3DAPIs(): void;
857 /**
858 * Disables hardware acceleration for current app.
859 *
860This method can only be called before app is ready.
861 */
862 disableHardwareAcceleration(): void;
863 /**
864 * Enables full sandbox mode on the app.
865 *
866This method can only be called before app is ready.
867 *
868 * @experimental
869 */
870 enableSandbox(): void;
871 /**
872 * Exits immediately with `exitCode`. `exitCode` defaults to 0.
873 *
874 * All windows will be closed immediately without asking the user, and the
875 * `before-quit` and `will-quit` events will not be emitted.
876 */
877 exit(exitCode?: number): void;
878 /**
879 * On Linux, focuses on the first visible window. On macOS, makes the application
880 * the active app. On Windows, focuses on the application's first window.
881 */
882 focus(): void;
883 /**
884 * Array of `ProcessMetric` objects that correspond to memory and CPU usage
885 * statistics of all the processes associated with the app.
886 */
887 getAppMetrics(): ProcessMetric[];
888 /**
889 * The current application directory.
890 */
891 getAppPath(): string;
892 /**
893 * The current value displayed in the counter badge.
894
895**Deprecated**
896 *
897 * @platform linux,darwin
898 */
899 getBadgeCount(): number;
900 /**
901 * The type of the currently running activity.
902 *
903 * @platform darwin
904 */
905 getCurrentActivityType(): string;
906 /**
907 * fulfilled with the app's icon, which is a NativeImage.
908 *
909 * Fetches a path's associated icon.
910 *
911 * On _Windows_, there a 2 kinds of icons:
912 *
913 * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
914 * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
915 *
916 * On _Linux_ and _macOS_, icons depend on the application associated with file
917 * mime type.
918 */
919 getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
920 /**
921 * The Graphics Feature Status from `chrome://gpu/`.
922 *
923 * **Note:** This information is only usable after the `gpu-info-update` event is
924 * emitted.
925 */
926 getGPUFeatureStatus(): GPUFeatureStatus;
927 /**
928 * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
929 * containing all the GPU Information as in chromium's GPUInfo object. This
930 * includes the version and driver information that's shown on `chrome://gpu` page.
931 *
932 * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
933 * fewer attributes than when requested with `complete`. Here's an example of basic
934 * response:
935 *
936 * Using `basic` should be preferred if only basic information like `vendorId` or
937 * `driverId` is needed.
938 */
939 getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
940 /**
941 * * `minItems` Integer - The minimum number of items that will be shown in the
942 * Jump List (for a more detailed description of this value see the MSDN docs).
943 * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
944 * correspond to items that the user has explicitly removed from custom categories
945 * in the Jump List. These items must not be re-added to the Jump List in the
946 * **next** call to `app.setJumpList()`, Windows will not display any custom
947 * category that contains any of the removed items.
948 *
949 * @platform win32
950 */
951 getJumpListSettings(): JumpListSettings;
952 /**
953 * The current application locale. Possible return values are documented here.
954 *
955 * To set the locale, you'll want to use a command line switch at app startup,
956 * which may be found here.
957 *
958 * **Note:** When distributing your packaged app, you have to also ship the
959 * `locales` folder.
960 *
961 * **Note:** On Windows, you have to call it after the `ready` events gets emitted.
962 */
963 getLocale(): string;
964 /**
965 * User operating system's locale two-letter ISO 3166 country code. The value is
966 * taken from native OS APIs.
967 *
968**Note:** When unable to detect locale country code, it returns empty string.
969 */
970 getLocaleCountryCode(): string;
971 /**
972 * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
973 * you need to pass the same arguments here for `openAtLogin` to be set correctly.
974 *
975 *
976 * * `openAtLogin` Boolean - `true` if the app is set to open at login.
977 * * `openAsHidden` Boolean _macOS_ - `true` if the app is set to open as hidden at
978 * login. This setting is not available on MAS builds.
979 * * `wasOpenedAtLogin` Boolean _macOS_ - `true` if the app was opened at login
980 * automatically. This setting is not available on MAS builds.
981 * * `wasOpenedAsHidden` Boolean _macOS_ - `true` if the app was opened as a hidden
982 * login item. This indicates that the app should not open any windows at startup.
983 * This setting is not available on MAS builds.
984 * * `restoreState` Boolean _macOS_ - `true` if the app was opened as a login item
985 * that should restore the state from the previous session. This indicates that the
986 * app should restore the windows that were open the last time the app was closed.
987 * This setting is not available on MAS builds.
988 *
989 * @platform darwin,win32
990 */
991 getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
992 /**
993 * The current application's name, which is the name in the application's
994 * `package.json` file.
995 *
996 * Usually the `name` field of `package.json` is a short lowercase name, according
997 * to the npm modules spec. You should usually also specify a `productName` field,
998 * which is your application's full capitalized name, and which will be preferred
999 * over `name` by Electron.
1000
1001**Deprecated**
1002 */
1003 getName(): string;
1004 /**
1005 * A path to a special directory or file associated with `name`. On failure, an
1006 * `Error` is thrown.
1007 *
1008 * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
1009 * called first, a default log directory will be created equivalent to calling
1010 * `app.setAppLogsPath()` without a `path` parameter.
1011 */
1012 getPath(name: 'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'logs' | 'pepperFlashSystemPlugin'): string;
1013 /**
1014 * The version of the loaded application. If no version is found in the
1015 * application's `package.json` file, the version of the current bundle or
1016 * executable is returned.
1017 */
1018 getVersion(): string;
1019 /**
1020 * This method returns whether or not this instance of your app is currently
1021 * holding the single instance lock. You can request the lock with
1022 * `app.requestSingleInstanceLock()` and release with
1023 * `app.releaseSingleInstanceLock()`
1024 */
1025 hasSingleInstanceLock(): boolean;
1026 /**
1027 * Hides all application windows without minimizing them.
1028 *
1029 * @platform darwin
1030 */
1031 hide(): void;
1032 /**
1033 * Imports the certificate in pkcs12 format into the platform certificate store.
1034 * `callback` is called with the `result` of import operation, a value of `0`
1035 * indicates success while any other value indicates failure according to Chromium
1036 * net_error_list.
1037 *
1038 * @platform linux
1039 */
1040 importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
1041 /**
1042 * Invalidates the current Handoff user activity.
1043 *
1044 * @platform darwin
1045 */
1046 invalidateCurrentActivity(): void;
1047 /**
1048 * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
1049 * will return `true` if the use of assistive technologies, such as screen readers,
1050 * has been detected. See
1051 * https://www.chromium.org/developers/design-documents/accessibility for more
1052 * details.
1053
1054**Deprecated**
1055 *
1056 * @platform darwin,win32
1057 */
1058 isAccessibilitySupportEnabled(): boolean;
1059 /**
1060 * This method checks if the current executable is the default handler for a
1061 * protocol (aka URI scheme). If so, it will return true. Otherwise, it will return
1062 * false.
1063 *
1064 * **Note:** On macOS, you can use this method to check if the app has been
1065 * registered as the default protocol handler for a protocol. You can also verify
1066 * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
1067 * macOS machine. Please refer to Apple's documentation for details.
1068 *
1069 * The API uses the Windows Registry and LSCopyDefaultHandlerForURLScheme
1070 * internally.
1071 */
1072 isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1073 /**
1074 * whether or not the current OS version allows for native emoji pickers.
1075 */
1076 isEmojiPanelSupported(): boolean;
1077 /**
1078 * Whether the application is currently running from the systems Application
1079 * folder. Use in combination with `app.moveToApplicationsFolder()`
1080 *
1081 * @platform darwin
1082 */
1083 isInApplicationsFolder(): boolean;
1084 /**
1085 * `true` if Electron has finished initializing, `false` otherwise.
1086 */
1087 isReady(): boolean;
1088 /**
1089 * Whether the current desktop environment is Unity launcher.
1090 *
1091 * @platform linux
1092 */
1093 isUnityRunning(): boolean;
1094 /**
1095 * Whether the move was successful. Please note that if the move is successful,
1096 * your application will quit and relaunch.
1097 *
1098 * No confirmation dialog will be presented by default. If you wish to allow the
1099 * user to confirm the operation, you may do so using the `dialog` API.
1100 *
1101 * **NOTE:** This method throws errors if anything other than the user causes the
1102 * move to fail. For instance if the user cancels the authorization dialog, this
1103 * method returns false. If we fail to perform the copy, then this method will
1104 * throw an error. The message in the error should be informative and tell you
1105 * exactly what went wrong.
1106 *
1107 * By default, if an app of the same name as the one being moved exists in the
1108 * Applications directory and is _not_ running, the existing app will be trashed
1109 * and the active app moved into its place. If it _is_ running, the pre-existing
1110 * running app will assume focus and the the previously active app will quit
1111 * itself. This behavior can be changed by providing the optional conflict handler,
1112 * where the boolean returned by the handler determines whether or not the move
1113 * conflict is resolved with default behavior. i.e. returning `false` will ensure
1114 * no further action is taken, returning `true` will result in the default behavior
1115 * and the method continuing.
1116 *
1117 * For example:
1118 *
1119 * Would mean that if an app already exists in the user directory, if the user
1120 * chooses to 'Continue Move' then the function would continue with its default
1121 * behavior and the existing app will be trashed and the active app moved into its
1122 * place.
1123 *
1124 * @platform darwin
1125 */
1126 moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
1127 /**
1128 * Try to close all windows. The `before-quit` event will be emitted first. If all
1129 * windows are successfully closed, the `will-quit` event will be emitted and by
1130 * default the application will terminate.
1131 *
1132 * This method guarantees that all `beforeunload` and `unload` event handlers are
1133 * correctly executed. It is possible that a window cancels the quitting by
1134 * returning `false` in the `beforeunload` event handler.
1135 */
1136 quit(): void;
1137 /**
1138 * Relaunches the app when current instance exits.
1139 *
1140 * By default, the new instance will use the same working directory and command
1141 * line arguments with current instance. When `args` is specified, the `args` will
1142 * be passed as command line arguments instead. When `execPath` is specified, the
1143 * `execPath` will be executed for relaunch instead of current app.
1144 *
1145 * Note that this method does not quit the app when executed, you have to call
1146 * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
1147 *
1148 * When `app.relaunch` is called for multiple times, multiple instances will be
1149 * started after current instance exited.
1150 *
1151 * An example of restarting current instance immediately and adding a new command
1152 * line argument to the new instance:
1153 */
1154 relaunch(options?: RelaunchOptions): void;
1155 /**
1156 * Releases all locks that were created by `requestSingleInstanceLock`. This will
1157 * allow multiple instances of the application to once again run side by side.
1158 */
1159 releaseSingleInstanceLock(): void;
1160 /**
1161 * Whether the call succeeded.
1162 *
1163 * This method checks if the current executable as the default handler for a
1164 * protocol (aka URI scheme). If so, it will remove the app as the default handler.
1165 *
1166 * @platform darwin,win32
1167 */
1168 removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1169 /**
1170 * The return value of this method indicates whether or not this instance of your
1171 * application successfully obtained the lock. If it failed to obtain the lock,
1172 * you can assume that another instance of your application is already running with
1173 * the lock and exit immediately.
1174 *
1175 * I.e. This method returns `true` if your process is the primary instance of your
1176 * application and your app should continue loading. It returns `false` if your
1177 * process should immediately quit as it has sent its parameters to another
1178 * instance that has already acquired the lock.
1179 *
1180 * On macOS, the system enforces single instance automatically when users try to
1181 * open a second instance of your app in Finder, and the `open-file` and `open-url`
1182 * events will be emitted for that. However when users start your app in command
1183 * line, the system's single instance mechanism will be bypassed, and you have to
1184 * use this method to ensure single instance.
1185 *
1186 * An example of activating the window of primary instance when a second instance
1187 * starts:
1188 */
1189 requestSingleInstanceLock(): boolean;
1190 /**
1191 * Marks the current Handoff user activity as inactive without invalidating it.
1192 *
1193 * @platform darwin
1194 */
1195 resignCurrentActivity(): void;
1196 /**
1197 * Set the about panel options. This will override the values defined in the app's
1198 * `.plist` file on MacOS. See the Apple docs for more details. On Linux, values
1199 * must be set in order to be shown; there are no defaults.
1200 *
1201 * @platform darwin,linux
1202 */
1203 setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
1204 /**
1205 * Manually enables Chrome's accessibility support, allowing to expose
1206 * accessibility switch to users in application settings. See Chromium's
1207 * accessibility docs for more details. Disabled by default.
1208 *
1209 * This API must be called after the `ready` event is emitted.
1210 *
1211 * **Note:** Rendering accessibility tree can significantly affect the performance
1212 * of your app. It should not be enabled by default.
1213
1214**Deprecated**
1215 *
1216 * @platform darwin,win32
1217 */
1218 setAccessibilitySupportEnabled(enabled: boolean): void;
1219 /**
1220 * Sets or creates a directory your app's logs which can then be manipulated with
1221 * `app.getPath()` or `app.setPath(pathName, newPath)`.
1222 *
1223 * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
1224 * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
1225 * `userData` directory on _Linux_ and _Windows_.
1226 */
1227 setAppLogsPath(path?: string): void;
1228 /**
1229 * Changes the Application User Model ID to `id`.
1230 *
1231 * @platform win32
1232 */
1233 setAppUserModelId(id: string): void;
1234 /**
1235 * Whether the call succeeded.
1236 *
1237 * This method sets the current executable as the default handler for a protocol
1238 * (aka URI scheme). It allows you to integrate your app deeper into the operating
1239 * system. Once registered, all links with `your-protocol://` will be opened with
1240 * the current executable. The whole link, including protocol, will be passed to
1241 * your application as a parameter.
1242 *
1243 * On Windows, you can provide optional parameters path, the path to your
1244 * executable, and args, an array of arguments to be passed to your executable when
1245 * it launches.
1246 *
1247 * **Note:** On macOS, you can only register protocols that have been added to your
1248 * app's `info.plist`, which can not be modified at runtime. You can however change
1249 * the file with a simple text editor or script during build time. Please refer to
1250 * Apple's documentation for details.
1251 *
1252 * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
1253 * will return `true` for all calls but the registry key it sets won't be
1254 * accessible by other applications. In order to register your Windows Store
1255 * application as a default protocol handler you must declare the protocol in your
1256 * manifest.
1257 *
1258 * The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme
1259 * internally.
1260 */
1261 setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1262 /**
1263 * Whether the call succeeded.
1264 *
1265 * Sets the counter badge for current app. Setting the count to `0` will hide the
1266 * badge.
1267 *
1268 * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
1269 *
1270 * **Note:** Unity launcher requires the existence of a `.desktop` file to work,
1271 * for more information please read Desktop Environment Integration.
1272 *
1273**Deprecated**
1274 *
1275 * @platform linux,darwin
1276 */
1277 setBadgeCount(count: number): boolean;
1278 /**
1279 * Sets or removes a custom Jump List for the application, and returns one of the
1280 * following strings:
1281 *
1282 * * `ok` - Nothing went wrong.
1283 * * `error` - One or more errors occurred, enable runtime logging to figure out
1284 * the likely cause.
1285 * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
1286 * category in the Jump List. Separators are only allowed in the standard `Tasks`
1287 * category.
1288 * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
1289 * Jump List for a file type the app isn't registered to handle.
1290 * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
1291 * Jump List due to user privacy or group policy settings.
1292 *
1293 * If `categories` is `null` the previously set custom Jump List (if any) will be
1294 * replaced by the standard Jump List for the app (managed by Windows).
1295 *
1296 * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
1297 * property set then its `type` is assumed to be `tasks`. If the `name` property is
1298 * set but the `type` property is omitted then the `type` is assumed to be
1299 * `custom`.
1300 *
1301 * **Note:** Users can remove items from custom categories, and Windows will not
1302 * allow a removed item to be added back into a custom category until **after** the
1303 * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
1304 * removed item to a custom category earlier than that will result in the entire
1305 * custom category being omitted from the Jump List. The list of removed items can
1306 * be obtained using `app.getJumpListSettings()`.
1307 *
1308Here's a very simple example of creating a custom Jump List:
1309 *
1310 * @platform win32
1311 */
1312 setJumpList(categories: (JumpListCategory[]) | (null)): void;
1313 /**
1314 * Set the app's login item settings.
1315 *
1316 * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
1317 * want to set the launch path to Update.exe, and pass arguments that specify your
1318 * application name. For example:
1319 *
1320 * @platform darwin,win32
1321 */
1322 setLoginItemSettings(settings: Settings): void;
1323 /**
1324 * Overrides the current application's name.
1325
1326**Deprecated**
1327 */
1328 setName(name: string): void;
1329 /**
1330 * Overrides the `path` to a special directory or file associated with `name`. If
1331 * the path specifies a directory that does not exist, an `Error` is thrown. In
1332 * that case, the directory should be created with `fs.mkdirSync` or similar.
1333 *
1334 * You can only override paths of a `name` defined in `app.getPath`.
1335 *
1336 * By default, web pages' cookies and caches will be stored under the `userData`
1337 * directory. If you want to change this location, you have to override the
1338 * `userData` path before the `ready` event of the `app` module is emitted.
1339 */
1340 setPath(name: string, path: string): void;
1341 /**
1342 * Creates an `NSUserActivity` and sets it as the current activity. The activity is
1343 * eligible for Handoff to another device afterward.
1344 *
1345 * @platform darwin
1346 */
1347 setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
1348 /**
1349 * Adds `tasks` to the Tasks category of the Jump List on Windows.
1350 *
1351 * `tasks` is an array of `Task` objects.
1352 *
1353 * Whether the call succeeded.
1354 *
1355 * **Note:** If you'd like to customize the Jump List even more use
1356 * `app.setJumpList(categories)` instead.
1357 *
1358 * @platform win32
1359 */
1360 setUserTasks(tasks: Task[]): boolean;
1361 /**
1362 * Shows application windows after they were hidden. Does not automatically focus
1363 * them.
1364 *
1365 * @platform darwin
1366 */
1367 show(): void;
1368 /**
1369 * Show the app's about panel options. These options can be overridden with
1370 * `app.setAboutPanelOptions(options)`.
1371 *
1372 * @platform darwin,linux
1373 */
1374 showAboutPanel(): void;
1375 /**
1376 * Show the platform's native emoji picker.
1377 *
1378 * @platform darwin,win32
1379 */
1380 showEmojiPanel(): void;
1381 /**
1382 * This function **must** be called once you have finished accessing the security
1383 * scoped file. If you do not remember to stop accessing the bookmark, kernel
1384 * resources will be leaked and your app will lose its ability to reach outside the
1385 * sandbox completely, until your app is restarted.
1386 *
1387 * Start accessing a security scoped resource. With this method Electron
1388 * applications that are packaged for the Mac App Store may reach outside their
1389 * sandbox to access files chosen by the user. See Apple's documentation for a
1390 * description of how this system works.
1391 *
1392 * @platform mas
1393 */
1394 startAccessingSecurityScopedResource(bookmarkData: string): Function;
1395 /**
1396 * Updates the current activity if its type matches `type`, merging the entries
1397 * from `userInfo` into its current `userInfo` dictionary.
1398 *
1399 * @platform darwin
1400 */
1401 updateCurrentActivity(type: string, userInfo: any): void;
1402 /**
1403 * fulfilled when Electron is initialized. May be used as a convenient alternative
1404 * to checking `app.isReady()` and subscribing to the `ready` event if the app is
1405 * not ready yet.
1406 */
1407 whenReady(): Promise<void>;
1408 /**
1409 * A `Boolean` property that's `true` if Chrome's accessibility support is enabled,
1410 * `false` otherwise. This property will be `true` if the use of assistive
1411 * technologies, such as screen readers, has been detected. Setting this property
1412 * to `true` manually enables Chrome's accessibility support, allowing developers
1413 * to expose accessibility switch to users in application settings.
1414 *
1415 * See Chromium's accessibility docs for more details. Disabled by default.
1416 *
1417 * This API must be called after the `ready` event is emitted.
1418 *
1419 * **Note:** Rendering accessibility tree can significantly affect the performance
1420 * of your app. It should not be enabled by default.
1421 *
1422 * @platform darwin,win32
1423 */
1424 accessibilitySupportEnabled: boolean;
1425 /**
1426 * A `Boolean` which when `true` disables the overrides that Electron has in place
1427 * to ensure renderer processes are restarted on every navigation. The current
1428 * default value for this property is `false`.
1429 *
1430 * The intention is for these overrides to become disabled by default and then at
1431 * some point in the future this property will be removed. This property impacts
1432 * which native modules you can use in the renderer process. For more information
1433 * on the direction Electron is going with renderer process restarts and usage of
1434 * native modules in the renderer process please check out this Tracking Issue.
1435 */
1436 allowRendererProcessReuse: boolean;
1437 /**
1438 * A `Menu | null` property that returns `Menu` if one has been set and `null`
1439 * otherwise. Users can pass a Menu to set this property.
1440 */
1441 applicationMenu: (Menu) | (null);
1442 /**
1443 * An `Integer` property that returns the badge count for current app. Setting the
1444 * count to `0` will hide the badge.
1445 *
1446 * On macOS, setting this with any nonzero integer shows on the dock icon. On
1447 * Linux, this property only works for Unity launcher.
1448 *
1449 * **Note:** Unity launcher requires the existence of a `.desktop` file to work,
1450 * for more information please read Desktop Environment Integration.
1451 *
1452 * @platform linux,darwin
1453 */
1454 badgeCount: number;
1455 /**
1456 * A `CommandLine` object that allows you to read and manipulate the command line
1457 * arguments that Chromium uses.
1458 *
1459 */
1460 readonly commandLine: CommandLine;
1461 /**
1462 * A `Dock` object that allows you to perform actions on your app icon in the
1463 * user's dock on macOS.
1464 *
1465 * @platform darwin
1466 */
1467 readonly dock: Dock;
1468 /**
1469 * A `Boolean` property that returns `true` if the app is packaged, `false`
1470 * otherwise. For many apps, this property can be used to distinguish development
1471 * and production environments.
1472 *
1473 */
1474 readonly isPackaged: boolean;
1475 /**
1476 * A `String` property that indicates the current application's name, which is the
1477 * name in the application's `package.json` file.
1478 *
1479 * Usually the `name` field of `package.json` is a short lowercase name, according
1480 * to the npm modules spec. You should usually also specify a `productName` field,
1481 * which is your application's full capitalized name, and which will be preferred
1482 * over `name` by Electron.
1483 */
1484 name: string;
1485 /**
1486 * A `String` which is the user agent string Electron will use as a global
1487 * fallback.
1488 *
1489 * This is the user agent that will be used when no user agent is set at the
1490 * `webContents` or `session` level. It is useful for ensuring that your entire
1491 * app has the same user agent. Set to a custom value as early as possible in your
1492 * app's initialization to ensure that your overridden value is used.
1493 */
1494 userAgentFallback: string;
1495 }
1496
1497 interface AutoUpdater extends NodeJS.EventEmitter {
1498
1499 // Docs: http://electronjs.org/docs/api/auto-updater
1500
1501 /**
1502 * This event is emitted after a user calls `quitAndInstall()`.
1503 *
1504 * When this API is called, the `before-quit` event is not emitted before all
1505 * windows are closed. As a result you should listen to this event if you wish to
1506 * perform actions before the windows are closed while a process is quitting, as
1507 * well as listening to `before-quit`.
1508 */
1509 on(event: 'before-quit-for-update', listener: Function): this;
1510 once(event: 'before-quit-for-update', listener: Function): this;
1511 addListener(event: 'before-quit-for-update', listener: Function): this;
1512 removeListener(event: 'before-quit-for-update', listener: Function): this;
1513 /**
1514 * Emitted when checking if an update has started.
1515 */
1516 on(event: 'checking-for-update', listener: Function): this;
1517 once(event: 'checking-for-update', listener: Function): this;
1518 addListener(event: 'checking-for-update', listener: Function): this;
1519 removeListener(event: 'checking-for-update', listener: Function): this;
1520 /**
1521 * Emitted when there is an error while updating.
1522 */
1523 on(event: 'error', listener: (error: Error) => void): this;
1524 once(event: 'error', listener: (error: Error) => void): this;
1525 addListener(event: 'error', listener: (error: Error) => void): this;
1526 removeListener(event: 'error', listener: (error: Error) => void): this;
1527 /**
1528 * Emitted when there is an available update. The update is downloaded
1529 * automatically.
1530 */
1531 on(event: 'update-available', listener: Function): this;
1532 once(event: 'update-available', listener: Function): this;
1533 addListener(event: 'update-available', listener: Function): this;
1534 removeListener(event: 'update-available', listener: Function): this;
1535 /**
1536 * Emitted when an update has been downloaded.
1537 *
1538 * On Windows only `releaseName` is available.
1539 *
1540 * **Note:** It is not strictly necessary to handle this event. A successfully
1541 * downloaded update will still be applied the next time the application starts.
1542 */
1543 on(event: 'update-downloaded', listener: (event: Event,
1544 releaseNotes: string,
1545 releaseName: string,
1546 releaseDate: Date,
1547 updateURL: string) => void): this;
1548 once(event: 'update-downloaded', listener: (event: Event,
1549 releaseNotes: string,
1550 releaseName: string,
1551 releaseDate: Date,
1552 updateURL: string) => void): this;
1553 addListener(event: 'update-downloaded', listener: (event: Event,
1554 releaseNotes: string,
1555 releaseName: string,
1556 releaseDate: Date,
1557 updateURL: string) => void): this;
1558 removeListener(event: 'update-downloaded', listener: (event: Event,
1559 releaseNotes: string,
1560 releaseName: string,
1561 releaseDate: Date,
1562 updateURL: string) => void): this;
1563 /**
1564 * Emitted when there is no available update.
1565 */
1566 on(event: 'update-not-available', listener: Function): this;
1567 once(event: 'update-not-available', listener: Function): this;
1568 addListener(event: 'update-not-available', listener: Function): this;
1569 removeListener(event: 'update-not-available', listener: Function): this;
1570 /**
1571 * Asks the server whether there is an update. You must call `setFeedURL` before
1572 * using this API.
1573 */
1574 checkForUpdates(): void;
1575 /**
1576 * The current update feed URL.
1577 */
1578 getFeedURL(): string;
1579 /**
1580 * Restarts the app and installs the update after it has been downloaded. It should
1581 * only be called after `update-downloaded` has been emitted.
1582 *
1583 * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
1584 * windows first, and automatically call `app.quit()` after all windows have been
1585 * closed.
1586 *
1587 * **Note:** It is not strictly necessary to call this function to apply an update,
1588 * as a successfully downloaded update will always be applied the next time the
1589 * application starts.
1590 */
1591 quitAndInstall(): void;
1592 /**
1593 * Sets the `url` and initialize the auto updater.
1594 */
1595 setFeedURL(options: FeedURLOptions): void;
1596 }
1597
1598 interface BluetoothDevice {
1599
1600 // Docs: http://electronjs.org/docs/api/structures/bluetooth-device
1601
1602 deviceId: string;
1603 deviceName: string;
1604 }
1605
1606 class BrowserView {
1607
1608 // Docs: http://electronjs.org/docs/api/browser-view
1609
1610 /**
1611 * BrowserView
1612 */
1613 constructor(options?: BrowserViewConstructorOptions);
1614 /**
1615 * The view with the given `id`.
1616 */
1617 static fromId(id: number): BrowserView;
1618 /**
1619 * The BrowserView that owns the given `webContents` or `null` if the contents are
1620 * not owned by a BrowserView.
1621 */
1622 static fromWebContents(webContents: WebContents): (BrowserView) | (null);
1623 /**
1624 * An array of all opened BrowserViews.
1625 */
1626 static getAllViews(): BrowserView[];
1627 /**
1628 * Force closing the view, the `unload` and `beforeunload` events won't be emitted
1629 * for the web page. After you're done with a view, call this function in order to
1630 * free memory and other resources as soon as possible.
1631 */
1632 destroy(): void;
1633 /**
1634 * The `bounds` of this BrowserView instance as `Object`.
1635 *
1636 * @experimental
1637 */
1638 getBounds(): Rectangle;
1639 /**
1640 * Whether the view is destroyed.
1641 */
1642 isDestroyed(): boolean;
1643 setAutoResize(options: AutoResizeOptions): void;
1644 setBackgroundColor(color: string): void;
1645 /**
1646 * Resizes and moves the view to the supplied bounds relative to the window.
1647 *
1648 * @experimental
1649 */
1650 setBounds(bounds: Rectangle): void;
1651 id: number;
1652 webContents: WebContents;
1653 }
1654
1655 class BrowserWindow extends NodeJS.EventEmitter {
1656
1657 // Docs: http://electronjs.org/docs/api/browser-window
1658
1659 /**
1660 * Emitted when the window is set or unset to show always on top of other windows.
1661 */
1662 on(event: 'always-on-top-changed', listener: (event: Event,
1663 isAlwaysOnTop: boolean) => void): this;
1664 once(event: 'always-on-top-changed', listener: (event: Event,
1665 isAlwaysOnTop: boolean) => void): this;
1666 addListener(event: 'always-on-top-changed', listener: (event: Event,
1667 isAlwaysOnTop: boolean) => void): this;
1668 removeListener(event: 'always-on-top-changed', listener: (event: Event,
1669 isAlwaysOnTop: boolean) => void): this;
1670 /**
1671 * Emitted when an App Command is invoked. These are typically related to keyboard
1672 * media keys or browser commands, as well as the "Back" button built into some
1673 * mice on Windows.
1674 *
1675 * Commands are lowercased, underscores are replaced with hyphens, and the
1676 * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
1677 * emitted as `browser-backward`.
1678 *
1679 * The following app commands are explicitly supported on Linux:
1680 *
1681* `browser-backward`
1682* `browser-forward`
1683 *
1684 * @platform win32,linux
1685 */
1686 on(event: 'app-command', listener: (event: Event,
1687 command: string) => void): this;
1688 once(event: 'app-command', listener: (event: Event,
1689 command: string) => void): this;
1690 addListener(event: 'app-command', listener: (event: Event,
1691 command: string) => void): this;
1692 removeListener(event: 'app-command', listener: (event: Event,
1693 command: string) => void): this;
1694 /**
1695 * Emitted when the window loses focus.
1696 */
1697 on(event: 'blur', listener: Function): this;
1698 once(event: 'blur', listener: Function): this;
1699 addListener(event: 'blur', listener: Function): this;
1700 removeListener(event: 'blur', listener: Function): this;
1701 /**
1702 * Emitted when the window is going to be closed. It's emitted before the
1703 * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
1704 * will cancel the close.
1705 *
1706 * Usually you would want to use the `beforeunload` handler to decide whether the
1707 * window should be closed, which will also be called when the window is reloaded.
1708 * In Electron, returning any value other than `undefined` would cancel the close.
1709 * For example:
1710 *
1711 * _**Note**: There is a subtle difference between the behaviors of
1712 * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
1713 * handler)`. It is recommended to always set the `event.returnValue` explicitly,
1714 * instead of only returning a value, as the former works more consistently within
1715 * Electron._
1716 */
1717 on(event: 'close', listener: (event: Event) => void): this;
1718 once(event: 'close', listener: (event: Event) => void): this;
1719 addListener(event: 'close', listener: (event: Event) => void): this;
1720 removeListener(event: 'close', listener: (event: Event) => void): this;
1721 /**
1722 * Emitted when the window is closed. After you have received this event you should
1723 * remove the reference to the window and avoid using it any more.
1724 */
1725 on(event: 'closed', listener: Function): this;
1726 once(event: 'closed', listener: Function): this;
1727 addListener(event: 'closed', listener: Function): this;
1728 removeListener(event: 'closed', listener: Function): this;
1729 /**
1730 * Emitted when the window enters a full-screen state.
1731 */
1732 on(event: 'enter-full-screen', listener: Function): this;
1733 once(event: 'enter-full-screen', listener: Function): this;
1734 addListener(event: 'enter-full-screen', listener: Function): this;
1735 removeListener(event: 'enter-full-screen', listener: Function): this;
1736 /**
1737 * Emitted when the window enters a full-screen state triggered by HTML API.
1738 */
1739 on(event: 'enter-html-full-screen', listener: Function): this;
1740 once(event: 'enter-html-full-screen', listener: Function): this;
1741 addListener(event: 'enter-html-full-screen', listener: Function): this;
1742 removeListener(event: 'enter-html-full-screen', listener: Function): this;
1743 /**
1744 * Emitted when the window gains focus.
1745 */
1746 on(event: 'focus', listener: Function): this;
1747 once(event: 'focus', listener: Function): this;
1748 addListener(event: 'focus', listener: Function): this;
1749 removeListener(event: 'focus', listener: Function): this;
1750 /**
1751 * Emitted when the window is hidden.
1752 */
1753 on(event: 'hide', listener: Function): this;
1754 once(event: 'hide', listener: Function): this;
1755 addListener(event: 'hide', listener: Function): this;
1756 removeListener(event: 'hide', listener: Function): this;
1757 /**
1758 * Emitted when the window leaves a full-screen state.
1759 */
1760 on(event: 'leave-full-screen', listener: Function): this;
1761 once(event: 'leave-full-screen', listener: Function): this;
1762 addListener(event: 'leave-full-screen', listener: Function): this;
1763 removeListener(event: 'leave-full-screen', listener: Function): this;
1764 /**
1765 * Emitted when the window leaves a full-screen state triggered by HTML API.
1766 */
1767 on(event: 'leave-html-full-screen', listener: Function): this;
1768 once(event: 'leave-html-full-screen', listener: Function): this;
1769 addListener(event: 'leave-html-full-screen', listener: Function): this;
1770 removeListener(event: 'leave-html-full-screen', listener: Function): this;
1771 /**
1772 * Emitted when window is maximized.
1773 */
1774 on(event: 'maximize', listener: Function): this;
1775 once(event: 'maximize', listener: Function): this;
1776 addListener(event: 'maximize', listener: Function): this;
1777 removeListener(event: 'maximize', listener: Function): this;
1778 /**
1779 * Emitted when the window is minimized.
1780 */
1781 on(event: 'minimize', listener: Function): this;
1782 once(event: 'minimize', listener: Function): this;
1783 addListener(event: 'minimize', listener: Function): this;
1784 removeListener(event: 'minimize', listener: Function): this;
1785 /**
1786 * Emitted when the window is being moved to a new position.
1787 *
1788__Note__: On macOS this event is an alias of `moved`.
1789 */
1790 on(event: 'move', listener: Function): this;
1791 once(event: 'move', listener: Function): this;
1792 addListener(event: 'move', listener: Function): this;
1793 removeListener(event: 'move', listener: Function): this;
1794 /**
1795 * Emitted once when the window is moved to a new position.
1796 *
1797 * @platform darwin
1798 */
1799 on(event: 'moved', listener: Function): this;
1800 once(event: 'moved', listener: Function): this;
1801 addListener(event: 'moved', listener: Function): this;
1802 removeListener(event: 'moved', listener: Function): this;
1803 /**
1804 * Emitted when the native new tab button is clicked.
1805 *
1806 * @platform darwin
1807 */
1808 on(event: 'new-window-for-tab', listener: Function): this;
1809 once(event: 'new-window-for-tab', listener: Function): this;
1810 addListener(event: 'new-window-for-tab', listener: Function): this;
1811 removeListener(event: 'new-window-for-tab', listener: Function): this;
1812 /**
1813 * Emitted when the document changed its title, calling `event.preventDefault()`
1814 * will prevent the native window's title from changing. `explicitSet` is false
1815 * when title is synthesized from file URL.
1816 */
1817 on(event: 'page-title-updated', listener: (event: Event,
1818 title: string,
1819 explicitSet: boolean) => void): this;
1820 once(event: 'page-title-updated', listener: (event: Event,
1821 title: string,
1822 explicitSet: boolean) => void): this;
1823 addListener(event: 'page-title-updated', listener: (event: Event,
1824 title: string,
1825 explicitSet: boolean) => void): this;
1826 removeListener(event: 'page-title-updated', listener: (event: Event,
1827 title: string,
1828 explicitSet: boolean) => void): this;
1829 /**
1830 * Emitted when the web page has been rendered (while not being shown) and window
1831 * can be displayed without a visual flash.
1832 *
1833 * Please note that using this event implies that the renderer will be considered
1834 * "visible" and paint even though `show` is false. This event will never fire if
1835 * you use `paintWhenInitiallyHidden: false`
1836 */
1837 on(event: 'ready-to-show', listener: Function): this;
1838 once(event: 'ready-to-show', listener: Function): this;
1839 addListener(event: 'ready-to-show', listener: Function): this;
1840 removeListener(event: 'ready-to-show', listener: Function): this;
1841 /**
1842 * Emitted after the window has been resized.
1843 */
1844 on(event: 'resize', listener: Function): this;
1845 once(event: 'resize', listener: Function): this;
1846 addListener(event: 'resize', listener: Function): this;
1847 removeListener(event: 'resize', listener: Function): this;
1848 /**
1849 * Emitted when the unresponsive web page becomes responsive again.
1850 */
1851 on(event: 'responsive', listener: Function): this;
1852 once(event: 'responsive', listener: Function): this;
1853 addListener(event: 'responsive', listener: Function): this;
1854 removeListener(event: 'responsive', listener: Function): this;
1855 /**
1856 * Emitted when the window is restored from a minimized state.
1857 */
1858 on(event: 'restore', listener: Function): this;
1859 once(event: 'restore', listener: Function): this;
1860 addListener(event: 'restore', listener: Function): this;
1861 removeListener(event: 'restore', listener: Function): this;
1862 /**
1863 * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
1864 * is ended. The `rotation` value on each emission is the angle in degrees rotated
1865 * since the last emission. The last emitted event upon a rotation gesture will
1866 * always be of value `0`. Counter-clockwise rotation values are positive, while
1867 * clockwise ones are negative.
1868 *
1869 * @platform darwin
1870 */
1871 on(event: 'rotate-gesture', listener: (event: Event,
1872 rotation: number) => void): this;
1873 once(event: 'rotate-gesture', listener: (event: Event,
1874 rotation: number) => void): this;
1875 addListener(event: 'rotate-gesture', listener: (event: Event,
1876 rotation: number) => void): this;
1877 removeListener(event: 'rotate-gesture', listener: (event: Event,
1878 rotation: number) => void): this;
1879 /**
1880 * Emitted when scroll wheel event phase has begun.
1881 *
1882 * @platform darwin
1883 */
1884 on(event: 'scroll-touch-begin', listener: Function): this;
1885 once(event: 'scroll-touch-begin', listener: Function): this;
1886 addListener(event: 'scroll-touch-begin', listener: Function): this;
1887 removeListener(event: 'scroll-touch-begin', listener: Function): this;
1888 /**
1889 * Emitted when scroll wheel event phase filed upon reaching the edge of element.
1890 *
1891 * @platform darwin
1892 */
1893 on(event: 'scroll-touch-edge', listener: Function): this;
1894 once(event: 'scroll-touch-edge', listener: Function): this;
1895 addListener(event: 'scroll-touch-edge', listener: Function): this;
1896 removeListener(event: 'scroll-touch-edge', listener: Function): this;
1897 /**
1898 * Emitted when scroll wheel event phase has ended.
1899 *
1900 * @platform darwin
1901 */
1902 on(event: 'scroll-touch-end', listener: Function): this;
1903 once(event: 'scroll-touch-end', listener: Function): this;
1904 addListener(event: 'scroll-touch-end', listener: Function): this;
1905 removeListener(event: 'scroll-touch-end', listener: Function): this;
1906 /**
1907 * Emitted when window session is going to end due to force shutdown or machine
1908 * restart or session log off.
1909 *
1910 * @platform win32
1911 */
1912 on(event: 'session-end', listener: Function): this;
1913 once(event: 'session-end', listener: Function): this;
1914 addListener(event: 'session-end', listener: Function): this;
1915 removeListener(event: 'session-end', listener: Function): this;
1916 /**
1917 * Emitted when the window opens a sheet.
1918 *
1919 * @platform darwin
1920 */
1921 on(event: 'sheet-begin', listener: Function): this;
1922 once(event: 'sheet-begin', listener: Function): this;
1923 addListener(event: 'sheet-begin', listener: Function): this;
1924 removeListener(event: 'sheet-begin', listener: Function): this;
1925 /**
1926 * Emitted when the window has closed a sheet.
1927 *
1928 * @platform darwin
1929 */
1930 on(event: 'sheet-end', listener: Function): this;
1931 once(event: 'sheet-end', listener: Function): this;
1932 addListener(event: 'sheet-end', listener: Function): this;
1933 removeListener(event: 'sheet-end', listener: Function): this;
1934 /**
1935 * Emitted when the window is shown.
1936 */
1937 on(event: 'show', listener: Function): this;
1938 once(event: 'show', listener: Function): this;
1939 addListener(event: 'show', listener: Function): this;
1940 removeListener(event: 'show', listener: Function): this;
1941 /**
1942 * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
1943 * `left`.
1944 *
1945 * @platform darwin
1946 */
1947 on(event: 'swipe', listener: (event: Event,
1948 direction: string) => void): this;
1949 once(event: 'swipe', listener: (event: Event,
1950 direction: string) => void): this;
1951 addListener(event: 'swipe', listener: (event: Event,
1952 direction: string) => void): this;
1953 removeListener(event: 'swipe', listener: (event: Event,
1954 direction: string) => void): this;
1955 /**
1956 * Emitted when the window exits from a maximized state.
1957 */
1958 on(event: 'unmaximize', listener: Function): this;
1959 once(event: 'unmaximize', listener: Function): this;
1960 addListener(event: 'unmaximize', listener: Function): this;
1961 removeListener(event: 'unmaximize', listener: Function): this;
1962 /**
1963 * Emitted when the web page becomes unresponsive.
1964 */
1965 on(event: 'unresponsive', listener: Function): this;
1966 once(event: 'unresponsive', listener: Function): this;
1967 addListener(event: 'unresponsive', listener: Function): this;
1968 removeListener(event: 'unresponsive', listener: Function): this;
1969 /**
1970 * Emitted before the window is moved. Calling `event.preventDefault()` will
1971 * prevent the window from being moved.
1972 *
1973 * Note that this is only emitted when the window is being resized manually.
1974 * Resizing the window with `setBounds`/`setSize` will not emit this event.
1975 *
1976 * @platform win32
1977 */
1978 on(event: 'will-move', listener: (event: Event,
1979 /**
1980 * Location the window is being moved to.
1981 */
1982 newBounds: Rectangle) => void): this;
1983 once(event: 'will-move', listener: (event: Event,
1984 /**
1985 * Location the window is being moved to.
1986 */
1987 newBounds: Rectangle) => void): this;
1988 addListener(event: 'will-move', listener: (event: Event,
1989 /**
1990 * Location the window is being moved to.
1991 */
1992 newBounds: Rectangle) => void): this;
1993 removeListener(event: 'will-move', listener: (event: Event,
1994 /**
1995 * Location the window is being moved to.
1996 */
1997 newBounds: Rectangle) => void): this;
1998 /**
1999 * Emitted before the window is resized. Calling `event.preventDefault()` will
2000 * prevent the window from being resized.
2001 *
2002 * Note that this is only emitted when the window is being resized manually.
2003 * Resizing the window with `setBounds`/`setSize` will not emit this event.
2004 *
2005 * @platform darwin,win32
2006 */
2007 on(event: 'will-resize', listener: (event: Event,
2008 /**
2009 * Size the window is being resized to.
2010 */
2011 newBounds: Rectangle) => void): this;
2012 once(event: 'will-resize', listener: (event: Event,
2013 /**
2014 * Size the window is being resized to.
2015 */
2016 newBounds: Rectangle) => void): this;
2017 addListener(event: 'will-resize', listener: (event: Event,
2018 /**
2019 * Size the window is being resized to.
2020 */
2021 newBounds: Rectangle) => void): this;
2022 removeListener(event: 'will-resize', listener: (event: Event,
2023 /**
2024 * Size the window is being resized to.
2025 */
2026 newBounds: Rectangle) => void): this;
2027 /**
2028 * BrowserWindow
2029 */
2030 constructor(options?: BrowserWindowConstructorOptions);
2031 /**
2032 * Adds DevTools extension located at `path`, and returns extension's name.
2033 *
2034 * The extension will be remembered so you only need to call this API once, this
2035 * API is not for programming use. If you try to add an extension that has already
2036 * been loaded, this method will not return and instead log a warning to the
2037 * console.
2038 *
2039 * The method will also not return if the extension's manifest is missing or
2040 * incomplete.
2041 *
2042 * **Note:** This API cannot be called before the `ready` event of the `app` module
2043 * is emitted.
2044 */
2045 static addDevToolsExtension(path: string): void;
2046 /**
2047 * Adds Chrome extension located at `path`, and returns extension's name.
2048 *
2049 * The method will also not return if the extension's manifest is missing or
2050 * incomplete.
2051 *
2052 * **Note:** This API cannot be called before the `ready` event of the `app` module
2053 * is emitted.
2054 */
2055 static addExtension(path: string): void;
2056 /**
2057 * The window that owns the given `browserView`. If the given view is not attached
2058 * to any window, returns `null`.
2059 */
2060 static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
2061 /**
2062 * The window with the given `id`.
2063 */
2064 static fromId(id: number): BrowserWindow;
2065 /**
2066 * The window that owns the given `webContents`.
2067 */
2068 static fromWebContents(webContents: WebContents): BrowserWindow;
2069 /**
2070 * An array of all opened browser windows.
2071 */
2072 static getAllWindows(): BrowserWindow[];
2073 /**
2074 * The keys are the extension names and each value is an Object containing `name`
2075 * and `version` properties.
2076 *
2077 * To check if a DevTools extension is installed you can run the following:
2078 *
2079 * **Note:** This API cannot be called before the `ready` event of the `app` module
2080 * is emitted.
2081 */
2082 static getDevToolsExtensions(): Record<string, ExtensionInfo>;
2083 /**
2084 * The keys are the extension names and each value is an Object containing `name`
2085 * and `version` properties.
2086 *
2087 * **Note:** This API cannot be called before the `ready` event of the `app` module
2088 * is emitted.
2089 */
2090 static getExtensions(): Record<string, ExtensionInfo>;
2091 /**
2092 * The window that is focused in this application, otherwise returns `null`.
2093 */
2094 static getFocusedWindow(): (BrowserWindow) | (null);
2095 /**
2096 * Remove a DevTools extension by name.
2097 *
2098 * **Note:** This API cannot be called before the `ready` event of the `app` module
2099 * is emitted.
2100 */
2101 static removeDevToolsExtension(name: string): void;
2102 /**
2103 * Remove a Chrome extension by name.
2104 *
2105 * **Note:** This API cannot be called before the `ready` event of the `app` module
2106 * is emitted.
2107 */
2108 static removeExtension(name: string): void;
2109 /**
2110 * Replacement API for setBrowserView supporting work with multi browser views.
2111 *
2112 * @experimental
2113 */
2114 addBrowserView(browserView: BrowserView): void;
2115 /**
2116 * Adds a window as a tab on this window, after the tab for the window instance.
2117 *
2118 * @platform darwin
2119 */
2120 addTabbedWindow(browserWindow: BrowserWindow): void;
2121 /**
2122 * Removes focus from the window.
2123 */
2124 blur(): void;
2125 blurWebView(): void;
2126 /**
2127 * Resolves with a NativeImage
2128 *
2129 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
2130 * whole visible page.
2131 */
2132 capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
2133 /**
2134 * Moves window to the center of the screen.
2135 */
2136 center(): void;
2137 /**
2138 * Try to close the window. This has the same effect as a user manually clicking
2139 * the close button of the window. The web page may cancel the close though. See
2140 * the close event.
2141 */
2142 close(): void;
2143 /**
2144 * Closes the currently open Quick Look panel.
2145 *
2146 * @platform darwin
2147 */
2148 closeFilePreview(): void;
2149 /**
2150 * Force closing the window, the `unload` and `beforeunload` event won't be emitted
2151 * for the web page, and `close` event will also not be emitted for this window,
2152 * but it guarantees the `closed` event will be emitted.
2153 */
2154 destroy(): void;
2155 /**
2156 * Starts or stops flashing the window to attract user's attention.
2157 */
2158 flashFrame(flag: boolean): void;
2159 /**
2160 * Focuses on the window.
2161 */
2162 focus(): void;
2163 focusOnWebView(): void;
2164 /**
2165 * The `bounds` of the window as `Object`.
2166 */
2167 getBounds(): Rectangle;
2168 /**
2169 * an BrowserView what is attached. Returns `null` if none is attached. Throw error
2170 * if multiple BrowserViews is attached.
2171 *
2172 * @experimental
2173 */
2174 getBrowserView(): (BrowserView) | (null);
2175 /**
2176 * an array of all BrowserViews that have been attached with `addBrowserView` or
2177 * `setBrowserView`.
2178 *
2179 * **Note:** The BrowserView API is currently experimental and may change or be
2180 * removed in future Electron releases.
2181 *
2182 * @experimental
2183 */
2184 getBrowserViews(): BrowserView[];
2185 /**
2186 * All child windows.
2187 */
2188 getChildWindows(): BrowserWindow[];
2189 /**
2190 * The `bounds` of the window's client area as `Object`.
2191 */
2192 getContentBounds(): Rectangle;
2193 /**
2194 * Contains the window's client area's width and height.
2195 */
2196 getContentSize(): number[];
2197 /**
2198 * Contains the window's maximum width and height.
2199 */
2200 getMaximumSize(): number[];
2201 /**
2202 * Contains the window's minimum width and height.
2203 */
2204 getMinimumSize(): number[];
2205 /**
2206 * The platform-specific handle of the window.
2207 *
2208 * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
2209 * `Window` (`unsigned long`) on Linux.
2210 */
2211 getNativeWindowHandle(): Buffer;
2212 /**
2213 * Contains the window bounds of the normal state
2214 *
2215 * **Note:** whatever the current state of the window : maximized, minimized or in
2216 * fullscreen, this function always returns the position and size of the window in
2217 * normal state. In normal state, getBounds and getNormalBounds returns the same
2218 * `Rectangle`.
2219 */
2220 getNormalBounds(): Rectangle;
2221 /**
2222 * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
2223 * 1.
2224 */
2225 getOpacity(): number;
2226 /**
2227 * The parent window.
2228 */
2229 getParentWindow(): BrowserWindow;
2230 /**
2231 * Contains the window's current position.
2232 */
2233 getPosition(): number[];
2234 /**
2235 * The pathname of the file the window represents.
2236 *
2237 * @platform darwin
2238 */
2239 getRepresentedFilename(): string;
2240 /**
2241 * Contains the window's width and height.
2242 */
2243 getSize(): number[];
2244 /**
2245 * The title of the native window.
2246 *
2247 * **Note:** The title of the web page can be different from the title of the
2248 * native window.
2249 */
2250 getTitle(): string;
2251 /**
2252 * Whether the window has a shadow.
2253 */
2254 hasShadow(): boolean;
2255 /**
2256 * Hides the window.
2257 */
2258 hide(): void;
2259 /**
2260 * Hooks a windows message. The `callback` is called when the message is received
2261 * in the WndProc.
2262 *
2263 * @platform win32
2264 */
2265 hookWindowMessage(message: number, callback: () => void): void;
2266 /**
2267 * Whether the window is always on top of other windows.
2268 */
2269 isAlwaysOnTop(): boolean;
2270 /**
2271 * Whether the window can be manually closed by user.
2272 *
2273On Linux always returns `true`.
2274
2275**Deprecated**
2276 *
2277 * @platform darwin,win32
2278 */
2279 isClosable(): boolean;
2280 /**
2281 * Whether the window is destroyed.
2282 */
2283 isDestroyed(): boolean;
2284 /**
2285 * Whether the window's document has been edited.
2286 *
2287 * @platform darwin
2288 */
2289 isDocumentEdited(): boolean;
2290 /**
2291 * Returns Boolean - whether the window is enabled.
2292 */
2293 isEnabled(): void;
2294 /**
2295 * Whether the window is focused.
2296 */
2297 isFocused(): boolean;
2298 /**
2299 * Whether the window is in fullscreen mode.
2300 */
2301 isFullScreen(): boolean;
2302 /**
2303 * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
2304 * window.
2305
2306**Deprecated**
2307 */
2308 isFullScreenable(): boolean;
2309 /**
2310 * Whether the window is in kiosk mode.
2311 */
2312 isKiosk(): boolean;
2313 /**
2314 * Whether the window can be manually maximized by user.
2315 *
2316On Linux always returns `true`.
2317
2318**Deprecated**
2319 *
2320 * @platform darwin,win32
2321 */
2322 isMaximizable(): boolean;
2323 /**
2324 * Whether the window is maximized.
2325 */
2326 isMaximized(): boolean;
2327 /**
2328 * Whether menu bar automatically hides itself.
2329
2330**Deprecated**
2331 */
2332 isMenuBarAutoHide(): boolean;
2333 /**
2334 * Whether the menu bar is visible.
2335 */
2336 isMenuBarVisible(): boolean;
2337 /**
2338 * Whether the window can be manually minimized by user
2339 *
2340On Linux always returns `true`.
2341
2342**Deprecated**
2343 *
2344 * @platform darwin,win32
2345 */
2346 isMinimizable(): boolean;
2347 /**
2348 * Whether the window is minimized.
2349 */
2350 isMinimized(): boolean;
2351 /**
2352 * Whether current window is a modal window.
2353 */
2354 isModal(): boolean;
2355 /**
2356 * Whether the window can be moved by user.
2357 *
2358On Linux always returns `true`.
2359
2360**Deprecated**
2361 *
2362 * @platform darwin,win32
2363 */
2364 isMovable(): boolean;
2365 /**
2366 * Whether the window is in normal state (not maximized, not minimized, not in
2367 * fullscreen mode).
2368 */
2369 isNormal(): boolean;
2370 /**
2371 * Whether the window can be manually resized by user.
2372
2373**Deprecated**
2374 */
2375 isResizable(): boolean;
2376 /**
2377 * Whether the window is in simple (pre-Lion) fullscreen mode.
2378 *
2379 * @platform darwin
2380 */
2381 isSimpleFullScreen(): boolean;
2382 /**
2383 * Whether the window is visible to the user.
2384 */
2385 isVisible(): boolean;
2386 /**
2387 * Whether the window is visible on all workspaces.
2388 *
2389**Note:** This API always returns false on Windows.
2390 */
2391 isVisibleOnAllWorkspaces(): boolean;
2392 /**
2393 * `true` or `false` depending on whether the message is hooked.
2394 *
2395 * @platform win32
2396 */
2397 isWindowMessageHooked(message: number): boolean;
2398 /**
2399 * the promise will resolve when the page has finished loading (see
2400 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
2401 *
2402 * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
2403 * relative to the root of your application. See the `webContents` docs for more
2404 * information.
2405 */
2406 loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
2407 /**
2408 * the promise will resolve when the page has finished loading (see
2409 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
2410 *
2411 * Same as `webContents.loadURL(url[, options])`.
2412 *
2413 * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
2414 * file using the `file://` protocol.
2415 *
2416 * To ensure that file URLs are properly formatted, it is recommended to use Node's
2417 * `url.format` method:
2418 *
2419 * You can load a URL using a `POST` request with URL-encoded data by doing the
2420 * following:
2421 */
2422 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
2423 /**
2424 * Maximizes the window. This will also show (but not focus) the window if it isn't
2425 * being displayed already.
2426 */
2427 maximize(): void;
2428 /**
2429 * Merges all windows into one window with multiple tabs when native tabs are
2430 * enabled and there is more than one open window.
2431 *
2432 * @platform darwin
2433 */
2434 mergeAllWindows(): void;
2435 /**
2436 * Minimizes the window. On some platforms the minimized window will be shown in
2437 * the Dock.
2438 */
2439 minimize(): void;
2440 /**
2441 * Moves the current tab into a new window if native tabs are enabled and there is
2442 * more than one tab in the current window.
2443 *
2444 * @platform darwin
2445 */
2446 moveTabToNewWindow(): void;
2447 /**
2448 * Moves window to top(z-order) regardless of focus
2449 */
2450 moveTop(): void;
2451 /**
2452 * Uses Quick Look to preview a file at a given path.
2453 *
2454 * @platform darwin
2455 */
2456 previewFile(path: string, displayName?: string): void;
2457 /**
2458 * Same as `webContents.reload`.
2459 */
2460 reload(): void;
2461 removeBrowserView(browserView: BrowserView): void;
2462 /**
2463 * Remove the window's menu bar.
2464 *
2465 * @platform linux,win32
2466 */
2467 removeMenu(): void;
2468 /**
2469 * Restores the window from minimized state to its previous state.
2470 */
2471 restore(): void;
2472 /**
2473 * Selects the next tab when native tabs are enabled and there are other tabs in
2474 * the window.
2475 *
2476 * @platform darwin
2477 */
2478 selectNextTab(): void;
2479 /**
2480 * Selects the previous tab when native tabs are enabled and there are other tabs
2481 * in the window.
2482 *
2483 * @platform darwin
2484 */
2485 selectPreviousTab(): void;
2486 /**
2487 * Sets whether the window should show always on top of other windows. After
2488 * setting this, the window is still a normal window, not a toolbox window which
2489 * can not be focused on.
2490 */
2491 setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
2492 /**
2493 * Sets the properties for the window's taskbar button.
2494 *
2495 * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
2496 * together. If one of those properties is not set, then neither will be used.
2497 *
2498 * @platform win32
2499 */
2500 setAppDetails(options: AppDetailsOptions): void;
2501 /**
2502 * This will make a window maintain an aspect ratio. The extra size allows a
2503 * developer to have space, specified in pixels, not included within the aspect
2504 * ratio calculations. This API already takes into account the difference between a
2505 * window's size and its content size.
2506 *
2507 * Consider a normal window with an HD video player and associated controls.
2508 * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
2509 * on the right edge and 50 pixels of controls below the player. In order to
2510 * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
2511 * the player itself we would call this function with arguments of 16/9 and [ 40,
2512 * 50 ]. The second argument doesn't care where the extra width and height are
2513 * within the content view--only that they exist. Sum any extra width and height
2514 * areas you have within the overall content view.
2515 *
2516 * Calling this function with a value of `0` will remove any previously set aspect
2517 * ratios.
2518 *
2519 * @platform darwin
2520 */
2521 setAspectRatio(aspectRatio: number, extraSize?: Size): void;
2522 /**
2523 * Controls whether to hide cursor when typing.
2524 *
2525 * @platform darwin
2526 */
2527 setAutoHideCursor(autoHide: boolean): void;
2528 /**
2529 * Sets whether the window menu bar should hide itself automatically. Once set the
2530 * menu bar will only show when users press the single `Alt` key.
2531 *
2532 * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
2533 * hide it immediately.
2534
2535**Deprecated**
2536 */
2537 setAutoHideMenuBar(hide: boolean): void;
2538 /**
2539 * Sets the background color of the window. See Setting `backgroundColor`.
2540 */
2541 setBackgroundColor(backgroundColor: string): void;
2542 /**
2543 * Resizes and moves the window to the supplied bounds. Any properties that are not
2544 * supplied will default to their current values.
2545 */
2546 setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
2547 setBrowserView(browserView: (BrowserView) | (null)): void;
2548 /**
2549 * Sets whether the window can be manually closed by user. On Linux does nothing.
2550 *
2551**Deprecated**
2552 *
2553 * @platform darwin,win32
2554 */
2555 setClosable(closable: boolean): void;
2556 /**
2557 * Resizes and moves the window's client area (e.g. the web page) to the supplied
2558 * bounds.
2559 */
2560 setContentBounds(bounds: Rectangle, animate?: boolean): void;
2561 /**
2562 * Prevents the window contents from being captured by other apps.
2563 *
2564 * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
2565 * it calls SetWindowDisplayAffinity with `WDA_MONITOR`.
2566 *
2567 * @platform darwin,win32
2568 */
2569 setContentProtection(enable: boolean): void;
2570 /**
2571 * Resizes the window's client area (e.g. the web page) to `width` and `height`.
2572 */
2573 setContentSize(width: number, height: number, animate?: boolean): void;
2574 /**
2575 * Specifies whether the window’s document has been edited, and the icon in title
2576 * bar will become gray when set to `true`.
2577 *
2578 * @platform darwin
2579 */
2580 setDocumentEdited(edited: boolean): void;
2581 /**
2582 * Disable or enable the window.
2583 */
2584 setEnabled(enable: boolean): void;
2585 /**
2586 * Changes whether the window can be focused.
2587 *
2588On macOS it does not remove the focus from the window.
2589 *
2590 * @platform darwin,win32
2591 */
2592 setFocusable(focusable: boolean): void;
2593 /**
2594 * Sets whether the window should be in fullscreen mode.
2595 */
2596 setFullScreen(flag: boolean): void;
2597 /**
2598 * Sets whether the maximize/zoom window button toggles fullscreen mode or
2599 * maximizes the window.
2600
2601**Deprecated**
2602 */
2603 setFullScreenable(fullscreenable: boolean): void;
2604 /**
2605 * Sets whether the window should have a shadow.
2606 */
2607 setHasShadow(hasShadow: boolean): void;
2608 /**
2609 * Changes window icon.
2610 *
2611 * @platform win32,linux
2612 */
2613 setIcon(icon: (NativeImage) | (string)): void;
2614 /**
2615 * Makes the window ignore all mouse events.
2616 *
2617 * All mouse events happened in this window will be passed to the window below this
2618 * window, but if this window has focus, it will still receive keyboard events.
2619 */
2620 setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
2621 /**
2622 * Enters or leaves the kiosk mode.
2623 */
2624 setKiosk(flag: boolean): void;
2625 /**
2626 * Sets whether the window can be manually maximized by user. On Linux does
2627 * nothing.
2628
2629**Deprecated**
2630 *
2631 * @platform darwin,win32
2632 */
2633 setMaximizable(maximizable: boolean): void;
2634 /**
2635 * Sets the maximum size of window to `width` and `height`.
2636 */
2637 setMaximumSize(width: number, height: number): void;
2638 /**
2639 * Sets the `menu` as the window's menu bar.
2640 *
2641 * @platform linux,win32
2642 */
2643 setMenu(menu: (Menu) | (null)): void;
2644 /**
2645 * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
2646 * can still bring up the menu bar by pressing the single `Alt` key.
2647 *
2648 * @platform win32,linux
2649 */
2650 setMenuBarVisibility(visible: boolean): void;
2651 /**
2652 * Sets whether the window can be manually minimized by user. On Linux does
2653 * nothing.
2654
2655**Deprecated**
2656 *
2657 * @platform darwin,win32
2658 */
2659 setMinimizable(minimizable: boolean): void;
2660 /**
2661 * Sets the minimum size of window to `width` and `height`.
2662 */
2663 setMinimumSize(width: number, height: number): void;
2664 /**
2665 * Sets whether the window can be moved by user. On Linux does nothing.
2666 *
2667**Deprecated**
2668 *
2669 * @platform darwin,win32
2670 */
2671 setMovable(movable: boolean): void;
2672 /**
2673 * Sets the opacity of the window. On Linux, does nothing. Out of bound number
2674 * values are clamped to the [0, 1] range.
2675 *
2676 * @platform win32,darwin
2677 */
2678 setOpacity(opacity: number): void;
2679 /**
2680 * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
2681 * convey some sort of application status or to passively notify the user.
2682 *
2683 * @platform win32
2684 */
2685 setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
2686 /**
2687 * Sets `parent` as current window's parent window, passing `null` will turn
2688 * current window into a top-level window.
2689 */
2690 setParentWindow(parent: (BrowserWindow) | (null)): void;
2691 /**
2692 * Moves window to `x` and `y`.
2693 */
2694 setPosition(x: number, y: number, animate?: boolean): void;
2695 /**
2696 * Sets progress value in progress bar. Valid range is [0, 1.0].
2697 *
2698 * Remove progress bar when progress < 0; Change to indeterminate mode when
2699 * progress > 1.
2700 *
2701 * On Linux platform, only supports Unity desktop environment, you need to specify
2702 * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
2703 * it will assume `{app.name}.desktop`.
2704 *
2705 * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
2706 * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
2707 * mode set (but with a value within the valid range), `normal` will be assumed.
2708 */
2709 setProgressBar(progress: number, options?: ProgressBarOptions): void;
2710 /**
2711 * Sets the pathname of the file the window represents, and the icon of the file
2712 * will show in window's title bar.
2713 *
2714 * @platform darwin
2715 */
2716 setRepresentedFilename(filename: string): void;
2717 /**
2718 * Sets whether the window can be manually resized by user.
2719
2720**Deprecated**
2721 */
2722 setResizable(resizable: boolean): void;
2723 /**
2724 * Setting a window shape determines the area within the window where the system
2725 * permits drawing and user interaction. Outside of the given region, no pixels
2726 * will be drawn and no mouse events will be registered. Mouse events outside of
2727 * the region will not be received by that window, but will fall through to
2728 * whatever is behind the window.
2729 *
2730 * @experimental
2731 * @platform win32,linux
2732 */
2733 setShape(rects: Rectangle[]): void;
2734 /**
2735 * Changes the attachment point for sheets on macOS. By default, sheets are
2736 * attached just below the window frame, but you may want to display them beneath a
2737 * HTML-rendered toolbar. For example:
2738 *
2739 * @platform darwin
2740 */
2741 setSheetOffset(offsetY: number, offsetX?: number): void;
2742 /**
2743 * Enters or leaves simple fullscreen mode.
2744 *
2745 * Simple fullscreen mode emulates the native fullscreen behavior found in versions
2746 * of Mac OS X prior to Lion (10.7).
2747 *
2748 * @platform darwin
2749 */
2750 setSimpleFullScreen(flag: boolean): void;
2751 /**
2752 * Resizes the window to `width` and `height`. If `width` or `height` are below any
2753 * set minimum size constraints the window will snap to its minimum size.
2754 */
2755 setSize(width: number, height: number, animate?: boolean): void;
2756 /**
2757 * Makes the window not show in the taskbar.
2758 */
2759 setSkipTaskbar(skip: boolean): void;
2760 /**
2761 * Whether the buttons were added successfully
2762 *
2763 * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
2764 * of a window in a taskbar button layout. Returns a `Boolean` object indicates
2765 * whether the thumbnail has been added successfully.
2766 *
2767 * The number of buttons in thumbnail toolbar should be no greater than 7 due to
2768 * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
2769 * removed due to the platform's limitation. But you can call the API with an empty
2770 * array to clean the buttons.
2771 *
2772 * The `buttons` is an array of `Button` objects:
2773 *
2774 * * `Button` Object
2775 * * `icon` NativeImage - The icon showing in thumbnail toolbar.
2776 * * `click` Function
2777 * * `tooltip` String (optional) - The text of the button's tooltip.
2778 * * `flags` String[] (optional) - Control specific states and behaviors of the
2779 * button. By default, it is `['enabled']`.
2780 *
2781 * The `flags` is an array that can include following `String`s:
2782 *
2783 * * `enabled` - The button is active and available to the user.
2784 * * `disabled` - The button is disabled. It is present, but has a visual state
2785 * indicating it will not respond to user action.
2786 * * `dismissonclick` - When the button is clicked, the thumbnail window closes
2787 * immediately.
2788 * * `nobackground` - Do not draw a button border, use only the image.
2789 * * `hidden` - The button is not shown to the user.
2790 * * `noninteractive` - The button is enabled but not interactive; no pressed
2791 * button state is drawn. This value is intended for instances where the button is
2792 * used in a notification.
2793 *
2794 * @platform win32
2795 */
2796 setThumbarButtons(buttons: ThumbarButton[]): boolean;
2797 /**
2798 * Sets the region of the window to show as the thumbnail image displayed when
2799 * hovering over the window in the taskbar. You can reset the thumbnail to be the
2800 * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
2801 * }`.
2802 *
2803 * @platform win32
2804 */
2805 setThumbnailClip(region: Rectangle): void;
2806 /**
2807 * Sets the toolTip that is displayed when hovering over the window thumbnail in
2808 * the taskbar.
2809 *
2810 * @platform win32
2811 */
2812 setThumbnailToolTip(toolTip: string): void;
2813 /**
2814 * Changes the title of native window to `title`.
2815 */
2816 setTitle(title: string): void;
2817 /**
2818 * Sets the touchBar layout for the current window. Specifying `null` or
2819 * `undefined` clears the touch bar. This method only has an effect if the machine
2820 * has a touch bar and is running on macOS 10.12.1+.
2821 *
2822 * **Note:** The TouchBar API is currently experimental and may change or be
2823 * removed in future Electron releases.
2824 *
2825 * @experimental
2826 * @platform darwin
2827 */
2828 setTouchBar(touchBar: (TouchBar) | (null)): void;
2829 /**
2830 * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
2831 * will remove the vibrancy effect on the window.
2832 *
2833 * Note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
2834 * have been deprecated and will be removed in an upcoming version of macOS.
2835 *
2836 * @platform darwin
2837 */
2838 setVibrancy(type: (('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page')) | (null)): void;
2839 /**
2840 * Sets whether the window should be visible on all workspaces.
2841 *
2842**Note:** This API does nothing on Windows.
2843 */
2844 setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
2845 /**
2846 * Sets whether the window traffic light buttons should be visible.
2847 *
2848This cannot be called when `titleBarStyle` is set to `customButtonsOnHover`.
2849 *
2850 * @platform darwin
2851 */
2852 setWindowButtonVisibility(visible: boolean): void;
2853 /**
2854 * Shows and gives focus to the window.
2855 */
2856 show(): void;
2857 /**
2858 * Same as `webContents.showDefinitionForSelection()`.
2859 *
2860 * @platform darwin
2861 */
2862 showDefinitionForSelection(): void;
2863 /**
2864 * Shows the window but doesn't focus on it.
2865 */
2866 showInactive(): void;
2867 /**
2868 * Toggles the visibility of the tab bar if native tabs are enabled and there is
2869 * only one tab in the current window.
2870 *
2871 * @platform darwin
2872 */
2873 toggleTabBar(): void;
2874 /**
2875 * Unhooks all of the window messages.
2876 *
2877 * @platform win32
2878 */
2879 unhookAllWindowMessages(): void;
2880 /**
2881 * Unhook the window message.
2882 *
2883 * @platform win32
2884 */
2885 unhookWindowMessage(message: number): void;
2886 /**
2887 * Unmaximizes the window.
2888 */
2889 unmaximize(): void;
2890 autoHideMenuBar: boolean;
2891 closable: boolean;
2892 excludedFromShownWindowsMenu: boolean;
2893 fullScreenable: boolean;
2894 readonly id: number;
2895 maximizable: boolean;
2896 minimizable: boolean;
2897 movable: boolean;
2898 resizable: boolean;
2899 readonly webContents: WebContents;
2900 }
2901
2902 class BrowserWindowProxy {
2903
2904 // Docs: http://electronjs.org/docs/api/browser-window-proxy
2905
2906 /**
2907 * Removes focus from the child window.
2908 */
2909 blur(): void;
2910 /**
2911 * Forcefully closes the child window without calling its unload event.
2912 */
2913 close(): void;
2914 /**
2915 * Evaluates the code in the child window.
2916 */
2917 eval(code: string): void;
2918 /**
2919 * Focuses the child window (brings the window to front).
2920 */
2921 focus(): void;
2922 /**
2923 * Sends a message to the child window with the specified origin or `*` for no
2924 * origin preference.
2925 *
2926 * In addition to these methods, the child window implements `window.opener` object
2927 * with no properties and a single method.
2928 */
2929 postMessage(message: any, targetOrigin: string): void;
2930 /**
2931 * Invokes the print dialog on the child window.
2932 */
2933 print(): void;
2934 closed: boolean;
2935 }
2936
2937 interface Certificate {
2938
2939 // Docs: http://electronjs.org/docs/api/structures/certificate
2940
2941 /**
2942 * PEM encoded data
2943 */
2944 data: string;
2945 /**
2946 * Fingerprint of the certificate
2947 */
2948 fingerprint: string;
2949 /**
2950 * Issuer principal
2951 */
2952 issuer: CertificatePrincipal;
2953 /**
2954 * Issuer certificate (if not self-signed)
2955 */
2956 issuerCert: Certificate;
2957 /**
2958 * Issuer's Common Name
2959 */
2960 issuerName: string;
2961 /**
2962 * Hex value represented string
2963 */
2964 serialNumber: string;
2965 /**
2966 * Subject principal
2967 */
2968 subject: CertificatePrincipal;
2969 /**
2970 * Subject's Common Name
2971 */
2972 subjectName: string;
2973 /**
2974 * End date of the certificate being valid in seconds
2975 */
2976 validExpiry: number;
2977 /**
2978 * Start date of the certificate being valid in seconds
2979 */
2980 validStart: number;
2981 }
2982
2983 interface CertificatePrincipal {
2984
2985 // Docs: http://electronjs.org/docs/api/structures/certificate-principal
2986
2987 /**
2988 * Common Name.
2989 */
2990 commonName: string;
2991 /**
2992 * Country or region.
2993 */
2994 country: string;
2995 /**
2996 * Locality.
2997 */
2998 locality: string;
2999 /**
3000 * Organization names.
3001 */
3002 organizations: string[];
3003 /**
3004 * Organization Unit names.
3005 */
3006 organizationUnits: string[];
3007 /**
3008 * State or province.
3009 */
3010 state: string;
3011 }
3012
3013 class ClientRequest extends NodeJS.EventEmitter {
3014
3015 // Docs: http://electronjs.org/docs/api/client-request
3016
3017 /**
3018 * Emitted when the `request` is aborted. The `abort` event will not be fired if
3019 * the `request` is already closed.
3020 */
3021 on(event: 'abort', listener: Function): this;
3022 once(event: 'abort', listener: Function): this;
3023 addListener(event: 'abort', listener: Function): this;
3024 removeListener(event: 'abort', listener: Function): this;
3025 /**
3026 * Emitted as the last event in the HTTP request-response transaction. The `close`
3027 * event indicates that no more events will be emitted on either the `request` or
3028 * `response` objects.
3029 */
3030 on(event: 'close', listener: Function): this;
3031 once(event: 'close', listener: Function): this;
3032 addListener(event: 'close', listener: Function): this;
3033 removeListener(event: 'close', listener: Function): this;
3034 /**
3035 * Emitted when the `net` module fails to issue a network request. Typically when
3036 * the `request` object emits an `error` event, a `close` event will subsequently
3037 * follow and no response object will be provided.
3038 */
3039 on(event: 'error', listener: (
3040 /**
3041 * an error object providing some information about the failure.
3042 */
3043 error: Error) => void): this;
3044 once(event: 'error', listener: (
3045 /**
3046 * an error object providing some information about the failure.
3047 */
3048 error: Error) => void): this;
3049 addListener(event: 'error', listener: (
3050 /**
3051 * an error object providing some information about the failure.
3052 */
3053 error: Error) => void): this;
3054 removeListener(event: 'error', listener: (
3055 /**
3056 * an error object providing some information about the failure.
3057 */
3058 error: Error) => void): this;
3059 /**
3060 * Emitted just after the last chunk of the `request`'s data has been written into
3061 * the `request` object.
3062 */
3063 on(event: 'finish', listener: Function): this;
3064 once(event: 'finish', listener: Function): this;
3065 addListener(event: 'finish', listener: Function): this;
3066 removeListener(event: 'finish', listener: Function): this;
3067 /**
3068 * Emitted when an authenticating proxy is asking for user credentials.
3069 *
3070 * The `callback` function is expected to be called back with user credentials:
3071 *
3072 * * `username` String
3073 * * `password` String
3074 *
3075 * Providing empty credentials will cancel the request and report an authentication
3076 * error on the response object:
3077 */
3078 on(event: 'login', listener: (authInfo: AuthInfo,
3079 callback: (username?: string, password?: string) => void) => void): this;
3080 once(event: 'login', listener: (authInfo: AuthInfo,
3081 callback: (username?: string, password?: string) => void) => void): this;
3082 addListener(event: 'login', listener: (authInfo: AuthInfo,
3083 callback: (username?: string, password?: string) => void) => void): this;
3084 removeListener(event: 'login', listener: (authInfo: AuthInfo,
3085 callback: (username?: string, password?: string) => void) => void): this;
3086 /**
3087 * Emitted when the server returns a redirect response (e.g. 301 Moved
3088 * Permanently). Calling `request.followRedirect` will continue with the
3089 * redirection. If this event is handled, `request.followRedirect` must be called
3090 * **synchronously**, otherwise the request will be cancelled.
3091 */
3092 on(event: 'redirect', listener: (statusCode: number,
3093 method: string,
3094 redirectUrl: string,
3095 responseHeaders: Record<string, string[]>) => void): this;
3096 once(event: 'redirect', listener: (statusCode: number,
3097 method: string,
3098 redirectUrl: string,
3099 responseHeaders: Record<string, string[]>) => void): this;
3100 addListener(event: 'redirect', listener: (statusCode: number,
3101 method: string,
3102 redirectUrl: string,
3103 responseHeaders: Record<string, string[]>) => void): this;
3104 removeListener(event: 'redirect', listener: (statusCode: number,
3105 method: string,
3106 redirectUrl: string,
3107 responseHeaders: Record<string, string[]>) => void): this;
3108 on(event: 'response', listener: (
3109 /**
3110 * An object representing the HTTP response message.
3111 */
3112 response: IncomingMessage) => void): this;
3113 once(event: 'response', listener: (
3114 /**
3115 * An object representing the HTTP response message.
3116 */
3117 response: IncomingMessage) => void): this;
3118 addListener(event: 'response', listener: (
3119 /**
3120 * An object representing the HTTP response message.
3121 */
3122 response: IncomingMessage) => void): this;
3123 removeListener(event: 'response', listener: (
3124 /**
3125 * An object representing the HTTP response message.
3126 */
3127 response: IncomingMessage) => void): this;
3128 /**
3129 * ClientRequest
3130 */
3131 constructor(options: (ClientRequestConstructorOptions) | (string));
3132 /**
3133 * Cancels an ongoing HTTP transaction. If the request has already emitted the
3134 * `close` event, the abort operation will have no effect. Otherwise an ongoing
3135 * event will emit `abort` and `close` events. Additionally, if there is an ongoing
3136 * response object,it will emit the `aborted` event.
3137 */
3138 abort(): void;
3139 /**
3140 * Sends the last chunk of the request data. Subsequent write or end operations
3141 * will not be allowed. The `finish` event is emitted just after the end operation.
3142 */
3143 end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): void;
3144 /**
3145 * Continues any pending redirection. Can only be called during a `'redirect'`
3146 * event.
3147 */
3148 followRedirect(): void;
3149 /**
3150 * The value of a previously set extra header name.
3151 */
3152 getHeader(name: string): string;
3153 /**
3154 * * `active` Boolean - Whether the request is currently active. If this is false
3155 * no other properties will be set
3156 * * `started` Boolean - Whether the upload has started. If this is false both
3157 * `current` and `total` will be set to 0.
3158 * * `current` Integer - The number of bytes that have been uploaded so far
3159 * * `total` Integer - The number of bytes that will be uploaded this request
3160 *
3161 * You can use this method in conjunction with `POST` requests to get the progress
3162 * of a file upload or other data transfer.
3163 */
3164 getUploadProgress(): UploadProgress;
3165 /**
3166 * Removes a previously set extra header name. This method can be called only
3167 * before first write. Trying to call it after the first write will throw an error.
3168 */
3169 removeHeader(name: string): void;
3170 /**
3171 * Adds an extra HTTP header. The header name will be issued as-is without
3172 * lowercasing. It can be called only before first write. Calling this method after
3173 * the first write will throw an error. If the passed value is not a `String`, its
3174 * `toString()` method will be called to obtain the final value.
3175 */
3176 setHeader(name: string, value: string): void;
3177 /**
3178 * `callback` is essentially a dummy function introduced in the purpose of keeping
3179 * similarity with the Node.js API. It is called asynchronously in the next tick
3180 * after `chunk` content have been delivered to the Chromium networking layer.
3181 * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
3182 * content have been flushed on the wire before `callback` is called.
3183 *
3184 * Adds a chunk of data to the request body. The first write operation may cause
3185 * the request headers to be issued on the wire. After the first write operation,
3186 * it is not allowed to add or remove a custom header.
3187 */
3188 write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
3189 chunkedEncoding: boolean;
3190 }
3191
3192 interface Clipboard {
3193
3194 // Docs: http://electronjs.org/docs/api/clipboard
3195
3196 /**
3197 * An array of supported formats for the clipboard `type`.
3198 */
3199 availableFormats(type?: 'selection' | 'clipboard'): string[];
3200 /**
3201 * Clears the clipboard content.
3202 */
3203 clear(type?: 'selection' | 'clipboard'): void;
3204 /**
3205 * Whether the clipboard supports the specified `format`.
3206 *
3207 * @experimental
3208 */
3209 has(format: string, type?: 'selection' | 'clipboard'): boolean;
3210 /**
3211 * Reads `format` type from the clipboard.
3212 *
3213 * @experimental
3214 */
3215 read(format: string): string;
3216 /**
3217 * * `title` String
3218 * * `url` String
3219 *
3220 * Returns an Object containing `title` and `url` keys representing the bookmark in
3221 * the clipboard. The `title` and `url` values will be empty strings when the
3222 * bookmark is unavailable.
3223 *
3224 * @platform darwin,win32
3225 */
3226 readBookmark(): ReadBookmark;
3227 /**
3228 * Reads `format` type from the clipboard.
3229 *
3230 * @experimental
3231 */
3232 readBuffer(format: string): Buffer;
3233 /**
3234 * The text on the find pasteboard, which is the pasteboard that holds information
3235 * about the current state of the active application’s find panel.
3236 *
3237 * This method uses synchronous IPC when called from the renderer process. The
3238 * cached value is reread from the find pasteboard whenever the application is
3239 * activated.
3240 *
3241 * @platform darwin
3242 */
3243 readFindText(): string;
3244 /**
3245 * The content in the clipboard as markup.
3246 */
3247 readHTML(type?: 'selection' | 'clipboard'): string;
3248 /**
3249 * The image content in the clipboard.
3250 */
3251 readImage(type?: 'selection' | 'clipboard'): NativeImage;
3252 /**
3253 * The content in the clipboard as RTF.
3254 */
3255 readRTF(type?: 'selection' | 'clipboard'): string;
3256 /**
3257 * The content in the clipboard as plain text.
3258 */
3259 readText(type?: 'selection' | 'clipboard'): string;
3260 /**
3261 * Writes `data` to the clipboard.
3262 */
3263 write(data: Data, type?: 'selection' | 'clipboard'): void;
3264 /**
3265 * Writes the `title` and `url` into the clipboard as a bookmark.
3266 *
3267 * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
3268 * can use `clipboard.write` to write both a bookmark and fallback text to the
3269 * clipboard.
3270 *
3271 * @platform darwin,win32
3272 */
3273 writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
3274 /**
3275 * Writes the `buffer` into the clipboard as `format`.
3276 *
3277 * @experimental
3278 */
3279 writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
3280 /**
3281 * Writes the `text` into the find pasteboard (the pasteboard that holds
3282 * information about the current state of the active application’s find panel) as
3283 * plain text. This method uses synchronous IPC when called from the renderer
3284 * process.
3285 *
3286 * @platform darwin
3287 */
3288 writeFindText(text: string): void;
3289 /**
3290 * Writes `markup` to the clipboard.
3291 */
3292 writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
3293 /**
3294 * Writes `image` to the clipboard.
3295 */
3296 writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
3297 /**
3298 * Writes the `text` into the clipboard in RTF.
3299 */
3300 writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
3301 /**
3302 * Writes the `text` into the clipboard as plain text.
3303 */
3304 writeText(text: string, type?: 'selection' | 'clipboard'): void;
3305 }
3306
3307 class CommandLine {
3308
3309 // Docs: http://electronjs.org/docs/api/command-line
3310
3311 /**
3312 * Append an argument to Chromium's command line. The argument will be quoted
3313 * correctly. Switches will precede arguments regardless of appending order.
3314 *
3315 * If you're appending an argument like `--switch=value`, consider using
3316 * `appendSwitch('switch', 'value')` instead.
3317 *
3318 * **Note:** This will not affect `process.argv`. The intended usage of this
3319 * function is to control Chromium's behavior.
3320 */
3321 appendArgument(value: string): void;
3322 /**
3323 * Append a switch (with optional `value`) to Chromium's command line.
3324 *
3325 * **Note:** This will not affect `process.argv`. The intended usage of this
3326 * function is to control Chromium's behavior.
3327 */
3328 appendSwitch(the_switch: string, value?: string): void;
3329 /**
3330 * The command-line switch value.
3331 *
3332 * **Note:** When the switch is not present or has no value, it returns empty
3333 * string.
3334 */
3335 getSwitchValue(the_switch: string): string;
3336 /**
3337 * Whether the command-line switch is present.
3338 */
3339 hasSwitch(the_switch: string): boolean;
3340 }
3341
3342 interface ContentTracing {
3343
3344 // Docs: http://electronjs.org/docs/api/content-tracing
3345
3346 /**
3347 * resolves with an array of category groups once all child processes have
3348 * acknowledged the `getCategories` request
3349 *
3350 * Get a set of category groups. The category groups can change as new code paths
3351 * are reached. See also the list of built-in tracing categories.
3352 */
3353 getCategories(): Promise<string[]>;
3354 /**
3355 * Resolves with an object containing the `value` and `percentage` of trace buffer
3356 * maximum usage
3357 *
3358 * * `value` Number
3359 * * `percentage` Number
3360 *
3361 * Get the maximum usage across processes of trace buffer as a percentage of the
3362 * full state.
3363 */
3364 getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
3365 /**
3366 * resolved once all child processes have acknowledged the `startRecording`
3367 * request.
3368 *
3369 * Start recording on all processes.
3370 *
3371 * Recording begins immediately locally and asynchronously on child processes as
3372 * soon as they receive the EnableRecording request.
3373 *
3374 * If a recording is already running, the promise will be immediately resolved, as
3375 * only one trace operation can be in progress at a time.
3376 */
3377 startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
3378 /**
3379 * resolves with a path to a file that contains the traced data once all child
3380 * processes have acknowledged the `stopRecording` request
3381 *
3382 * Stop recording on all processes.
3383 *
3384 * Child processes typically cache trace data and only rarely flush and send trace
3385 * data back to the main process. This helps to minimize the runtime overhead of
3386 * tracing since sending trace data over IPC can be an expensive operation. So, to
3387 * end tracing, Chromium asynchronously asks all child processes to flush any
3388 * pending trace data.
3389 *
3390 * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
3391 * or not provided, trace data will be written to a temporary file, and the path
3392 * will be returned in the promise.
3393 */
3394 stopRecording(resultFilePath?: string): Promise<string>;
3395 }
3396
3397 interface ContextBridge extends NodeJS.EventEmitter {
3398
3399 // Docs: http://electronjs.org/docs/api/context-bridge
3400
3401 exposeInMainWorld(apiKey: string, api: Record<string, any>): void;
3402 }
3403
3404 interface Cookie {
3405
3406 // Docs: http://electronjs.org/docs/api/structures/cookie
3407
3408 /**
3409 * The domain of the cookie; this will be normalized with a preceding dot so that
3410 * it's also valid for subdomains.
3411 */
3412 domain?: string;
3413 /**
3414 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
3415 * Not provided for session cookies.
3416 */
3417 expirationDate?: number;
3418 /**
3419 * Whether the cookie is a host-only cookie; this will only be `true` if no domain
3420 * was passed.
3421 */
3422 hostOnly?: boolean;
3423 /**
3424 * Whether the cookie is marked as HTTP only.
3425 */
3426 httpOnly?: boolean;
3427 /**
3428 * The name of the cookie.
3429 */
3430 name: string;
3431 /**
3432 * The path of the cookie.
3433 */
3434 path?: string;
3435 /**
3436 * Whether the cookie is marked as secure.
3437 */
3438 secure?: boolean;
3439 /**
3440 * Whether the cookie is a session cookie or a persistent cookie with an expiration
3441 * date.
3442 */
3443 session?: boolean;
3444 /**
3445 * The value of the cookie.
3446 */
3447 value: string;
3448 }
3449
3450 class Cookies extends NodeJS.EventEmitter {
3451
3452 // Docs: http://electronjs.org/docs/api/cookies
3453
3454 /**
3455 * Emitted when a cookie is changed because it was added, edited, removed, or
3456 * expired.
3457 */
3458 on(event: 'changed', listener: Function): this;
3459 once(event: 'changed', listener: Function): this;
3460 addListener(event: 'changed', listener: Function): this;
3461 removeListener(event: 'changed', listener: Function): this;
3462 /**
3463 * A promise which resolves when the cookie store has been flushed
3464 *
3465Writes any unwritten cookies data to disk.
3466 */
3467 flushStore(): Promise<void>;
3468 /**
3469 * A promise which resolves an array of cookie objects.
3470 *
3471 * Sends a request to get all cookies matching `filter`, and resolves a promise
3472 * with the response.
3473 */
3474 get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
3475 /**
3476 * A promise which resolves when the cookie has been removed
3477 *
3478Removes the cookies matching `url` and `name`
3479 */
3480 remove(url: string, name: string): Promise<void>;
3481 /**
3482 * A promise which resolves when the cookie has been set
3483 *
3484Sets a cookie with `details`.
3485 */
3486 set(details: CookiesSetDetails): Promise<void>;
3487 }
3488
3489 interface CPUUsage {
3490
3491 // Docs: http://electronjs.org/docs/api/structures/cpu-usage
3492
3493 /**
3494 * The number of average idle CPU wakeups per second since the last call to
3495 * getCPUUsage. First call returns 0. Will always return 0 on Windows.
3496 */
3497 idleWakeupsPerSecond: number;
3498 /**
3499 * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
3500 */
3501 percentCPUUsage: number;
3502 }
3503
3504 interface CrashReport {
3505
3506 // Docs: http://electronjs.org/docs/api/structures/crash-report
3507
3508 date: Date;
3509 id: string;
3510 }
3511
3512 interface CrashReporter {
3513
3514 // Docs: http://electronjs.org/docs/api/crash-reporter
3515
3516 /**
3517 * Set an extra parameter to be sent with the crash report. The values specified
3518 * here will be sent in addition to any values set via the `extra` option when
3519 * `start` was called. This API is only available on macOS and windows, if you need
3520 * to add/update extra parameters on Linux after your first call to `start` you can
3521 * call `start` again with the updated `extra` options.
3522 *
3523 * @platform darwin,win32
3524 */
3525 addExtraParameter(key: string, value: string): void;
3526 /**
3527 * Returns the date and ID of the last crash report. Only crash reports that have
3528 * been uploaded will be returned; even if a crash report is present on disk it
3529 * will not be returned until it is uploaded. In the case that there are no
3530 * uploaded reports, `null` is returned.
3531 */
3532 getLastCrashReport(): CrashReport;
3533 /**
3534 * See all of the current parameters being passed to the crash reporter.
3535 */
3536 getParameters(): void;
3537 /**
3538 * Returns all uploaded crash reports. Each report contains the date and uploaded
3539 * ID.
3540 */
3541 getUploadedReports(): CrashReport[];
3542 /**
3543 * Whether reports should be submitted to the server. Set through the `start`
3544 * method or `setUploadToServer`.
3545 *
3546**Note:** This API can only be called from the main process.
3547 */
3548 getUploadToServer(): boolean;
3549 /**
3550 * Remove a extra parameter from the current set of parameters so that it will not
3551 * be sent with the crash report.
3552 *
3553 * @platform darwin,win32
3554 */
3555 removeExtraParameter(key: string): void;
3556 /**
3557 * This would normally be controlled by user preferences. This has no effect if
3558 * called before `start` is called.
3559 *
3560**Note:** This API can only be called from the main process.
3561 */
3562 setUploadToServer(uploadToServer: boolean): void;
3563 /**
3564 * You are required to call this method before using any other `crashReporter` APIs
3565 * and in each process (main/renderer) from which you want to collect crash
3566 * reports. You can pass different options to `crashReporter.start` when calling
3567 * from different processes.
3568 *
3569 * **Note** Child processes created via the `child_process` module will not have
3570 * access to the Electron modules. Therefore, to collect crash reports from them,
3571 * use `process.crashReporter.start` instead. Pass the same options as above along
3572 * with an additional one called `crashesDirectory` that should point to a
3573 * directory to store the crash reports temporarily. You can test this out by
3574 * calling `process.crash()` to crash the child process.
3575 *
3576 * **Note:** If you need send additional/updated `extra` parameters after your
3577 * first call `start` you can call `addExtraParameter` on macOS or call `start`
3578 * again with the new/updated `extra` parameters on Linux and Windows.
3579 *
3580 * **Note:** On macOS and windows, Electron uses a new `crashpad` client for crash
3581 * collection and reporting. If you want to enable crash reporting, initializing
3582 * `crashpad` from the main process using `crashReporter.start` is required
3583 * regardless of which process you want to collect crashes from. Once initialized
3584 * this way, the crashpad handler collects crashes from all processes. You still
3585 * have to call `crashReporter.start` from the renderer or child process, otherwise
3586 * crashes from them will get reported without `companyName`, `productName` or any
3587 * of the `extra` information.
3588 */
3589 start(options: CrashReporterStartOptions): void;
3590 }
3591
3592 interface CustomScheme {
3593
3594 // Docs: http://electronjs.org/docs/api/structures/custom-scheme
3595
3596 privileges?: Privileges;
3597 /**
3598 * Custom schemes to be registered with options.
3599 */
3600 scheme: string;
3601 }
3602
3603 class Debugger extends NodeJS.EventEmitter {
3604
3605 // Docs: http://electronjs.org/docs/api/debugger
3606
3607 /**
3608 * Emitted when the debugging session is terminated. This happens either when
3609 * `webContents` is closed or devtools is invoked for the attached `webContents`.
3610 */
3611 on(event: 'detach', listener: (event: Event,
3612 /**
3613 * Reason for detaching debugger.
3614 */
3615 reason: string) => void): this;
3616 once(event: 'detach', listener: (event: Event,
3617 /**
3618 * Reason for detaching debugger.
3619 */
3620 reason: string) => void): this;
3621 addListener(event: 'detach', listener: (event: Event,
3622 /**
3623 * Reason for detaching debugger.
3624 */
3625 reason: string) => void): this;
3626 removeListener(event: 'detach', listener: (event: Event,
3627 /**
3628 * Reason for detaching debugger.
3629 */
3630 reason: string) => void): this;
3631 /**
3632 * Emitted whenever the debugging target issues an instrumentation event.
3633 */
3634 on(event: 'message', listener: (event: Event,
3635 /**
3636 * Method name.
3637 */
3638 method: string,
3639 /**
3640 * Event parameters defined by the 'parameters' attribute in the remote debugging
3641 * protocol.
3642 */
3643 params: unknown) => void): this;
3644 once(event: 'message', listener: (event: Event,
3645 /**
3646 * Method name.
3647 */
3648 method: string,
3649 /**
3650 * Event parameters defined by the 'parameters' attribute in the remote debugging
3651 * protocol.
3652 */
3653 params: unknown) => void): this;
3654 addListener(event: 'message', listener: (event: Event,
3655 /**
3656 * Method name.
3657 */
3658 method: string,
3659 /**
3660 * Event parameters defined by the 'parameters' attribute in the remote debugging
3661 * protocol.
3662 */
3663 params: unknown) => void): this;
3664 removeListener(event: 'message', listener: (event: Event,
3665 /**
3666 * Method name.
3667 */
3668 method: string,
3669 /**
3670 * Event parameters defined by the 'parameters' attribute in the remote debugging
3671 * protocol.
3672 */
3673 params: unknown) => void): this;
3674 /**
3675 * Attaches the debugger to the `webContents`.
3676 */
3677 attach(protocolVersion?: string): void;
3678 /**
3679 * Detaches the debugger from the `webContents`.
3680 */
3681 detach(): void;
3682 /**
3683 * Whether a debugger is attached to the `webContents`.
3684 */
3685 isAttached(): boolean;
3686 /**
3687 * A promise that resolves with the response defined by the 'returns' attribute of
3688 * the command description in the remote debugging protocol or is rejected
3689 * indicating the failure of the command.
3690 *
3691Send given command to the debugging target.
3692 */
3693 sendCommand(method: string, commandParams?: any): Promise<any>;
3694 }
3695
3696 interface DesktopCapturer {
3697
3698 // Docs: http://electronjs.org/docs/api/desktop-capturer
3699
3700 /**
3701 * Resolves with an array of `DesktopCapturerSource` objects, each
3702 * `DesktopCapturerSource` represents a screen or an individual window that can be
3703 * captured.
3704 */
3705 getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
3706 }
3707
3708 interface DesktopCapturerSource {
3709
3710 // Docs: http://electronjs.org/docs/api/structures/desktop-capturer-source
3711
3712 /**
3713 * An icon image of the application that owns the window or null if the source has
3714 * a type screen. The size of the icon is not known in advance and depends on what
3715 * the the application provides.
3716 */
3717 appIcon: NativeImage;
3718 /**
3719 * A unique identifier that will correspond to the `id` of the matching Display
3720 * returned by the Screen API. On some platforms, this is equivalent to the `XX`
3721 * portion of the `id` field above and on others it will differ. It will be an
3722 * empty string if not available.
3723 */
3724 display_id: string;
3725 /**
3726 * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
3727 * constraint when calling [`navigator.webkitGetUserMedia`]. The format of the
3728 * identifier will be `window:XX` or `screen:XX`, where `XX` is a random generated
3729 * number.
3730 */
3731 id: string;
3732 /**
3733 * A screen source will be named either `Entire Screen` or `Screen <index>`, while
3734 * the name of a window source will match the window title.
3735 */
3736 name: string;
3737 /**
3738 * A thumbnail image. **Note:** There is no guarantee that the size of the
3739 * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
3740 * to `desktopCapturer.getSources`. The actual size depends on the scale of the
3741 * screen or window.
3742 */
3743 thumbnail: NativeImage;
3744 }
3745
3746 interface Dialog {
3747
3748 // Docs: http://electronjs.org/docs/api/dialog
3749
3750 /**
3751 * resolves when the certificate trust dialog is shown.
3752 *
3753 * On macOS, this displays a modal dialog that shows a message and certificate
3754 * information, and gives the user the option of trusting/importing the
3755 * certificate. If you provide a `browserWindow` argument the dialog will be
3756 * attached to the parent window, making it modal.
3757 *
3758 * On Windows the options are more limited, due to the Win32 APIs used:
3759 *
3760 * * The `message` argument is not used, as the OS provides its own confirmation
3761 * dialog.
3762 * * The `browserWindow` argument is ignored since it is not possible to make this
3763 * confirmation dialog modal.
3764 *
3765 * @platform darwin,win32
3766 */
3767 showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
3768 /**
3769 * resolves when the certificate trust dialog is shown.
3770 *
3771 * On macOS, this displays a modal dialog that shows a message and certificate
3772 * information, and gives the user the option of trusting/importing the
3773 * certificate. If you provide a `browserWindow` argument the dialog will be
3774 * attached to the parent window, making it modal.
3775 *
3776 * On Windows the options are more limited, due to the Win32 APIs used:
3777 *
3778 * * The `message` argument is not used, as the OS provides its own confirmation
3779 * dialog.
3780 * * The `browserWindow` argument is ignored since it is not possible to make this
3781 * confirmation dialog modal.
3782 *
3783 * @platform darwin,win32
3784 */
3785 showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
3786 /**
3787 * Displays a modal dialog that shows an error message.
3788 *
3789 * This API can be called safely before the `ready` event the `app` module emits,
3790 * it is usually used to report errors in early stage of startup. If called before
3791 * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
3792 * dialog will appear.
3793 */
3794 showErrorBox(title: string, content: string): void;
3795 /**
3796 * resolves with a promise containing the following properties:
3797 *
3798 * * `response` Number - The index of the clicked button.
3799 * * `checkboxChecked` Boolean - The checked state of the checkbox if
3800 * `checkboxLabel` was set. Otherwise `false`.
3801 *
3802 * Shows a message box, it will block the process until the message box is closed.
3803 *
3804 * The `browserWindow` argument allows the dialog to attach itself to a parent
3805 * window, making it modal.
3806 */
3807 showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
3808 /**
3809 * resolves with a promise containing the following properties:
3810 *
3811 * * `response` Number - The index of the clicked button.
3812 * * `checkboxChecked` Boolean - The checked state of the checkbox if
3813 * `checkboxLabel` was set. Otherwise `false`.
3814 *
3815 * Shows a message box, it will block the process until the message box is closed.
3816 *
3817 * The `browserWindow` argument allows the dialog to attach itself to a parent
3818 * window, making it modal.
3819 */
3820 showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
3821 /**
3822 * the index of the clicked button.
3823 *
3824 * Shows a message box, it will block the process until the message box is closed.
3825 * It returns the index of the clicked button.
3826 *
3827 * The `browserWindow` argument allows the dialog to attach itself to a parent
3828 * window, making it modal.
3829 */
3830 showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
3831 /**
3832 * the index of the clicked button.
3833 *
3834 * Shows a message box, it will block the process until the message box is closed.
3835 * It returns the index of the clicked button.
3836 *
3837 * The `browserWindow` argument allows the dialog to attach itself to a parent
3838 * window, making it modal.
3839 */
3840 showMessageBoxSync(options: MessageBoxSyncOptions): number;
3841 /**
3842 * Resolve with an object containing the following:
3843 *
3844 * * `canceled` Boolean - whether or not the dialog was canceled.
3845 * * `filePaths` String[] - An array of file paths chosen by the user. If the
3846 * dialog is cancelled this will be an empty array.
3847 * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
3848 * `filePaths` array of base64 encoded strings which contains security scoped
3849 * bookmark data. `securityScopedBookmarks` must be enabled for this to be
3850 * populated.
3851 *
3852 * The `browserWindow` argument allows the dialog to attach itself to a parent
3853 * window, making it modal.
3854 *
3855 * The `filters` specifies an array of file types that can be displayed or selected
3856 * when you want to limit the user to a specific type. For example:
3857 *
3858 * The `extensions` array should contain extensions without wildcards or dots (e.g.
3859 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
3860 * `'*'` wildcard (no other wildcard is supported).
3861 *
3862 * **Note:** On Windows and Linux an open dialog can not be both a file selector
3863 * and a directory selector, so if you set `properties` to `['openFile',
3864 * 'openDirectory']` on these platforms, a directory selector will be shown.
3865 */
3866 showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
3867 /**
3868 * Resolve with an object containing the following:
3869 *
3870 * * `canceled` Boolean - whether or not the dialog was canceled.
3871 * * `filePaths` String[] - An array of file paths chosen by the user. If the
3872 * dialog is cancelled this will be an empty array.
3873 * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
3874 * `filePaths` array of base64 encoded strings which contains security scoped
3875 * bookmark data. `securityScopedBookmarks` must be enabled for this to be
3876 * populated.
3877 *
3878 * The `browserWindow` argument allows the dialog to attach itself to a parent
3879 * window, making it modal.
3880 *
3881 * The `filters` specifies an array of file types that can be displayed or selected
3882 * when you want to limit the user to a specific type. For example:
3883 *
3884 * The `extensions` array should contain extensions without wildcards or dots (e.g.
3885 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
3886 * `'*'` wildcard (no other wildcard is supported).
3887 *
3888 * **Note:** On Windows and Linux an open dialog can not be both a file selector
3889 * and a directory selector, so if you set `properties` to `['openFile',
3890 * 'openDirectory']` on these platforms, a directory selector will be shown.
3891 */
3892 showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
3893 /**
3894 * the file paths chosen by the user; if the dialog is cancelled it returns
3895 * `undefined`.
3896 *
3897 * The `browserWindow` argument allows the dialog to attach itself to a parent
3898 * window, making it modal.
3899 *
3900 * The `filters` specifies an array of file types that can be displayed or selected
3901 * when you want to limit the user to a specific type. For example:
3902 *
3903 * The `extensions` array should contain extensions without wildcards or dots (e.g.
3904 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
3905 * `'*'` wildcard (no other wildcard is supported).
3906 *
3907 * **Note:** On Windows and Linux an open dialog can not be both a file selector
3908 * and a directory selector, so if you set `properties` to `['openFile',
3909 * 'openDirectory']` on these platforms, a directory selector will be shown.
3910 */
3911 showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
3912 /**
3913 * the file paths chosen by the user; if the dialog is cancelled it returns
3914 * `undefined`.
3915 *
3916 * The `browserWindow` argument allows the dialog to attach itself to a parent
3917 * window, making it modal.
3918 *
3919 * The `filters` specifies an array of file types that can be displayed or selected
3920 * when you want to limit the user to a specific type. For example:
3921 *
3922 * The `extensions` array should contain extensions without wildcards or dots (e.g.
3923 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
3924 * `'*'` wildcard (no other wildcard is supported).
3925 *
3926 * **Note:** On Windows and Linux an open dialog can not be both a file selector
3927 * and a directory selector, so if you set `properties` to `['openFile',
3928 * 'openDirectory']` on these platforms, a directory selector will be shown.
3929 */
3930 showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
3931 /**
3932 * Resolve with an object containing the following:
3933 *
3934 * * `canceled` Boolean - whether or not the dialog was canceled.
3935 * * `filePath` String (optional) - If the dialog is canceled, this will be
3936 * `undefined`.
3937 * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
3938 * contains the security scoped bookmark data for the saved file.
3939 * `securityScopedBookmarks` must be enabled for this to be present.
3940 *
3941 * The `browserWindow` argument allows the dialog to attach itself to a parent
3942 * window, making it modal.
3943 *
3944 * The `filters` specifies an array of file types that can be displayed, see
3945 * `dialog.showOpenDialog` for an example.
3946 *
3947 * **Note:** On macOS, using the asynchronous version is recommended to avoid
3948 * issues when expanding and collapsing the dialog.
3949 */
3950 showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
3951 /**
3952 * Resolve with an object containing the following:
3953 *
3954 * * `canceled` Boolean - whether or not the dialog was canceled.
3955 * * `filePath` String (optional) - If the dialog is canceled, this will be
3956 * `undefined`.
3957 * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
3958 * contains the security scoped bookmark data for the saved file.
3959 * `securityScopedBookmarks` must be enabled for this to be present.
3960 *
3961 * The `browserWindow` argument allows the dialog to attach itself to a parent
3962 * window, making it modal.
3963 *
3964 * The `filters` specifies an array of file types that can be displayed, see
3965 * `dialog.showOpenDialog` for an example.
3966 *
3967 * **Note:** On macOS, using the asynchronous version is recommended to avoid
3968 * issues when expanding and collapsing the dialog.
3969 */
3970 showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
3971 /**
3972 * the path of the file chosen by the user; if the dialog is cancelled it returns
3973 * `undefined`.
3974 *
3975 * The `browserWindow` argument allows the dialog to attach itself to a parent
3976 * window, making it modal.
3977 *
3978 * The `filters` specifies an array of file types that can be displayed, see
3979 * `dialog.showOpenDialog` for an example.
3980 */
3981 showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined);
3982 /**
3983 * the path of the file chosen by the user; if the dialog is cancelled it returns
3984 * `undefined`.
3985 *
3986 * The `browserWindow` argument allows the dialog to attach itself to a parent
3987 * window, making it modal.
3988 *
3989 * The `filters` specifies an array of file types that can be displayed, see
3990 * `dialog.showOpenDialog` for an example.
3991 */
3992 showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined);
3993 }
3994
3995 interface Display {
3996
3997 // Docs: http://electronjs.org/docs/api/structures/display
3998
3999 /**
4000 * Can be `available`, `unavailable`, `unknown`.
4001 */
4002 accelerometerSupport: ('available' | 'unavailable' | 'unknown');
4003 bounds: Rectangle;
4004 /**
4005 * The number of bits per pixel.
4006 */
4007 colorDepth: number;
4008 /**
4009 * represent a color space (three-dimensional object which contains all realizable
4010 * color combinations) for the purpose of color conversions
4011 */
4012 colorSpace: string;
4013 /**
4014 * The number of bits per color component.
4015 */
4016 depthPerComponent: number;
4017 /**
4018 * Unique identifier associated with the display.
4019 */
4020 id: number;
4021 /**
4022 * `true` for an internal display and `false` for an external display
4023 */
4024 internal: boolean;
4025 /**
4026 * Whether or not the display is a monochrome display.
4027 */
4028 monochrome: boolean;
4029 /**
4030 * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
4031 */
4032 rotation: number;
4033 /**
4034 * Output device's pixel scale factor.
4035 */
4036 scaleFactor: number;
4037 size: Size;
4038 /**
4039 * Can be `available`, `unavailable`, `unknown`.
4040 */
4041 touchSupport: ('available' | 'unavailable' | 'unknown');
4042 workArea: Rectangle;
4043 workAreaSize: Size;
4044 }
4045
4046 class Dock {
4047
4048 // Docs: http://electronjs.org/docs/api/dock
4049
4050 /**
4051 * an ID representing the request.
4052 *
4053 * When `critical` is passed, the dock icon will bounce until either the
4054 * application becomes active or the request is canceled.
4055 *
4056 * When `informational` is passed, the dock icon will bounce for one second.
4057 * However, the request remains active until either the application becomes active
4058 * or the request is canceled.
4059 *
4060 * **Nota Bene:** This method can only be used while the app is not focused; when
4061 * the app is focused it will return -1.
4062 *
4063 * @platform darwin
4064 */
4065 bounce(type?: 'critical' | 'informational'): number;
4066 /**
4067 * Cancel the bounce of `id`.
4068 *
4069 * @platform darwin
4070 */
4071 cancelBounce(id: number): void;
4072 /**
4073 * Bounces the Downloads stack if the filePath is inside the Downloads folder.
4074 *
4075 * @platform darwin
4076 */
4077 downloadFinished(filePath: string): void;
4078 /**
4079 * The badge string of the dock.
4080 *
4081 * @platform darwin
4082 */
4083 getBadge(): string;
4084 /**
4085 * The application's [dock menu][dock-menu].
4086 *
4087 * @platform darwin
4088 */
4089 getMenu(): (Menu) | (null);
4090 /**
4091 * Hides the dock icon.
4092 *
4093 * @platform darwin
4094 */
4095 hide(): void;
4096 /**
4097 * Whether the dock icon is visible.
4098 *
4099 * @platform darwin
4100 */
4101 isVisible(): boolean;
4102 /**
4103 * Sets the string to be displayed in the dock’s badging area.
4104 *
4105 * @platform darwin
4106 */
4107 setBadge(text: string): void;
4108 /**
4109 * Sets the `image` associated with this dock icon.
4110 *
4111 * @platform darwin
4112 */
4113 setIcon(image: (NativeImage) | (string)): void;
4114 /**
4115 * Sets the application's [dock menu][dock-menu].
4116 *
4117 * @platform darwin
4118 */
4119 setMenu(menu: Menu): void;
4120 /**
4121 * Resolves when the dock icon is shown.
4122 *
4123 * @platform darwin
4124 */
4125 show(): Promise<void>;
4126 }
4127
4128 class DownloadItem extends NodeJS.EventEmitter {
4129
4130 // Docs: http://electronjs.org/docs/api/download-item
4131
4132 /**
4133 * Emitted when the download is in a terminal state. This includes a completed
4134 * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
4135 * download that can't be resumed.
4136 *
4137 * The `state` can be one of following:
4138 *
4139 * * `completed` - The download completed successfully.
4140 * * `cancelled` - The download has been cancelled.
4141 * * `interrupted` - The download has interrupted and can not resume.
4142 */
4143 on(event: 'done', listener: (event: Event,
4144 /**
4145 * Can be `completed`, `cancelled` or `interrupted`.
4146 */
4147 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4148 once(event: 'done', listener: (event: Event,
4149 /**
4150 * Can be `completed`, `cancelled` or `interrupted`.
4151 */
4152 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4153 addListener(event: 'done', listener: (event: Event,
4154 /**
4155 * Can be `completed`, `cancelled` or `interrupted`.
4156 */
4157 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4158 removeListener(event: 'done', listener: (event: Event,
4159 /**
4160 * Can be `completed`, `cancelled` or `interrupted`.
4161 */
4162 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4163 /**
4164 * Emitted when the download has been updated and is not done.
4165 *
4166 * The `state` can be one of following:
4167 *
4168 * * `progressing` - The download is in-progress.
4169 * * `interrupted` - The download has interrupted and can be resumed.
4170 */
4171 on(event: 'updated', listener: (event: Event,
4172 /**
4173 * Can be `progressing` or `interrupted`.
4174 */
4175 state: ('progressing' | 'interrupted')) => void): this;
4176 once(event: 'updated', listener: (event: Event,
4177 /**
4178 * Can be `progressing` or `interrupted`.
4179 */
4180 state: ('progressing' | 'interrupted')) => void): this;
4181 addListener(event: 'updated', listener: (event: Event,
4182 /**
4183 * Can be `progressing` or `interrupted`.
4184 */
4185 state: ('progressing' | 'interrupted')) => void): this;
4186 removeListener(event: 'updated', listener: (event: Event,
4187 /**
4188 * Can be `progressing` or `interrupted`.
4189 */
4190 state: ('progressing' | 'interrupted')) => void): this;
4191 /**
4192 * Cancels the download operation.
4193 */
4194 cancel(): void;
4195 /**
4196 * Whether the download can resume.
4197 */
4198 canResume(): boolean;
4199 /**
4200 * The Content-Disposition field from the response header.
4201 */
4202 getContentDisposition(): string;
4203 /**
4204 * ETag header value.
4205 */
4206 getETag(): string;
4207 /**
4208 * The file name of the download item.
4209 *
4210 * **Note:** The file name is not always the same as the actual one saved in local
4211 * disk. If user changes the file name in a prompted download saving dialog, the
4212 * actual name of saved file will be different.
4213 */
4214 getFilename(): string;
4215 /**
4216 * Last-Modified header value.
4217 */
4218 getLastModifiedTime(): string;
4219 /**
4220 * The files mime type.
4221 */
4222 getMimeType(): string;
4223 /**
4224 * The received bytes of the download item.
4225 */
4226 getReceivedBytes(): number;
4227 /**
4228 * Returns the object previously set by
4229 * `downloadItem.setSaveDialogOptions(options)`.
4230 */
4231 getSaveDialogOptions(): SaveDialogOptions;
4232 /**
4233 * The save path of the download item. This will be either the path set via
4234 * `downloadItem.setSavePath(path)` or the path selected from the shown save
4235 * dialog.
4236
4237**Deprecated: use the `savePath` property instead.**
4238 */
4239 getSavePath(): string;
4240 /**
4241 * Number of seconds since the UNIX epoch when the download was started.
4242 */
4243 getStartTime(): number;
4244 /**
4245 * The current state. Can be `progressing`, `completed`, `cancelled` or
4246 * `interrupted`.
4247 *
4248 * **Note:** The following methods are useful specifically to resume a `cancelled`
4249 * item when session is restarted.
4250 */
4251 getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
4252 /**
4253 * The total size in bytes of the download item.
4254 *
4255If the size is unknown, it returns 0.
4256 */
4257 getTotalBytes(): number;
4258 /**
4259 * The origin URL where the item is downloaded from.
4260 */
4261 getURL(): string;
4262 /**
4263 * The complete URL chain of the item including any redirects.
4264 */
4265 getURLChain(): string[];
4266 /**
4267 * Whether the download has user gesture.
4268 */
4269 hasUserGesture(): boolean;
4270 /**
4271 * Whether the download is paused.
4272 */
4273 isPaused(): boolean;
4274 /**
4275 * Pauses the download.
4276 */
4277 pause(): void;
4278 /**
4279 * Resumes the download that has been paused.
4280 *
4281 * **Note:** To enable resumable downloads the server you are downloading from must
4282 * support range requests and provide both `Last-Modified` and `ETag` header
4283 * values. Otherwise `resume()` will dismiss previously received bytes and restart
4284 * the download from the beginning.
4285 */
4286 resume(): void;
4287 /**
4288 * This API allows the user to set custom options for the save dialog that opens
4289 * for the download item by default. The API is only available in session's
4290 * `will-download` callback function.
4291 */
4292 setSaveDialogOptions(options: SaveDialogOptions): void;
4293 /**
4294 * The API is only available in session's `will-download` callback function. If
4295 * user doesn't set the save path via the API, Electron will use the original
4296 * routine to determine the save path; this usually prompts a save dialog.
4297 *
4298**Deprecated: use the `savePath` property instead.**
4299 */
4300 setSavePath(path: string): void;
4301 savePath: string;
4302 }
4303
4304 interface Event extends GlobalEvent {
4305
4306 // Docs: http://electronjs.org/docs/api/structures/event
4307
4308 preventDefault: (() => void);
4309 }
4310
4311 interface ExtensionInfo {
4312
4313 // Docs: http://electronjs.org/docs/api/structures/extension-info
4314
4315 name: string;
4316 version: string;
4317 }
4318
4319 interface FileFilter {
4320
4321 // Docs: http://electronjs.org/docs/api/structures/file-filter
4322
4323 extensions: string[];
4324 name: string;
4325 }
4326
4327 interface FilePathWithHeaders {
4328
4329 // Docs: http://electronjs.org/docs/api/structures/file-path-with-headers
4330
4331 /**
4332 * Additional headers to be sent.
4333 */
4334 headers?: Record<string, string>;
4335 /**
4336 * The path to the file to send.
4337 */
4338 path: string;
4339 }
4340
4341 interface GlobalShortcut {
4342
4343 // Docs: http://electronjs.org/docs/api/global-shortcut
4344
4345 /**
4346 * Whether this application has registered `accelerator`.
4347 *
4348 * When the accelerator is already taken by other applications, this call will
4349 * still return `false`. This behavior is intended by operating systems, since they
4350 * don't want applications to fight for global shortcuts.
4351 */
4352 isRegistered(accelerator: Accelerator): boolean;
4353 /**
4354 * Whether or not the shortcut was registered successfully.
4355 *
4356 * Registers a global shortcut of `accelerator`. The `callback` is called when the
4357 * registered shortcut is pressed by the user.
4358 *
4359 * When the accelerator is already taken by other applications, this call will
4360 * silently fail. This behavior is intended by operating systems, since they don't
4361 * want applications to fight for global shortcuts.
4362 *
4363 * The following accelerators will not be registered successfully on macOS 10.14
4364 * Mojave unless the app has been authorized as a trusted accessibility client:
4365 *
4366 * * "Media Play/Pause"
4367 * * "Media Next Track"
4368* "Media Previous Track"
4369* "Media Stop"
4370 */
4371 register(accelerator: Accelerator, callback: () => void): boolean;
4372 /**
4373 * Registers a global shortcut of all `accelerator` items in `accelerators`. The
4374 * `callback` is called when any of the registered shortcuts are pressed by the
4375 * user.
4376 *
4377 * When a given accelerator is already taken by other applications, this call will
4378 * silently fail. This behavior is intended by operating systems, since they don't
4379 * want applications to fight for global shortcuts.
4380 *
4381 * The following accelerators will not be registered successfully on macOS 10.14
4382 * Mojave unless the app has been authorized as a trusted accessibility client:
4383 *
4384 * * "Media Play/Pause"
4385 * * "Media Next Track"
4386* "Media Previous Track"
4387* "Media Stop"
4388 */
4389 registerAll(accelerators: string[], callback: () => void): void;
4390 /**
4391 * Unregisters the global shortcut of `accelerator`.
4392 */
4393 unregister(accelerator: Accelerator): void;
4394 /**
4395 * Unregisters all of the global shortcuts.
4396 */
4397 unregisterAll(): void;
4398 }
4399
4400 interface GPUFeatureStatus {
4401
4402 // Docs: http://electronjs.org/docs/api/structures/gpu-feature-status
4403
4404 /**
4405 * Canvas.
4406 */
4407 '2d_canvas': string;
4408 /**
4409 * Flash.
4410 */
4411 flash_3d: string;
4412 /**
4413 * Flash Stage3D.
4414 */
4415 flash_stage3d: string;
4416 /**
4417 * Flash Stage3D Baseline profile.
4418 */
4419 flash_stage3d_baseline: string;
4420 /**
4421 * Compositing.
4422 */
4423 gpu_compositing: string;
4424 /**
4425 * Multiple Raster Threads.
4426 */
4427 multiple_raster_threads: string;
4428 /**
4429 * Native GpuMemoryBuffers.
4430 */
4431 native_gpu_memory_buffers: string;
4432 /**
4433 * Rasterization.
4434 */
4435 rasterization: string;
4436 /**
4437 * Video Decode.
4438 */
4439 video_decode: string;
4440 /**
4441 * Video Encode.
4442 */
4443 video_encode: string;
4444 /**
4445 * VPx Video Decode.
4446 */
4447 vpx_decode: string;
4448 /**
4449 * WebGL.
4450 */
4451 webgl: string;
4452 /**
4453 * WebGL2.
4454 */
4455 webgl2: string;
4456 }
4457
4458 interface InAppPurchase extends NodeJS.EventEmitter {
4459
4460 // Docs: http://electronjs.org/docs/api/in-app-purchase
4461
4462 on(event: 'transactions-updated', listener: Function): this;
4463 once(event: 'transactions-updated', listener: Function): this;
4464 addListener(event: 'transactions-updated', listener: Function): this;
4465 removeListener(event: 'transactions-updated', listener: Function): this;
4466 /**
4467 * whether a user can make a payment.
4468 */
4469 canMakePayments(): boolean;
4470 /**
4471 * Completes all pending transactions.
4472 */
4473 finishAllTransactions(): void;
4474 /**
4475 * Completes the pending transactions corresponding to the date.
4476 */
4477 finishTransactionByDate(date: string): void;
4478 /**
4479 * Resolves with an array of `Product` objects.
4480 *
4481Retrieves the product descriptions.
4482 */
4483 getProducts(productIDs: string[]): Promise<Electron.Product[]>;
4484 /**
4485 * the path to the receipt.
4486 */
4487 getReceiptURL(): string;
4488 /**
4489 * Returns `true` if the product is valid and added to the payment queue.
4490 *
4491 * You should listen for the `transactions-updated` event as soon as possible and
4492 * certainly before you call `purchaseProduct`.
4493 */
4494 purchaseProduct(productID: string, quantity?: number): Promise<boolean>;
4495 }
4496
4497 class IncomingMessage extends NodeJS.EventEmitter {
4498
4499 // Docs: http://electronjs.org/docs/api/incoming-message
4500
4501 /**
4502 * Emitted when a request has been canceled during an ongoing HTTP transaction.
4503 */
4504 on(event: 'aborted', listener: Function): this;
4505 once(event: 'aborted', listener: Function): this;
4506 addListener(event: 'aborted', listener: Function): this;
4507 removeListener(event: 'aborted', listener: Function): this;
4508 /**
4509 * The `data` event is the usual method of transferring response data into
4510 * applicative code.
4511 */
4512 on(event: 'data', listener: (
4513 /**
4514 * A chunk of response body's data.
4515 */
4516 chunk: Buffer) => void): this;
4517 once(event: 'data', listener: (
4518 /**
4519 * A chunk of response body's data.
4520 */
4521 chunk: Buffer) => void): this;
4522 addListener(event: 'data', listener: (
4523 /**
4524 * A chunk of response body's data.
4525 */
4526 chunk: Buffer) => void): this;
4527 removeListener(event: 'data', listener: (
4528 /**
4529 * A chunk of response body's data.
4530 */
4531 chunk: Buffer) => void): this;
4532 /**
4533 * Indicates that response body has ended.
4534 */
4535 on(event: 'end', listener: Function): this;
4536 once(event: 'end', listener: Function): this;
4537 addListener(event: 'end', listener: Function): this;
4538 removeListener(event: 'end', listener: Function): this;
4539 /**
4540 * Returns:
4541 *
4542 * `error` Error - Typically holds an error string identifying failure root cause.
4543 *
4544 * Emitted when an error was encountered while streaming response data events. For
4545 * instance, if the server closes the underlying while the response is still
4546 * streaming, an `error` event will be emitted on the response object and a `close`
4547 * event will subsequently follow on the request object.
4548 */
4549 on(event: 'error', listener: Function): this;
4550 once(event: 'error', listener: Function): this;
4551 addListener(event: 'error', listener: Function): this;
4552 removeListener(event: 'error', listener: Function): this;
4553 headers: Record<string, string[]>;
4554 httpVersion: string;
4555 httpVersionMajor: number;
4556 httpVersionMinor: number;
4557 statusCode: number;
4558 statusMessage: string;
4559 }
4560
4561 interface InputEvent {
4562
4563 // Docs: http://electronjs.org/docs/api/structures/input-event
4564
4565 /**
4566 * An array of modifiers of the event, can be `shift`, `control`, `alt`, `meta`,
4567 * `isKeypad`, `isAutoRepeat`, `leftButtonDown`, `middleButtonDown`,
4568 * `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
4569 */
4570 modifiers: Array<'shift' | 'control' | 'alt' | 'meta' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
4571 }
4572
4573 interface IOCounters {
4574
4575 // Docs: http://electronjs.org/docs/api/structures/io-counters
4576
4577 /**
4578 * Then number of I/O other operations.
4579 */
4580 otherOperationCount: number;
4581 /**
4582 * Then number of I/O other transfers.
4583 */
4584 otherTransferCount: number;
4585 /**
4586 * The number of I/O read operations.
4587 */
4588 readOperationCount: number;
4589 /**
4590 * The number of I/O read transfers.
4591 */
4592 readTransferCount: number;
4593 /**
4594 * The number of I/O write operations.
4595 */
4596 writeOperationCount: number;
4597 /**
4598 * The number of I/O write transfers.
4599 */
4600 writeTransferCount: number;
4601 }
4602
4603 interface IpcMain extends NodeJS.EventEmitter {
4604
4605 // Docs: http://electronjs.org/docs/api/ipc-main
4606
4607 /**
4608 * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
4609 * renderer calls `ipcRenderer.invoke(channel, ...args)`.
4610 *
4611 * If `listener` returns a Promise, the eventual result of the promise will be
4612 * returned as a reply to the remote caller. Otherwise, the return value of the
4613 * listener will be used as the value of the reply.
4614 *
4615 * The `event` that is passed as the first argument to the handler is the same as
4616 * that passed to a regular event listener. It includes information about which
4617 * WebContents is the source of the invoke request.
4618 */
4619 handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
4620 /**
4621 * Handles a single `invoke`able IPC message, then removes the listener. See
4622 * `ipcMain.handle(channel, listener)`.
4623 */
4624 handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
4625 /**
4626 * Listens to `channel`, when a new message arrives `listener` would be called with
4627 * `listener(event, args...)`.
4628 */
4629 on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
4630 /**
4631 * Adds a one time `listener` function for the event. This `listener` is invoked
4632 * only the next time a message is sent to `channel`, after which it is removed.
4633 */
4634 once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
4635 /**
4636 * Removes listeners of the specified `channel`.
4637 */
4638 removeAllListeners(channel?: string): this;
4639 /**
4640 * Removes any handler for `channel`, if present.
4641 */
4642 removeHandler(channel: string): void;
4643 /**
4644 * Removes the specified `listener` from the listener array for the specified
4645 * `channel`.
4646 */
4647 removeListener(channel: string, listener: (...args: any[]) => void): this;
4648 }
4649
4650 interface IpcMainEvent extends Event {
4651
4652 // Docs: http://electronjs.org/docs/api/structures/ipc-main-event
4653
4654 /**
4655 * The ID of the renderer frame that sent this message
4656 */
4657 frameId: number;
4658 /**
4659 * A function that will send an IPC message to the renderer frame that sent the
4660 * original message that you are currently handling. You should use this method to
4661 * "reply" to the sent message in order to guarantee the reply will go to the
4662 * correct process and frame.
4663 */
4664 reply: Function;
4665 /**
4666 * Set this to the value to be returned in a synchronous message
4667 */
4668 returnValue: any;
4669 /**
4670 * Returns the `webContents` that sent the message
4671 */
4672 sender: WebContents;
4673 }
4674
4675 interface IpcMainInvokeEvent extends Event {
4676
4677 // Docs: http://electronjs.org/docs/api/structures/ipc-main-invoke-event
4678
4679 /**
4680 * The ID of the renderer frame that sent this message
4681 */
4682 frameId: number;
4683 /**
4684 * Returns the `webContents` that sent the message
4685 */
4686 sender: WebContents;
4687 }
4688
4689 interface IpcRenderer extends NodeJS.EventEmitter {
4690
4691 // Docs: http://electronjs.org/docs/api/ipc-renderer
4692
4693 /**
4694 * Resolves with the response from the main process.
4695 *
4696 * Send a message to the main process asynchronously via `channel` and expect an
4697 * asynchronous result. Arguments will be serialized as JSON internally and hence
4698 * no functions or prototype chain will be included.
4699 *
4700 * The main process should listen for `channel` with `ipcMain.handle()`.
4701 *
4702For example:
4703 */
4704 invoke(channel: string, ...args: any[]): Promise<any>;
4705 /**
4706 * Listens to `channel`, when a new message arrives `listener` would be called with
4707 * `listener(event, args...)`.
4708 */
4709 on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
4710 /**
4711 * Adds a one time `listener` function for the event. This `listener` is invoked
4712 * only the next time a message is sent to `channel`, after which it is removed.
4713 */
4714 once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
4715 /**
4716 * Removes all listeners, or those of the specified `channel`.
4717 */
4718 removeAllListeners(channel: string): this;
4719 /**
4720 * Removes the specified `listener` from the listener array for the specified
4721 * `channel`.
4722 */
4723 removeListener(channel: string, listener: (...args: any[]) => void): this;
4724 /**
4725 * Send a message to the main process asynchronously via `channel`, you can also
4726 * send arbitrary arguments. Arguments will be serialized as JSON internally and
4727 * hence no functions or prototype chain will be included.
4728 *
4729 * The main process handles it by listening for `channel` with the `ipcMain`
4730 * module.
4731 */
4732 send(channel: string, ...args: any[]): void;
4733 /**
4734 * The value sent back by the `ipcMain` handler.
4735 *
4736 * Send a message to the main process synchronously via `channel`, you can also
4737 * send arbitrary arguments. Arguments will be serialized in JSON internally and
4738 * hence no functions or prototype chain will be included.
4739 *
4740 * The main process handles it by listening for `channel` with `ipcMain` module,
4741 * and replies by setting `event.returnValue`.
4742 *
4743 * **Note:** Sending a synchronous message will block the whole renderer process,
4744 * unless you know what you are doing you should never use it.
4745 */
4746 sendSync(channel: string, ...args: any[]): any;
4747 /**
4748 * Sends a message to a window with `webContentsId` via `channel`.
4749 */
4750 sendTo(webContentsId: number, channel: string, ...args: any[]): void;
4751 /**
4752 * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
4753 * the host page instead of the main process.
4754 */
4755 sendToHost(channel: string, ...args: any[]): void;
4756 }
4757
4758 interface IpcRendererEvent extends Event {
4759
4760 // Docs: http://electronjs.org/docs/api/structures/ipc-renderer-event
4761
4762 /**
4763 * The `IpcRenderer` instance that emitted the event originally
4764 */
4765 sender: IpcRenderer;
4766 /**
4767 * The `webContents.id` that sent the message, you can call
4768 * `event.sender.sendTo(event.senderId, ...)` to reply to the message, see
4769 * ipcRenderer.sendTo for more information. This only applies to messages sent from
4770 * a different renderer. Messages sent directly from the main process set
4771 * `event.senderId` to `0`.
4772 */
4773 senderId: number;
4774 }
4775
4776 interface JumpListCategory {
4777
4778 // Docs: http://electronjs.org/docs/api/structures/jump-list-category
4779
4780 /**
4781 * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
4782 * should be omitted.
4783 */
4784 items?: JumpListItem[];
4785 /**
4786 * Must be set if `type` is `custom`, otherwise it should be omitted.
4787 */
4788 name?: string;
4789 /**
4790 * One of the following:
4791 */
4792 type?: ('tasks' | 'frequent' | 'recent' | 'custom');
4793 }
4794
4795 interface JumpListItem {
4796
4797 // Docs: http://electronjs.org/docs/api/structures/jump-list-item
4798
4799 /**
4800 * The command line arguments when `program` is executed. Should only be set if
4801 * `type` is `task`.
4802 */
4803 args?: string;
4804 /**
4805 * Description of the task (displayed in a tooltip). Should only be set if `type`
4806 * is `task`.
4807 */
4808 description?: string;
4809 /**
4810 * The index of the icon in the resource file. If a resource file contains multiple
4811 * icons this value can be used to specify the zero-based index of the icon that
4812 * should be displayed for this task. If a resource file contains only one icon,
4813 * this property should be set to zero.
4814 */
4815 iconIndex?: number;
4816 /**
4817 * The absolute path to an icon to be displayed in a Jump List, which can be an
4818 * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
4819 * can usually specify `process.execPath` to show the program icon.
4820 */
4821 iconPath?: string;
4822 /**
4823 * Path of the file to open, should only be set if `type` is `file`.
4824 */
4825 path?: string;
4826 /**
4827 * Path of the program to execute, usually you should specify `process.execPath`
4828 * which opens the current program. Should only be set if `type` is `task`.
4829 */
4830 program?: string;
4831 /**
4832 * The text to be displayed for the item in the Jump List. Should only be set if
4833 * `type` is `task`.
4834 */
4835 title?: string;
4836 /**
4837 * One of the following:
4838 */
4839 type?: ('task' | 'separator' | 'file');
4840 /**
4841 * The working directory. Default is empty.
4842 */
4843 workingDirectory?: string;
4844 }
4845
4846 interface KeyboardEvent extends Event {
4847
4848 // Docs: http://electronjs.org/docs/api/structures/keyboard-event
4849
4850 /**
4851 * whether an Alt key was used in an accelerator to trigger the Event
4852 */
4853 altKey?: boolean;
4854 /**
4855 * whether the Control key was used in an accelerator to trigger the Event
4856 */
4857 ctrlKey?: boolean;
4858 /**
4859 * whether a meta key was used in an accelerator to trigger the Event
4860 */
4861 metaKey?: boolean;
4862 /**
4863 * whether a Shift key was used in an accelerator to trigger the Event
4864 */
4865 shiftKey?: boolean;
4866 /**
4867 * whether an accelerator was used to trigger the event as opposed to another user
4868 * gesture like mouse click
4869 */
4870 triggeredByAccelerator?: boolean;
4871 }
4872
4873 interface KeyboardInputEvent extends InputEvent {
4874
4875 // Docs: http://electronjs.org/docs/api/structures/keyboard-input-event
4876
4877 /**
4878 * The character that will be sent as the keyboard event. Should only use the valid
4879 * key codes in Accelerator.
4880 */
4881 keyCode: string;
4882 /**
4883 * The type of the event, can be `keyDown`, `keyUp` or `char`.
4884 */
4885 type: ('keyDown' | 'keyUp' | 'char');
4886 }
4887
4888 interface MemoryInfo {
4889
4890 // Docs: http://electronjs.org/docs/api/structures/memory-info
4891
4892 /**
4893 * The maximum amount of memory that has ever been pinned to actual physical RAM.
4894 */
4895 peakWorkingSetSize: number;
4896 /**
4897 * The amount of memory not shared by other processes, such as JS heap or HTML
4898 * content.
4899 *
4900 * @platform win32
4901 */
4902 privateBytes?: number;
4903 /**
4904 * The amount of memory currently pinned to actual physical RAM.
4905 */
4906 workingSetSize: number;
4907 }
4908
4909 interface MemoryUsageDetails {
4910
4911 // Docs: http://electronjs.org/docs/api/structures/memory-usage-details
4912
4913 count: number;
4914 liveSize: number;
4915 size: number;
4916 }
4917
4918 class Menu {
4919
4920 // Docs: http://electronjs.org/docs/api/menu
4921
4922 /**
4923 * Emitted when a popup is closed either manually or with `menu.closePopup()`.
4924 */
4925 on(event: 'menu-will-close', listener: (event: Event) => void): this;
4926 once(event: 'menu-will-close', listener: (event: Event) => void): this;
4927 addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
4928 removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
4929 /**
4930 * Emitted when `menu.popup()` is called.
4931 */
4932 on(event: 'menu-will-show', listener: (event: Event) => void): this;
4933 once(event: 'menu-will-show', listener: (event: Event) => void): this;
4934 addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
4935 removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
4936 /**
4937 * Menu
4938 */
4939 constructor();
4940 /**
4941 * Generally, the `template` is an array of `options` for constructing a MenuItem.
4942 * The usage can be referenced above.
4943 *
4944 * You can also attach other fields to the element of the `template` and they will
4945 * become properties of the constructed menu items.
4946 */
4947 static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
4948 /**
4949 * The application menu, if set, or `null`, if not set.
4950 *
4951 * **Note:** The returned `Menu` instance doesn't support dynamic addition or
4952 * removal of menu items. Instance properties can still be dynamically modified.
4953 */
4954 static getApplicationMenu(): (Menu) | (null);
4955 /**
4956 * Sends the `action` to the first responder of application. This is used for
4957 * emulating default macOS menu behaviors. Usually you would use the `role`
4958 * property of a `MenuItem`.
4959 *
4960 * See the macOS Cocoa Event Handling Guide for more information on macOS' native
4961 * actions.
4962 *
4963 * @platform darwin
4964 */
4965 static sendActionToFirstResponder(action: string): void;
4966 /**
4967 * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
4968 * will be set as each window's top menu.
4969 *
4970 * Also on Windows and Linux, you can use a `&` in the top-level item name to
4971 * indicate which letter should get a generated accelerator. For example, using
4972 * `&File` for the file menu would result in a generated `Alt-F` accelerator that
4973 * opens the associated menu. The indicated character in the button label gets an
4974 * underline. The `&` character is not displayed on the button label.
4975 *
4976 * Passing `null` will suppress the default menu. On Windows and Linux, this has
4977 * the additional effect of removing the menu bar from the window.
4978 *
4979 * **Note:** The default menu will be created automatically if the app does not set
4980 * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
4981 * `Help`.
4982 */
4983 static setApplicationMenu(menu: (Menu) | (null)): void;
4984 /**
4985 * Appends the `menuItem` to the menu.
4986 */
4987 append(menuItem: MenuItem): void;
4988 /**
4989 * Closes the context menu in the `browserWindow`.
4990 */
4991 closePopup(browserWindow?: BrowserWindow): void;
4992 /**
4993 * the item with the specified `id`
4994 */
4995 getMenuItemById(id: string): MenuItem;
4996 /**
4997 * Inserts the `menuItem` to the `pos` position of the menu.
4998 */
4999 insert(pos: number, menuItem: MenuItem): void;
5000 /**
5001 * Pops up this menu as a context menu in the `BrowserWindow`.
5002 */
5003 popup(options?: PopupOptions): void;
5004 items: MenuItem[];
5005 }
5006
5007 class MenuItem {
5008
5009 // Docs: http://electronjs.org/docs/api/menu-item
5010
5011 /**
5012 * MenuItem
5013 */
5014 constructor(options: MenuItemConstructorOptions);
5015 accelerator?: Accelerator;
5016 checked: boolean;
5017 click: Function;
5018 commandId: number;
5019 enabled: boolean;
5020 icon?: (NativeImage) | (string);
5021 id: string;
5022 label: string;
5023 menu: Menu;
5024 registerAccelerator: boolean;
5025 role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'close' | 'minimize' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
5026 sublabel: string;
5027 submenu?: Menu;
5028 toolTip: string;
5029 type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
5030 visible: boolean;
5031 }
5032
5033 interface MimeTypedBuffer {
5034
5035 // Docs: http://electronjs.org/docs/api/structures/mime-typed-buffer
5036
5037 /**
5038 * The actual Buffer content.
5039 */
5040 data: Buffer;
5041 /**
5042 * The mimeType of the Buffer that you are sending.
5043 */
5044 mimeType: string;
5045 }
5046
5047 interface MouseInputEvent extends InputEvent {
5048
5049 // Docs: http://electronjs.org/docs/api/structures/mouse-input-event
5050
5051 /**
5052 * The button pressed, can be `left`, `middle`, `right`.
5053 */
5054 button?: ('left' | 'middle' | 'right');
5055 clickCount?: number;
5056 globalX?: number;
5057 globalY?: number;
5058 movementX?: number;
5059 movementY?: number;
5060 /**
5061 * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
5062 * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
5063 */
5064 type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
5065 x: number;
5066 y: number;
5067 }
5068
5069 interface MouseWheelInputEvent extends MouseInputEvent {
5070
5071 // Docs: http://electronjs.org/docs/api/structures/mouse-wheel-input-event
5072
5073 accelerationRatioX?: number;
5074 accelerationRatioY?: number;
5075 canScroll?: boolean;
5076 deltaX?: number;
5077 deltaY?: number;
5078 hasPreciseScrollingDeltas?: boolean;
5079 /**
5080 * The type of the event, can be `mouseWheel`.
5081 */
5082 type: ('mouseWheel');
5083 wheelTicksX?: number;
5084 wheelTicksY?: number;
5085 }
5086
5087 class NativeImage {
5088
5089 // Docs: http://electronjs.org/docs/api/native-image
5090
5091 /**
5092 * Creates an empty `NativeImage` instance.
5093 */
5094 static createEmpty(): NativeImage;
5095 /**
5096 * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
5097 * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
5098 */
5099 static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
5100 /**
5101 * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
5102 * JPEG first.
5103 */
5104 static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
5105 /**
5106 * Creates a new `NativeImage` instance from `dataURL`.
5107 */
5108 static createFromDataURL(dataURL: string): NativeImage;
5109 /**
5110 * Creates a new `NativeImage` instance from the NSImage that maps to the given
5111 * image name. See `System Icons` for a list of possible values.
5112 *
5113 * The `hslShift` is applied to the image with the following rules
5114 *
5115 * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
5116 * and 360 on the hue color wheel (red).
5117 * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
5118 * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
5119 * saturate the image.
5120 * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
5121 * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
5122 * leave unchanged. 1 = full lightness (make all pixels white).
5123 *
5124 * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
5125 * 0]` will make the image completely black.
5126 *
5127 * In some cases, the `NSImageName` doesn't match its string representation; one
5128 * example of this is `NSFolderImageName`, whose string representation would
5129 * actually be `NSFolder`. Therefore, you'll need to determine the correct string
5130 * representation for your image before passing it in. This can be done with the
5131 * following:
5132 *
5133 * `echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME);
5134 * }' | clang -otest -x objective-c -framework Cocoa - && ./test`
5135 *
5136where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
5137 *
5138 * @platform darwin
5139 */
5140 static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
5141 /**
5142 * Creates a new `NativeImage` instance from a file located at `path`. This method
5143 * returns an empty image if the `path` does not exist, cannot be read, or is not a
5144 * valid image.
5145 */
5146 static createFromPath(path: string): NativeImage;
5147 /**
5148 * Add an image representation for a specific scale factor. This can be used to
5149 * explicitly add different scale factor representations to an image. This can be
5150 * called on empty images.
5151 */
5152 addRepresentation(options: AddRepresentationOptions): void;
5153 /**
5154 * The cropped image.
5155 */
5156 crop(rect: Rectangle): NativeImage;
5157 /**
5158 * The image's aspect ratio.
5159 */
5160 getAspectRatio(): number;
5161 /**
5162 * A Buffer that contains the image's raw bitmap pixel data.
5163 *
5164 * The difference between `getBitmap()` and `toBitmap()` is, `getBitmap()` does not
5165 * copy the bitmap data, so you have to use the returned Buffer immediately in
5166 * current event loop tick, otherwise the data might be changed or destroyed.
5167 */
5168 getBitmap(options?: BitmapOptions): Buffer;
5169 /**
5170 * A Buffer that stores C pointer to underlying native handle of the image. On
5171 * macOS, a pointer to `NSImage` instance would be returned.
5172 *
5173 * Notice that the returned pointer is a weak pointer to the underlying native
5174 * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
5175 * instance is kept around.
5176 *
5177 * @platform darwin
5178 */
5179 getNativeHandle(): Buffer;
5180 getSize(): Size;
5181 /**
5182 * Whether the image is empty.
5183 */
5184 isEmpty(): boolean;
5185 /**
5186 * Whether the image is a template image.
5187
5188**Deprecated**
5189 */
5190 isTemplateImage(): boolean;
5191 /**
5192 * The resized image.
5193 *
5194 * If only the `height` or the `width` are specified then the current aspect ratio
5195 * will be preserved in the resized image.
5196 */
5197 resize(options: ResizeOptions): NativeImage;
5198 /**
5199 * Marks the image as a template image.
5200
5201**Deprecated**
5202 */
5203 setTemplateImage(option: boolean): void;
5204 /**
5205 * A Buffer that contains a copy of the image's raw bitmap pixel data.
5206 */
5207 toBitmap(options?: ToBitmapOptions): Buffer;
5208 /**
5209 * The data URL of the image.
5210 */
5211 toDataURL(options?: ToDataURLOptions): string;
5212 /**
5213 * A Buffer that contains the image's `JPEG` encoded data.
5214 */
5215 toJPEG(quality: number): Buffer;
5216 /**
5217 * A Buffer that contains the image's `PNG` encoded data.
5218 */
5219 toPNG(options?: ToPNGOptions): Buffer;
5220 isMacTemplateImage: boolean;
5221 }
5222
5223 interface NativeTheme extends NodeJS.EventEmitter {
5224
5225 // Docs: http://electronjs.org/docs/api/native-theme
5226
5227 /**
5228 * Emitted when something in the underlying NativeTheme has changed. This normally
5229 * means that either the value of `shouldUseDarkColors`,
5230 * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
5231 * will have to check them to determine which one has changed.
5232 */
5233 on(event: 'updated', listener: Function): this;
5234 once(event: 'updated', listener: Function): this;
5235 addListener(event: 'updated', listener: Function): this;
5236 removeListener(event: 'updated', listener: Function): this;
5237 /**
5238 * A `Boolean` for if the OS / Chromium currently has a dark mode enabled or is
5239 * being instructed to show a dark-style UI. If you want to modify this value you
5240 * should use `themeSource` below.
5241 *
5242 */
5243 readonly shouldUseDarkColors: boolean;
5244 /**
5245 * A `Boolean` for if the OS / Chromium currently has high-contrast mode enabled or
5246 * is being instructed to show a high-constrast UI.
5247 *
5248 * @platform darwin,win32
5249 */
5250 readonly shouldUseHighContrastColors: boolean;
5251 /**
5252 * A `Boolean` for if the OS / Chromium currently has an inverted color scheme or
5253 * is being instructed to use an inverted color scheme.
5254 *
5255 * @platform darwin,win32
5256 */
5257 readonly shouldUseInvertedColorScheme: boolean;
5258 /**
5259 * A `String` property that can be `system`, `light` or `dark`. It is used to
5260 * override and supercede the value that Chromium has chosen to use internally.
5261 *
5262 * Setting this property to `system` will remove the override and everything will
5263 * be reset to the OS default. By default `themeSource` is `system`.
5264 *
5265 * Settings this property to `dark` will have the following effects:
5266 *
5267 * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
5268 * * Any UI Electron renders on Linux and Windows including context menus,
5269 * devtools, etc. will use the dark UI.
5270 * * Any UI the OS renders on macOS including menus, window frames, etc. will use
5271 * the dark UI.
5272 * * The `prefers-color-scheme` CSS query will match `dark` mode.
5273 * * The `updated` event will be emitted
5274 *
5275 * Settings this property to `light` will have the following effects:
5276 *
5277 * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
5278 * * Any UI Electron renders on Linux and Windows including context menus,
5279 * devtools, etc. will use the light UI.
5280 * * Any UI the OS renders on macOS including menus, window frames, etc. will use
5281 * the light UI.
5282 * * The `prefers-color-scheme` CSS query will match `light` mode.
5283 * * The `updated` event will be emitted
5284 *
5285 * The usage of this property should align with a classic "dark mode" state machine
5286 * in your application where the user has three options.
5287 *
5288 * * `Follow OS` --> `themeSource = 'system'`
5289 * * `Dark Mode` --> `themeSource = 'dark'`
5290 * * `Light Mode` --> `themeSource = 'light'`
5291 *
5292 * Your application should then always use `shouldUseDarkColors` to determine what
5293 * CSS to apply.
5294 */
5295 themeSource: ('system' | 'light' | 'dark');
5296 }
5297
5298 interface Net {
5299
5300 // Docs: http://electronjs.org/docs/api/net
5301
5302 /**
5303 * Creates a `ClientRequest` instance using the provided `options` which are
5304 * directly forwarded to the `ClientRequest` constructor. The `net.request` method
5305 * would be used to issue both secure and insecure HTTP requests according to the
5306 * specified protocol scheme in the `options` object.
5307 */
5308 request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
5309 }
5310
5311 interface NetLog {
5312
5313 // Docs: http://electronjs.org/docs/api/net-log
5314
5315 /**
5316 * resolves when the net log has begun recording.
5317 *
5318Starts recording network events to `path`.
5319 */
5320 startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
5321 /**
5322 * resolves with a file path to which network logs were recorded.
5323 *
5324 * Stops recording network events. If not called, net logging will automatically
5325 * end when app quits.
5326 */
5327 stopLogging(): Promise<string>;
5328 /**
5329 * A `Boolean` property that indicates whether network logs are recorded.
5330 *
5331 */
5332 readonly currentlyLogging: boolean;
5333 /**
5334 * A `String` property that returns the path to the current log file.
5335 *
5336 * @deprecated
5337 */
5338 readonly currentlyLoggingPath: string;
5339 }
5340
5341 class Notification extends NodeJS.EventEmitter {
5342
5343 // Docs: http://electronjs.org/docs/api/notification
5344
5345 on(event: 'action', listener: (event: Event,
5346 /**
5347 * The index of the action that was activated.
5348 */
5349 index: number) => void): this;
5350 once(event: 'action', listener: (event: Event,
5351 /**
5352 * The index of the action that was activated.
5353 */
5354 index: number) => void): this;
5355 addListener(event: 'action', listener: (event: Event,
5356 /**
5357 * The index of the action that was activated.
5358 */
5359 index: number) => void): this;
5360 removeListener(event: 'action', listener: (event: Event,
5361 /**
5362 * The index of the action that was activated.
5363 */
5364 index: number) => void): this;
5365 /**
5366 * Emitted when the notification is clicked by the user.
5367 */
5368 on(event: 'click', listener: (event: Event) => void): this;
5369 once(event: 'click', listener: (event: Event) => void): this;
5370 addListener(event: 'click', listener: (event: Event) => void): this;
5371 removeListener(event: 'click', listener: (event: Event) => void): this;
5372 /**
5373 * Emitted when the notification is closed by manual intervention from the user.
5374 *
5375 * This event is not guaranteed to be emitted in all cases where the notification
5376 * is closed.
5377 */
5378 on(event: 'close', listener: (event: Event) => void): this;
5379 once(event: 'close', listener: (event: Event) => void): this;
5380 addListener(event: 'close', listener: (event: Event) => void): this;
5381 removeListener(event: 'close', listener: (event: Event) => void): this;
5382 /**
5383 * Emitted when the user clicks the "Reply" button on a notification with
5384 * `hasReply: true`.
5385 *
5386 * @platform darwin
5387 */
5388 on(event: 'reply', listener: (event: Event,
5389 /**
5390 * The string the user entered into the inline reply field.
5391 */
5392 reply: string) => void): this;
5393 once(event: 'reply', listener: (event: Event,
5394 /**
5395 * The string the user entered into the inline reply field.
5396 */
5397 reply: string) => void): this;
5398 addListener(event: 'reply', listener: (event: Event,
5399 /**
5400 * The string the user entered into the inline reply field.
5401 */
5402 reply: string) => void): this;
5403 removeListener(event: 'reply', listener: (event: Event,
5404 /**
5405 * The string the user entered into the inline reply field.
5406 */
5407 reply: string) => void): this;
5408 /**
5409 * Emitted when the notification is shown to the user, note this could be fired
5410 * multiple times as a notification can be shown multiple times through the
5411 * `show()` method.
5412 */
5413 on(event: 'show', listener: (event: Event) => void): this;
5414 once(event: 'show', listener: (event: Event) => void): this;
5415 addListener(event: 'show', listener: (event: Event) => void): this;
5416 removeListener(event: 'show', listener: (event: Event) => void): this;
5417 /**
5418 * Notification
5419 */
5420 constructor(options?: NotificationConstructorOptions);
5421 /**
5422 * Whether or not desktop notifications are supported on the current system
5423 */
5424 static isSupported(): boolean;
5425 /**
5426 * Dismisses the notification.
5427 */
5428 close(): void;
5429 /**
5430 * Immediately shows the notification to the user, please note this means unlike
5431 * the HTML5 Notification implementation, instantiating a `new Notification` does
5432 * not immediately show it to the user, you need to call this method before the OS
5433 * will display it.
5434 *
5435 * If the notification has been shown before, this method will dismiss the
5436 * previously shown notification and create a new one with identical properties.
5437 */
5438 show(): void;
5439 actions: NotificationAction[];
5440 body: string;
5441 closeButtonText: string;
5442 hasReply: boolean;
5443 replyPlaceholder: string;
5444 silent: boolean;
5445 sound: string;
5446 subtitle: string;
5447 title: string;
5448 }
5449
5450 interface NotificationAction {
5451
5452 // Docs: http://electronjs.org/docs/api/structures/notification-action
5453
5454 /**
5455 * The label for the given action.
5456 */
5457 text?: string;
5458 /**
5459 * The type of action, can be `button`.
5460 */
5461 type: ('button');
5462 }
5463
5464 interface Point {
5465
5466 // Docs: http://electronjs.org/docs/api/structures/point
5467
5468 x: number;
5469 y: number;
5470 }
5471
5472 interface PowerMonitor extends NodeJS.EventEmitter {
5473
5474 // Docs: http://electronjs.org/docs/api/power-monitor
5475
5476 /**
5477 * Emitted when the system is about to lock the screen.
5478 *
5479 * @platform darwin,win32
5480 */
5481 on(event: 'lock-screen', listener: Function): this;
5482 once(event: 'lock-screen', listener: Function): this;
5483 addListener(event: 'lock-screen', listener: Function): this;
5484 removeListener(event: 'lock-screen', listener: Function): this;
5485 /**
5486 * Emitted when the system changes to AC power.
5487 *
5488 * @platform win32
5489 */
5490 on(event: 'on-ac', listener: Function): this;
5491 once(event: 'on-ac', listener: Function): this;
5492 addListener(event: 'on-ac', listener: Function): this;
5493 removeListener(event: 'on-ac', listener: Function): this;
5494 /**
5495 * Emitted when system changes to battery power.
5496 *
5497 * @platform win32
5498 */
5499 on(event: 'on-battery', listener: Function): this;
5500 once(event: 'on-battery', listener: Function): this;
5501 addListener(event: 'on-battery', listener: Function): this;
5502 removeListener(event: 'on-battery', listener: Function): this;
5503 /**
5504 * Emitted when system is resuming.
5505 */
5506 on(event: 'resume', listener: Function): this;
5507 once(event: 'resume', listener: Function): this;
5508 addListener(event: 'resume', listener: Function): this;
5509 removeListener(event: 'resume', listener: Function): this;
5510 /**
5511 * Emitted when the system is about to reboot or shut down. If the event handler
5512 * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
5513 * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
5514 * should exit as soon as possible by calling something like `app.quit()`.
5515 *
5516 * @platform linux,darwin
5517 */
5518 on(event: 'shutdown', listener: Function): this;
5519 once(event: 'shutdown', listener: Function): this;
5520 addListener(event: 'shutdown', listener: Function): this;
5521 removeListener(event: 'shutdown', listener: Function): this;
5522 /**
5523 * Emitted when the system is suspending.
5524 */
5525 on(event: 'suspend', listener: Function): this;
5526 once(event: 'suspend', listener: Function): this;
5527 addListener(event: 'suspend', listener: Function): this;
5528 removeListener(event: 'suspend', listener: Function): this;
5529 /**
5530 * Emitted as soon as the systems screen is unlocked.
5531 *
5532 * @platform darwin,win32
5533 */
5534 on(event: 'unlock-screen', listener: Function): this;
5535 once(event: 'unlock-screen', listener: Function): this;
5536 addListener(event: 'unlock-screen', listener: Function): this;
5537 removeListener(event: 'unlock-screen', listener: Function): this;
5538 /**
5539 * The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
5540 *
5541 * Calculate the system idle state. `idleThreshold` is the amount of time (in
5542 * seconds) before considered idle. `locked` is available on supported systems
5543 * only.
5544 */
5545 getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
5546 /**
5547 * Idle time in seconds
5548
5549Calculate system idle time in seconds.
5550 */
5551 getSystemIdleTime(): number;
5552 }
5553
5554 interface PowerSaveBlocker {
5555
5556 // Docs: http://electronjs.org/docs/api/power-save-blocker
5557
5558 /**
5559 * Whether the corresponding `powerSaveBlocker` has started.
5560 */
5561 isStarted(id: number): boolean;
5562 /**
5563 * The blocker ID that is assigned to this power blocker.
5564 *
5565 * Starts preventing the system from entering lower-power mode. Returns an integer
5566 * identifying the power save blocker.
5567 *
5568 * **Note:** `prevent-display-sleep` has higher precedence over
5569 * `prevent-app-suspension`. Only the highest precedence type takes effect. In
5570 * other words, `prevent-display-sleep` always takes precedence over
5571 * `prevent-app-suspension`.
5572 *
5573 * For example, an API calling A requests for `prevent-app-suspension`, and another
5574 * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
5575 * used until B stops its request. After that, `prevent-app-suspension` is used.
5576 */
5577 start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
5578 /**
5579 * Stops the specified power save blocker.
5580 */
5581 stop(id: number): void;
5582 }
5583
5584 interface PrinterInfo {
5585
5586 // Docs: http://electronjs.org/docs/api/structures/printer-info
5587
5588 description: string;
5589 isDefault: boolean;
5590 name: string;
5591 status: number;
5592 }
5593
5594 interface ProcessMemoryInfo {
5595
5596 // Docs: http://electronjs.org/docs/api/structures/process-memory-info
5597
5598 /**
5599 * The amount of memory not shared by other processes, such as JS heap or HTML
5600 * content in Kilobytes.
5601 */
5602 private: number;
5603 /**
5604 * The amount of memory currently pinned to actual physical RAM in Kilobytes.
5605 *
5606 * @platform linux,win32
5607 */
5608 residentSet: number;
5609 /**
5610 * The amount of memory shared between processes, typically memory consumed by the
5611 * Electron code itself in Kilobytes.
5612 */
5613 shared: number;
5614 }
5615
5616 interface ProcessMetric {
5617
5618 // Docs: http://electronjs.org/docs/api/structures/process-metric
5619
5620 /**
5621 * CPU usage of the process.
5622 */
5623 cpu: CPUUsage;
5624 /**
5625 * Creation time for this process. The time is represented as number of
5626 * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
5627 * is useful to use both the `pid` and the `creationTime` to uniquely identify a
5628 * process.
5629 */
5630 creationTime: number;
5631 /**
5632 * One of the following values:
5633 *
5634 * @platform win32
5635 */
5636 integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
5637 /**
5638 * Memory information for the process.
5639 */
5640 memory: MemoryInfo;
5641 /**
5642 * Process id of the process.
5643 */
5644 pid: number;
5645 /**
5646 * Whether the process is sandboxed on OS level.
5647 *
5648 * @platform darwin,win32
5649 */
5650 sandboxed?: boolean;
5651 /**
5652 * Process type. One of the following values:
5653 */
5654 type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
5655 }
5656
5657 interface Product {
5658
5659 // Docs: http://electronjs.org/docs/api/structures/product
5660
5661 /**
5662 * The total size of the content, in bytes.
5663 */
5664 contentLengths: number[];
5665 /**
5666 * A string that identifies the version of the content.
5667 */
5668 contentVersion: string;
5669 /**
5670 * The locale formatted price of the product.
5671 */
5672 formattedPrice: string;
5673 /**
5674 * A Boolean value that indicates whether the App Store has downloadable content
5675 * for this product. `true` if at least one file has been associated with the
5676 * product.
5677 */
5678 isDownloadable: boolean;
5679 /**
5680 * A description of the product.
5681 */
5682 localizedDescription: string;
5683 /**
5684 * The name of the product.
5685 */
5686 localizedTitle: string;
5687 /**
5688 * The cost of the product in the local currency.
5689 */
5690 price: number;
5691 /**
5692 * The string that identifies the product to the Apple App Store.
5693 */
5694 productIdentifier: string;
5695 }
5696
5697 interface Protocol {
5698
5699 // Docs: http://electronjs.org/docs/api/protocol
5700
5701 /**
5702 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
5703 * which sends a `Buffer` as a response.
5704 */
5705 interceptBufferProtocol(scheme: string, handler: (request: Request, callback: (buffer?: Buffer) => void) => void, completion?: (error: Error) => void): void;
5706 /**
5707 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
5708 * which sends a file as a response.
5709 */
5710 interceptFileProtocol(scheme: string, handler: (request: Request, callback: (filePath: string) => void) => void, completion?: (error: Error) => void): void;
5711 /**
5712 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
5713 * which sends a new HTTP request as a response.
5714 */
5715 interceptHttpProtocol(scheme: string, handler: (request: Request, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void;
5716 /**
5717 * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
5718 * protocol handler.
5719 */
5720 interceptStreamProtocol(scheme: string, handler: (request: Request, callback: (stream?: (NodeJS.ReadableStream) | (StreamProtocolResponse)) => void) => void, completion?: (error: Error) => void): void;
5721 /**
5722 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
5723 * which sends a `String` as a response.
5724 */
5725 interceptStringProtocol(scheme: string, handler: (request: Request, callback: (data?: (string) | (StringProtocolResponse)) => void) => void, completion?: (error: Error) => void): void;
5726 /**
5727 * fulfilled with a boolean that indicates whether there is already a handler for
5728 * `scheme`.
5729 */
5730 isProtocolHandled(scheme: string): Promise<boolean>;
5731 /**
5732 * Registers a protocol of `scheme` that will send a `Buffer` as a response.
5733 *
5734 * The usage is the same with `registerFileProtocol`, except that the `callback`
5735 * should be called with either a `Buffer` object or an object that has the `data`,
5736 * `mimeType`, and `charset` properties.
5737
5738Example:
5739 */
5740 registerBufferProtocol(scheme: string, handler: (request: Request, callback: (buffer?: (Buffer) | (MimeTypedBuffer)) => void) => void, completion?: (error: Error) => void): void;
5741 /**
5742 * Registers a protocol of `scheme` that will send the file as a response. The
5743 * `handler` will be called with `handler(request, callback)` when a `request` is
5744 * going to be created with `scheme`. `completion` will be called with
5745 * `completion(null)` when `scheme` is successfully registered or
5746 * `completion(error)` when failed.
5747 *
5748 * To handle the `request`, the `callback` should be called with either the file's
5749 * path or an object that has a `path` property, e.g. `callback(filePath)` or
5750 * `callback({ path: filePath })`. The object may also have a `headers` property
5751 * which gives a map of headers to values for the response headers, e.g.
5752 * `callback({ path: filePath, headers: {"Content-Security-Policy": "default-src
5753 * 'none'"]})`.
5754 *
5755 * When `callback` is called with nothing, a number, or an object that has an
5756 * `error` property, the `request` will fail with the `error` number you specified.
5757 * For the available error numbers you can use, please see the net error list.
5758 *
5759 * By default the `scheme` is treated like `http:`, which is parsed differently
5760 * than protocols that follow the "generic URI syntax" like `file:`.
5761 */
5762 registerFileProtocol(scheme: string, handler: (request: Request, callback: (filePath?: (string) | (FilePathWithHeaders)) => void) => void, completion?: (error: Error) => void): void;
5763 /**
5764 * Registers a protocol of `scheme` that will send an HTTP request as a response.
5765 *
5766 * The usage is the same with `registerFileProtocol`, except that the `callback`
5767 * should be called with a `redirectRequest` object that has the `url`, `method`,
5768 * `referrer`, `uploadData` and `session` properties.
5769 *
5770 * By default the HTTP request will reuse the current session. If you want the
5771 * request to have a different session you should set `session` to `null`.
5772 *
5773For POST requests the `uploadData` object must be provided.
5774 */
5775 registerHttpProtocol(scheme: string, handler: (request: Request, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void;
5776 /**
5777 * **Note:** This method can only be used before the `ready` event of the `app`
5778 * module gets emitted and can be called only once.
5779 *
5780 * Registers the `scheme` as standard, secure, bypasses content security policy for
5781 * resources, allows registering ServiceWorker and supports fetch API.
5782 *
5783 * Specify a privilege with the value of `true` to enable the capability. An
5784 * example of registering a privileged scheme, with bypassing Content Security
5785 * Policy:
5786 *
5787 * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
5788 * `http` and `https` are standard schemes, while `file` is not.
5789 *
5790 * Registering a scheme as standard, will allow relative and absolute resources to
5791 * be resolved correctly when served. Otherwise the scheme will behave like the
5792 * `file` protocol, but without the ability to resolve relative URLs.
5793 *
5794 * For example when you load following page with custom protocol without
5795 * registering it as standard scheme, the image will not be loaded because
5796 * non-standard schemes can not recognize relative URLs:
5797 *
5798 * Registering a scheme as standard will allow access to files through the
5799 * FileSystem API. Otherwise the renderer will throw a security error for the
5800 * scheme.
5801 *
5802 * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
5803 * cookies) are disabled for non standard schemes. So in general if you want to
5804 * register a custom protocol to replace the `http` protocol, you have to register
5805 * it as a standard scheme.
5806 *
5807 * `protocol.registerSchemesAsPrivileged` can be used to replicate the
5808 * functionality of the previous `protocol.registerStandardSchemes`,
5809 * `webFrame.registerURLSchemeAs*` and `protocol.registerServiceWorkerSchemes`
5810 * functions that existed prior to Electron 5.0.0, for example:
5811 *
5812**before (<= v4.x)**
5813
5814**after (>= v5.x)**
5815 */
5816 registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
5817 /**
5818 * Registers a protocol of `scheme` that will send a `Readable` as a response.
5819 *
5820 * The usage is similar to the other `register{Any}Protocol`, except that the
5821 * `callback` should be called with either a `Readable` object or an object that
5822 * has the `data`, `statusCode`, and `headers` properties.
5823 *
5824 * Example:
5825 *
5826 * It is possible to pass any object that implements the readable stream API (emits
5827 * `data`/`end`/`error` events). For example, here's how a file could be returned:
5828 */
5829 registerStreamProtocol(scheme: string, handler: (request: Request, callback: (stream?: (NodeJS.ReadableStream) | (StreamProtocolResponse)) => void) => void, completion?: (error: Error) => void): void;
5830 /**
5831 * Registers a protocol of `scheme` that will send a `String` as a response.
5832 *
5833 * The usage is the same with `registerFileProtocol`, except that the `callback`
5834 * should be called with either a `String` or an object that has the `data`,
5835 * `mimeType`, and `charset` properties.
5836 */
5837 registerStringProtocol(scheme: string, handler: (request: Request, callback: (data?: (string) | (StringProtocolResponse)) => void) => void, completion?: (error: Error) => void): void;
5838 /**
5839 * Remove the interceptor installed for `scheme` and restore its original handler.
5840 */
5841 uninterceptProtocol(scheme: string, completion?: (error: Error) => void): void;
5842 /**
5843 * Unregisters the custom protocol of `scheme`.
5844 */
5845 unregisterProtocol(scheme: string, completion?: (error: Error) => void): void;
5846 }
5847
5848 interface ProtocolRequest {
5849
5850 // Docs: http://electronjs.org/docs/api/structures/protocol-request
5851
5852 method: string;
5853 referrer: string;
5854 uploadData?: UploadData[];
5855 url: string;
5856 }
5857
5858 interface ProtocolResponse {
5859
5860 // Docs: http://electronjs.org/docs/api/structures/protocol-response
5861
5862 /**
5863 * The charset of response body, default is `"utf-8"`.
5864 */
5865 charset?: string;
5866 /**
5867 * The response body. When returning stream as response, this is a Node.js readable
5868 * stream representing the response body. When returning `Buffer` as response, this
5869 * is a `Buffer`. When returning `String` as response, this is a `String`. This is
5870 * ignored for other types of responses.
5871 */
5872 data?: (Buffer) | (string) | (NodeJS.ReadableStream);
5873 /**
5874 * When assigned, the `request` will fail with the `error` number . For the
5875 * available error numbers you can use, please see the net error list.
5876 */
5877 error?: number;
5878 /**
5879 * An object containing the response headers. The keys must be String, and values
5880 * must be either String or Array of String.
5881 */
5882 headers?: Record<string, (string) | (string[])>;
5883 /**
5884 * The HTTP `method`. This is only used for file and URL responses.
5885 */
5886 method?: string;
5887 /**
5888 * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
5889 * would implicitly set the `content-type` header in response, but if
5890 * `content-type` is already set in `headers`, the `mimeType` would be ignored.
5891 */
5892 mimeType?: string;
5893 /**
5894 * Path to the file which would be sent as response body. This is only used for
5895 * file responses.
5896 */
5897 path?: string;
5898 /**
5899 * The `referrer` URL. This is only used for file and URL responses.
5900 */
5901 referrer?: string;
5902 /**
5903 * The session used for requesting URL, by default the HTTP request will reuse the
5904 * current session. Setting `session` to `null` would use a random independent
5905 * session. This is only used for URL responses.
5906 */
5907 session?: Session;
5908 /**
5909 * The HTTP response code, default is 200.
5910 */
5911 statusCode?: number;
5912 /**
5913 * The data used as upload data. This is only used for URL responses when `method`
5914 * is `"POST"`.
5915 */
5916 uploadData?: ProtocolResponseUploadData;
5917 /**
5918 * Download the `url` and pipe the result as response body. This is only used for
5919 * URL responses.
5920 */
5921 url?: string;
5922 }
5923
5924 interface ProtocolResponseUploadData {
5925
5926 // Docs: http://electronjs.org/docs/api/structures/protocol-response-upload-data
5927
5928 /**
5929 * MIME type of the content.
5930 */
5931 contentType: string;
5932 /**
5933 * Content to be sent.
5934 */
5935 data: (string) | (Buffer);
5936 }
5937
5938 interface Rectangle {
5939
5940 // Docs: http://electronjs.org/docs/api/structures/rectangle
5941
5942 /**
5943 * The height of the rectangle (must be an integer).
5944 */
5945 height: number;
5946 /**
5947 * The width of the rectangle (must be an integer).
5948 */
5949 width: number;
5950 /**
5951 * The x coordinate of the origin of the rectangle (must be an integer).
5952 */
5953 x: number;
5954 /**
5955 * The y coordinate of the origin of the rectangle (must be an integer).
5956 */
5957 y: number;
5958 }
5959
5960 interface Referrer {
5961
5962 // Docs: http://electronjs.org/docs/api/structures/referrer
5963
5964 /**
5965 * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
5966 * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
5967 * See the Referrer-Policy spec for more details on the meaning of these values.
5968 */
5969 policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
5970 /**
5971 * HTTP Referrer URL.
5972 */
5973 url: string;
5974 }
5975
5976 interface Remote extends MainInterface {
5977
5978 // Docs: http://electronjs.org/docs/api/remote
5979
5980 /**
5981 * The web contents of this web page.
5982 */
5983 getCurrentWebContents(): WebContents;
5984 /**
5985 * The window to which this web page belongs.
5986 *
5987 * **Note:** Do not use `removeAllListeners` on `BrowserWindow`. Use of this can
5988 * remove all `blur` listeners, disable click events on touch bar buttons, and
5989 * other unintended consequences.
5990 */
5991 getCurrentWindow(): BrowserWindow;
5992 /**
5993 * The global variable of `name` (e.g. `global[name]`) in the main process.
5994 */
5995 getGlobal(name: string): any;
5996 /**
5997 * The object returned by `require(module)` in the main process. Modules specified
5998 * by their relative path will resolve relative to the entrypoint of the main
5999 * process.
6000
6001e.g.
6002 */
6003 require(module: string): any;
6004 /**
6005 * A `NodeJS.Process` object. The `process` object in the main process. This is
6006 * the same as `remote.getGlobal('process')` but is cached.
6007 *
6008 */
6009 readonly process: NodeJS.Process;
6010 }
6011
6012 interface RemoveClientCertificate {
6013
6014 // Docs: http://electronjs.org/docs/api/structures/remove-client-certificate
6015
6016 /**
6017 * Origin of the server whose associated client certificate must be removed from
6018 * the cache.
6019 */
6020 origin: string;
6021 /**
6022 * `clientCertificate`.
6023 */
6024 type: string;
6025 }
6026
6027 interface RemovePassword {
6028
6029 // Docs: http://electronjs.org/docs/api/structures/remove-password
6030
6031 /**
6032 * When provided, the authentication info related to the origin will only be
6033 * removed otherwise the entire cache will be cleared.
6034 */
6035 origin?: string;
6036 /**
6037 * Credentials of the authentication. Must be provided if removing by `origin`.
6038 */
6039 password?: string;
6040 /**
6041 * Realm of the authentication. Must be provided if removing by `origin`.
6042 */
6043 realm?: string;
6044 /**
6045 * Scheme of the authentication. Can be `basic`, `digest`, `ntlm`, `negotiate`.
6046 * Must be provided if removing by `origin`.
6047 */
6048 scheme?: ('basic' | 'digest' | 'ntlm' | 'negotiate');
6049 /**
6050 * `password`.
6051 */
6052 type: string;
6053 /**
6054 * Credentials of the authentication. Must be provided if removing by `origin`.
6055 */
6056 username?: string;
6057 }
6058
6059 interface Screen extends NodeJS.EventEmitter {
6060
6061 // Docs: http://electronjs.org/docs/api/screen
6062
6063 /**
6064 * Emitted when `newDisplay` has been added.
6065 */
6066 on(event: 'display-added', listener: (event: Event,
6067 newDisplay: Display) => void): this;
6068 once(event: 'display-added', listener: (event: Event,
6069 newDisplay: Display) => void): this;
6070 addListener(event: 'display-added', listener: (event: Event,
6071 newDisplay: Display) => void): this;
6072 removeListener(event: 'display-added', listener: (event: Event,
6073 newDisplay: Display) => void): this;
6074 /**
6075 * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
6076 * an array of strings that describe the changes. Possible changes are `bounds`,
6077 * `workArea`, `scaleFactor` and `rotation`.
6078 */
6079 on(event: 'display-metrics-changed', listener: (event: Event,
6080 display: Display,
6081 changedMetrics: string[]) => void): this;
6082 once(event: 'display-metrics-changed', listener: (event: Event,
6083 display: Display,
6084 changedMetrics: string[]) => void): this;
6085 addListener(event: 'display-metrics-changed', listener: (event: Event,
6086 display: Display,
6087 changedMetrics: string[]) => void): this;
6088 removeListener(event: 'display-metrics-changed', listener: (event: Event,
6089 display: Display,
6090 changedMetrics: string[]) => void): this;
6091 /**
6092 * Emitted when `oldDisplay` has been removed.
6093 */
6094 on(event: 'display-removed', listener: (event: Event,
6095 oldDisplay: Display) => void): this;
6096 once(event: 'display-removed', listener: (event: Event,
6097 oldDisplay: Display) => void): this;
6098 addListener(event: 'display-removed', listener: (event: Event,
6099 oldDisplay: Display) => void): this;
6100 removeListener(event: 'display-removed', listener: (event: Event,
6101 oldDisplay: Display) => void): this;
6102 /**
6103 * Converts a screen DIP point to a screen physical point. The DPI scale is
6104 * performed relative to the display containing the DIP point.
6105 *
6106 * @platform win32
6107 */
6108 dipToScreenPoint(point: Point): Point;
6109 /**
6110 * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
6111 * relative to the display nearest to `window`. If `window` is null, scaling will
6112 * be performed to the display nearest to `rect`.
6113 *
6114 * @platform win32
6115 */
6116 dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
6117 /**
6118 * An array of displays that are currently available.
6119 */
6120 getAllDisplays(): Display[];
6121 /**
6122 * The current absolute position of the mouse pointer.
6123 */
6124 getCursorScreenPoint(): Point;
6125 /**
6126 * The display that most closely intersects the provided bounds.
6127 */
6128 getDisplayMatching(rect: Rectangle): Display;
6129 /**
6130 * The display nearest the specified point.
6131 */
6132 getDisplayNearestPoint(point: Point): Display;
6133 /**
6134 * The primary display.
6135 */
6136 getPrimaryDisplay(): Display;
6137 /**
6138 * Converts a screen physical point to a screen DIP point. The DPI scale is
6139 * performed relative to the display containing the physical point.
6140 *
6141 * @platform win32
6142 */
6143 screenToDipPoint(point: Point): Point;
6144 /**
6145 * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
6146 * relative to the display nearest to `window`. If `window` is null, scaling will
6147 * be performed to the display nearest to `rect`.
6148 *
6149 * @platform win32
6150 */
6151 screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
6152 }
6153
6154 interface ScrubberItem {
6155
6156 // Docs: http://electronjs.org/docs/api/structures/scrubber-item
6157
6158 /**
6159 * The image to appear in this item.
6160 */
6161 icon?: NativeImage;
6162 /**
6163 * The text to appear in this item.
6164 */
6165 label?: string;
6166 }
6167
6168 interface SegmentedControlSegment {
6169
6170 // Docs: http://electronjs.org/docs/api/structures/segmented-control-segment
6171
6172 /**
6173 * Whether this segment is selectable. Default: true.
6174 */
6175 enabled?: boolean;
6176 /**
6177 * The image to appear in this segment.
6178 */
6179 icon?: NativeImage;
6180 /**
6181 * The text to appear in this segment.
6182 */
6183 label?: string;
6184 }
6185
6186 class Session extends NodeJS.EventEmitter {
6187
6188 // Docs: http://electronjs.org/docs/api/session
6189
6190 /**
6191 * A session instance from `partition` string. When there is an existing `Session`
6192 * with the same `partition`, it will be returned; otherwise a new `Session`
6193 * instance will be created with `options`.
6194 *
6195 * If `partition` starts with `persist:`, the page will use a persistent session
6196 * available to all pages in the app with the same `partition`. if there is no
6197 * `persist:` prefix, the page will use an in-memory session. If the `partition` is
6198 * empty then default session of the app will be returned.
6199 *
6200 * To create a `Session` with `options`, you have to ensure the `Session` with the
6201 * `partition` has never been used before. There is no way to change the `options`
6202 * of an existing `Session` object.
6203 */
6204 static fromPartition(partition: string, options?: FromPartitionOptions): Session;
6205 /**
6206 * A `Session` object, the default session object of the app.
6207 */
6208 static defaultSession: Session;
6209 /**
6210 * Emitted when a render process requests preconnection to a URL, generally due to
6211 * a resource hint.
6212 *
6213 * @experimental
6214 */
6215 on(event: 'preconnect', listener: (event: Event,
6216 /**
6217 * The URL being requested for preconnection by the renderer.
6218 */
6219 preconnectUrl: string,
6220 /**
6221 * True if the renderer is requesting that the connection include credentials (see
6222 * the spec for more details.)
6223 */
6224 allowCredentials: boolean) => void): this;
6225 once(event: 'preconnect', listener: (event: Event,
6226 /**
6227 * The URL being requested for preconnection by the renderer.
6228 */
6229 preconnectUrl: string,
6230 /**
6231 * True if the renderer is requesting that the connection include credentials (see
6232 * the spec for more details.)
6233 */
6234 allowCredentials: boolean) => void): this;
6235 addListener(event: 'preconnect', listener: (event: Event,
6236 /**
6237 * The URL being requested for preconnection by the renderer.
6238 */
6239 preconnectUrl: string,
6240 /**
6241 * True if the renderer is requesting that the connection include credentials (see
6242 * the spec for more details.)
6243 */
6244 allowCredentials: boolean) => void): this;
6245 removeListener(event: 'preconnect', listener: (event: Event,
6246 /**
6247 * The URL being requested for preconnection by the renderer.
6248 */
6249 preconnectUrl: string,
6250 /**
6251 * True if the renderer is requesting that the connection include credentials (see
6252 * the spec for more details.)
6253 */
6254 allowCredentials: boolean) => void): this;
6255 /**
6256 * Emitted when Electron is about to download `item` in `webContents`.
6257 *
6258 * Calling `event.preventDefault()` will cancel the download and `item` will not be
6259 * available from next tick of the process.
6260 */
6261 on(event: 'will-download', listener: (event: Event,
6262 item: DownloadItem,
6263 webContents: WebContents) => void): this;
6264 once(event: 'will-download', listener: (event: Event,
6265 item: DownloadItem,
6266 webContents: WebContents) => void): this;
6267 addListener(event: 'will-download', listener: (event: Event,
6268 item: DownloadItem,
6269 webContents: WebContents) => void): this;
6270 removeListener(event: 'will-download', listener: (event: Event,
6271 item: DownloadItem,
6272 webContents: WebContents) => void): this;
6273 /**
6274 * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
6275 * authentication.
6276 */
6277 allowNTLMCredentialsForDomains(domains: string): void;
6278 /**
6279 * resolves when the session’s HTTP authentication cache has been cleared.
6280 */
6281 clearAuthCache(options: (RemovePassword) | (RemoveClientCertificate)): Promise<void>;
6282 /**
6283 * resolves when the cache clear operation is complete.
6284 *
6285Clears the session’s HTTP cache.
6286 */
6287 clearCache(): Promise<void>;
6288 /**
6289 * Resolves when the operation is complete.
6290
6291Clears the host resolver cache.
6292 */
6293 clearHostResolverCache(): Promise<void>;
6294 /**
6295 * resolves when the storage data has been cleared.
6296 */
6297 clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
6298 /**
6299 * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
6300 * The API will generate a DownloadItem that can be accessed with the will-download
6301 * event. The DownloadItem will not have any `WebContents` associated with it and
6302 * the initial state will be `interrupted`. The download will start only when the
6303 * `resume` API is called on the DownloadItem.
6304 */
6305 createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
6306 /**
6307 * Disables any network emulation already active for the `session`. Resets to the
6308 * original network configuration.
6309 */
6310 disableNetworkEmulation(): void;
6311 /**
6312 * Emulates network with the given configuration for the `session`.
6313 */
6314 enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
6315 /**
6316 * Writes any unwritten DOMStorage data to disk.
6317 */
6318 flushStorageData(): void;
6319 /**
6320 * resolves with blob data.
6321 */
6322 getBlobData(identifier: string): Promise<Buffer>;
6323 /**
6324 * the session's current cache size, in bytes.
6325 */
6326 getCacheSize(): Promise<number>;
6327 /**
6328 * an array of paths to preload scripts that have been registered.
6329 */
6330 getPreloads(): string[];
6331 /**
6332 * The user agent for this session.
6333 */
6334 getUserAgent(): string;
6335 /**
6336 * Preconnects the given number of sockets to an origin.
6337 *
6338 * @experimental
6339 */
6340 preconnect(options: PreconnectOptions): void;
6341 /**
6342 * Resolves with the proxy information for `url`.
6343 */
6344 resolveProxy(url: string): Promise<string>;
6345 /**
6346 * Sets the certificate verify proc for `session`, the `proc` will be called with
6347 * `proc(request, callback)` whenever a server certificate verification is
6348 * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
6349 * rejects it.
6350 *
6351 * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
6352 * verify proc.
6353 */
6354 setCertificateVerifyProc(proc: (request: ProcRequest, callback: (verificationResult: number) => void) => void): void;
6355 /**
6356 * Sets download saving directory. By default, the download directory will be the
6357 * `Downloads` under the respective app folder.
6358 */
6359 setDownloadPath(path: string): void;
6360 /**
6361 * Sets the handler which can be used to respond to permission checks for the
6362 * `session`. Returning `true` will allow the permission and `false` will reject
6363 * it. To clear the handler, call `setPermissionCheckHandler(null)`.
6364 */
6365 setPermissionCheckHandler(handler: ((webContents: WebContents, permission: string, requestingOrigin: string, details: Details) => boolean) | (null)): void;
6366 /**
6367 * Sets the handler which can be used to respond to permission requests for the
6368 * `session`. Calling `callback(true)` will allow the permission and
6369 * `callback(false)` will reject it. To clear the handler, call
6370 * `setPermissionRequestHandler(null)`.
6371 */
6372 setPermissionRequestHandler(handler: ((webContents: WebContents, permission: string, callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void;
6373 /**
6374 * Adds scripts that will be executed on ALL web contents that are associated with
6375 * this session just before normal `preload` scripts run.
6376 */
6377 setPreloads(preloads: string[]): void;
6378 /**
6379 * Resolves when the proxy setting process is complete.
6380 *
6381 * Sets the proxy settings.
6382 *
6383 * When `pacScript` and `proxyRules` are provided together, the `proxyRules` option
6384 * is ignored and `pacScript` configuration is applied.
6385 *
6386 * The `proxyRules` has to follow the rules below:
6387 *
6388 * For example:
6389 *
6390 * * `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
6391 * HTTP proxy `foopy2:80` for `ftp://` URLs.
6392 * * `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
6393 * * `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
6394 * over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
6395 * * `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
6396 * * `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
6397 * over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
6398 * * `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
6399 * proxy if `foopy` is unavailable.
6400 * * `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
6401 * `socks4://foopy2` for all other URLs.
6402 *
6403 * The `proxyBypassRules` is a comma separated list of rules described below:
6404 *
6405 * * `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
6406 *
6407 * Match all hostnames that match the pattern HOSTNAME_PATTERN.
6408 *
6409 * Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
6410 * "https://x.*.y.com:99"
6411 * * `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
6412 *
6413 * Match a particular domain suffix.
6414 *
6415 * Examples: ".google.com", ".com", "http://.google.com"
6416 * * `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
6417 *
6418 * Match URLs which are IP address literals.
6419 *
6420 * Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
6421 * * `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
6422 *
6423 * Match any URL that is to an IP literal that falls between the given range. IP
6424 * range is specified using CIDR notation.
6425 *
6426 * Examples: "192.168.1.1/16", "fefe:13::abc/33".
6427 * * `<local>`
6428 *
6429 * Match local addresses. The meaning of `<local>` is whether the host matches one
6430 * of: "127.0.0.1", "::1", "localhost".
6431 */
6432 setProxy(config: Config): Promise<void>;
6433 /**
6434 * Overrides the `userAgent` and `acceptLanguages` for this session.
6435 *
6436 * The `acceptLanguages` must a comma separated ordered list of language codes, for
6437 * example `"en-US,fr,de,ko,zh-CN,ja"`.
6438 *
6439 * This doesn't affect existing `WebContents`, and each `WebContents` can use
6440 * `webContents.setUserAgent` to override the session-wide user agent.
6441 */
6442 setUserAgent(userAgent: string, acceptLanguages?: string): void;
6443 readonly cookies: Cookies;
6444 readonly netLog: NetLog;
6445 readonly protocol: Protocol;
6446 readonly webRequest: WebRequest;
6447 }
6448
6449 interface Shell {
6450
6451 // Docs: http://electronjs.org/docs/api/shell
6452
6453 /**
6454 * Play the beep sound.
6455 */
6456 beep(): void;
6457 /**
6458 * Whether the item was successfully moved to the trash.
6459 *
6460Move the given file to trash and returns a boolean status for the operation.
6461 */
6462 moveItemToTrash(fullPath: string): boolean;
6463 /**
6464 * Open the given external protocol URL in the desktop's default manner. (For
6465 * example, mailto: URLs in the user's default mail agent).
6466 */
6467 openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
6468 /**
6469 * Whether the item was successfully opened.
6470 *
6471Open the given file in the desktop's default manner.
6472 */
6473 openItem(fullPath: string): boolean;
6474 /**
6475 * Resolves the shortcut link at `shortcutPath`.
6476 *
6477An exception will be thrown when any error happens.
6478 *
6479 * @platform win32
6480 */
6481 readShortcutLink(shortcutPath: string): ShortcutDetails;
6482 /**
6483 * Show the given file in a file manager. If possible, select the file.
6484 */
6485 showItemInFolder(fullPath: string): void;
6486 /**
6487 * Whether the shortcut was created successfully.
6488 *
6489Creates or updates a shortcut link at `shortcutPath`.
6490 *
6491 * @platform win32
6492 */
6493 writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
6494 /**
6495 * Whether the shortcut was created successfully.
6496 *
6497Creates or updates a shortcut link at `shortcutPath`.
6498 *
6499 * @platform win32
6500 */
6501 writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
6502 }
6503
6504 interface ShortcutDetails {
6505
6506 // Docs: http://electronjs.org/docs/api/structures/shortcut-details
6507
6508 /**
6509 * The Application User Model ID. Default is empty.
6510 */
6511 appUserModelId?: string;
6512 /**
6513 * The arguments to be applied to `target` when launching from this shortcut.
6514 * Default is empty.
6515 */
6516 args?: string;
6517 /**
6518 * The working directory. Default is empty.
6519 */
6520 cwd?: string;
6521 /**
6522 * The description of the shortcut. Default is empty.
6523 */
6524 description?: string;
6525 /**
6526 * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
6527 * together. Default is empty, which uses the target's icon.
6528 */
6529 icon?: string;
6530 /**
6531 * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
6532 */
6533 iconIndex?: number;
6534 /**
6535 * The target to launch from this shortcut.
6536 */
6537 target: string;
6538 }
6539
6540 interface Size {
6541
6542 // Docs: http://electronjs.org/docs/api/structures/size
6543
6544 height: number;
6545 width: number;
6546 }
6547
6548 interface StreamProtocolResponse {
6549
6550 // Docs: http://electronjs.org/docs/api/structures/stream-protocol-response
6551
6552 /**
6553 * A Node.js readable stream representing the response body.
6554 */
6555 data: (NodeJS.ReadableStream) | (null);
6556 /**
6557 * An object containing the response headers.
6558 */
6559 headers?: Record<string, (string) | (string[])>;
6560 /**
6561 * The HTTP response code.
6562 */
6563 statusCode?: number;
6564 }
6565
6566 interface StringProtocolResponse {
6567
6568 // Docs: http://electronjs.org/docs/api/structures/string-protocol-response
6569
6570 /**
6571 * Charset of the response.
6572 */
6573 charset?: string;
6574 /**
6575 * A string representing the response body.
6576 */
6577 data: (string) | (null);
6578 /**
6579 * MIME type of the response.
6580 */
6581 mimeType?: string;
6582 }
6583
6584 interface SystemPreferences extends NodeJS.EventEmitter {
6585
6586 // Docs: http://electronjs.org/docs/api/system-preferences
6587
6588 on(event: 'accent-color-changed', listener: (event: Event,
6589 /**
6590 * The new RGBA color the user assigned to be their system accent color.
6591 */
6592 newColor: string) => void): this;
6593 once(event: 'accent-color-changed', listener: (event: Event,
6594 /**
6595 * The new RGBA color the user assigned to be their system accent color.
6596 */
6597 newColor: string) => void): this;
6598 addListener(event: 'accent-color-changed', listener: (event: Event,
6599 /**
6600 * The new RGBA color the user assigned to be their system accent color.
6601 */
6602 newColor: string) => void): this;
6603 removeListener(event: 'accent-color-changed', listener: (event: Event,
6604 /**
6605 * The new RGBA color the user assigned to be their system accent color.
6606 */
6607 newColor: string) => void): this;
6608 on(event: 'color-changed', listener: (event: Event) => void): this;
6609 once(event: 'color-changed', listener: (event: Event) => void): this;
6610 addListener(event: 'color-changed', listener: (event: Event) => void): this;
6611 removeListener(event: 'color-changed', listener: (event: Event) => void): this;
6612 /**
6613 * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
6614 *
6615 * @deprecated
6616 * @platform win32
6617 */
6618 on(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
6619 /**
6620 * `true` if a high contrast theme is being used, `false` otherwise.
6621 */
6622 highContrastColorScheme: boolean) => void): this;
6623 once(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
6624 /**
6625 * `true` if a high contrast theme is being used, `false` otherwise.
6626 */
6627 highContrastColorScheme: boolean) => void): this;
6628 addListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
6629 /**
6630 * `true` if a high contrast theme is being used, `false` otherwise.
6631 */
6632 highContrastColorScheme: boolean) => void): this;
6633 removeListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
6634 /**
6635 * `true` if a high contrast theme is being used, `false` otherwise.
6636 */
6637 highContrastColorScheme: boolean) => void): this;
6638 /**
6639 * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
6640 *
6641 * @deprecated
6642 * @platform win32
6643 */
6644 on(event: 'inverted-color-scheme-changed', listener: (event: Event,
6645 /**
6646 * `true` if an inverted color scheme (a high contrast color scheme with light text
6647 * and dark backgrounds) is being used, `false` otherwise.
6648 */
6649 invertedColorScheme: boolean) => void): this;
6650 once(event: 'inverted-color-scheme-changed', listener: (event: Event,
6651 /**
6652 * `true` if an inverted color scheme (a high contrast color scheme with light text
6653 * and dark backgrounds) is being used, `false` otherwise.
6654 */
6655 invertedColorScheme: boolean) => void): this;
6656 addListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
6657 /**
6658 * `true` if an inverted color scheme (a high contrast color scheme with light text
6659 * and dark backgrounds) is being used, `false` otherwise.
6660 */
6661 invertedColorScheme: boolean) => void): this;
6662 removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
6663 /**
6664 * `true` if an inverted color scheme (a high contrast color scheme with light text
6665 * and dark backgrounds) is being used, `false` otherwise.
6666 */
6667 invertedColorScheme: boolean) => void): this;
6668 /**
6669 * A promise that resolves with `true` if consent was granted and `false` if it was
6670 * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
6671 * access request was denied and later is changed through the System Preferences
6672 * pane, a restart of the app will be required for the new permissions to take
6673 * effect. If access has already been requested and denied, it _must_ be changed
6674 * through the preference pane; an alert will not pop up and the promise will
6675 * resolve with the existing access status.
6676 *
6677 * **Important:** In order to properly leverage this API, you must set the
6678 * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
6679 * app's `Info.plist` file. The values for these keys will be used to populate the
6680 * permission dialogs so that the user will be properly informed as to the purpose
6681 * of the permission request. See Electron Application Distribution for more
6682 * information about how to set these in the context of Electron.
6683 *
6684 * This user consent was not required until macOS 10.14 Mojave, so this method will
6685 * always return `true` if your system is running 10.13 High Sierra or lower.
6686 *
6687 * @platform darwin
6688 */
6689 askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
6690 /**
6691 * whether or not this device has the ability to use Touch ID.
6692 *
6693 * **NOTE:** This API will return `false` on macOS systems older than Sierra
6694 * 10.12.2.
6695
6696**Deprecated**
6697 *
6698 * @platform darwin
6699 */
6700 canPromptTouchID(): boolean;
6701 /**
6702 * The users current system wide accent color preference in RGBA hexadecimal form.
6703 *
6704This API is only available on macOS 10.14 Mojave or newer.
6705 *
6706 * @platform win32,darwin
6707 */
6708 getAccentColor(): string;
6709 /**
6710 * * `shouldRenderRichAnimation` Boolean - Returns true if rich animations should
6711 * be rendered. Looks at session type (e.g. remote desktop) and accessibility
6712 * settings to give guidance for heavy animations.
6713 * * `scrollAnimationsEnabledBySystem` Boolean - Determines on a per-platform basis
6714 * whether scroll animations (e.g. produced by home/end key) should be enabled.
6715 * * `prefersReducedMotion` Boolean - Determines whether the user desires reduced
6716 * motion based on platform APIs.
6717 *
6718Returns an object with system animation settings.
6719 */
6720 getAnimationSettings(): AnimationSettings;
6721 /**
6722 * | `null` - Can be `dark`, `light` or `unknown`.
6723 *
6724 * Gets the macOS appearance setting that you have declared you want for your
6725 * application, maps to NSApplication.appearance. You can use the
6726 * `setAppLevelAppearance` API to set this value.
6727
6728**Deprecated**
6729 *
6730 * @deprecated
6731 * @platform darwin
6732 */
6733 getAppLevelAppearance(): ('dark' | 'light' | 'unknown');
6734 /**
6735 * The system color setting in RGB hexadecimal form (`#ABCDEF`). See the Windows
6736 * docs and the MacOS docs for more details.
6737 *
6738 * @platform win32,darwin
6739 */
6740 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' | 'alternate-selected-control-text' | 'control-background' | 'control' | 'control-text' | 'disabled-control-text' | 'find-highlight' | 'grid' | 'header-text' | 'highlight' | 'keyboard-focus-indicator' | 'label' | 'link' | 'placeholder-text' | 'quaternary-label' | 'scrubber-textured-background' | 'secondary-label' | 'selected-content-background' | 'selected-control' | 'selected-control-text' | 'selected-menu-item' | 'selected-text-background' | 'selected-text' | 'separator' | 'shadow' | 'tertiary-label' | 'text-background' | 'text' | 'under-page-background' | 'unemphasized-selected-content-background' | 'unemphasized-selected-text-background' | 'unemphasized-selected-text' | 'window-background' | 'window-frame-text'): string;
6741 /**
6742 * Can be `dark`, `light` or `unknown`.
6743 *
6744 * Gets the macOS appearance setting that is currently applied to your application,
6745 * maps to NSApplication.effectiveAppearance
6746 *
6747 * Please note that until Electron is built targeting the 10.14 SDK, your
6748 * application's `effectiveAppearance` will default to 'light' and won't inherit
6749 * the OS preference. In the interim in order for your application to inherit the
6750 * OS preference you must set the `NSRequiresAquaSystemAppearance` key in your apps
6751 * `Info.plist` to `false`. If you are using `electron-packager` or
6752 * `electron-forge` just set the `enableDarwinDarkMode` packager option to `true`.
6753 * See the Electron Packager API for more details.
6754
6755**Deprecated**
6756 *
6757 * @platform darwin
6758 */
6759 getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
6760 /**
6761 * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
6762 *
6763 * This user consent was not required until macOS 10.14 Mojave, so this method will
6764 * always return `granted` if your system is running 10.13 High Sierra or lower.
6765 *
6766 * @platform darwin
6767 */
6768 getMediaAccessStatus(mediaType: string): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
6769 /**
6770 * The standard system color formatted as `#RRGGBBAA`.
6771 *
6772 * Returns one of several standard system colors that automatically adapt to
6773 * vibrancy and changes in accessibility settings like 'Increase contrast' and
6774 * 'Reduce transparency'. See Apple Documentation for more details.
6775 *
6776 * @platform darwin
6777 */
6778 getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
6779 /**
6780 * The value of `key` in `NSUserDefaults`.
6781 *
6782 * Some popular `key` and `type`s are:
6783 *
6784 * * `AppleInterfaceStyle`: `string`
6785 * * `AppleAquaColorVariant`: `integer`
6786 * * `AppleHighlightColor`: `string`
6787 * * `AppleShowScrollBars`: `string`
6788 * * `NSNavRecentPlaces`: `array`
6789 * * `NSPreferredWebServices`: `dictionary`
6790 * * `NSUserDictionaryReplacementItems`: `array`
6791 *
6792 * @platform darwin
6793 */
6794 getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any;
6795 /**
6796 * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
6797 *
6798 * An example of using it to determine if you should create a transparent window or
6799 * not (transparent windows won't work correctly when DWM composition is disabled):
6800 *
6801 * @platform win32
6802 */
6803 isAeroGlassEnabled(): boolean;
6804 /**
6805 * Whether the system is in Dark Mode.
6806 *
6807 * **Note:** On macOS 10.15 Catalina in order for this API to return the correct
6808 * value when in the "automatic" dark mode setting you must either have
6809 * `NSRequiresAquaSystemAppearance=false` in your `Info.plist` or be on Electron
6810 * `>=7.0.0`. See the dark mode guide for more information.
6811 *
6812**Deprecated:** Should use the new `nativeTheme.shouldUseDarkColors` API.
6813 *
6814 * @deprecated
6815 * @platform darwin,win32
6816 */
6817 isDarkMode(): boolean;
6818 /**
6819 * `true` if a high contrast theme is active, `false` otherwise.
6820 *
6821 * **Depreacted:** Should use the new `nativeTheme.shouldUseHighContrastColors`
6822 * API.
6823 *
6824 * @deprecated
6825 * @platform darwin,win32
6826 */
6827 isHighContrastColorScheme(): boolean;
6828 /**
6829 * `true` if an inverted color scheme (a high contrast color scheme with light text
6830 * and dark backgrounds) is active, `false` otherwise.
6831 *
6832 * **Deprecated:** Should use the new `nativeTheme.shouldUseInvertedColorScheme`
6833 * API.
6834 *
6835 * @deprecated
6836 * @platform win32
6837 */
6838 isInvertedColorScheme(): boolean;
6839 /**
6840 * Whether the Swipe between pages setting is on.
6841 *
6842 * @platform darwin
6843 */
6844 isSwipeTrackingFromScrollEventsEnabled(): boolean;
6845 /**
6846 * `true` if the current process is a trusted accessibility client and `false` if
6847 * it is not.
6848 *
6849 * @platform darwin
6850 */
6851 isTrustedAccessibilityClient(prompt: boolean): boolean;
6852 /**
6853 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
6854 * contains the user information dictionary sent along with the notification.
6855 *
6856 * @platform darwin
6857 */
6858 postLocalNotification(event: string, userInfo: Record<string, any>): void;
6859 /**
6860 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
6861 * contains the user information dictionary sent along with the notification.
6862 *
6863 * @platform darwin
6864 */
6865 postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
6866 /**
6867 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
6868 * contains the user information dictionary sent along with the notification.
6869 *
6870 * @platform darwin
6871 */
6872 postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
6873 /**
6874 * resolves if the user has successfully authenticated with Touch ID.
6875 *
6876 * This API itself will not protect your user data; rather, it is a mechanism to
6877 * allow you to do so. Native apps will need to set Access Control Constants like
6878 * `kSecAccessControlUserPresence` on the their keychain entry so that reading it
6879 * would auto-prompt for Touch ID biometric consent. This could be done with
6880 * `node-keytar`, such that one would store an encryption key with `node-keytar`
6881 * and only fetch it if `promptTouchID()` resolves.
6882 *
6883 * **NOTE:** This API will return a rejected Promise on macOS systems older than
6884 * Sierra 10.12.2.
6885 *
6886 * @platform darwin
6887 */
6888 promptTouchID(reason: string): Promise<void>;
6889 /**
6890 * Add the specified defaults to your application's `NSUserDefaults`.
6891 *
6892 * @platform darwin
6893 */
6894 registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
6895 /**
6896 * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
6897 * or global value of a `key` previously set with `setUserDefault`.
6898 *
6899 * @platform darwin
6900 */
6901 removeUserDefault(key: string): void;
6902 /**
6903 * Sets the appearance setting for your application, this should override the
6904 * system default and override the value of `getEffectiveAppearance`.
6905 *
6906**Deprecated**
6907 *
6908 * @deprecated
6909 * @platform darwin
6910 */
6911 setAppLevelAppearance(appearance: (('dark' | 'light')) | (null)): void;
6912 /**
6913 * Set the value of `key` in `NSUserDefaults`.
6914 *
6915 * Note that `type` should match actual type of `value`. An exception is thrown if
6916 * they don't.
6917 *
6918Some popular `key` and `type`s are:
6919
6920* `ApplePressAndHoldEnabled`: `boolean`
6921 *
6922 * @platform darwin
6923 */
6924 setUserDefault(key: string, type: string, value: string): void;
6925 /**
6926 * The ID of this subscription
6927 *
6928 * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
6929 * defaults. This is necessary for events such as
6930 * `NSUserDefaultsDidChangeNotification`.
6931 *
6932 * @platform darwin
6933 */
6934 subscribeLocalNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
6935 /**
6936 * The ID of this subscription
6937 *
6938 * Subscribes to native notifications of macOS, `callback` will be called with
6939 * `callback(event, userInfo)` when the corresponding `event` happens. The
6940 * `userInfo` is an Object that contains the user information dictionary sent along
6941 * with the notification. The `object` is the sender of the notification, and only
6942 * supports `NSString` values for now.
6943 *
6944 * The `id` of the subscriber is returned, which can be used to unsubscribe the
6945 * `event`.
6946 *
6947 * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
6948 * values of `event` are:
6949 *
6950 * * `AppleInterfaceThemeChangedNotification`
6951 * * `AppleAquaColorVariantChanged`
6952 * * `AppleColorPreferencesChangedNotification`
6953 * * `AppleShowScrollBarsSettingChanged`
6954 *
6955 * @platform darwin
6956 */
6957 subscribeNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
6958 /**
6959 * Same as `subscribeNotification`, but uses
6960 * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
6961 * such as `NSWorkspaceDidActivateApplicationNotification`.
6962 *
6963 * @platform darwin
6964 */
6965 subscribeWorkspaceNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): void;
6966 /**
6967 * Same as `unsubscribeNotification`, but removes the subscriber from
6968 * `NSNotificationCenter`.
6969 *
6970 * @platform darwin
6971 */
6972 unsubscribeLocalNotification(id: number): void;
6973 /**
6974 * Removes the subscriber with `id`.
6975 *
6976 * @platform darwin
6977 */
6978 unsubscribeNotification(id: number): void;
6979 /**
6980 * Same as `unsubscribeNotification`, but removes the subscriber from
6981 * `NSWorkspace.sharedWorkspace.notificationCenter`.
6982 *
6983 * @platform darwin
6984 */
6985 unsubscribeWorkspaceNotification(id: number): void;
6986 /**
6987 * A `String` property that can be `dark`, `light` or `unknown`. It determines the
6988 * macOS appearance setting for your application. This maps to values in:
6989 * NSApplication.appearance. Setting this will override the system default as well
6990 * as the value of `getEffectiveAppearance`.
6991 *
6992 * Possible values that can be set are `dark` and `light`, and possible return
6993 * values are `dark`, `light`, and `unknown`.
6994 *
6995This property is only available on macOS 10.14 Mojave or newer.
6996 *
6997 * @platform darwin
6998 */
6999 appLevelAppearance: ('dark' | 'light' | 'unknown');
7000 /**
7001 * A `String` property that can be `dark`, `light` or `unknown`.
7002 *
7003 * Returns the macOS appearance setting that is currently applied to your
7004 * application, maps to NSApplication.effectiveAppearance
7005 *
7006 * Please note that until Electron is built targeting the 10.14 SDK, your
7007 * application's `effectiveAppearance` will default to 'light' and won't inherit
7008 * the OS preference. In the interim in order for your application to inherit the
7009 * OS preference you must set the `NSRequiresAquaSystemAppearance` key in your apps
7010 * `Info.plist` to `false`. If you are using `electron-packager` or
7011 * `electron-forge` just set the `enableDarwinDarkMode` packager option to `true`.
7012 * See the Electron Packager API for more details.
7013 *
7014 * @platform darwin
7015 */
7016 readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
7017 }
7018
7019 interface Task {
7020
7021 // Docs: http://electronjs.org/docs/api/structures/task
7022
7023 /**
7024 * The command line arguments when `program` is executed.
7025 */
7026 arguments: string;
7027 /**
7028 * Description of this task.
7029 */
7030 description: string;
7031 /**
7032 * The icon index in the icon file. If an icon file consists of two or more icons,
7033 * set this value to identify the icon. If an icon file consists of one icon, this
7034 * value is 0.
7035 */
7036 iconIndex: number;
7037 /**
7038 * The absolute path to an icon to be displayed in a JumpList, which can be an
7039 * arbitrary resource file that contains an icon. You can usually specify
7040 * `process.execPath` to show the icon of the program.
7041 */
7042 iconPath: string;
7043 /**
7044 * Path of the program to execute, usually you should specify `process.execPath`
7045 * which opens the current program.
7046 */
7047 program: string;
7048 /**
7049 * The string to be displayed in a JumpList.
7050 */
7051 title: string;
7052 /**
7053 * The working directory. Default is empty.
7054 */
7055 workingDirectory?: string;
7056 }
7057
7058 interface ThumbarButton {
7059
7060 // Docs: http://electronjs.org/docs/api/structures/thumbar-button
7061
7062 click: Function;
7063 /**
7064 * Control specific states and behaviors of the button. By default, it is
7065 * `['enabled']`.
7066 */
7067 flags?: string[];
7068 /**
7069 * The icon showing in thumbnail toolbar.
7070 */
7071 icon: NativeImage;
7072 /**
7073 * The text of the button's tooltip.
7074 */
7075 tooltip?: string;
7076 }
7077
7078 class TouchBar {
7079
7080 // Docs: http://electronjs.org/docs/api/touch-bar
7081
7082 /**
7083 * TouchBar
7084 */
7085 constructor(options: TouchBarConstructorOptions);
7086 escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
7087 static TouchBarButton: typeof TouchBarButton;
7088 static TouchBarColorPicker: typeof TouchBarColorPicker;
7089 static TouchBarGroup: typeof TouchBarGroup;
7090 static TouchBarLabel: typeof TouchBarLabel;
7091 static TouchBarPopover: typeof TouchBarPopover;
7092 static TouchBarScrubber: typeof TouchBarScrubber;
7093 static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
7094 static TouchBarSlider: typeof TouchBarSlider;
7095 static TouchBarSpacer: typeof TouchBarSpacer;
7096 }
7097
7098 class TouchBarButton {
7099
7100 // Docs: http://electronjs.org/docs/api/touch-bar-button
7101
7102 /**
7103 * TouchBarButton
7104 */
7105 constructor(options: TouchBarButtonConstructorOptions);
7106 backgroundColor: string;
7107 icon: NativeImage;
7108 label: string;
7109 }
7110
7111 class TouchBarColorPicker extends NodeJS.EventEmitter {
7112
7113 // Docs: http://electronjs.org/docs/api/touch-bar-color-picker
7114
7115 /**
7116 * TouchBarColorPicker
7117 */
7118 constructor(options: TouchBarColorPickerConstructorOptions);
7119 availableColors: string[];
7120 selectedColor: string;
7121 }
7122
7123 class TouchBarGroup extends NodeJS.EventEmitter {
7124
7125 // Docs: http://electronjs.org/docs/api/touch-bar-group
7126
7127 /**
7128 * TouchBarGroup
7129 */
7130 constructor(options: TouchBarGroupConstructorOptions);
7131 }
7132
7133 class TouchBarLabel extends NodeJS.EventEmitter {
7134
7135 // Docs: http://electronjs.org/docs/api/touch-bar-label
7136
7137 /**
7138 * TouchBarLabel
7139 */
7140 constructor(options: TouchBarLabelConstructorOptions);
7141 label: string;
7142 textColor: string;
7143 }
7144
7145 class TouchBarPopover extends NodeJS.EventEmitter {
7146
7147 // Docs: http://electronjs.org/docs/api/touch-bar-popover
7148
7149 /**
7150 * TouchBarPopover
7151 */
7152 constructor(options: TouchBarPopoverConstructorOptions);
7153 icon: NativeImage;
7154 label: string;
7155 }
7156
7157 class TouchBarScrubber extends NodeJS.EventEmitter {
7158
7159 // Docs: http://electronjs.org/docs/api/touch-bar-scrubber
7160
7161 /**
7162 * TouchBarScrubber
7163 */
7164 constructor(options: TouchBarScrubberConstructorOptions);
7165 continuous: boolean;
7166 items: ScrubberItem[];
7167 mode: ('fixed' | 'free');
7168 overlayStyle: ('background' | 'outline' | 'null');
7169 selectedStyle: ('background' | 'outline' | 'null');
7170 showArrowButtons: boolean;
7171 }
7172
7173 class TouchBarSegmentedControl extends NodeJS.EventEmitter {
7174
7175 // Docs: http://electronjs.org/docs/api/touch-bar-segmented-control
7176
7177 /**
7178 * TouchBarSegmentedControl
7179 */
7180 constructor(options: TouchBarSegmentedControlConstructorOptions);
7181 segments: SegmentedControlSegment[];
7182 segmentStyle: string;
7183 selectedIndex: number;
7184 }
7185
7186 class TouchBarSlider extends NodeJS.EventEmitter {
7187
7188 // Docs: http://electronjs.org/docs/api/touch-bar-slider
7189
7190 /**
7191 * TouchBarSlider
7192 */
7193 constructor(options: TouchBarSliderConstructorOptions);
7194 label: string;
7195 maxValue: number;
7196 minValue: number;
7197 value: number;
7198 }
7199
7200 class TouchBarSpacer extends NodeJS.EventEmitter {
7201
7202 // Docs: http://electronjs.org/docs/api/touch-bar-spacer
7203
7204 /**
7205 * TouchBarSpacer
7206 */
7207 constructor(options: TouchBarSpacerConstructorOptions);
7208 }
7209
7210 interface TraceCategoriesAndOptions {
7211
7212 // Docs: http://electronjs.org/docs/api/structures/trace-categories-and-options
7213
7214 /**
7215 * A filter to control what category groups should be traced. A filter can have an
7216 * optional '-' prefix to exclude category groups that contain a matching category.
7217 * Having both included and excluded category patterns in the same list is not
7218 * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
7219 * `-excluded_category1,-excluded_category2`.
7220 */
7221 categoryFilter: string;
7222 /**
7223 * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
7224 * the following strings: `record-until-full`, `record-continuously`,
7225 * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
7226 * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
7227 * modes and hence mutually exclusive. If more than one trace recording modes
7228 * appear in the `traceOptions` string, the last one takes precedence. If none of
7229 * the trace recording modes are specified, recording mode is `record-until-full`.
7230 * The trace option will first be reset to the default option (`record_mode` set to
7231 * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
7232 * before options parsed from `traceOptions` are applied on it.
7233 */
7234 traceOptions: string;
7235 }
7236
7237 interface TraceConfig {
7238
7239 // Docs: http://electronjs.org/docs/api/structures/trace-config
7240
7241 /**
7242 * if true, filter event data according to a whitelist of events that have been
7243 * manually vetted to not include any PII. See the implementation in Chromium for
7244 * specifics.
7245 */
7246 enable_argument_filter?: boolean;
7247 /**
7248 * a list of tracing categories to exclude. Can include glob-like patterns using
7249 * `*` at the end of the category name. See tracing categories for the list of
7250 * categories.
7251 */
7252 excluded_categories?: string[];
7253 /**
7254 * a list of histogram names to report with the trace.
7255 */
7256 histogram_names?: string[];
7257 /**
7258 * a list of tracing categories to include. Can include glob-like patterns using
7259 * `*` at the end of the category name. See tracing categories for the list of
7260 * categories.
7261 */
7262 included_categories?: string[];
7263 /**
7264 * a list of process IDs to include in the trace. If not specified, trace all
7265 * processes.
7266 */
7267 included_process_ids?: number[];
7268 /**
7269 * if the `disabled-by-default-memory-infra` category is enabled, this contains
7270 * optional additional configuration for data collection. See the Chromium
7271 * memory-infra docs for more information.
7272 */
7273 memory_dump_config?: Record<string, any>;
7274 /**
7275 * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
7276 * or `trace-to-console`. Defaults to `record-until-full`.
7277 */
7278 recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
7279 /**
7280 * maximum size of the trace recording buffer in events.
7281 */
7282 trace_buffer_size_in_events?: number;
7283 /**
7284 * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
7285 */
7286 trace_buffer_size_in_kb?: number;
7287 }
7288
7289 interface Transaction {
7290
7291 // Docs: http://electronjs.org/docs/api/structures/transaction
7292
7293 /**
7294 * The error code if an error occurred while processing the transaction.
7295 */
7296 errorCode: number;
7297 /**
7298 * The error message if an error occurred while processing the transaction.
7299 */
7300 errorMessage: string;
7301 /**
7302 * The identifier of the restored transaction by the App Store.
7303 */
7304 originalTransactionIdentifier: string;
7305 payment: Payment;
7306 /**
7307 * The date the transaction was added to the App Stores payment queue.
7308 */
7309 transactionDate: string;
7310 /**
7311 * A string that uniquely identifies a successful payment transaction.
7312 */
7313 transactionIdentifier: string;
7314 /**
7315 * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
7316 * `deferred`.
7317 */
7318 transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
7319 }
7320
7321 class Tray extends NodeJS.EventEmitter {
7322
7323 // Docs: http://electronjs.org/docs/api/tray
7324
7325 /**
7326 * Emitted when the tray balloon is clicked.
7327 *
7328 * @platform win32
7329 */
7330 on(event: 'balloon-click', listener: Function): this;
7331 once(event: 'balloon-click', listener: Function): this;
7332 addListener(event: 'balloon-click', listener: Function): this;
7333 removeListener(event: 'balloon-click', listener: Function): this;
7334 /**
7335 * Emitted when the tray balloon is closed because of timeout or user manually
7336 * closes it.
7337 *
7338 * @platform win32
7339 */
7340 on(event: 'balloon-closed', listener: Function): this;
7341 once(event: 'balloon-closed', listener: Function): this;
7342 addListener(event: 'balloon-closed', listener: Function): this;
7343 removeListener(event: 'balloon-closed', listener: Function): this;
7344 /**
7345 * Emitted when the tray balloon shows.
7346 *
7347 * @platform win32
7348 */
7349 on(event: 'balloon-show', listener: Function): this;
7350 once(event: 'balloon-show', listener: Function): this;
7351 addListener(event: 'balloon-show', listener: Function): this;
7352 removeListener(event: 'balloon-show', listener: Function): this;
7353 /**
7354 * Emitted when the tray icon is clicked.
7355 */
7356 on(event: 'click', listener: (event: KeyboardEvent,
7357 /**
7358 * The bounds of tray icon.
7359 */
7360 bounds: Rectangle,
7361 /**
7362 * The position of the event.
7363 */
7364 position: Point) => void): this;
7365 once(event: 'click', listener: (event: KeyboardEvent,
7366 /**
7367 * The bounds of tray icon.
7368 */
7369 bounds: Rectangle,
7370 /**
7371 * The position of the event.
7372 */
7373 position: Point) => void): this;
7374 addListener(event: 'click', listener: (event: KeyboardEvent,
7375 /**
7376 * The bounds of tray icon.
7377 */
7378 bounds: Rectangle,
7379 /**
7380 * The position of the event.
7381 */
7382 position: Point) => void): this;
7383 removeListener(event: 'click', listener: (event: KeyboardEvent,
7384 /**
7385 * The bounds of tray icon.
7386 */
7387 bounds: Rectangle,
7388 /**
7389 * The position of the event.
7390 */
7391 position: Point) => void): this;
7392 /**
7393 * Emitted when the tray icon is double clicked.
7394 *
7395 * @platform darwin,win32
7396 */
7397 on(event: 'double-click', listener: (event: KeyboardEvent,
7398 /**
7399 * The bounds of tray icon.
7400 */
7401 bounds: Rectangle) => void): this;
7402 once(event: 'double-click', listener: (event: KeyboardEvent,
7403 /**
7404 * The bounds of tray icon.
7405 */
7406 bounds: Rectangle) => void): this;
7407 addListener(event: 'double-click', listener: (event: KeyboardEvent,
7408 /**
7409 * The bounds of tray icon.
7410 */
7411 bounds: Rectangle) => void): this;
7412 removeListener(event: 'double-click', listener: (event: KeyboardEvent,
7413 /**
7414 * The bounds of tray icon.
7415 */
7416 bounds: Rectangle) => void): this;
7417 /**
7418 * Emitted when a drag operation ends on the tray or ends at another location.
7419 *
7420 * @platform darwin
7421 */
7422 on(event: 'drag-end', listener: Function): this;
7423 once(event: 'drag-end', listener: Function): this;
7424 addListener(event: 'drag-end', listener: Function): this;
7425 removeListener(event: 'drag-end', listener: Function): this;
7426 /**
7427 * Emitted when a drag operation enters the tray icon.
7428 *
7429 * @platform darwin
7430 */
7431 on(event: 'drag-enter', listener: Function): this;
7432 once(event: 'drag-enter', listener: Function): this;
7433 addListener(event: 'drag-enter', listener: Function): this;
7434 removeListener(event: 'drag-enter', listener: Function): this;
7435 /**
7436 * Emitted when a drag operation exits the tray icon.
7437 *
7438 * @platform darwin
7439 */
7440 on(event: 'drag-leave', listener: Function): this;
7441 once(event: 'drag-leave', listener: Function): this;
7442 addListener(event: 'drag-leave', listener: Function): this;
7443 removeListener(event: 'drag-leave', listener: Function): this;
7444 /**
7445 * Emitted when any dragged items are dropped on the tray icon.
7446 *
7447 * @platform darwin
7448 */
7449 on(event: 'drop', listener: Function): this;
7450 once(event: 'drop', listener: Function): this;
7451 addListener(event: 'drop', listener: Function): this;
7452 removeListener(event: 'drop', listener: Function): this;
7453 /**
7454 * Emitted when dragged files are dropped in the tray icon.
7455 *
7456 * @platform darwin
7457 */
7458 on(event: 'drop-files', listener: (event: Event,
7459 /**
7460 * The paths of the dropped files.
7461 */
7462 files: string[]) => void): this;
7463 once(event: 'drop-files', listener: (event: Event,
7464 /**
7465 * The paths of the dropped files.
7466 */
7467 files: string[]) => void): this;
7468 addListener(event: 'drop-files', listener: (event: Event,
7469 /**
7470 * The paths of the dropped files.
7471 */
7472 files: string[]) => void): this;
7473 removeListener(event: 'drop-files', listener: (event: Event,
7474 /**
7475 * The paths of the dropped files.
7476 */
7477 files: string[]) => void): this;
7478 /**
7479 * Emitted when dragged text is dropped in the tray icon.
7480 *
7481 * @platform darwin
7482 */
7483 on(event: 'drop-text', listener: (event: Event,
7484 /**
7485 * the dropped text string.
7486 */
7487 text: string) => void): this;
7488 once(event: 'drop-text', listener: (event: Event,
7489 /**
7490 * the dropped text string.
7491 */
7492 text: string) => void): this;
7493 addListener(event: 'drop-text', listener: (event: Event,
7494 /**
7495 * the dropped text string.
7496 */
7497 text: string) => void): this;
7498 removeListener(event: 'drop-text', listener: (event: Event,
7499 /**
7500 * the dropped text string.
7501 */
7502 text: string) => void): this;
7503 /**
7504 * Emitted when the mouse enters the tray icon.
7505 *
7506 * @platform darwin
7507 */
7508 on(event: 'mouse-enter', listener: (event: KeyboardEvent,
7509 /**
7510 * The position of the event.
7511 */
7512 position: Point) => void): this;
7513 once(event: 'mouse-enter', listener: (event: KeyboardEvent,
7514 /**
7515 * The position of the event.
7516 */
7517 position: Point) => void): this;
7518 addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
7519 /**
7520 * The position of the event.
7521 */
7522 position: Point) => void): this;
7523 removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
7524 /**
7525 * The position of the event.
7526 */
7527 position: Point) => void): this;
7528 /**
7529 * Emitted when the mouse exits the tray icon.
7530 *
7531 * @platform darwin
7532 */
7533 on(event: 'mouse-leave', listener: (event: KeyboardEvent,
7534 /**
7535 * The position of the event.
7536 */
7537 position: Point) => void): this;
7538 once(event: 'mouse-leave', listener: (event: KeyboardEvent,
7539 /**
7540 * The position of the event.
7541 */
7542 position: Point) => void): this;
7543 addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
7544 /**
7545 * The position of the event.
7546 */
7547 position: Point) => void): this;
7548 removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
7549 /**
7550 * The position of the event.
7551 */
7552 position: Point) => void): this;
7553 /**
7554 * Emitted when the mouse moves in the tray icon.
7555 *
7556 * @platform darwin,win32
7557 */
7558 on(event: 'mouse-move', listener: (event: KeyboardEvent,
7559 /**
7560 * The position of the event.
7561 */
7562 position: Point) => void): this;
7563 once(event: 'mouse-move', listener: (event: KeyboardEvent,
7564 /**
7565 * The position of the event.
7566 */
7567 position: Point) => void): this;
7568 addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
7569 /**
7570 * The position of the event.
7571 */
7572 position: Point) => void): this;
7573 removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
7574 /**
7575 * The position of the event.
7576 */
7577 position: Point) => void): this;
7578 /**
7579 * Emitted when the tray icon is right clicked.
7580 *
7581 * @platform darwin,win32
7582 */
7583 on(event: 'right-click', listener: (event: KeyboardEvent,
7584 /**
7585 * The bounds of tray icon.
7586 */
7587 bounds: Rectangle) => void): this;
7588 once(event: 'right-click', listener: (event: KeyboardEvent,
7589 /**
7590 * The bounds of tray icon.
7591 */
7592 bounds: Rectangle) => void): this;
7593 addListener(event: 'right-click', listener: (event: KeyboardEvent,
7594 /**
7595 * The bounds of tray icon.
7596 */
7597 bounds: Rectangle) => void): this;
7598 removeListener(event: 'right-click', listener: (event: KeyboardEvent,
7599 /**
7600 * The bounds of tray icon.
7601 */
7602 bounds: Rectangle) => void): this;
7603 /**
7604 * Tray
7605 */
7606 constructor(image: (NativeImage) | (string));
7607 /**
7608 * Destroys the tray icon immediately.
7609 */
7610 destroy(): void;
7611 /**
7612 * Displays a tray balloon.
7613 *
7614 * @platform win32
7615 */
7616 displayBalloon(options: DisplayBalloonOptions): void;
7617 /**
7618 * The `bounds` of this tray icon as `Object`.
7619 *
7620 * @platform darwin,win32
7621 */
7622 getBounds(): Rectangle;
7623 /**
7624 * Whether double click events will be ignored.
7625 *
7626 * @platform darwin
7627 */
7628 getIgnoreDoubleClickEvents(): boolean;
7629 /**
7630 * the title displayed next to the tray icon in the status bar
7631 *
7632 * @platform darwin
7633 */
7634 getTitle(): string;
7635 /**
7636 * Whether the tray icon is destroyed.
7637 */
7638 isDestroyed(): boolean;
7639 /**
7640 * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
7641 * will be shown instead of the tray icon's context menu.
7642 *
7643The `position` is only available on Windows, and it is (0, 0) by default.
7644 *
7645 * @platform darwin,win32
7646 */
7647 popUpContextMenu(menu?: Menu, position?: Point): void;
7648 /**
7649 * Sets the context menu for this icon.
7650 */
7651 setContextMenu(menu: (Menu) | (null)): void;
7652 /**
7653 * Sets the option to ignore double click events. Ignoring these events allows you
7654 * to detect every individual click of the tray icon.
7655 *
7656This value is set to false by default.
7657 *
7658 * @platform darwin
7659 */
7660 setIgnoreDoubleClickEvents(ignore: boolean): void;
7661 /**
7662 * Sets the `image` associated with this tray icon.
7663 */
7664 setImage(image: (NativeImage) | (string)): void;
7665 /**
7666 * Sets the `image` associated with this tray icon when pressed on macOS.
7667 *
7668 * @platform darwin
7669 */
7670 setPressedImage(image: (NativeImage) | (string)): void;
7671 /**
7672 * Sets the title displayed next to the tray icon in the status bar (Support ANSI
7673 * colors).
7674 *
7675 * @platform darwin
7676 */
7677 setTitle(title: string): void;
7678 /**
7679 * Sets the hover text for this tray icon.
7680 */
7681 setToolTip(toolTip: string): void;
7682 }
7683
7684 interface UploadBlob {
7685
7686 // Docs: http://electronjs.org/docs/api/structures/upload-blob
7687
7688 /**
7689 * UUID of blob data to upload.
7690 */
7691 blobUUID: string;
7692 /**
7693 * `blob`.
7694 */
7695 type: string;
7696 }
7697
7698 interface UploadData {
7699
7700 // Docs: http://electronjs.org/docs/api/structures/upload-data
7701
7702 /**
7703 * UUID of blob data. Use ses.getBlobData method to retrieve the data.
7704 */
7705 blobUUID?: string;
7706 /**
7707 * Content being sent.
7708 */
7709 bytes: Buffer;
7710 /**
7711 * Path of file being uploaded.
7712 */
7713 file?: string;
7714 }
7715
7716 interface UploadFile {
7717
7718 // Docs: http://electronjs.org/docs/api/structures/upload-file
7719
7720 /**
7721 * Path of file to be uploaded.
7722 */
7723 filePath: string;
7724 /**
7725 * Number of bytes to read from `offset`. Defaults to `0`.
7726 */
7727 length: number;
7728 /**
7729 * Last Modification time in number of seconds since the UNIX epoch.
7730 */
7731 modificationTime: number;
7732 /**
7733 * Defaults to `0`.
7734 */
7735 offset: number;
7736 /**
7737 * `file`.
7738 */
7739 type: string;
7740 }
7741
7742 interface UploadRawData {
7743
7744 // Docs: http://electronjs.org/docs/api/structures/upload-raw-data
7745
7746 /**
7747 * Data to be uploaded.
7748 */
7749 bytes: Buffer;
7750 /**
7751 * `rawData`.
7752 */
7753 type: string;
7754 }
7755
7756 class WebContents extends NodeJS.EventEmitter {
7757
7758 // Docs: http://electronjs.org/docs/api/web-contents
7759
7760 /**
7761 * A WebContents instance with the given ID.
7762 */
7763 static fromId(id: number): WebContents;
7764 /**
7765 * An array of all `WebContents` instances. This will contain web contents for all
7766 * windows, webviews, opened devtools, and devtools extension background pages.
7767 */
7768 static getAllWebContents(): WebContents[];
7769 /**
7770 * The web contents that is focused in this application, otherwise returns `null`.
7771 */
7772 static getFocusedWebContents(): WebContents;
7773 /**
7774 * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
7775 * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
7776 * menu shortcuts.
7777 *
7778To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
7779 */
7780 on(event: 'before-input-event', listener: (event: Event,
7781 /**
7782 * Input properties.
7783 */
7784 input: Input) => void): this;
7785 once(event: 'before-input-event', listener: (event: Event,
7786 /**
7787 * Input properties.
7788 */
7789 input: Input) => void): this;
7790 addListener(event: 'before-input-event', listener: (event: Event,
7791 /**
7792 * Input properties.
7793 */
7794 input: Input) => void): this;
7795 removeListener(event: 'before-input-event', listener: (event: Event,
7796 /**
7797 * Input properties.
7798 */
7799 input: Input) => void): this;
7800 /**
7801 * Emitted when failed to verify the `certificate` for `url`.
7802 *
7803The usage is the same with the `certificate-error` event of `app`.
7804 */
7805 on(event: 'certificate-error', listener: (event: Event,
7806 url: string,
7807 /**
7808 * The error code.
7809 */
7810 error: string,
7811 certificate: Certificate,
7812 callback: (isTrusted: boolean) => void) => void): this;
7813 once(event: 'certificate-error', listener: (event: Event,
7814 url: string,
7815 /**
7816 * The error code.
7817 */
7818 error: string,
7819 certificate: Certificate,
7820 callback: (isTrusted: boolean) => void) => void): this;
7821 addListener(event: 'certificate-error', listener: (event: Event,
7822 url: string,
7823 /**
7824 * The error code.
7825 */
7826 error: string,
7827 certificate: Certificate,
7828 callback: (isTrusted: boolean) => void) => void): this;
7829 removeListener(event: 'certificate-error', listener: (event: Event,
7830 url: string,
7831 /**
7832 * The error code.
7833 */
7834 error: string,
7835 certificate: Certificate,
7836 callback: (isTrusted: boolean) => void) => void): this;
7837 /**
7838 * Emitted when the associated window logs a console message. Will not be emitted
7839 * for windows with *offscreen rendering* enabled.
7840 */
7841 on(event: 'console-message', listener: (event: Event,
7842 level: number,
7843 message: string,
7844 line: number,
7845 sourceId: string) => void): this;
7846 once(event: 'console-message', listener: (event: Event,
7847 level: number,
7848 message: string,
7849 line: number,
7850 sourceId: string) => void): this;
7851 addListener(event: 'console-message', listener: (event: Event,
7852 level: number,
7853 message: string,
7854 line: number,
7855 sourceId: string) => void): this;
7856 removeListener(event: 'console-message', listener: (event: Event,
7857 level: number,
7858 message: string,
7859 line: number,
7860 sourceId: string) => void): this;
7861 /**
7862 * Emitted when there is a new context menu that needs to be handled.
7863 */
7864 on(event: 'context-menu', listener: (event: Event,
7865 params: ContextMenuParams) => void): this;
7866 once(event: 'context-menu', listener: (event: Event,
7867 params: ContextMenuParams) => void): this;
7868 addListener(event: 'context-menu', listener: (event: Event,
7869 params: ContextMenuParams) => void): this;
7870 removeListener(event: 'context-menu', listener: (event: Event,
7871 params: ContextMenuParams) => void): this;
7872 /**
7873 * Emitted when the renderer process crashes or is killed.
7874 */
7875 on(event: 'crashed', listener: (event: Event,
7876 killed: boolean) => void): this;
7877 once(event: 'crashed', listener: (event: Event,
7878 killed: boolean) => void): this;
7879 addListener(event: 'crashed', listener: (event: Event,
7880 killed: boolean) => void): this;
7881 removeListener(event: 'crashed', listener: (event: Event,
7882 killed: boolean) => void): this;
7883 /**
7884 * Emitted when the cursor's type changes. The `type` parameter can be `default`,
7885 * `crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
7886 * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
7887 * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
7888 * `row-resize`, `m-panning`, `e-panning`, `n-panning`, `ne-panning`, `nw-panning`,
7889 * `s-panning`, `se-panning`, `sw-panning`, `w-panning`, `move`, `vertical-text`,
7890 * `cell`, `context-menu`, `alias`, `progress`, `nodrop`, `copy`, `none`,
7891 * `not-allowed`, `zoom-in`, `zoom-out`, `grab`, `grabbing` or `custom`.
7892 *
7893 * If the `type` parameter is `custom`, the `image` parameter will hold the custom
7894 * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
7895 * additional information about the custom cursor.
7896 */
7897 on(event: 'cursor-changed', listener: (event: Event,
7898 type: string,
7899 image: NativeImage,
7900 /**
7901 * scaling factor for the custom cursor.
7902 */
7903 scale: number,
7904 /**
7905 * the size of the `image`.
7906 */
7907 size: Size,
7908 /**
7909 * coordinates of the custom cursor's hotspot.
7910 */
7911 hotspot: Point) => void): this;
7912 once(event: 'cursor-changed', listener: (event: Event,
7913 type: string,
7914 image: NativeImage,
7915 /**
7916 * scaling factor for the custom cursor.
7917 */
7918 scale: number,
7919 /**
7920 * the size of the `image`.
7921 */
7922 size: Size,
7923 /**
7924 * coordinates of the custom cursor's hotspot.
7925 */
7926 hotspot: Point) => void): this;
7927 addListener(event: 'cursor-changed', listener: (event: Event,
7928 type: string,
7929 image: NativeImage,
7930 /**
7931 * scaling factor for the custom cursor.
7932 */
7933 scale: number,
7934 /**
7935 * the size of the `image`.
7936 */
7937 size: Size,
7938 /**
7939 * coordinates of the custom cursor's hotspot.
7940 */
7941 hotspot: Point) => void): this;
7942 removeListener(event: 'cursor-changed', listener: (event: Event,
7943 type: string,
7944 image: NativeImage,
7945 /**
7946 * scaling factor for the custom cursor.
7947 */
7948 scale: number,
7949 /**
7950 * the size of the `image`.
7951 */
7952 size: Size,
7953 /**
7954 * coordinates of the custom cursor's hotspot.
7955 */
7956 hotspot: Point) => void): this;
7957 /**
7958 * Emitted when `desktopCapturer.getSources()` is called in the renderer process.
7959 * Calling `event.preventDefault()` will make it return empty sources.
7960 */
7961 on(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
7962 once(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
7963 addListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
7964 removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
7965 /**
7966 * Emitted when `webContents` is destroyed.
7967 */
7968 on(event: 'destroyed', listener: Function): this;
7969 once(event: 'destroyed', listener: Function): this;
7970 addListener(event: 'destroyed', listener: Function): this;
7971 removeListener(event: 'destroyed', listener: Function): this;
7972 /**
7973 * Emitted when DevTools is closed.
7974 */
7975 on(event: 'devtools-closed', listener: Function): this;
7976 once(event: 'devtools-closed', listener: Function): this;
7977 addListener(event: 'devtools-closed', listener: Function): this;
7978 removeListener(event: 'devtools-closed', listener: Function): this;
7979 /**
7980 * Emitted when DevTools is focused / opened.
7981 */
7982 on(event: 'devtools-focused', listener: Function): this;
7983 once(event: 'devtools-focused', listener: Function): this;
7984 addListener(event: 'devtools-focused', listener: Function): this;
7985 removeListener(event: 'devtools-focused', listener: Function): this;
7986 /**
7987 * Emitted when DevTools is opened.
7988 */
7989 on(event: 'devtools-opened', listener: Function): this;
7990 once(event: 'devtools-opened', listener: Function): this;
7991 addListener(event: 'devtools-opened', listener: Function): this;
7992 removeListener(event: 'devtools-opened', listener: Function): this;
7993 /**
7994 * Emitted when the devtools window instructs the webContents to reload
7995 */
7996 on(event: 'devtools-reload-page', listener: Function): this;
7997 once(event: 'devtools-reload-page', listener: Function): this;
7998 addListener(event: 'devtools-reload-page', listener: Function): this;
7999 removeListener(event: 'devtools-reload-page', listener: Function): this;
8000 /**
8001 * Emitted when a `<webview>` has been attached to this web contents.
8002 */
8003 on(event: 'did-attach-webview', listener: (event: Event,
8004 /**
8005 * The guest web contents that is used by the `<webview>`.
8006 */
8007 webContents: WebContents) => void): this;
8008 once(event: 'did-attach-webview', listener: (event: Event,
8009 /**
8010 * The guest web contents that is used by the `<webview>`.
8011 */
8012 webContents: WebContents) => void): this;
8013 addListener(event: 'did-attach-webview', listener: (event: Event,
8014 /**
8015 * The guest web contents that is used by the `<webview>`.
8016 */
8017 webContents: WebContents) => void): this;
8018 removeListener(event: 'did-attach-webview', listener: (event: Event,
8019 /**
8020 * The guest web contents that is used by the `<webview>`.
8021 */
8022 webContents: WebContents) => void): this;
8023 /**
8024 * Emitted when a page's theme color changes. This is usually due to encountering a
8025 * meta tag:
8026 */
8027 on(event: 'did-change-theme-color', listener: (event: Event,
8028 /**
8029 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
8030 */
8031 color: (string) | (null)) => void): this;
8032 once(event: 'did-change-theme-color', listener: (event: Event,
8033 /**
8034 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
8035 */
8036 color: (string) | (null)) => void): this;
8037 addListener(event: 'did-change-theme-color', listener: (event: Event,
8038 /**
8039 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
8040 */
8041 color: (string) | (null)) => void): this;
8042 removeListener(event: 'did-change-theme-color', listener: (event: Event,
8043 /**
8044 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
8045 */
8046 color: (string) | (null)) => void): this;
8047 /**
8048 * This event is like `did-finish-load` but emitted when the load failed. The full
8049 * list of error codes and their meaning is available here.
8050 */
8051 on(event: 'did-fail-load', listener: (event: Event,
8052 errorCode: number,
8053 errorDescription: string,
8054 validatedURL: string,
8055 isMainFrame: boolean,
8056 frameProcessId: number,
8057 frameRoutingId: number) => void): this;
8058 once(event: 'did-fail-load', listener: (event: Event,
8059 errorCode: number,
8060 errorDescription: string,
8061 validatedURL: string,
8062 isMainFrame: boolean,
8063 frameProcessId: number,
8064 frameRoutingId: number) => void): this;
8065 addListener(event: 'did-fail-load', listener: (event: Event,
8066 errorCode: number,
8067 errorDescription: string,
8068 validatedURL: string,
8069 isMainFrame: boolean,
8070 frameProcessId: number,
8071 frameRoutingId: number) => void): this;
8072 removeListener(event: 'did-fail-load', listener: (event: Event,
8073 errorCode: number,
8074 errorDescription: string,
8075 validatedURL: string,
8076 isMainFrame: boolean,
8077 frameProcessId: number,
8078 frameRoutingId: number) => void): this;
8079 /**
8080 * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
8081 * `window.stop()` was invoked).
8082 */
8083 on(event: 'did-fail-provisional-load', listener: (event: Event,
8084 errorCode: number,
8085 errorDescription: string,
8086 validatedURL: string,
8087 isMainFrame: boolean,
8088 frameProcessId: number,
8089 frameRoutingId: number) => void): this;
8090 once(event: 'did-fail-provisional-load', listener: (event: Event,
8091 errorCode: number,
8092 errorDescription: string,
8093 validatedURL: string,
8094 isMainFrame: boolean,
8095 frameProcessId: number,
8096 frameRoutingId: number) => void): this;
8097 addListener(event: 'did-fail-provisional-load', listener: (event: Event,
8098 errorCode: number,
8099 errorDescription: string,
8100 validatedURL: string,
8101 isMainFrame: boolean,
8102 frameProcessId: number,
8103 frameRoutingId: number) => void): this;
8104 removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
8105 errorCode: number,
8106 errorDescription: string,
8107 validatedURL: string,
8108 isMainFrame: boolean,
8109 frameProcessId: number,
8110 frameRoutingId: number) => void): this;
8111 /**
8112 * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
8113 * spinning, and the `onload` event was dispatched.
8114 */
8115 on(event: 'did-finish-load', listener: Function): this;
8116 once(event: 'did-finish-load', listener: Function): this;
8117 addListener(event: 'did-finish-load', listener: Function): this;
8118 removeListener(event: 'did-finish-load', listener: Function): this;
8119 /**
8120 * Emitted when a frame has done navigation.
8121 */
8122 on(event: 'did-frame-finish-load', listener: (event: Event,
8123 isMainFrame: boolean,
8124 frameProcessId: number,
8125 frameRoutingId: number) => void): this;
8126 once(event: 'did-frame-finish-load', listener: (event: Event,
8127 isMainFrame: boolean,
8128 frameProcessId: number,
8129 frameRoutingId: number) => void): this;
8130 addListener(event: 'did-frame-finish-load', listener: (event: Event,
8131 isMainFrame: boolean,
8132 frameProcessId: number,
8133 frameRoutingId: number) => void): this;
8134 removeListener(event: 'did-frame-finish-load', listener: (event: Event,
8135 isMainFrame: boolean,
8136 frameProcessId: number,
8137 frameRoutingId: number) => void): this;
8138 /**
8139 * Emitted when any frame navigation is done.
8140 *
8141 * This event is not emitted for in-page navigations, such as clicking anchor links
8142 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
8143 * this purpose.
8144 */
8145 on(event: 'did-frame-navigate', listener: (event: Event,
8146 url: string,
8147 /**
8148 * -1 for non HTTP navigations
8149 */
8150 httpResponseCode: number,
8151 /**
8152 * empty for non HTTP navigations,
8153 */
8154 httpStatusText: string,
8155 isMainFrame: boolean,
8156 frameProcessId: number,
8157 frameRoutingId: number) => void): this;
8158 once(event: 'did-frame-navigate', listener: (event: Event,
8159 url: string,
8160 /**
8161 * -1 for non HTTP navigations
8162 */
8163 httpResponseCode: number,
8164 /**
8165 * empty for non HTTP navigations,
8166 */
8167 httpStatusText: string,
8168 isMainFrame: boolean,
8169 frameProcessId: number,
8170 frameRoutingId: number) => void): this;
8171 addListener(event: 'did-frame-navigate', listener: (event: Event,
8172 url: string,
8173 /**
8174 * -1 for non HTTP navigations
8175 */
8176 httpResponseCode: number,
8177 /**
8178 * empty for non HTTP navigations,
8179 */
8180 httpStatusText: string,
8181 isMainFrame: boolean,
8182 frameProcessId: number,
8183 frameRoutingId: number) => void): this;
8184 removeListener(event: 'did-frame-navigate', listener: (event: Event,
8185 url: string,
8186 /**
8187 * -1 for non HTTP navigations
8188 */
8189 httpResponseCode: number,
8190 /**
8191 * empty for non HTTP navigations,
8192 */
8193 httpStatusText: string,
8194 isMainFrame: boolean,
8195 frameProcessId: number,
8196 frameRoutingId: number) => void): this;
8197 /**
8198 * Emitted when a main frame navigation is done.
8199 *
8200 * This event is not emitted for in-page navigations, such as clicking anchor links
8201 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
8202 * this purpose.
8203 */
8204 on(event: 'did-navigate', listener: (event: Event,
8205 url: string,
8206 /**
8207 * -1 for non HTTP navigations
8208 */
8209 httpResponseCode: number,
8210 /**
8211 * empty for non HTTP navigations
8212 */
8213 httpStatusText: string) => void): this;
8214 once(event: 'did-navigate', listener: (event: Event,
8215 url: string,
8216 /**
8217 * -1 for non HTTP navigations
8218 */
8219 httpResponseCode: number,
8220 /**
8221 * empty for non HTTP navigations
8222 */
8223 httpStatusText: string) => void): this;
8224 addListener(event: 'did-navigate', listener: (event: Event,
8225 url: string,
8226 /**
8227 * -1 for non HTTP navigations
8228 */
8229 httpResponseCode: number,
8230 /**
8231 * empty for non HTTP navigations
8232 */
8233 httpStatusText: string) => void): this;
8234 removeListener(event: 'did-navigate', listener: (event: Event,
8235 url: string,
8236 /**
8237 * -1 for non HTTP navigations
8238 */
8239 httpResponseCode: number,
8240 /**
8241 * empty for non HTTP navigations
8242 */
8243 httpStatusText: string) => void): this;
8244 /**
8245 * Emitted when an in-page navigation happened in any frame.
8246 *
8247 * When in-page navigation happens, the page URL changes but does not cause
8248 * navigation outside of the page. Examples of this occurring are when anchor links
8249 * are clicked or when the DOM `hashchange` event is triggered.
8250 */
8251 on(event: 'did-navigate-in-page', listener: (event: Event,
8252 url: string,
8253 isMainFrame: boolean,
8254 frameProcessId: number,
8255 frameRoutingId: number) => void): this;
8256 once(event: 'did-navigate-in-page', listener: (event: Event,
8257 url: string,
8258 isMainFrame: boolean,
8259 frameProcessId: number,
8260 frameRoutingId: number) => void): this;
8261 addListener(event: 'did-navigate-in-page', listener: (event: Event,
8262 url: string,
8263 isMainFrame: boolean,
8264 frameProcessId: number,
8265 frameRoutingId: number) => void): this;
8266 removeListener(event: 'did-navigate-in-page', listener: (event: Event,
8267 url: string,
8268 isMainFrame: boolean,
8269 frameProcessId: number,
8270 frameRoutingId: number) => void): this;
8271 /**
8272 * Emitted after a server side redirect occurs during navigation. For example a
8273 * 302 redirect.
8274 *
8275 * This event can not be prevented, if you want to prevent redirects you should
8276 * checkout out the `will-redirect` event above.
8277 */
8278 on(event: 'did-redirect-navigation', listener: (event: Event,
8279 url: string,
8280 isInPlace: boolean,
8281 isMainFrame: boolean,
8282 frameProcessId: number,
8283 frameRoutingId: number) => void): this;
8284 once(event: 'did-redirect-navigation', listener: (event: Event,
8285 url: string,
8286 isInPlace: boolean,
8287 isMainFrame: boolean,
8288 frameProcessId: number,
8289 frameRoutingId: number) => void): this;
8290 addListener(event: 'did-redirect-navigation', listener: (event: Event,
8291 url: string,
8292 isInPlace: boolean,
8293 isMainFrame: boolean,
8294 frameProcessId: number,
8295 frameRoutingId: number) => void): this;
8296 removeListener(event: 'did-redirect-navigation', listener: (event: Event,
8297 url: string,
8298 isInPlace: boolean,
8299 isMainFrame: boolean,
8300 frameProcessId: number,
8301 frameRoutingId: number) => void): this;
8302 /**
8303 * Corresponds to the points in time when the spinner of the tab started spinning.
8304 */
8305 on(event: 'did-start-loading', listener: Function): this;
8306 once(event: 'did-start-loading', listener: Function): this;
8307 addListener(event: 'did-start-loading', listener: Function): this;
8308 removeListener(event: 'did-start-loading', listener: Function): this;
8309 /**
8310 * Emitted when any frame (including main) starts navigating. `isInplace` will be
8311 * `true` for in-page navigations.
8312 */
8313 on(event: 'did-start-navigation', listener: (event: Event,
8314 url: string,
8315 isInPlace: boolean,
8316 isMainFrame: boolean,
8317 frameProcessId: number,
8318 frameRoutingId: number) => void): this;
8319 once(event: 'did-start-navigation', listener: (event: Event,
8320 url: string,
8321 isInPlace: boolean,
8322 isMainFrame: boolean,
8323 frameProcessId: number,
8324 frameRoutingId: number) => void): this;
8325 addListener(event: 'did-start-navigation', listener: (event: Event,
8326 url: string,
8327 isInPlace: boolean,
8328 isMainFrame: boolean,
8329 frameProcessId: number,
8330 frameRoutingId: number) => void): this;
8331 removeListener(event: 'did-start-navigation', listener: (event: Event,
8332 url: string,
8333 isInPlace: boolean,
8334 isMainFrame: boolean,
8335 frameProcessId: number,
8336 frameRoutingId: number) => void): this;
8337 /**
8338 * Corresponds to the points in time when the spinner of the tab stopped spinning.
8339 */
8340 on(event: 'did-stop-loading', listener: Function): this;
8341 once(event: 'did-stop-loading', listener: Function): this;
8342 addListener(event: 'did-stop-loading', listener: Function): this;
8343 removeListener(event: 'did-stop-loading', listener: Function): this;
8344 /**
8345 * Emitted when the document in the given frame is loaded.
8346 */
8347 on(event: 'dom-ready', listener: (event: Event) => void): this;
8348 once(event: 'dom-ready', listener: (event: Event) => void): this;
8349 addListener(event: 'dom-ready', listener: (event: Event) => void): this;
8350 removeListener(event: 'dom-ready', listener: (event: Event) => void): this;
8351 /**
8352 * Emitted when the window enters a full-screen state triggered by HTML API.
8353 */
8354 on(event: 'enter-html-full-screen', listener: Function): this;
8355 once(event: 'enter-html-full-screen', listener: Function): this;
8356 addListener(event: 'enter-html-full-screen', listener: Function): this;
8357 removeListener(event: 'enter-html-full-screen', listener: Function): this;
8358 /**
8359 * Emitted when a result is available for [`webContents.findInPage`] request.
8360 */
8361 on(event: 'found-in-page', listener: (event: Event,
8362 result: Result) => void): this;
8363 once(event: 'found-in-page', listener: (event: Event,
8364 result: Result) => void): this;
8365 addListener(event: 'found-in-page', listener: (event: Event,
8366 result: Result) => void): this;
8367 removeListener(event: 'found-in-page', listener: (event: Event,
8368 result: Result) => void): this;
8369 /**
8370 * Emitted when the renderer process sends an asynchronous message via
8371 * `ipcRenderer.send()`.
8372 */
8373 on(event: 'ipc-message', listener: (event: Event,
8374 channel: string,
8375 ...args: any[]) => void): this;
8376 once(event: 'ipc-message', listener: (event: Event,
8377 channel: string,
8378 ...args: any[]) => void): this;
8379 addListener(event: 'ipc-message', listener: (event: Event,
8380 channel: string,
8381 ...args: any[]) => void): this;
8382 removeListener(event: 'ipc-message', listener: (event: Event,
8383 channel: string,
8384 ...args: any[]) => void): this;
8385 /**
8386 * Emitted when the renderer process sends a synchronous message via
8387 * `ipcRenderer.sendSync()`.
8388 */
8389 on(event: 'ipc-message-sync', listener: (event: Event,
8390 channel: string,
8391 ...args: any[]) => void): this;
8392 once(event: 'ipc-message-sync', listener: (event: Event,
8393 channel: string,
8394 ...args: any[]) => void): this;
8395 addListener(event: 'ipc-message-sync', listener: (event: Event,
8396 channel: string,
8397 ...args: any[]) => void): this;
8398 removeListener(event: 'ipc-message-sync', listener: (event: Event,
8399 channel: string,
8400 ...args: any[]) => void): this;
8401 /**
8402 * Emitted when the window leaves a full-screen state triggered by HTML API.
8403 */
8404 on(event: 'leave-html-full-screen', listener: Function): this;
8405 once(event: 'leave-html-full-screen', listener: Function): this;
8406 addListener(event: 'leave-html-full-screen', listener: Function): this;
8407 removeListener(event: 'leave-html-full-screen', listener: Function): this;
8408 /**
8409 * Emitted when `webContents` wants to do basic auth.
8410 *
8411The usage is the same with the `login` event of `app`.
8412 */
8413 on(event: 'login', listener: (event: Event,
8414 authenticationResponseDetails: AuthenticationResponseDetails,
8415 authInfo: AuthInfo,
8416 callback: (username?: string, password?: string) => void) => void): this;
8417 once(event: 'login', listener: (event: Event,
8418 authenticationResponseDetails: AuthenticationResponseDetails,
8419 authInfo: AuthInfo,
8420 callback: (username?: string, password?: string) => void) => void): this;
8421 addListener(event: 'login', listener: (event: Event,
8422 authenticationResponseDetails: AuthenticationResponseDetails,
8423 authInfo: AuthInfo,
8424 callback: (username?: string, password?: string) => void) => void): this;
8425 removeListener(event: 'login', listener: (event: Event,
8426 authenticationResponseDetails: AuthenticationResponseDetails,
8427 authInfo: AuthInfo,
8428 callback: (username?: string, password?: string) => void) => void): this;
8429 /**
8430 * Emitted when media is paused or done playing.
8431 */
8432 on(event: 'media-paused', listener: Function): this;
8433 once(event: 'media-paused', listener: Function): this;
8434 addListener(event: 'media-paused', listener: Function): this;
8435 removeListener(event: 'media-paused', listener: Function): this;
8436 /**
8437 * Emitted when media starts playing.
8438 */
8439 on(event: 'media-started-playing', listener: Function): this;
8440 once(event: 'media-started-playing', listener: Function): this;
8441 addListener(event: 'media-started-playing', listener: Function): this;
8442 removeListener(event: 'media-started-playing', listener: Function): this;
8443 /**
8444 * Emitted when the page requests to open a new window for a `url`. It could be
8445 * requested by `window.open` or an external link like `<a target='_blank'>`.
8446 *
8447 * By default a new `BrowserWindow` will be created for the `url`.
8448 *
8449 * Calling `event.preventDefault()` will prevent Electron from automatically
8450 * creating a new `BrowserWindow`. If you call `event.preventDefault()` and
8451 * manually create a new `BrowserWindow` then you must set `event.newGuest` to
8452 * reference the new `BrowserWindow` instance, failing to do so may result in
8453 * unexpected behavior. For example:
8454 */
8455 on(event: 'new-window', listener: (event: Event,
8456 url: string,
8457 frameName: string,
8458 /**
8459 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
8460 * `save-to-disk` and `other`.
8461 */
8462 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
8463 /**
8464 * The options which will be used for creating the new `BrowserWindow`.
8465 */
8466 options: BrowserWindowConstructorOptions,
8467 /**
8468 * The non-standard features (features not handled by Chromium or Electron) given
8469 * to `window.open()`.
8470 */
8471 additionalFeatures: string[],
8472 /**
8473 * The referrer that will be passed to the new window. May or may not result in the
8474 * `Referer` header being sent, depending on the referrer policy.
8475 */
8476 referrer: Referrer) => void): this;
8477 once(event: 'new-window', listener: (event: Event,
8478 url: string,
8479 frameName: string,
8480 /**
8481 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
8482 * `save-to-disk` and `other`.
8483 */
8484 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
8485 /**
8486 * The options which will be used for creating the new `BrowserWindow`.
8487 */
8488 options: BrowserWindowConstructorOptions,
8489 /**
8490 * The non-standard features (features not handled by Chromium or Electron) given
8491 * to `window.open()`.
8492 */
8493 additionalFeatures: string[],
8494 /**
8495 * The referrer that will be passed to the new window. May or may not result in the
8496 * `Referer` header being sent, depending on the referrer policy.
8497 */
8498 referrer: Referrer) => void): this;
8499 addListener(event: 'new-window', listener: (event: Event,
8500 url: string,
8501 frameName: string,
8502 /**
8503 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
8504 * `save-to-disk` and `other`.
8505 */
8506 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
8507 /**
8508 * The options which will be used for creating the new `BrowserWindow`.
8509 */
8510 options: BrowserWindowConstructorOptions,
8511 /**
8512 * The non-standard features (features not handled by Chromium or Electron) given
8513 * to `window.open()`.
8514 */
8515 additionalFeatures: string[],
8516 /**
8517 * The referrer that will be passed to the new window. May or may not result in the
8518 * `Referer` header being sent, depending on the referrer policy.
8519 */
8520 referrer: Referrer) => void): this;
8521 removeListener(event: 'new-window', listener: (event: Event,
8522 url: string,
8523 frameName: string,
8524 /**
8525 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
8526 * `save-to-disk` and `other`.
8527 */
8528 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
8529 /**
8530 * The options which will be used for creating the new `BrowserWindow`.
8531 */
8532 options: BrowserWindowConstructorOptions,
8533 /**
8534 * The non-standard features (features not handled by Chromium or Electron) given
8535 * to `window.open()`.
8536 */
8537 additionalFeatures: string[],
8538 /**
8539 * The referrer that will be passed to the new window. May or may not result in the
8540 * `Referer` header being sent, depending on the referrer policy.
8541 */
8542 referrer: Referrer) => void): this;
8543 /**
8544 * Emitted when page receives favicon urls.
8545 */
8546 on(event: 'page-favicon-updated', listener: (event: Event,
8547 /**
8548 * Array of URLs.
8549 */
8550 favicons: string[]) => void): this;
8551 once(event: 'page-favicon-updated', listener: (event: Event,
8552 /**
8553 * Array of URLs.
8554 */
8555 favicons: string[]) => void): this;
8556 addListener(event: 'page-favicon-updated', listener: (event: Event,
8557 /**
8558 * Array of URLs.
8559 */
8560 favicons: string[]) => void): this;
8561 removeListener(event: 'page-favicon-updated', listener: (event: Event,
8562 /**
8563 * Array of URLs.
8564 */
8565 favicons: string[]) => void): this;
8566 /**
8567 * Fired when page title is set during navigation. `explicitSet` is false when
8568 * title is synthesized from file url.
8569 */
8570 on(event: 'page-title-updated', listener: (event: Event,
8571 title: string,
8572 explicitSet: boolean) => void): this;
8573 once(event: 'page-title-updated', listener: (event: Event,
8574 title: string,
8575 explicitSet: boolean) => void): this;
8576 addListener(event: 'page-title-updated', listener: (event: Event,
8577 title: string,
8578 explicitSet: boolean) => void): this;
8579 removeListener(event: 'page-title-updated', listener: (event: Event,
8580 title: string,
8581 explicitSet: boolean) => void): this;
8582 /**
8583 * Emitted when a new frame is generated. Only the dirty area is passed in the
8584 * buffer.
8585 */
8586 on(event: 'paint', listener: (event: Event,
8587 dirtyRect: Rectangle,
8588 /**
8589 * The image data of the whole frame.
8590 */
8591 image: NativeImage) => void): this;
8592 once(event: 'paint', listener: (event: Event,
8593 dirtyRect: Rectangle,
8594 /**
8595 * The image data of the whole frame.
8596 */
8597 image: NativeImage) => void): this;
8598 addListener(event: 'paint', listener: (event: Event,
8599 dirtyRect: Rectangle,
8600 /**
8601 * The image data of the whole frame.
8602 */
8603 image: NativeImage) => void): this;
8604 removeListener(event: 'paint', listener: (event: Event,
8605 dirtyRect: Rectangle,
8606 /**
8607 * The image data of the whole frame.
8608 */
8609 image: NativeImage) => void): this;
8610 /**
8611 * Emitted when a plugin process has crashed.
8612 */
8613 on(event: 'plugin-crashed', listener: (event: Event,
8614 name: string,
8615 version: string) => void): this;
8616 once(event: 'plugin-crashed', listener: (event: Event,
8617 name: string,
8618 version: string) => void): this;
8619 addListener(event: 'plugin-crashed', listener: (event: Event,
8620 name: string,
8621 version: string) => void): this;
8622 removeListener(event: 'plugin-crashed', listener: (event: Event,
8623 name: string,
8624 version: string) => void): this;
8625 /**
8626 * Emitted when the preload script `preloadPath` throws an unhandled exception
8627 * `error`.
8628 */
8629 on(event: 'preload-error', listener: (event: Event,
8630 preloadPath: string,
8631 error: Error) => void): this;
8632 once(event: 'preload-error', listener: (event: Event,
8633 preloadPath: string,
8634 error: Error) => void): this;
8635 addListener(event: 'preload-error', listener: (event: Event,
8636 preloadPath: string,
8637 error: Error) => void): this;
8638 removeListener(event: 'preload-error', listener: (event: Event,
8639 preloadPath: string,
8640 error: Error) => void): this;
8641 /**
8642 * Emitted when `remote.getBuiltin()` is called in the renderer process. Calling
8643 * `event.preventDefault()` will prevent the module from being returned. Custom
8644 * value can be returned by setting `event.returnValue`.
8645 */
8646 on(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
8647 moduleName: string) => void): this;
8648 once(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
8649 moduleName: string) => void): this;
8650 addListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
8651 moduleName: string) => void): this;
8652 removeListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
8653 moduleName: string) => void): this;
8654 /**
8655 * Emitted when `remote.getCurrentWebContents()` is called in the renderer process.
8656 * Calling `event.preventDefault()` will prevent the object from being returned.
8657 * Custom value can be returned by setting `event.returnValue`.
8658 */
8659 on(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
8660 once(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
8661 addListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
8662 removeListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
8663 /**
8664 * Emitted when `remote.getCurrentWindow()` is called in the renderer process.
8665 * Calling `event.preventDefault()` will prevent the object from being returned.
8666 * Custom value can be returned by setting `event.returnValue`.
8667 */
8668 on(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
8669 once(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
8670 addListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
8671 removeListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
8672 /**
8673 * Emitted when `remote.getGlobal()` is called in the renderer process. Calling
8674 * `event.preventDefault()` will prevent the global from being returned. Custom
8675 * value can be returned by setting `event.returnValue`.
8676 */
8677 on(event: 'remote-get-global', listener: (event: IpcMainEvent,
8678 globalName: string) => void): this;
8679 once(event: 'remote-get-global', listener: (event: IpcMainEvent,
8680 globalName: string) => void): this;
8681 addListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
8682 globalName: string) => void): this;
8683 removeListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
8684 globalName: string) => void): this;
8685 /**
8686 * Emitted when `<webview>.getWebContents()` is called in the renderer process.
8687 * Calling `event.preventDefault()` will prevent the object from being returned.
8688 * Custom value can be returned by setting `event.returnValue`.
8689 */
8690 on(event: 'remote-get-guest-web-contents', listener: (event: IpcMainEvent,
8691 guestWebContents: WebContents) => void): this;
8692 once(event: 'remote-get-guest-web-contents', listener: (event: IpcMainEvent,
8693 guestWebContents: WebContents) => void): this;
8694 addListener(event: 'remote-get-guest-web-contents', listener: (event: IpcMainEvent,
8695 guestWebContents: WebContents) => void): this;
8696 removeListener(event: 'remote-get-guest-web-contents', listener: (event: IpcMainEvent,
8697 guestWebContents: WebContents) => void): this;
8698 /**
8699 * Emitted when `remote.require()` is called in the renderer process. Calling
8700 * `event.preventDefault()` will prevent the module from being returned. Custom
8701 * value can be returned by setting `event.returnValue`.
8702 */
8703 on(event: 'remote-require', listener: (event: IpcMainEvent,
8704 moduleName: string) => void): this;
8705 once(event: 'remote-require', listener: (event: IpcMainEvent,
8706 moduleName: string) => void): this;
8707 addListener(event: 'remote-require', listener: (event: IpcMainEvent,
8708 moduleName: string) => void): this;
8709 removeListener(event: 'remote-require', listener: (event: IpcMainEvent,
8710 moduleName: string) => void): this;
8711 /**
8712 * Emitted when the unresponsive web page becomes responsive again.
8713 */
8714 on(event: 'responsive', listener: Function): this;
8715 once(event: 'responsive', listener: Function): this;
8716 addListener(event: 'responsive', listener: Function): this;
8717 removeListener(event: 'responsive', listener: Function): this;
8718 /**
8719 * Emitted when bluetooth device needs to be selected on call to
8720 * `navigator.bluetooth.requestDevice`. To use `navigator.bluetooth` api
8721 * `webBluetooth` should be enabled. If `event.preventDefault` is not called, first
8722 * available device will be selected. `callback` should be called with `deviceId`
8723 * to be selected, passing empty string to `callback` will cancel the request.
8724 */
8725 on(event: 'select-bluetooth-device', listener: (event: Event,
8726 devices: BluetoothDevice[],
8727 callback: (deviceId: string) => void) => void): this;
8728 once(event: 'select-bluetooth-device', listener: (event: Event,
8729 devices: BluetoothDevice[],
8730 callback: (deviceId: string) => void) => void): this;
8731 addListener(event: 'select-bluetooth-device', listener: (event: Event,
8732 devices: BluetoothDevice[],
8733 callback: (deviceId: string) => void) => void): this;
8734 removeListener(event: 'select-bluetooth-device', listener: (event: Event,
8735 devices: BluetoothDevice[],
8736 callback: (deviceId: string) => void) => void): this;
8737 /**
8738 * Emitted when a client certificate is requested.
8739 *
8740The usage is the same with the `select-client-certificate` event of `app`.
8741 */
8742 on(event: 'select-client-certificate', listener: (event: Event,
8743 url: string,
8744 certificateList: Certificate[],
8745 callback: (certificate: Certificate) => void) => void): this;
8746 once(event: 'select-client-certificate', listener: (event: Event,
8747 url: string,
8748 certificateList: Certificate[],
8749 callback: (certificate: Certificate) => void) => void): this;
8750 addListener(event: 'select-client-certificate', listener: (event: Event,
8751 url: string,
8752 certificateList: Certificate[],
8753 callback: (certificate: Certificate) => void) => void): this;
8754 removeListener(event: 'select-client-certificate', listener: (event: Event,
8755 url: string,
8756 certificateList: Certificate[],
8757 callback: (certificate: Certificate) => void) => void): this;
8758 /**
8759 * Emitted when the web page becomes unresponsive.
8760 */
8761 on(event: 'unresponsive', listener: Function): this;
8762 once(event: 'unresponsive', listener: Function): this;
8763 addListener(event: 'unresponsive', listener: Function): this;
8764 removeListener(event: 'unresponsive', listener: Function): this;
8765 /**
8766 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
8767 */
8768 on(event: 'update-target-url', listener: (event: Event,
8769 url: string) => void): this;
8770 once(event: 'update-target-url', listener: (event: Event,
8771 url: string) => void): this;
8772 addListener(event: 'update-target-url', listener: (event: Event,
8773 url: string) => void): this;
8774 removeListener(event: 'update-target-url', listener: (event: Event,
8775 url: string) => void): this;
8776 /**
8777 * Emitted when a `<webview>`'s web contents is being attached to this web
8778 * contents. Calling `event.preventDefault()` will destroy the guest page.
8779 *
8780 * This event can be used to configure `webPreferences` for the `webContents` of a
8781 * `<webview>` before it's loaded, and provides the ability to set settings that
8782 * can't be set via `<webview>` attributes.
8783 *
8784 * **Note:** The specified `preload` script option will be appear as `preloadURL`
8785 * (not `preload`) in the `webPreferences` object emitted with this event.
8786 */
8787 on(event: 'will-attach-webview', listener: (event: Event,
8788 /**
8789 * The web preferences that will be used by the guest page. This object can be
8790 * modified to adjust the preferences for the guest page.
8791 */
8792 webPreferences: WebPreferences,
8793 /**
8794 * The other `<webview>` parameters such as the `src` URL. This object can be
8795 * modified to adjust the parameters of the guest page.
8796 */
8797 params: Record<string, string>) => void): this;
8798 once(event: 'will-attach-webview', listener: (event: Event,
8799 /**
8800 * The web preferences that will be used by the guest page. This object can be
8801 * modified to adjust the preferences for the guest page.
8802 */
8803 webPreferences: WebPreferences,
8804 /**
8805 * The other `<webview>` parameters such as the `src` URL. This object can be
8806 * modified to adjust the parameters of the guest page.
8807 */
8808 params: Record<string, string>) => void): this;
8809 addListener(event: 'will-attach-webview', listener: (event: Event,
8810 /**
8811 * The web preferences that will be used by the guest page. This object can be
8812 * modified to adjust the preferences for the guest page.
8813 */
8814 webPreferences: WebPreferences,
8815 /**
8816 * The other `<webview>` parameters such as the `src` URL. This object can be
8817 * modified to adjust the parameters of the guest page.
8818 */
8819 params: Record<string, string>) => void): this;
8820 removeListener(event: 'will-attach-webview', listener: (event: Event,
8821 /**
8822 * The web preferences that will be used by the guest page. This object can be
8823 * modified to adjust the preferences for the guest page.
8824 */
8825 webPreferences: WebPreferences,
8826 /**
8827 * The other `<webview>` parameters such as the `src` URL. This object can be
8828 * modified to adjust the parameters of the guest page.
8829 */
8830 params: Record<string, string>) => void): this;
8831 /**
8832 * Emitted when a user or the page wants to start navigation. It can happen when
8833 * the `window.location` object is changed or a user clicks a link in the page.
8834 *
8835 * This event will not emit when the navigation is started programmatically with
8836 * APIs like `webContents.loadURL` and `webContents.back`.
8837 *
8838 * It is also not emitted for in-page navigations, such as clicking anchor links or
8839 * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
8840 * purpose.
8841
8842Calling `event.preventDefault()` will prevent the navigation.
8843 */
8844 on(event: 'will-navigate', listener: (event: Event,
8845 url: string) => void): this;
8846 once(event: 'will-navigate', listener: (event: Event,
8847 url: string) => void): this;
8848 addListener(event: 'will-navigate', listener: (event: Event,
8849 url: string) => void): this;
8850 removeListener(event: 'will-navigate', listener: (event: Event,
8851 url: string) => void): this;
8852 /**
8853 * Emitted when a `beforeunload` event handler is attempting to cancel a page
8854 * unload.
8855 *
8856 * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
8857 * and allow the page to be unloaded.
8858 */
8859 on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
8860 once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
8861 addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
8862 removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
8863 /**
8864 * Emitted as a server side redirect occurs during navigation. For example a 302
8865 * redirect.
8866 *
8867 * This event will be emitted after `did-start-navigation` and always before the
8868 * `did-redirect-navigation` event for the same navigation.
8869 *
8870 * Calling `event.preventDefault()` will prevent the navigation (not just the
8871 * redirect).
8872 */
8873 on(event: 'will-redirect', listener: (event: Event,
8874 url: string,
8875 isInPlace: boolean,
8876 isMainFrame: boolean,
8877 frameProcessId: number,
8878 frameRoutingId: number) => void): this;
8879 once(event: 'will-redirect', listener: (event: Event,
8880 url: string,
8881 isInPlace: boolean,
8882 isMainFrame: boolean,
8883 frameProcessId: number,
8884 frameRoutingId: number) => void): this;
8885 addListener(event: 'will-redirect', listener: (event: Event,
8886 url: string,
8887 isInPlace: boolean,
8888 isMainFrame: boolean,
8889 frameProcessId: number,
8890 frameRoutingId: number) => void): this;
8891 removeListener(event: 'will-redirect', listener: (event: Event,
8892 url: string,
8893 isInPlace: boolean,
8894 isMainFrame: boolean,
8895 frameProcessId: number,
8896 frameRoutingId: number) => void): this;
8897 /**
8898 * Emitted when the user is requesting to change the zoom level using the mouse
8899 * wheel.
8900 */
8901 on(event: 'zoom-changed', listener: (event: Event,
8902 /**
8903 * Can be `in` or `out`.
8904 */
8905 zoomDirection: ('in' | 'out')) => void): this;
8906 once(event: 'zoom-changed', listener: (event: Event,
8907 /**
8908 * Can be `in` or `out`.
8909 */
8910 zoomDirection: ('in' | 'out')) => void): this;
8911 addListener(event: 'zoom-changed', listener: (event: Event,
8912 /**
8913 * Can be `in` or `out`.
8914 */
8915 zoomDirection: ('in' | 'out')) => void): this;
8916 removeListener(event: 'zoom-changed', listener: (event: Event,
8917 /**
8918 * Can be `in` or `out`.
8919 */
8920 zoomDirection: ('in' | 'out')) => void): this;
8921 /**
8922 * Adds the specified path to DevTools workspace. Must be used after DevTools
8923 * creation:
8924 */
8925 addWorkSpace(path: string): void;
8926 /**
8927 * Begin subscribing for presentation events and captured frames, the `callback`
8928 * will be called with `callback(image, dirtyRect)` when there is a presentation
8929 * event.
8930 *
8931 * The `image` is an instance of NativeImage that stores the captured frame.
8932 *
8933 * The `dirtyRect` is an object with `x, y, width, height` properties that
8934 * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
8935 * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
8936 */
8937 beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
8938 /**
8939 * Begin subscribing for presentation events and captured frames, the `callback`
8940 * will be called with `callback(image, dirtyRect)` when there is a presentation
8941 * event.
8942 *
8943 * The `image` is an instance of NativeImage that stores the captured frame.
8944 *
8945 * The `dirtyRect` is an object with `x, y, width, height` properties that
8946 * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
8947 * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
8948 */
8949 beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
8950 /**
8951 * Whether the browser can go back to previous web page.
8952 */
8953 canGoBack(): boolean;
8954 /**
8955 * Whether the browser can go forward to next web page.
8956 */
8957 canGoForward(): boolean;
8958 /**
8959 * Whether the web page can go to `offset`.
8960 */
8961 canGoToOffset(offset: number): boolean;
8962 /**
8963 * Resolves with a NativeImage
8964 *
8965 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
8966 * whole visible page.
8967 */
8968 capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
8969 /**
8970 * Clears the navigation history.
8971 */
8972 clearHistory(): void;
8973 /**
8974 * Closes the devtools.
8975 */
8976 closeDevTools(): void;
8977 /**
8978 * Executes the editing command `copy` in web page.
8979 */
8980 copy(): void;
8981 /**
8982 * Copy the image at the given position to the clipboard.
8983 */
8984 copyImageAt(x: number, y: number): void;
8985 /**
8986 * Executes the editing command `cut` in web page.
8987 */
8988 cut(): void;
8989 /**
8990 * Executes the editing command `delete` in web page.
8991 */
8992 delete(): void;
8993 /**
8994 * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
8995 */
8996 disableDeviceEmulation(): void;
8997 /**
8998 * Initiates a download of the resource at `url` without navigating. The
8999 * `will-download` event of `session` will be triggered.
9000 */
9001 downloadURL(url: string): void;
9002 /**
9003 * Enable device emulation with the given parameters.
9004 */
9005 enableDeviceEmulation(parameters: Parameters): void;
9006 /**
9007 * End subscribing for frame presentation events.
9008 */
9009 endFrameSubscription(): void;
9010 /**
9011 * A promise that resolves with the result of the executed code or is rejected if
9012 * the result of the code is a rejected promise.
9013 *
9014 * Evaluates `code` in page.
9015 *
9016 * In the browser window some HTML APIs like `requestFullScreen` can only be
9017 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
9018 * this limitation.
9019
9020Code execution will be suspended until web page stop loading.
9021 */
9022 executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
9023 /**
9024 * The request id used for the request.
9025 *
9026 * Starts a request to find all matches for the `text` in the web page. The result
9027 * of the request can be obtained by subscribing to `found-in-page` event.
9028 */
9029 findInPage(text: string, options?: FindInPageOptions): number;
9030 /**
9031 * Focuses the web page.
9032 */
9033 focus(): void;
9034 /**
9035 * If *offscreen rendering* is enabled returns the current frame rate.
9036 *
9037**Deprecated**
9038 */
9039 getFrameRate(): number;
9040 /**
9041 * The operating system `pid` of the associated renderer process.
9042 */
9043 getOSProcessId(): number;
9044 /**
9045 * Get the system printer list.
9046
9047Returns `PrinterInfo[]`.
9048 */
9049 getPrinters(): void;
9050 /**
9051 * The Chromium internal `pid` of the associated renderer. Can be compared to the
9052 * `frameProcessId` passed by frame specific navigation events (e.g.
9053 * `did-frame-navigate`)
9054 */
9055 getProcessId(): number;
9056 /**
9057 * The title of the current web page.
9058 */
9059 getTitle(): string;
9060 /**
9061 * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
9062 * `remote`, `webview` or `offscreen`.
9063 */
9064 getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
9065 /**
9066 * The URL of the current web page.
9067 */
9068 getURL(): string;
9069 /**
9070 * The user agent for this web page.
9071
9072**Deprecated**
9073 */
9074 getUserAgent(): string;
9075 /**
9076 * Returns the WebRTC IP Handling Policy.
9077 */
9078 getWebRTCIPHandlingPolicy(): string;
9079 /**
9080 * the current zoom factor.
9081
9082**Deprecated**
9083 */
9084 getZoomFactor(): number;
9085 /**
9086 * the current zoom level.
9087
9088**Deprecated**
9089 */
9090 getZoomLevel(): number;
9091 /**
9092 * Makes the browser go back a web page.
9093 */
9094 goBack(): void;
9095 /**
9096 * Makes the browser go forward a web page.
9097 */
9098 goForward(): void;
9099 /**
9100 * Navigates browser to the specified absolute web page index.
9101 */
9102 goToIndex(index: number): void;
9103 /**
9104 * Navigates to the specified offset from the "current entry".
9105 */
9106 goToOffset(offset: number): void;
9107 /**
9108 * A promise that resolves with a key for the inserted CSS that can later be used
9109 * to remove the CSS via `contents.removeInsertedCSS(key)`.
9110 *
9111 * Injects CSS into the current web page and returns a unique key for the inserted
9112 * stylesheet.
9113 */
9114 insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
9115 /**
9116 * Inserts `text` to the focused element.
9117 */
9118 insertText(text: string): Promise<void>;
9119 /**
9120 * Starts inspecting element at position (`x`, `y`).
9121 */
9122 inspectElement(x: number, y: number): void;
9123 /**
9124 * Opens the developer tools for the service worker context.
9125 */
9126 inspectServiceWorker(): void;
9127 /**
9128 * Opens the developer tools for the shared worker context.
9129 */
9130 inspectSharedWorker(): void;
9131 /**
9132 * Schedules a full repaint of the window this web contents is in.
9133 *
9134 * If *offscreen rendering* is enabled invalidates the frame and generates a new
9135 * one through the `'paint'` event.
9136 */
9137 invalidate(): void;
9138 /**
9139 * Whether this page has been muted.
9140
9141**Deprecated**
9142 */
9143 isAudioMuted(): boolean;
9144 /**
9145 * Whether the renderer process has crashed.
9146 */
9147 isCrashed(): boolean;
9148 /**
9149 * Whether audio is currently playing.
9150 */
9151 isCurrentlyAudible(): boolean;
9152 /**
9153 * Whether the web page is destroyed.
9154 */
9155 isDestroyed(): boolean;
9156 /**
9157 * Whether the devtools view is focused .
9158 */
9159 isDevToolsFocused(): boolean;
9160 /**
9161 * Whether the devtools is opened.
9162 */
9163 isDevToolsOpened(): boolean;
9164 /**
9165 * Whether the web page is focused.
9166 */
9167 isFocused(): boolean;
9168 /**
9169 * Whether web page is still loading resources.
9170 */
9171 isLoading(): boolean;
9172 /**
9173 * Whether the main frame (and not just iframes or frames within it) is still
9174 * loading.
9175 */
9176 isLoadingMainFrame(): boolean;
9177 /**
9178 * Indicates whether *offscreen rendering* is enabled.
9179 */
9180 isOffscreen(): boolean;
9181 /**
9182 * If *offscreen rendering* is enabled returns whether it is currently painting.
9183 */
9184 isPainting(): boolean;
9185 /**
9186 * Whether the web page is waiting for a first-response from the main resource of
9187 * the page.
9188 */
9189 isWaitingForResponse(): boolean;
9190 /**
9191 * the promise will resolve when the page has finished loading (see
9192 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
9193 *
9194 * Loads the given file in the window, `filePath` should be a path to an HTML file
9195 * relative to the root of your application. For instance an app structure like
9196 * this:
9197
9198Would require code like this
9199 */
9200 loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
9201 /**
9202 * the promise will resolve when the page has finished loading (see
9203 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
9204 * A noop rejection handler is already attached, which avoids unhandled rejection
9205 * errors.
9206 *
9207 * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
9208 * the `http://` or `file://`. If the load should bypass http cache then use the
9209 * `pragma` header to achieve it.
9210 */
9211 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
9212 /**
9213 * Opens the devtools.
9214 *
9215 * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
9216 * explicitly passing an empty `mode` can force using last used dock state.
9217 */
9218 openDevTools(options?: OpenDevToolsOptions): void;
9219 /**
9220 * Executes the editing command `paste` in web page.
9221 */
9222 paste(): void;
9223 /**
9224 * Executes the editing command `pasteAndMatchStyle` in web page.
9225 */
9226 pasteAndMatchStyle(): void;
9227 /**
9228 * Prints window's web page. When `silent` is set to `true`, Electron will pick the
9229 * system's default printer if `deviceName` is empty and the default settings for
9230 * printing.
9231 *
9232 * Use `page-break-before: always;` CSS style to force to print to a new page.
9233 *
9234Example usage:
9235 */
9236 print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: 'cancelled' | 'failed') => void): void;
9237 /**
9238 * Resolves with the generated PDF data.
9239 *
9240 * Prints window's web page as PDF with Chromium's preview printing custom
9241 * settings.
9242 *
9243 * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
9244 *
9245 * By default, an empty `options` will be regarded as:
9246 *
9247 * Use `page-break-before: always;` CSS style to force to print to a new page.
9248 *
9249An example of `webContents.printToPDF`:
9250 */
9251 printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
9252 /**
9253 * Executes the editing command `redo` in web page.
9254 */
9255 redo(): void;
9256 /**
9257 * Reloads the current web page.
9258 */
9259 reload(): void;
9260 /**
9261 * Reloads current page and ignores cache.
9262 */
9263 reloadIgnoringCache(): void;
9264 /**
9265 * Resolves if the removal was successful.
9266 *
9267 * Removes the inserted CSS from the current web page. The stylesheet is identified
9268 * by its key, which is returned from `contents.insertCSS(css)`.
9269 */
9270 removeInsertedCSS(key: string): Promise<void>;
9271 /**
9272 * Removes the specified path from DevTools workspace.
9273 */
9274 removeWorkSpace(path: string): void;
9275 /**
9276 * Executes the editing command `replace` in web page.
9277 */
9278 replace(text: string): void;
9279 /**
9280 * Executes the editing command `replaceMisspelling` in web page.
9281 */
9282 replaceMisspelling(text: string): void;
9283 /**
9284 * resolves if the page is saved.
9285 */
9286 savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
9287 /**
9288 * Executes the editing command `selectAll` in web page.
9289 */
9290 selectAll(): void;
9291 /**
9292 * Send an asynchronous message to renderer process via `channel`, you can also
9293 * send arbitrary arguments. Arguments will be serialized in JSON internally and
9294 * hence no functions or prototype chain will be included.
9295 *
9296 * The renderer process can handle the message by listening to `channel` with the
9297 * `ipcRenderer` module.
9298 *
9299An example of sending messages from the main process to the renderer process:
9300 */
9301 send(channel: string, ...args: any[]): void;
9302 /**
9303 * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
9304 * contents needs to be focused for `sendInputEvent()` to work.
9305 */
9306 sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
9307 /**
9308 * Send an asynchronous message to a specific frame in a renderer process via
9309 * `channel`. Arguments will be serialized as JSON internally and as such no
9310 * functions or prototype chains will be included.
9311 *
9312 * The renderer process can handle the message by listening to `channel` with the
9313 * `ipcRenderer` module.
9314 *
9315 * If you want to get the `frameId` of a given renderer context you should use the
9316 * `webFrame.routingId` value. E.g.
9317 *
9318You can also read `frameId` from all incoming IPC messages in the main process.
9319 */
9320 sendToFrame(frameId: number, channel: string, ...args: any[]): void;
9321 /**
9322 * Mute the audio on the current web page.
9323
9324**Deprecated**
9325 */
9326 setAudioMuted(muted: boolean): void;
9327 /**
9328 * Controls whether or not this WebContents will throttle animations and timers
9329 * when the page becomes backgrounded. This also affects the Page Visibility API.
9330 */
9331 setBackgroundThrottling(allowed: boolean): void;
9332 /**
9333 * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
9334 *
9335 * The `devToolsWebContents` must not have done any navigation, and it should not
9336 * be used for other purposes after the call.
9337 *
9338 * By default Electron manages the devtools by creating an internal `WebContents`
9339 * with native view, which developers have very limited control of. With the
9340 * `setDevToolsWebContents` method, developers can use any `WebContents` to show
9341 * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
9342 * tag.
9343 *
9344 * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
9345 * caller's responsibility to destroy `devToolsWebContents`.
9346 *
9347 * An example of showing devtools in a `<webview>` tag:
9348 *
9349An example of showing devtools in a `BrowserWindow`:
9350 */
9351 setDevToolsWebContents(devToolsWebContents: WebContents): void;
9352 /**
9353 * If *offscreen rendering* is enabled sets the frame rate to the specified number.
9354 * Only values between 1 and 60 are accepted.
9355
9356**Deprecated**
9357 */
9358 setFrameRate(fps: number): void;
9359 /**
9360 * Ignore application menu shortcuts while this web contents is focused.
9361 *
9362 * @experimental
9363 */
9364 setIgnoreMenuShortcuts(ignore: boolean): void;
9365 /**
9366 * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
9367 */
9368 setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
9369 /**
9370 * Overrides the user agent for this web page.
9371
9372**Deprecated**
9373 */
9374 setUserAgent(userAgent: string): void;
9375 /**
9376 * Sets the maximum and minimum pinch-to-zoom level.
9377 *
9378 * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
9379 * call:
9380 */
9381 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
9382 /**
9383 * Setting the WebRTC IP handling policy allows you to control which IPs are
9384 * exposed via WebRTC. See BrowserLeaks for more details.
9385 */
9386 setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
9387 /**
9388 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
9389 * divided by 100, so 300% = 3.0.
9390
9391**Deprecated**
9392 */
9393 setZoomFactor(factor: number): void;
9394 /**
9395 * Changes the zoom level to the specified level. The original size is 0 and each
9396 * increment above or below represents zooming 20% larger or smaller to default
9397 * limits of 300% and 50% of original size, respectively. The formula for this is
9398 * `scale := 1.2 ^ level`.
9399
9400**Deprecated**
9401 */
9402 setZoomLevel(level: number): void;
9403 /**
9404 * Shows pop-up dictionary that searches the selected word on the page.
9405 *
9406 * @platform darwin
9407 */
9408 showDefinitionForSelection(): void;
9409 /**
9410 * Sets the `item` as dragging item for current drag-drop operation, `file` is the
9411 * absolute path of the file to be dragged, and `icon` is the image showing under
9412 * the cursor when dragging.
9413 */
9414 startDrag(item: Item): void;
9415 /**
9416 * If *offscreen rendering* is enabled and not painting, start painting.
9417 */
9418 startPainting(): void;
9419 /**
9420 * Stops any pending navigation.
9421 */
9422 stop(): void;
9423 /**
9424 * Stops any `findInPage` request for the `webContents` with the provided `action`.
9425 */
9426 stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
9427 /**
9428 * If *offscreen rendering* is enabled and painting, stop painting.
9429 */
9430 stopPainting(): void;
9431 /**
9432 * Indicates whether the snapshot has been created successfully.
9433 *
9434Takes a V8 heap snapshot and saves it to `filePath`.
9435 */
9436 takeHeapSnapshot(filePath: string): Promise<void>;
9437 /**
9438 * Toggles the developer tools.
9439 */
9440 toggleDevTools(): void;
9441 /**
9442 * Executes the editing command `undo` in web page.
9443 */
9444 undo(): void;
9445 /**
9446 * Executes the editing command `unselect` in web page.
9447 */
9448 unselect(): void;
9449 audioMuted: boolean;
9450 readonly debugger: Debugger;
9451 readonly devToolsWebContents: WebContents;
9452 frameRate: number;
9453 readonly hostWebContents: WebContents;
9454 readonly id: number;
9455 readonly session: Session;
9456 userAgent: string;
9457 zoomFactor: number;
9458 zoomLevel: number;
9459 }
9460
9461 interface WebFrame extends NodeJS.EventEmitter {
9462
9463 // Docs: http://electronjs.org/docs/api/web-frame
9464
9465 /**
9466 * Attempts to free memory that is no longer being used (like images from a
9467 * previous navigation).
9468 *
9469 * Note that blindly calling this method probably makes Electron slower since it
9470 * will have to refill these emptied caches, you should only call it if an event in
9471 * your app has occurred that makes you think your page is actually using less
9472 * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
9473 * and intend to stay there).
9474 */
9475 clearCache(): void;
9476 /**
9477 * A promise that resolves with the result of the executed code or is rejected if
9478 * the result of the code is a rejected promise.
9479 *
9480 * Evaluates `code` in page.
9481 *
9482 * In the browser window some HTML APIs like `requestFullScreen` can only be
9483 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
9484 * this limitation.
9485 */
9486 executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
9487 /**
9488 * A promise that resolves with the result of the executed code or is rejected if
9489 * the result of the code is a rejected promise.
9490 *
9491Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
9492 */
9493 executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
9494 /**
9495 * A child of `webFrame` with the supplied `name`, `null` would be returned if
9496 * there's no such frame or if the frame is not in the current renderer process.
9497 */
9498 findFrameByName(name: string): WebFrame;
9499 /**
9500 * that has the supplied `routingId`, `null` if not found.
9501 */
9502 findFrameByRoutingId(routingId: number): WebFrame;
9503 /**
9504 * The frame element in `webFrame's` document selected by `selector`, `null` would
9505 * be returned if `selector` does not select a frame or if the frame is not in the
9506 * current renderer process.
9507 */
9508 getFrameForSelector(selector: string): WebFrame;
9509 /**
9510 * * `images` MemoryUsageDetails
9511 * * `scripts` MemoryUsageDetails
9512 * * `cssStyleSheets` MemoryUsageDetails
9513 * * `xslStyleSheets` MemoryUsageDetails
9514 * * `fonts` MemoryUsageDetails
9515 * * `other` MemoryUsageDetails
9516 *
9517 * Returns an object describing usage information of Blink's internal memory
9518 * caches.
9519
9520This will generate:
9521 */
9522 getResourceUsage(): ResourceUsage;
9523 /**
9524 * The current zoom factor.
9525 */
9526 getZoomFactor(): number;
9527 /**
9528 * The current zoom level.
9529 */
9530 getZoomLevel(): number;
9531 /**
9532 * A key for the inserted CSS that can later be used to remove the CSS via
9533 * `webFrame.removeInsertedCSS(key)`.
9534 *
9535 * Injects CSS into the current web page and returns a unique key for the inserted
9536 * stylesheet.
9537 */
9538 insertCSS(css: string): string;
9539 /**
9540 * Inserts `text` to the focused element.
9541 */
9542 insertText(text: string): void;
9543 /**
9544 * Removes the inserted CSS from the current web page. The stylesheet is identified
9545 * by its key, which is returned from `webFrame.insertCSS(css)`.
9546 */
9547 removeInsertedCSS(key: string): void;
9548 /**
9549 * Set the security origin, content security policy and name of the isolated world.
9550 * Note: If the `csp` is specified, then the `securityOrigin` also has to be
9551 * specified.
9552 */
9553 setIsolatedWorldInfo(worldId: number, info: Info): void;
9554 /**
9555 * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
9556 */
9557 setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
9558 /**
9559 * Sets a provider for spell checking in input fields and text areas.
9560 *
9561 * The `provider` must be an object that has a `spellCheck` method that accepts an
9562 * array of individual words for spellchecking. The `spellCheck` function runs
9563 * asynchronously and calls the `callback` function with an array of misspelt words
9564 * when complete.
9565
9566An example of using node-spellchecker as provider:
9567 */
9568 setSpellCheckProvider(language: string, provider: Provider): void;
9569 /**
9570 * Sets the maximum and minimum pinch-to-zoom level.
9571 *
9572 * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
9573 * call:
9574 */
9575 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
9576 /**
9577 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
9578 * divided by 100, so 300% = 3.0.
9579 */
9580 setZoomFactor(factor: number): void;
9581 /**
9582 * Changes the zoom level to the specified level. The original size is 0 and each
9583 * increment above or below represents zooming 20% larger or smaller to default
9584 * limits of 300% and 50% of original size, respectively.
9585 */
9586 setZoomLevel(level: number): void;
9587 /**
9588 * A `WebFrame | null` representing the first child frame of `webFrame`, the
9589 * property would be `null` if `webFrame` has no children or if first child is not
9590 * in the current renderer process.
9591 *
9592 */
9593 readonly firstChild: (WebFrame) | (null);
9594 /**
9595 * A `WebFrame | null` representing next sibling frame, the property would be
9596 * `null` if `webFrame` is the last frame in its parent or if the next sibling is
9597 * not in the current renderer process.
9598 *
9599 */
9600 readonly nextSibling: (WebFrame) | (null);
9601 /**
9602 * A `WebFrame | null` representing the frame which opened `webFrame`, the property
9603 * would be `null` if there's no opener or opener is not in the current renderer
9604 * process.
9605 *
9606 */
9607 readonly opener: (WebFrame) | (null);
9608 /**
9609 * A `WebFrame | null` representing parent frame of `webFrame`, the property would
9610 * be `null` if `webFrame` is top or parent is not in the current renderer process.
9611 *
9612 */
9613 readonly parent: (WebFrame) | (null);
9614 /**
9615 * An `Integer` representing the unique frame id in the current renderer process.
9616 * Distinct WebFrame instances that refer to the same underlying frame will have
9617 * the same `routingId`.
9618 *
9619 */
9620 readonly routingId: number;
9621 /**
9622 * A `WebFrame | null` representing top frame in frame hierarchy to which
9623 * `webFrame` belongs, the property would be `null` if top frame is not in the
9624 * current renderer process.
9625 *
9626 */
9627 readonly top: (WebFrame) | (null);
9628 }
9629
9630 class WebRequest {
9631
9632 // Docs: http://electronjs.org/docs/api/web-request
9633
9634 /**
9635 * The `listener` will be called with `listener(details)` when a server initiated
9636 * redirect is about to occur.
9637 */
9638 onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
9639 /**
9640 * The `listener` will be called with `listener(details)` when a server initiated
9641 * redirect is about to occur.
9642 */
9643 onBeforeRedirect(filter: Filter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
9644 /**
9645 * The `listener` will be called with `listener(details, callback)` when a request
9646 * is about to occur.
9647 *
9648 * The `uploadData` is an array of `UploadData` objects.
9649 *
9650 * The `callback` has to be called with an `response` object.
9651 *
9652Some examples of valid `urls`:
9653 */
9654 onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
9655 /**
9656 * The `listener` will be called with `listener(details, callback)` when a request
9657 * is about to occur.
9658 *
9659 * The `uploadData` is an array of `UploadData` objects.
9660 *
9661 * The `callback` has to be called with an `response` object.
9662 *
9663Some examples of valid `urls`:
9664 */
9665 onBeforeRequest(filter: Filter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
9666 /**
9667 * The `listener` will be called with `listener(details, callback)` before sending
9668 * an HTTP request, once the request headers are available. This may occur after a
9669 * TCP connection is made to the server, but before any http data is sent.
9670 *
9671The `callback` has to be called with a `response` object.
9672 */
9673 onBeforeSendHeaders(filter: Filter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
9674 /**
9675 * The `listener` will be called with `listener(details, callback)` before sending
9676 * an HTTP request, once the request headers are available. This may occur after a
9677 * TCP connection is made to the server, but before any http data is sent.
9678 *
9679The `callback` has to be called with a `response` object.
9680 */
9681 onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
9682 /**
9683 * The `listener` will be called with `listener(details)` when a request is
9684 * completed.
9685 */
9686 onCompleted(filter: Filter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
9687 /**
9688 * The `listener` will be called with `listener(details)` when a request is
9689 * completed.
9690 */
9691 onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
9692 /**
9693 * The `listener` will be called with `listener(details)` when an error occurs.
9694 */
9695 onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
9696 /**
9697 * The `listener` will be called with `listener(details)` when an error occurs.
9698 */
9699 onErrorOccurred(filter: Filter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
9700 /**
9701 * The `listener` will be called with `listener(details, callback)` when HTTP
9702 * response headers of a request have been received.
9703 *
9704The `callback` has to be called with a `response` object.
9705 */
9706 onHeadersReceived(filter: Filter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
9707 /**
9708 * The `listener` will be called with `listener(details, callback)` when HTTP
9709 * response headers of a request have been received.
9710 *
9711The `callback` has to be called with a `response` object.
9712 */
9713 onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
9714 /**
9715 * The `listener` will be called with `listener(details)` when first byte of the
9716 * response body is received. For HTTP requests, this means that the status line
9717 * and response headers are available.
9718 */
9719 onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
9720 /**
9721 * The `listener` will be called with `listener(details)` when first byte of the
9722 * response body is received. For HTTP requests, this means that the status line
9723 * and response headers are available.
9724 */
9725 onResponseStarted(filter: Filter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
9726 /**
9727 * The `listener` will be called with `listener(details)` just before a request is
9728 * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
9729 * response are visible by the time this listener is fired.
9730 */
9731 onSendHeaders(filter: Filter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
9732 /**
9733 * The `listener` will be called with `listener(details)` just before a request is
9734 * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
9735 * response are visible by the time this listener is fired.
9736 */
9737 onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
9738 }
9739
9740 interface WebSource {
9741
9742 // Docs: http://electronjs.org/docs/api/structures/web-source
9743
9744 code: string;
9745 /**
9746 * Default is 1.
9747 */
9748 startLine?: number;
9749 url?: string;
9750 }
9751
9752 interface WebviewTag extends HTMLElement {
9753
9754 // Docs: http://electronjs.org/docs/api/webview-tag
9755
9756 /**
9757 * Fired when a load has committed. This includes navigation within the current
9758 * document as well as subframe document-level loads, but does not include
9759 * asynchronous resource loads.
9760 */
9761 addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
9762 removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
9763 /**
9764 * Fired when the navigation is done, i.e. the spinner of the tab will stop
9765 * spinning, and the `onload` event is dispatched.
9766 */
9767 addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this;
9768 removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this;
9769 /**
9770 * This event is like `did-finish-load`, but fired when the load failed or was
9771 * cancelled, e.g. `window.stop()` is invoked.
9772 */
9773 addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
9774 removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
9775 /**
9776 * Fired when a frame has done navigation.
9777 */
9778 addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
9779 removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
9780 /**
9781 * Corresponds to the points in time when the spinner of the tab starts spinning.
9782 */
9783 addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this;
9784 removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this;
9785 /**
9786 * Corresponds to the points in time when the spinner of the tab stops spinning.
9787 */
9788 addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this;
9789 removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this;
9790 /**
9791 * Fired when document in the given frame is loaded.
9792 */
9793 addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this;
9794 removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this;
9795 /**
9796 * Fired when page title is set during navigation. `explicitSet` is false when
9797 * title is synthesized from file url.
9798 */
9799 addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
9800 removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
9801 /**
9802 * Fired when page receives favicon urls.
9803 */
9804 addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
9805 removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
9806 /**
9807 * Fired when page enters fullscreen triggered by HTML API.
9808 */
9809 addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
9810 removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this;
9811 /**
9812 * Fired when page leaves fullscreen triggered by HTML API.
9813 */
9814 addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
9815 removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this;
9816 /**
9817 * Fired when the guest window logs a console message.
9818 *
9819 * The following example code forwards all log messages to the embedder's console
9820 * without regard for log level or other properties.
9821 */
9822 addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
9823 removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
9824 /**
9825 * Fired when a result is available for `webview.findInPage` request.
9826 */
9827 addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
9828 removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
9829 /**
9830 * Fired when the guest page attempts to open a new browser window.
9831 *
9832The following example code opens the new url in system's default browser.
9833 */
9834 addEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void, useCapture?: boolean): this;
9835 removeEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void): this;
9836 /**
9837 * Emitted when a user or the page wants to start navigation. It can happen when
9838 * the `window.location` object is changed or a user clicks a link in the page.
9839 *
9840 * This event will not emit when the navigation is started programmatically with
9841 * APIs like `<webview>.loadURL` and `<webview>.back`.
9842 *
9843 * It is also not emitted during in-page navigation, such as clicking anchor links
9844 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
9845 * this purpose.
9846
9847Calling `event.preventDefault()` does __NOT__ have any effect.
9848 */
9849 addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
9850 removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
9851 /**
9852 * Emitted when a navigation is done.
9853 *
9854 * This event is not emitted for in-page navigations, such as clicking anchor links
9855 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
9856 * this purpose.
9857 */
9858 addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
9859 removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
9860 /**
9861 * Emitted when an in-page navigation happened.
9862 *
9863 * When in-page navigation happens, the page URL changes but does not cause
9864 * navigation outside of the page. Examples of this occurring are when anchor links
9865 * are clicked or when the DOM `hashchange` event is triggered.
9866 */
9867 addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
9868 removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
9869 /**
9870 * Fired when the guest page attempts to close itself.
9871 *
9872 * The following example code navigates the `webview` to `about:blank` when the
9873 * guest attempts to close itself.
9874 */
9875 addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this;
9876 removeEventListener(event: 'close', listener: (event: Event) => void): this;
9877 /**
9878 * Fired when the guest page has sent an asynchronous message to embedder page.
9879 *
9880 * With `sendToHost` method and `ipc-message` event you can communicate between
9881 * guest page and embedder page:
9882 */
9883 addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
9884 removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
9885 /**
9886 * Fired when the renderer process is crashed.
9887 */
9888 addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this;
9889 removeEventListener(event: 'crashed', listener: (event: Event) => void): this;
9890 /**
9891 * Fired when a plugin process is crashed.
9892 */
9893 addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
9894 removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
9895 /**
9896 * Fired when the WebContents is destroyed.
9897 */
9898 addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this;
9899 removeEventListener(event: 'destroyed', listener: (event: Event) => void): this;
9900 /**
9901 * Emitted when media starts playing.
9902 */
9903 addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this;
9904 removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this;
9905 /**
9906 * Emitted when media is paused or done playing.
9907 */
9908 addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this;
9909 removeEventListener(event: 'media-paused', listener: (event: Event) => void): this;
9910 /**
9911 * Emitted when a page's theme color changes. This is usually due to encountering a
9912 * meta tag:
9913 */
9914 addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
9915 removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
9916 /**
9917 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
9918 */
9919 addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
9920 removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
9921 /**
9922 * Emitted when DevTools is opened.
9923 */
9924 addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this;
9925 removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this;
9926 /**
9927 * Emitted when DevTools is closed.
9928 */
9929 addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this;
9930 removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this;
9931 /**
9932 * Emitted when DevTools is focused / opened.
9933 */
9934 addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this;
9935 removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this;
9936 addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
9937 addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
9938 removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
9939 removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
9940 /**
9941 * Whether the guest page can go back.
9942 */
9943 canGoBack(): boolean;
9944 /**
9945 * Whether the guest page can go forward.
9946 */
9947 canGoForward(): boolean;
9948 /**
9949 * Whether the guest page can go to `offset`.
9950 */
9951 canGoToOffset(offset: number): boolean;
9952 /**
9953 * Resolves with a NativeImage
9954 *
9955 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
9956 * whole visible page.
9957 */
9958 capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
9959 /**
9960 * Clears the navigation history.
9961 */
9962 clearHistory(): void;
9963 /**
9964 * Closes the DevTools window of guest page.
9965 */
9966 closeDevTools(): void;
9967 /**
9968 * Executes editing command `copy` in page.
9969 */
9970 copy(): void;
9971 /**
9972 * Executes editing command `cut` in page.
9973 */
9974 cut(): void;
9975 /**
9976 * Executes editing command `delete` in page.
9977 */
9978 delete(): void;
9979 /**
9980 * Initiates a download of the resource at `url` without navigating.
9981 */
9982 downloadURL(url: string): void;
9983 /**
9984 * A promise that resolves with the result of the executed code or is rejected if
9985 * the result of the code is a rejected promise.
9986 *
9987 * Evaluates `code` in page. If `userGesture` is set, it will create the user
9988 * gesture context in the page. HTML APIs like `requestFullScreen`, which require
9989 * user action, can take advantage of this option for automation.
9990 */
9991 executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
9992 /**
9993 * The request id used for the request.
9994 *
9995 * Starts a request to find all matches for the `text` in the web page. The result
9996 * of the request can be obtained by subscribing to `found-in-page` event.
9997 */
9998 findInPage(text: string, options?: FindInPageOptions): number;
9999 /**
10000 * The title of guest page.
10001 */
10002 getTitle(): string;
10003 /**
10004 * The URL of guest page.
10005 */
10006 getURL(): string;
10007 /**
10008 * The user agent for guest page.
10009 */
10010 getUserAgent(): string;
10011 /**
10012 * The web contents associated with this `webview`.
10013 *
10014 * It depends on the `remote` module, it is therefore not available when this
10015 * module is disabled.
10016 */
10017 getWebContents(): WebContents;
10018 /**
10019 * The WebContents ID of this `webview`.
10020 */
10021 getWebContentsId(): number;
10022 /**
10023 * the current zoom factor.
10024 */
10025 getZoomFactor(): number;
10026 /**
10027 * the current zoom level.
10028 */
10029 getZoomLevel(): number;
10030 /**
10031 * Makes the guest page go back.
10032 */
10033 goBack(): void;
10034 /**
10035 * Makes the guest page go forward.
10036 */
10037 goForward(): void;
10038 /**
10039 * Navigates to the specified absolute index.
10040 */
10041 goToIndex(index: number): void;
10042 /**
10043 * Navigates to the specified offset from the "current entry".
10044 */
10045 goToOffset(offset: number): void;
10046 /**
10047 * A promise that resolves with a key for the inserted CSS that can later be used
10048 * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
10049 *
10050 * Injects CSS into the current web page and returns a unique key for the inserted
10051 * stylesheet.
10052 */
10053 insertCSS(css: string): Promise<string>;
10054 /**
10055 * Inserts `text` to the focused element.
10056 */
10057 insertText(text: string): Promise<void>;
10058 /**
10059 * Starts inspecting element at position (`x`, `y`) of guest page.
10060 */
10061 inspectElement(x: number, y: number): void;
10062 /**
10063 * Opens the DevTools for the service worker context present in the guest page.
10064 */
10065 inspectServiceWorker(): void;
10066 /**
10067 * Opens the DevTools for the shared worker context present in the guest page.
10068 */
10069 inspectSharedWorker(): void;
10070 /**
10071 * Whether guest page has been muted.
10072 */
10073 isAudioMuted(): boolean;
10074 /**
10075 * Whether the renderer process has crashed.
10076 */
10077 isCrashed(): boolean;
10078 /**
10079 * Whether audio is currently playing.
10080 */
10081 isCurrentlyAudible(): boolean;
10082 /**
10083 * Whether DevTools window of guest page is focused.
10084 */
10085 isDevToolsFocused(): boolean;
10086 /**
10087 * Whether guest page has a DevTools window attached.
10088 */
10089 isDevToolsOpened(): boolean;
10090 /**
10091 * Whether guest page is still loading resources.
10092 */
10093 isLoading(): boolean;
10094 /**
10095 * Whether the main frame (and not just iframes or frames within it) is still
10096 * loading.
10097 */
10098 isLoadingMainFrame(): boolean;
10099 /**
10100 * Whether the guest page is waiting for a first-response for the main resource of
10101 * the page.
10102 */
10103 isWaitingForResponse(): boolean;
10104 /**
10105 * The promise will resolve when the page has finished loading (see
10106 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
10107 *
10108 * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
10109 * the `http://` or `file://`.
10110 */
10111 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
10112 /**
10113 * Opens a DevTools window for guest page.
10114 */
10115 openDevTools(): void;
10116 /**
10117 * Executes editing command `paste` in page.
10118 */
10119 paste(): void;
10120 /**
10121 * Executes editing command `pasteAndMatchStyle` in page.
10122 */
10123 pasteAndMatchStyle(): void;
10124 /**
10125 * Prints `webview`'s web page. Same as `webContents.print([options])`.
10126 */
10127 print(options?: WebviewTagPrintOptions): Promise<void>;
10128 /**
10129 * Resolves with the generated PDF data.
10130 *
10131Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
10132 */
10133 printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
10134 /**
10135 * Executes editing command `redo` in page.
10136 */
10137 redo(): void;
10138 /**
10139 * Reloads the guest page.
10140 */
10141 reload(): void;
10142 /**
10143 * Reloads the guest page and ignores cache.
10144 */
10145 reloadIgnoringCache(): void;
10146 /**
10147 * Resolves if the removal was successful.
10148 *
10149 * Removes the inserted CSS from the current web page. The stylesheet is identified
10150 * by its key, which is returned from `<webview>.insertCSS(css)`.
10151 */
10152 removeInsertedCSS(key: string): Promise<void>;
10153 /**
10154 * Executes editing command `replace` in page.
10155 */
10156 replace(text: string): void;
10157 /**
10158 * Executes editing command `replaceMisspelling` in page.
10159 */
10160 replaceMisspelling(text: string): void;
10161 /**
10162 * Executes editing command `selectAll` in page.
10163 */
10164 selectAll(): void;
10165 /**
10166 * Send an asynchronous message to renderer process via `channel`, you can also
10167 * send arbitrary arguments. The renderer process can handle the message by
10168 * listening to the `channel` event with the `ipcRenderer` module.
10169 *
10170See webContents.send for examples.
10171 */
10172 send(channel: string, ...args: any[]): Promise<void>;
10173 /**
10174 * Sends an input `event` to the page.
10175 *
10176See webContents.sendInputEvent for detailed description of `event` object.
10177 */
10178 sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
10179 /**
10180 * Set guest page muted.
10181 */
10182 setAudioMuted(muted: boolean): void;
10183 /**
10184 * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
10185 */
10186 setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
10187 /**
10188 * Overrides the user agent for the guest page.
10189 */
10190 setUserAgent(userAgent: string): void;
10191 /**
10192 * Sets the maximum and minimum pinch-to-zoom level.
10193 */
10194 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
10195 /**
10196 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
10197 * divided by 100, so 300% = 3.0.
10198 */
10199 setZoomFactor(factor: number): void;
10200 /**
10201 * Changes the zoom level to the specified level. The original size is 0 and each
10202 * increment above or below represents zooming 20% larger or smaller to default
10203 * limits of 300% and 50% of original size, respectively. The formula for this is
10204 * `scale := 1.2 ^ level`.
10205 */
10206 setZoomLevel(level: number): void;
10207 /**
10208 * Shows pop-up dictionary that searches the selected word on the page.
10209 *
10210 * @platform darwin
10211 */
10212 showDefinitionForSelection(): void;
10213 /**
10214 * Stops any pending navigation.
10215 */
10216 stop(): void;
10217 /**
10218 * Stops any `findInPage` request for the `webview` with the provided `action`.
10219 */
10220 stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
10221 /**
10222 * Executes editing command `undo` in page.
10223 */
10224 undo(): void;
10225 /**
10226 * Executes editing command `unselect` in page.
10227 */
10228 unselect(): void;
10229 /**
10230 * A `Boolean`. When this attribute is present the guest page will be allowed to
10231 * open new windows. Popups are disabled by default.
10232 */
10233 allowpopups: boolean;
10234 /**
10235 * A `String` which is a list of strings which specifies the blink features to be
10236 * disabled separated by `,`. The full list of supported feature strings can be
10237 * found in the RuntimeEnabledFeatures.json5 file.
10238 */
10239 disableblinkfeatures: string;
10240 /**
10241 * A `Boolean`. When this attribute is present the guest page will have web
10242 * security disabled. Web security is enabled by default.
10243 */
10244 disablewebsecurity: boolean;
10245 /**
10246 * A `String` which is a list of strings which specifies the blink features to be
10247 * enabled separated by `,`. The full list of supported feature strings can be
10248 * found in the RuntimeEnabledFeatures.json5 file.
10249 */
10250 enableblinkfeatures: string;
10251 /**
10252 * A `Boolean`. When this attribute is `false` the guest page in `webview` will not
10253 * have access to the `remote` module. The remote module is available by default.
10254 */
10255 enableremotemodule: boolean;
10256 /**
10257 * A `String` that sets the referrer URL for the guest page.
10258 */
10259 httpreferrer: string;
10260 /**
10261 * A `Boolean`. When this attribute is present the guest page in `webview` will
10262 * have node integration and can use node APIs like `require` and `process` to
10263 * access low level system resources. Node integration is disabled by default in
10264 * the guest page.
10265 */
10266 nodeintegration: boolean;
10267 /**
10268 * A `Boolean` for the experimental option for enabling NodeJS support in
10269 * sub-frames such as iframes inside the `webview`. All your preloads will load for
10270 * every iframe, you can use `process.isMainFrame` to determine if you are in the
10271 * main frame or not. This option is disabled by default in the guest page.
10272 */
10273 nodeintegrationinsubframes: boolean;
10274 /**
10275 * A `String` that sets the session used by the page. If `partition` starts with
10276 * `persist:`, the page will use a persistent session available to all pages in the
10277 * app with the same `partition`. if there is no `persist:` prefix, the page will
10278 * use an in-memory session. By assigning the same `partition`, multiple pages can
10279 * share the same session. If the `partition` is unset then default session of the
10280 * app will be used.
10281 *
10282 * This value can only be modified before the first navigation, since the session
10283 * of an active renderer process cannot change. Subsequent attempts to modify the
10284 * value will fail with a DOM exception.
10285 */
10286 partition: string;
10287 /**
10288 * A `Boolean`. When this attribute is present the guest page in `webview` will be
10289 * able to use browser plugins. Plugins are disabled by default.
10290 */
10291 plugins: boolean;
10292 /**
10293 * A `String` that specifies a script that will be loaded before other scripts run
10294 * in the guest page. The protocol of script's URL must be either `file:` or
10295 * `asar:`, because it will be loaded by `require` in guest page under the hood.
10296 *
10297 * When the guest page doesn't have node integration this script will still have
10298 * access to all Node APIs, but global objects injected by Node will be deleted
10299 * after this script has finished executing.
10300 *
10301 * **Note:** This option will appear as `preloadURL` (not `preload`) in the
10302 * `webPreferences` specified to the `will-attach-webview` event.
10303 */
10304 preload: string;
10305 /**
10306 * A `String` representing the visible URL. Writing to this attribute initiates
10307 * top-level navigation.
10308 *
10309 * Assigning `src` its own value will reload the current page.
10310 *
10311 * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
10312 * world!`.
10313 */
10314 src: string;
10315 /**
10316 * A `String` that sets the user agent for the guest page before the page is
10317 * navigated to. Once the page is loaded, use the `setUserAgent` method to change
10318 * the user agent.
10319 */
10320 useragent: string;
10321 /**
10322 * A `String` which is a comma separated list of strings which specifies the web
10323 * preferences to be set on the webview. The full list of supported preference
10324 * strings can be found in BrowserWindow.
10325 *
10326 * The string follows the same format as the features string in `window.open`. A
10327 * name by itself is given a `true` boolean value. A preference can be set to
10328 * another value by including an `=`, followed by the value. Special values `yes`
10329 * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
10330 * `false`.
10331 */
10332 webpreferences: string;
10333 }
10334
10335 interface AboutPanelOptionsOptions {
10336 /**
10337 * The app's name.
10338 */
10339 applicationName?: string;
10340 /**
10341 * The app's version.
10342 */
10343 applicationVersion?: string;
10344 /**
10345 * Copyright information.
10346 */
10347 copyright?: string;
10348 /**
10349 * The app's build version number.
10350 *
10351 * @platform darwin
10352 */
10353 version?: string;
10354 /**
10355 * Credit information.
10356 *
10357 * @platform darwin
10358 */
10359 credits?: string;
10360 /**
10361 * List of app authors.
10362 *
10363 * @platform linux
10364 */
10365 authors?: string[];
10366 /**
10367 * The app's website.
10368 *
10369 * @platform linux
10370 */
10371 website?: string;
10372 /**
10373 * Path to the app's icon. Will be shown as 64x64 pixels while retaining aspect
10374 * ratio.
10375 *
10376 * @platform linux
10377 */
10378 iconPath?: string;
10379 }
10380
10381 interface AddRepresentationOptions {
10382 /**
10383 * The scale factor to add the image representation for.
10384 */
10385 scaleFactor: number;
10386 /**
10387 * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
10388 */
10389 width?: number;
10390 /**
10391 * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
10392 */
10393 height?: number;
10394 /**
10395 * The buffer containing the raw image data.
10396 */
10397 buffer?: Buffer;
10398 /**
10399 * The data URL containing either a base 64 encoded PNG or JPEG image.
10400 */
10401 dataURL?: string;
10402 }
10403
10404 interface AnimationSettings {
10405 /**
10406 * Returns true if rich animations should be rendered. Looks at session type (e.g.
10407 * remote desktop) and accessibility settings to give guidance for heavy
10408 * animations.
10409 */
10410 shouldRenderRichAnimation: boolean;
10411 /**
10412 * Determines on a per-platform basis whether scroll animations (e.g. produced by
10413 * home/end key) should be enabled.
10414 */
10415 scrollAnimationsEnabledBySystem: boolean;
10416 /**
10417 * Determines whether the user desires reduced motion based on platform APIs.
10418 */
10419 prefersReducedMotion: boolean;
10420 }
10421
10422 interface AppDetailsOptions {
10423 /**
10424 * Window's App User Model ID. It has to be set, otherwise the other options will
10425 * have no effect.
10426 */
10427 appId?: string;
10428 /**
10429 * Window's Relaunch Icon.
10430 */
10431 appIconPath?: string;
10432 /**
10433 * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
10434 * Default is `0`.
10435 */
10436 appIconIndex?: number;
10437 /**
10438 * Window's Relaunch Command.
10439 */
10440 relaunchCommand?: string;
10441 /**
10442 * Window's Relaunch Display Name.
10443 */
10444 relaunchDisplayName?: string;
10445 }
10446
10447 interface AuthenticationResponseDetails {
10448 url: string;
10449 }
10450
10451 interface AuthInfo {
10452 isProxy: boolean;
10453 scheme: string;
10454 host: string;
10455 port: number;
10456 realm: string;
10457 }
10458
10459 interface AutoResizeOptions {
10460 /**
10461 * If `true`, the view's width will grow and shrink together with the window.
10462 * `false` by default.
10463 */
10464 width?: boolean;
10465 /**
10466 * If `true`, the view's height will grow and shrink together with the window.
10467 * `false` by default.
10468 */
10469 height?: boolean;
10470 /**
10471 * If `true`, the view's x position and width will grow and shrink proportionally
10472 * with the window. `false` by default.
10473 */
10474 horizontal?: boolean;
10475 /**
10476 * If `true`, the view's y position and height will grow and shrink proportionally
10477 * with the window. `false` by default.
10478 */
10479 vertical?: boolean;
10480 }
10481
10482 interface BeforeSendResponse {
10483 cancel?: boolean;
10484 /**
10485 * When provided, request will be made with these headers.
10486 */
10487 requestHeaders?: Record<string, (string) | (string[])>;
10488 }
10489
10490 interface BitmapOptions {
10491 /**
10492 * Defaults to 1.0.
10493 */
10494 scaleFactor?: number;
10495 }
10496
10497 interface BlinkMemoryInfo {
10498 /**
10499 * Size of all allocated objects in Kilobytes.
10500 */
10501 allocated: number;
10502 /**
10503 * Size of all marked objects in Kilobytes.
10504 */
10505 marked: number;
10506 /**
10507 * Total allocated space in Kilobytes.
10508 */
10509 total: number;
10510 }
10511
10512 interface BrowserViewConstructorOptions {
10513 /**
10514 * See BrowserWindow.
10515 */
10516 webPreferences?: WebPreferences;
10517 }
10518
10519 interface BrowserWindowConstructorOptions {
10520 /**
10521 * Window's width in pixels. Default is `800`.
10522 */
10523 width?: number;
10524 /**
10525 * Window's height in pixels. Default is `600`.
10526 */
10527 height?: number;
10528 /**
10529 * (**required** if y is used) Window's left offset from screen. Default is to
10530 * center the window.
10531 */
10532 x?: number;
10533 /**
10534 * (**required** if x is used) Window's top offset from screen. Default is to
10535 * center the window.
10536 */
10537 y?: number;
10538 /**
10539 * The `width` and `height` would be used as web page's size, which means the
10540 * actual window's size will include window frame's size and be slightly larger.
10541 * Default is `false`.
10542 */
10543 useContentSize?: boolean;
10544 /**
10545 * Show window in the center of the screen.
10546 */
10547 center?: boolean;
10548 /**
10549 * Window's minimum width. Default is `0`.
10550 */
10551 minWidth?: number;
10552 /**
10553 * Window's minimum height. Default is `0`.
10554 */
10555 minHeight?: number;
10556 /**
10557 * Window's maximum width. Default is no limit.
10558 */
10559 maxWidth?: number;
10560 /**
10561 * Window's maximum height. Default is no limit.
10562 */
10563 maxHeight?: number;
10564 /**
10565 * Whether window is resizable. Default is `true`.
10566 */
10567 resizable?: boolean;
10568 /**
10569 * Whether window is movable. This is not implemented on Linux. Default is `true`.
10570 */
10571 movable?: boolean;
10572 /**
10573 * Whether window is minimizable. This is not implemented on Linux. Default is
10574 * `true`.
10575 */
10576 minimizable?: boolean;
10577 /**
10578 * Whether window is maximizable. This is not implemented on Linux. Default is
10579 * `true`.
10580 */
10581 maximizable?: boolean;
10582 /**
10583 * Whether window is closable. This is not implemented on Linux. Default is `true`.
10584 */
10585 closable?: boolean;
10586 /**
10587 * Whether the window can be focused. Default is `true`. On Windows setting
10588 * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
10589 * `focusable: false` makes the window stop interacting with wm, so the window will
10590 * always stay on top in all workspaces.
10591 */
10592 focusable?: boolean;
10593 /**
10594 * Whether the window should always stay on top of other windows. Default is
10595 * `false`.
10596 */
10597 alwaysOnTop?: boolean;
10598 /**
10599 * Whether the window should show in fullscreen. When explicitly set to `false` the
10600 * fullscreen button will be hidden or disabled on macOS. Default is `false`.
10601 */
10602 fullscreen?: boolean;
10603 /**
10604 * Whether the window can be put into fullscreen mode. On macOS, also whether the
10605 * maximize/zoom button should toggle full screen mode or maximize window. Default
10606 * is `true`.
10607 */
10608 fullscreenable?: boolean;
10609 /**
10610 * Use pre-Lion fullscreen on macOS. Default is `false`.
10611 */
10612 simpleFullscreen?: boolean;
10613 /**
10614 * Whether to show the window in taskbar. Default is `false`.
10615 */
10616 skipTaskbar?: boolean;
10617 /**
10618 * The kiosk mode. Default is `false`.
10619 */
10620 kiosk?: boolean;
10621 /**
10622 * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
10623 * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
10624 */
10625 title?: string;
10626 /**
10627 * The window icon. On Windows it is recommended to use `ICO` icons to get best
10628 * visual effects, you can also leave it undefined so the executable's icon will be
10629 * used.
10630 */
10631 icon?: (NativeImage) | (string);
10632 /**
10633 * Whether window should be shown when created. Default is `true`.
10634 */
10635 show?: boolean;
10636 /**
10637 * Whether the renderer should be active when `show` is `false` and it has just
10638 * been created. In order for `document.visibilityState` to work correctly on
10639 * first load with `show: false` you should set this to `false`. Setting this to
10640 * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
10641 */
10642 paintWhenInitiallyHidden?: boolean;
10643 /**
10644 * Specify `false` to create a Frameless Window. Default is `true`.
10645 */
10646 frame?: boolean;
10647 /**
10648 * Specify parent window. Default is `null`.
10649 */
10650 parent?: BrowserWindow;
10651 /**
10652 * Whether this is a modal window. This only works when the window is a child
10653 * window. Default is `false`.
10654 */
10655 modal?: boolean;
10656 /**
10657 * Whether the web view accepts a single mouse-down event that simultaneously
10658 * activates the window. Default is `false`.
10659 */
10660 acceptFirstMouse?: boolean;
10661 /**
10662 * Whether to hide cursor when typing. Default is `false`.
10663 */
10664 disableAutoHideCursor?: boolean;
10665 /**
10666 * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
10667 */
10668 autoHideMenuBar?: boolean;
10669 /**
10670 * Enable the window to be resized larger than screen. Only relevant for macOS, as
10671 * other OSes allow larger-than-screen windows by default. Default is `false`.
10672 */
10673 enableLargerThanScreen?: boolean;
10674 /**
10675 * Window's background color as a hexadecimal value, like `#66CD00` or `#FFF` or
10676 * `#80FFFFFF` (alpha in #AARRGGBB format is supported if `transparent` is set to
10677 * `true`). Default is `#FFF` (white).
10678 */
10679 backgroundColor?: string;
10680 /**
10681 * Whether window should have a shadow. This is only implemented on macOS. Default
10682 * is `true`.
10683 */
10684 hasShadow?: boolean;
10685 /**
10686 * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
10687 * (fully opaque). This is only implemented on Windows and macOS.
10688 */
10689 opacity?: number;
10690 /**
10691 * Forces using dark theme for the window, only works on some GTK+3 desktop
10692 * environments. Default is `false`.
10693 */
10694 darkTheme?: boolean;
10695 /**
10696 * Makes the window transparent. Default is `false`. On Windows, does not work
10697 * unless the window is frameless.
10698 */
10699 transparent?: boolean;
10700 /**
10701 * The type of window, default is normal window. See more about this below.
10702 */
10703 type?: string;
10704 /**
10705 * The style of window title bar. Default is `default`. Possible values are:
10706 */
10707 titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
10708 /**
10709 * Shows the title in the title bar in full screen mode on macOS for all
10710 * `titleBarStyle` options. Default is `false`.
10711 */
10712 fullscreenWindowTitle?: boolean;
10713 /**
10714 * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
10715 * window frame. Setting it to `false` will remove window shadow and window
10716 * animations. Default is `true`.
10717 */
10718 thickFrame?: boolean;
10719 /**
10720 * Add a type of vibrancy effect to the window, only on macOS. Can be
10721 * `appearance-based`, `light`, `dark`, `titlebar`, `selection`, `menu`, `popover`,
10722 * `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`,
10723 * `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please
10724 * note that using `frame: false` in combination with a vibrancy value requires
10725 * that you use a non-default `titleBarStyle` as well. Also note that
10726 * `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` have been
10727 * deprecated and will be removed in an upcoming version of macOS.
10728 */
10729 vibrancy?: ('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page');
10730 /**
10731 * Controls the behavior on macOS when option-clicking the green stoplight button
10732 * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
10733 * will grow to the preferred width of the web page when zoomed, `false` will cause
10734 * it to zoom to the width of the screen. This will also affect the behavior when
10735 * calling `maximize()` directly. Default is `false`.
10736 */
10737 zoomToPageWidth?: boolean;
10738 /**
10739 * Tab group name, allows opening the window as a native tab on macOS 10.12+.
10740 * Windows with the same tabbing identifier will be grouped together. This also
10741 * adds a native new tab button to your window's tab bar and allows your `app` and
10742 * window to receive the `new-window-for-tab` event.
10743 */
10744 tabbingIdentifier?: string;
10745 /**
10746 * Settings of web page's features.
10747 */
10748 webPreferences?: WebPreferences;
10749 }
10750
10751 interface CertificateTrustDialogOptions {
10752 /**
10753 * The certificate to trust/import.
10754 */
10755 certificate: Certificate;
10756 /**
10757 * The message to display to the user.
10758 */
10759 message: string;
10760 }
10761
10762 interface ClearStorageDataOptions {
10763 /**
10764 * Should follow `window.location.origin`’s representation `scheme://host:port`.
10765 */
10766 origin?: string;
10767 /**
10768 * The types of storages to clear, can contain: `appcache`, `cookies`,
10769 * `filesystem`, `indexdb`, `localstorage`, `shadercache`, `websql`,
10770 * `serviceworkers`, `cachestorage`.
10771 */
10772 storages?: string[];
10773 /**
10774 * The types of quotas to clear, can contain: `temporary`, `persistent`,
10775 * `syncable`.
10776 */
10777 quotas?: string[];
10778 }
10779
10780 interface ClientRequestConstructorOptions {
10781 /**
10782 * The HTTP request method. Defaults to the GET method.
10783 */
10784 method?: string;
10785 /**
10786 * The request URL. Must be provided in the absolute form with the protocol scheme
10787 * specified as http or https.
10788 */
10789 url?: string;
10790 /**
10791 * The `Session` instance with which the request is associated.
10792 */
10793 session?: Session;
10794 /**
10795 * The name of the `partition` with which the request is associated. Defaults to
10796 * the empty string. The `session` option prevails on `partition`. Thus if a
10797 * `session` is explicitly specified, `partition` is ignored.
10798 */
10799 partition?: string;
10800 /**
10801 * The protocol scheme in the form 'scheme:'. Currently supported values are
10802 * 'http:' or 'https:'. Defaults to 'http:'.
10803 */
10804 protocol?: string;
10805 /**
10806 * The server host provided as a concatenation of the hostname and the port number
10807 * 'hostname:port'.
10808 */
10809 host?: string;
10810 /**
10811 * The server host name.
10812 */
10813 hostname?: string;
10814 /**
10815 * The server's listening port number.
10816 */
10817 port?: number;
10818 /**
10819 * The path part of the request URL.
10820 */
10821 path?: string;
10822 /**
10823 * The redirect mode for this request. Should be one of `follow`, `error` or
10824 * `manual`. Defaults to `follow`. When mode is `error`, any redirection will be
10825 * aborted. When mode is `manual` the redirection will be cancelled unless
10826 * `request.followRedirect` is invoked synchronously during the `redirect` event.
10827 */
10828 redirect?: string;
10829 }
10830
10831 interface Config {
10832 /**
10833 * The URL associated with the PAC file.
10834 */
10835 pacScript: string;
10836 /**
10837 * Rules indicating which proxies to use.
10838 */
10839 proxyRules: string;
10840 /**
10841 * Rules indicating which URLs should bypass the proxy settings.
10842 */
10843 proxyBypassRules: string;
10844 }
10845
10846 interface ConsoleMessageEvent extends Event {
10847 level: number;
10848 message: string;
10849 line: number;
10850 sourceId: string;
10851 }
10852
10853 interface ContextMenuParams {
10854 /**
10855 * x coordinate.
10856 */
10857 x: number;
10858 /**
10859 * y coordinate.
10860 */
10861 y: number;
10862 /**
10863 * URL of the link that encloses the node the context menu was invoked on.
10864 */
10865 linkURL: string;
10866 /**
10867 * Text associated with the link. May be an empty string if the contents of the
10868 * link are an image.
10869 */
10870 linkText: string;
10871 /**
10872 * URL of the top level page that the context menu was invoked on.
10873 */
10874 pageURL: string;
10875 /**
10876 * URL of the subframe that the context menu was invoked on.
10877 */
10878 frameURL: string;
10879 /**
10880 * Source URL for the element that the context menu was invoked on. Elements with
10881 * source URLs are images, audio and video.
10882 */
10883 srcURL: string;
10884 /**
10885 * Type of the node the context menu was invoked on. Can be `none`, `image`,
10886 * `audio`, `video`, `canvas`, `file` or `plugin`.
10887 */
10888 mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
10889 /**
10890 * Whether the context menu was invoked on an image which has non-empty contents.
10891 */
10892 hasImageContents: boolean;
10893 /**
10894 * Whether the context is editable.
10895 */
10896 isEditable: boolean;
10897 /**
10898 * Text of the selection that the context menu was invoked on.
10899 */
10900 selectionText: string;
10901 /**
10902 * Title or alt text of the selection that the context was invoked on.
10903 */
10904 titleText: string;
10905 /**
10906 * The misspelled word under the cursor, if any.
10907 */
10908 misspelledWord: string;
10909 /**
10910 * The character encoding of the frame on which the menu was invoked.
10911 */
10912 frameCharset: string;
10913 /**
10914 * If the context menu was invoked on an input field, the type of that field.
10915 * Possible values are `none`, `plainText`, `password`, `other`.
10916 */
10917 inputFieldType: string;
10918 /**
10919 * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
10920 * `touch` or `touchMenu`.
10921 */
10922 menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu');
10923 /**
10924 * The flags for the media element the context menu was invoked on.
10925 */
10926 mediaFlags: MediaFlags;
10927 /**
10928 * These flags indicate whether the renderer believes it is able to perform the
10929 * corresponding action.
10930 */
10931 editFlags: EditFlags;
10932 }
10933
10934 interface CookiesGetFilter {
10935 /**
10936 * Retrieves cookies which are associated with `url`. Empty implies retrieving
10937 * cookies of all URLs.
10938 */
10939 url?: string;
10940 /**
10941 * Filters cookies by name.
10942 */
10943 name?: string;
10944 /**
10945 * Retrieves cookies whose domains match or are subdomains of `domains`.
10946 */
10947 domain?: string;
10948 /**
10949 * Retrieves cookies whose path matches `path`.
10950 */
10951 path?: string;
10952 /**
10953 * Filters cookies by their Secure property.
10954 */
10955 secure?: boolean;
10956 /**
10957 * Filters out session or persistent cookies.
10958 */
10959 session?: boolean;
10960 }
10961
10962 interface CookiesSetDetails {
10963 /**
10964 * The URL to associate the cookie with. The promise will be rejected if the URL is
10965 * invalid.
10966 */
10967 url: string;
10968 /**
10969 * The name of the cookie. Empty by default if omitted.
10970 */
10971 name?: string;
10972 /**
10973 * The value of the cookie. Empty by default if omitted.
10974 */
10975 value?: string;
10976 /**
10977 * The domain of the cookie; this will be normalized with a preceding dot so that
10978 * it's also valid for subdomains. Empty by default if omitted.
10979 */
10980 domain?: string;
10981 /**
10982 * The path of the cookie. Empty by default if omitted.
10983 */
10984 path?: string;
10985 /**
10986 * Whether the cookie should be marked as Secure. Defaults to false.
10987 */
10988 secure?: boolean;
10989 /**
10990 * Whether the cookie should be marked as HTTP only. Defaults to false.
10991 */
10992 httpOnly?: boolean;
10993 /**
10994 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
10995 * If omitted then the cookie becomes a session cookie and will not be retained
10996 * between sessions.
10997 */
10998 expirationDate?: number;
10999 }
11000
11001 interface CrashReporterStartOptions {
11002 companyName: string;
11003 /**
11004 * URL that crash reports will be sent to as POST.
11005 */
11006 submitURL: string;
11007 /**
11008 * Defaults to `app.name`.
11009 */
11010 productName?: string;
11011 /**
11012 * Whether crash reports should be sent to the server. Default is `true`.
11013 */
11014 uploadToServer?: boolean;
11015 /**
11016 * Default is `false`.
11017 */
11018 ignoreSystemCrashHandler?: boolean;
11019 /**
11020 * An object you can define that will be sent along with the report. Only string
11021 * properties are sent correctly. Nested objects are not supported. When using
11022 * Windows, the property names and values must be fewer than 64 characters.
11023 */
11024 extra?: Record<string, string>;
11025 /**
11026 * Directory to store the crash reports temporarily (only used when the crash
11027 * reporter is started via `process.crashReporter.start`).
11028 */
11029 crashesDirectory?: string;
11030 }
11031
11032 interface CreateFromBitmapOptions {
11033 width: number;
11034 height: number;
11035 /**
11036 * Defaults to 1.0.
11037 */
11038 scaleFactor?: number;
11039 }
11040
11041 interface CreateFromBufferOptions {
11042 /**
11043 * Required for bitmap buffers.
11044 */
11045 width?: number;
11046 /**
11047 * Required for bitmap buffers.
11048 */
11049 height?: number;
11050 /**
11051 * Defaults to 1.0.
11052 */
11053 scaleFactor?: number;
11054 }
11055
11056 interface CreateInterruptedDownloadOptions {
11057 /**
11058 * Absolute path of the download.
11059 */
11060 path: string;
11061 /**
11062 * Complete URL chain for the download.
11063 */
11064 urlChain: string[];
11065 mimeType?: string;
11066 /**
11067 * Start range for the download.
11068 */
11069 offset: number;
11070 /**
11071 * Total length of the download.
11072 */
11073 length: number;
11074 /**
11075 * Last-Modified header value.
11076 */
11077 lastModified: string;
11078 /**
11079 * ETag header value.
11080 */
11081 eTag: string;
11082 /**
11083 * Time when download was started in number of seconds since UNIX epoch.
11084 */
11085 startTime?: number;
11086 }
11087
11088 interface Data {
11089 text?: string;
11090 html?: string;
11091 image?: NativeImage;
11092 rtf?: string;
11093 /**
11094 * The title of the URL at `text`.
11095 */
11096 bookmark?: string;
11097 }
11098
11099 interface Details {
11100 /**
11101 * The security orign of the `media` check.
11102 */
11103 securityOrigin: string;
11104 /**
11105 * The type of media access being requested, can be `video`, `audio` or `unknown`
11106 */
11107 mediaType: ('video' | 'audio' | 'unknown');
11108 /**
11109 * The last URL the requesting frame loaded
11110 */
11111 requestingUrl: string;
11112 /**
11113 * Whether the frame making the request is the main frame
11114 */
11115 isMainFrame: boolean;
11116 }
11117
11118 interface DidChangeThemeColorEvent extends Event {
11119 themeColor: string;
11120 }
11121
11122 interface DidFailLoadEvent extends Event {
11123 errorCode: number;
11124 errorDescription: string;
11125 validatedURL: string;
11126 isMainFrame: boolean;
11127 }
11128
11129 interface DidFrameFinishLoadEvent extends Event {
11130 isMainFrame: boolean;
11131 }
11132
11133 interface DidNavigateEvent extends Event {
11134 url: string;
11135 }
11136
11137 interface DidNavigateInPageEvent extends Event {
11138 isMainFrame: boolean;
11139 url: string;
11140 }
11141
11142 interface DisplayBalloonOptions {
11143 icon?: (NativeImage) | (string);
11144 title: string;
11145 content: string;
11146 }
11147
11148 interface EnableNetworkEmulationOptions {
11149 /**
11150 * Whether to emulate network outage. Defaults to false.
11151 */
11152 offline?: boolean;
11153 /**
11154 * RTT in ms. Defaults to 0 which will disable latency throttling.
11155 */
11156 latency?: number;
11157 /**
11158 * Download rate in Bps. Defaults to 0 which will disable download throttling.
11159 */
11160 downloadThroughput?: number;
11161 /**
11162 * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
11163 */
11164 uploadThroughput?: number;
11165 }
11166
11167 interface FeedURLOptions {
11168 url: string;
11169 /**
11170 * HTTP request headers.
11171 *
11172 * @platform darwin
11173 */
11174 headers?: Record<string, string>;
11175 /**
11176 * Either `json` or `default`, see the Squirrel.Mac README for more information.
11177 *
11178 * @platform darwin
11179 */
11180 serverType?: string;
11181 }
11182
11183 interface FileIconOptions {
11184 size: ('small' | 'normal' | 'large');
11185 }
11186
11187 interface Filter {
11188 /**
11189 * Array of URL patterns that will be used to filter out the requests that do not
11190 * match the URL patterns.
11191 */
11192 urls: string[];
11193 }
11194
11195 interface FindInPageOptions {
11196 /**
11197 * Whether to search forward or backward, defaults to `true`.
11198 */
11199 forward?: boolean;
11200 /**
11201 * Whether the operation is first request or a follow up, defaults to `false`.
11202 */
11203 findNext?: boolean;
11204 /**
11205 * Whether search should be case-sensitive, defaults to `false`.
11206 */
11207 matchCase?: boolean;
11208 /**
11209 * Whether to look only at the start of words. defaults to `false`.
11210 */
11211 wordStart?: boolean;
11212 /**
11213 * When combined with `wordStart`, accepts a match in the middle of a word if the
11214 * match begins with an uppercase letter followed by a lowercase or non-letter.
11215 * Accepts several other intra-word matches, defaults to `false`.
11216 */
11217 medialCapitalAsWordStart?: boolean;
11218 }
11219
11220 interface FoundInPageEvent extends Event {
11221 result: FoundInPageResult;
11222 }
11223
11224 interface FromPartitionOptions {
11225 /**
11226 * Whether to enable cache.
11227 */
11228 cache: boolean;
11229 }
11230
11231 interface HeadersReceivedResponse {
11232 cancel?: boolean;
11233 /**
11234 * When provided, the server is assumed to have responded with these headers.
11235 */
11236 responseHeaders?: Record<string, (string) | (string[])>;
11237 /**
11238 * Should be provided when overriding `responseHeaders` to change header status
11239 * otherwise original response header's status will be used.
11240 */
11241 statusLine?: string;
11242 }
11243
11244 interface HeapStatistics {
11245 totalHeapSize: number;
11246 totalHeapSizeExecutable: number;
11247 totalPhysicalSize: number;
11248 totalAvailableSize: number;
11249 usedHeapSize: number;
11250 heapSizeLimit: number;
11251 mallocedMemory: number;
11252 peakMallocedMemory: number;
11253 doesZapGarbage: boolean;
11254 }
11255
11256 interface IgnoreMouseEventsOptions {
11257 /**
11258 * If true, forwards mouse move messages to Chromium, enabling mouse related events
11259 * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
11260 * forwarding is always disabled regardless of this value.
11261 *
11262 * @platform darwin,win32
11263 */
11264 forward?: boolean;
11265 }
11266
11267 interface ImportCertificateOptions {
11268 /**
11269 * Path for the pkcs12 file.
11270 */
11271 certificate: string;
11272 /**
11273 * Passphrase for the certificate.
11274 */
11275 password: string;
11276 }
11277
11278 interface Info {
11279 /**
11280 * Security origin for the isolated world.
11281 */
11282 securityOrigin?: string;
11283 /**
11284 * Content Security Policy for the isolated world.
11285 */
11286 csp?: string;
11287 /**
11288 * Name for isolated world. Useful in devtools.
11289 */
11290 name?: string;
11291 }
11292
11293 interface Input {
11294 /**
11295 * Either `keyUp` or `keyDown`.
11296 */
11297 type: string;
11298 /**
11299 * Equivalent to KeyboardEvent.key.
11300 */
11301 key: string;
11302 /**
11303 * Equivalent to KeyboardEvent.code.
11304 */
11305 code: string;
11306 /**
11307 * Equivalent to KeyboardEvent.repeat.
11308 */
11309 isAutoRepeat: boolean;
11310 /**
11311 * Equivalent to KeyboardEvent.shiftKey.
11312 */
11313 shift: boolean;
11314 /**
11315 * Equivalent to KeyboardEvent.controlKey.
11316 */
11317 control: boolean;
11318 /**
11319 * Equivalent to KeyboardEvent.altKey.
11320 */
11321 alt: boolean;
11322 /**
11323 * Equivalent to KeyboardEvent.metaKey.
11324 */
11325 meta: boolean;
11326 }
11327
11328 interface InsertCSSOptions {
11329 /**
11330 * Can be either 'user' or 'author'; Specifying 'user' enables you to prevent
11331 * websites from overriding the CSS you insert. Default is 'author'.
11332 */
11333 cssOrigin?: string;
11334 }
11335
11336 interface IpcMessageEvent extends Event {
11337 channel: string;
11338 args: any[];
11339 }
11340
11341 interface Item {
11342 /**
11343 * The path(s) to the file(s) being dragged.
11344 */
11345 file: (string[]) | (string);
11346 /**
11347 * The image must be non-empty on macOS.
11348 */
11349 icon: NativeImage;
11350 }
11351
11352 interface JumpListSettings {
11353 /**
11354 * The minimum number of items that will be shown in the Jump List (for a more
11355 * detailed description of this value see the MSDN docs).
11356 */
11357 minItems: number;
11358 /**
11359 * Array of `JumpListItem` objects that correspond to items that the user has
11360 * explicitly removed from custom categories in the Jump List. These items must not
11361 * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
11362 * Windows will not display any custom category that contains any of the removed
11363 * items.
11364 */
11365 removedItems: JumpListItem[];
11366 }
11367
11368 interface LoadCommitEvent extends Event {
11369 url: string;
11370 isMainFrame: boolean;
11371 }
11372
11373 interface LoadFileOptions {
11374 /**
11375 * Passed to `url.format()`.
11376 */
11377 query?: Record<string, string>;
11378 /**
11379 * Passed to `url.format()`.
11380 */
11381 search?: string;
11382 /**
11383 * Passed to `url.format()`.
11384 */
11385 hash?: string;
11386 }
11387
11388 interface LoadURLOptions {
11389 /**
11390 * An HTTP Referrer url.
11391 */
11392 httpReferrer?: (string) | (Referrer);
11393 /**
11394 * A user agent originating the request.
11395 */
11396 userAgent?: string;
11397 /**
11398 * Extra headers separated by "\n"
11399 */
11400 extraHeaders?: string;
11401 postData?: (UploadRawData[]) | (UploadFile[]) | (UploadBlob[]);
11402 /**
11403 * Base url (with trailing path separator) for files to be loaded by the data url.
11404 * This is needed only if the specified `url` is a data url and needs to load other
11405 * files.
11406 */
11407 baseURLForDataURL?: string;
11408 }
11409
11410 interface LoginItemSettings {
11411 /**
11412 * `true` if the app is set to open at login.
11413 */
11414 openAtLogin: boolean;
11415 /**
11416 * `true` if the app is set to open as hidden at login. This setting is not
11417 * available on MAS builds.
11418 *
11419 * @platform darwin
11420 */
11421 openAsHidden: boolean;
11422 /**
11423 * `true` if the app was opened at login automatically. This setting is not
11424 * available on MAS builds.
11425 *
11426 * @platform darwin
11427 */
11428 wasOpenedAtLogin: boolean;
11429 /**
11430 * `true` if the app was opened as a hidden login item. This indicates that the app
11431 * should not open any windows at startup. This setting is not available on MAS
11432 * builds.
11433 *
11434 * @platform darwin
11435 */
11436 wasOpenedAsHidden: boolean;
11437 /**
11438 * `true` if the app was opened as a login item that should restore the state from
11439 * the previous session. This indicates that the app should restore the windows
11440 * that were open the last time the app was closed. This setting is not available
11441 * on MAS builds.
11442 *
11443 * @platform darwin
11444 */
11445 restoreState: boolean;
11446 }
11447
11448 interface LoginItemSettingsOptions {
11449 /**
11450 * The executable path to compare against. Defaults to `process.execPath`.
11451 *
11452 * @platform win32
11453 */
11454 path?: string;
11455 /**
11456 * The command-line arguments to compare against. Defaults to an empty array.
11457 *
11458 * @platform win32
11459 */
11460 args?: string[];
11461 }
11462
11463 interface MenuItemConstructorOptions {
11464 /**
11465 * Will be called with `click(menuItem, browserWindow, event)` when the menu item
11466 * is clicked.
11467 */
11468 click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: KeyboardEvent) => void;
11469 /**
11470 * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
11471 * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
11472 * `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`,
11473 * `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
11474 * `stopSpeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`,
11475 * `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`,
11476 * `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`,
11477 * `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when
11478 * specified the `click` property will be ignored. See roles.
11479 */
11480 role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'close' | 'minimize' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
11481 /**
11482 * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
11483 */
11484 type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
11485 label?: string;
11486 sublabel?: string;
11487 /**
11488 * Hover text for this menu item.
11489 *
11490 * @platform darwin
11491 */
11492 toolTip?: string;
11493 accelerator?: Accelerator;
11494 icon?: (NativeImage) | (string);
11495 /**
11496 * If false, the menu item will be greyed out and unclickable.
11497 */
11498 enabled?: boolean;
11499 /**
11500 * default is `true`, and when `false` will prevent the accelerator from triggering
11501 * the item if the item is not visible`.
11502 *
11503 * @platform darwin
11504 */
11505 acceleratorWorksWhenHidden?: boolean;
11506 /**
11507 * If false, the menu item will be entirely hidden.
11508 */
11509 visible?: boolean;
11510 /**
11511 * Should only be specified for `checkbox` or `radio` type menu items.
11512 */
11513 checked?: boolean;
11514 /**
11515 * If false, the accelerator won't be registered with the system, but it will still
11516 * be displayed. Defaults to true.
11517 *
11518 * @platform linux,win32
11519 */
11520 registerAccelerator?: boolean;
11521 /**
11522 * Should be specified for `submenu` type menu items. If `submenu` is specified,
11523 * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
11524 * be automatically converted to one using `Menu.buildFromTemplate`.
11525 */
11526 submenu?: (MenuItemConstructorOptions[]) | (Menu);
11527 /**
11528 * Unique within a single menu. If defined then it can be used as a reference to
11529 * this item by the position attribute.
11530 */
11531 id?: string;
11532 /**
11533 * Inserts this item before the item with the specified label. If the referenced
11534 * item doesn't exist the item will be inserted at the end of the menu. Also
11535 * implies that the menu item in question should be placed in the same “group” as
11536 * the item.
11537 */
11538 before?: string[];
11539 /**
11540 * Inserts this item after the item with the specified label. If the referenced
11541 * item doesn't exist the item will be inserted at the end of the menu.
11542 */
11543 after?: string[];
11544 /**
11545 * Provides a means for a single context menu to declare the placement of their
11546 * containing group before the containing group of the item with the specified
11547 * label.
11548 */
11549 beforeGroupContaining?: string[];
11550 /**
11551 * Provides a means for a single context menu to declare the placement of their
11552 * containing group after the containing group of the item with the specified
11553 * label.
11554 */
11555 afterGroupContaining?: string[];
11556 }
11557
11558 interface MessageBoxOptions {
11559 /**
11560 * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
11561 * `"question"` displays the same icon as `"info"`, unless you set an icon using
11562 * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
11563 * warning icon.
11564 */
11565 type?: string;
11566 /**
11567 * Array of texts for buttons. On Windows, an empty array will result in one button
11568 * labeled "OK".
11569 */
11570 buttons?: string[];
11571 /**
11572 * Index of the button in the buttons array which will be selected by default when
11573 * the message box opens.
11574 */
11575 defaultId?: number;
11576 /**
11577 * Title of the message box, some platforms will not show it.
11578 */
11579 title?: string;
11580 /**
11581 * Content of the message box.
11582 */
11583 message: string;
11584 /**
11585 * Extra information of the message.
11586 */
11587 detail?: string;
11588 /**
11589 * If provided, the message box will include a checkbox with the given label.
11590 */
11591 checkboxLabel?: string;
11592 /**
11593 * Initial checked state of the checkbox. `false` by default.
11594 */
11595 checkboxChecked?: boolean;
11596 icon?: NativeImage;
11597 /**
11598 * The index of the button to be used to cancel the dialog, via the `Esc` key. By
11599 * default this is assigned to the first button with "cancel" or "no" as the label.
11600 * If no such labeled buttons exist and this option is not set, `0` will be used as
11601 * the return value.
11602 */
11603 cancelId?: number;
11604 /**
11605 * On Windows Electron will try to figure out which one of the `buttons` are common
11606 * buttons (like "Cancel" or "Yes"), and show the others as command links in the
11607 * dialog. This can make the dialog appear in the style of modern Windows apps. If
11608 * you don't like this behavior, you can set `noLink` to `true`.
11609 */
11610 noLink?: boolean;
11611 /**
11612 * Normalize the keyboard access keys across platforms. Default is `false`.
11613 * Enabling this assumes `&` is used in the button labels for the placement of the
11614 * keyboard shortcut access key and labels will be converted so they work correctly
11615 * on each platform, `&` characters are removed on macOS, converted to `_` on
11616 * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
11617 * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
11618 * via `Alt-W` on Windows and Linux.
11619 */
11620 normalizeAccessKeys?: boolean;
11621 }
11622
11623 interface MessageBoxReturnValue {
11624 /**
11625 * The index of the clicked button.
11626 */
11627 response: number;
11628 /**
11629 * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
11630 */
11631 checkboxChecked: boolean;
11632 }
11633
11634 interface MessageBoxSyncOptions {
11635 /**
11636 * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
11637 * `"question"` displays the same icon as `"info"`, unless you set an icon using
11638 * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
11639 * warning icon.
11640 */
11641 type?: string;
11642 /**
11643 * Array of texts for buttons. On Windows, an empty array will result in one button
11644 * labeled "OK".
11645 */
11646 buttons?: string[];
11647 /**
11648 * Index of the button in the buttons array which will be selected by default when
11649 * the message box opens.
11650 */
11651 defaultId?: number;
11652 /**
11653 * Title of the message box, some platforms will not show it.
11654 */
11655 title?: string;
11656 /**
11657 * Content of the message box.
11658 */
11659 message: string;
11660 /**
11661 * Extra information of the message.
11662 */
11663 detail?: string;
11664 /**
11665 * If provided, the message box will include a checkbox with the given label.
11666 */
11667 checkboxLabel?: string;
11668 /**
11669 * Initial checked state of the checkbox. `false` by default.
11670 */
11671 checkboxChecked?: boolean;
11672 icon?: (NativeImage) | (string);
11673 /**
11674 * The index of the button to be used to cancel the dialog, via the `Esc` key. By
11675 * default this is assigned to the first button with "cancel" or "no" as the label.
11676 * If no such labeled buttons exist and this option is not set, `0` will be used as
11677 * the return value.
11678 */
11679 cancelId?: number;
11680 /**
11681 * On Windows Electron will try to figure out which one of the `buttons` are common
11682 * buttons (like "Cancel" or "Yes"), and show the others as command links in the
11683 * dialog. This can make the dialog appear in the style of modern Windows apps. If
11684 * you don't like this behavior, you can set `noLink` to `true`.
11685 */
11686 noLink?: boolean;
11687 /**
11688 * Normalize the keyboard access keys across platforms. Default is `false`.
11689 * Enabling this assumes `&` is used in the button labels for the placement of the
11690 * keyboard shortcut access key and labels will be converted so they work correctly
11691 * on each platform, `&` characters are removed on macOS, converted to `_` on
11692 * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
11693 * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
11694 * via `Alt-W` on Windows and Linux.
11695 */
11696 normalizeAccessKeys?: boolean;
11697 }
11698
11699 interface MoveToApplicationsFolderOptions {
11700 /**
11701 * A handler for potential conflict in move failure.
11702 */
11703 conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
11704 }
11705
11706 interface NewWindowEvent extends Event {
11707 url: string;
11708 frameName: string;
11709 /**
11710 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
11711 * `save-to-disk` and `other`.
11712 */
11713 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
11714 /**
11715 * The options which should be used for creating the new `BrowserWindow`.
11716 */
11717 options: BrowserWindowConstructorOptions;
11718 }
11719
11720 interface NotificationConstructorOptions {
11721 /**
11722 * A title for the notification, which will be shown at the top of the notification
11723 * window when it is shown.
11724 */
11725 title: string;
11726 /**
11727 * A subtitle for the notification, which will be displayed below the title.
11728 *
11729 * @platform darwin
11730 */
11731 subtitle?: string;
11732 /**
11733 * The body text of the notification, which will be displayed below the title or
11734 * subtitle.
11735 */
11736 body: string;
11737 /**
11738 * Whether or not to emit an OS notification noise when showing the notification.
11739 */
11740 silent?: boolean;
11741 /**
11742 * An icon to use in the notification.
11743 */
11744 icon?: (string) | (NativeImage);
11745 /**
11746 * Whether or not to add an inline reply option to the notification.
11747 *
11748 * @platform darwin
11749 */
11750 hasReply?: boolean;
11751 /**
11752 * The placeholder to write in the inline reply input field.
11753 *
11754 * @platform darwin
11755 */
11756 replyPlaceholder?: string;
11757 /**
11758 * The name of the sound file to play when the notification is shown.
11759 *
11760 * @platform darwin
11761 */
11762 sound?: string;
11763 /**
11764 * Actions to add to the notification. Please read the available actions and
11765 * limitations in the `NotificationAction` documentation.
11766 *
11767 * @platform darwin
11768 */
11769 actions?: NotificationAction[];
11770 /**
11771 * A custom title for the close button of an alert. An empty string will cause the
11772 * default localized text to be used.
11773 *
11774 * @platform darwin
11775 */
11776 closeButtonText?: string;
11777 }
11778
11779 interface OnBeforeRedirectListenerDetails {
11780 id: number;
11781 url: string;
11782 method: string;
11783 webContentsId?: number;
11784 resourceType: string;
11785 referrer: string;
11786 timestamp: number;
11787 redirectURL: string;
11788 statusCode: number;
11789 statusLine: string;
11790 /**
11791 * The server IP address that the request was actually sent to.
11792 */
11793 ip?: string;
11794 fromCache: boolean;
11795 responseHeaders?: Record<string, string>;
11796 }
11797
11798 interface OnBeforeRequestListenerDetails {
11799 id: number;
11800 url: string;
11801 method: string;
11802 webContentsId?: number;
11803 resourceType: string;
11804 referrer: string;
11805 timestamp: number;
11806 uploadData: UploadData[];
11807 }
11808
11809 interface OnBeforeSendHeadersListenerDetails {
11810 id: number;
11811 url: string;
11812 method: string;
11813 webContentsId?: number;
11814 resourceType: string;
11815 referrer: string;
11816 timestamp: number;
11817 requestHeaders: Record<string, string>;
11818 }
11819
11820 interface OnCompletedListenerDetails {
11821 id: number;
11822 url: string;
11823 method: string;
11824 webContentsId?: number;
11825 resourceType: string;
11826 referrer: string;
11827 timestamp: number;
11828 responseHeaders?: Record<string, string>;
11829 fromCache: boolean;
11830 statusCode: number;
11831 statusLine: string;
11832 }
11833
11834 interface OnErrorOccurredListenerDetails {
11835 id: number;
11836 url: string;
11837 method: string;
11838 webContentsId?: number;
11839 resourceType: string;
11840 referrer: string;
11841 timestamp: number;
11842 fromCache: boolean;
11843 /**
11844 * The error description.
11845 */
11846 error: string;
11847 }
11848
11849 interface OnHeadersReceivedListenerDetails {
11850 id: number;
11851 url: string;
11852 method: string;
11853 webContentsId?: number;
11854 resourceType: string;
11855 referrer: string;
11856 timestamp: number;
11857 statusLine: string;
11858 statusCode: number;
11859 responseHeaders?: Record<string, string>;
11860 }
11861
11862 interface OnResponseStartedListenerDetails {
11863 id: number;
11864 url: string;
11865 method: string;
11866 webContentsId?: number;
11867 resourceType: string;
11868 referrer: string;
11869 timestamp: number;
11870 responseHeaders?: Record<string, string>;
11871 /**
11872 * Indicates whether the response was fetched from disk cache.
11873 */
11874 fromCache: boolean;
11875 statusCode: number;
11876 statusLine: string;
11877 }
11878
11879 interface OnSendHeadersListenerDetails {
11880 id: number;
11881 url: string;
11882 method: string;
11883 webContentsId?: number;
11884 resourceType: string;
11885 referrer: string;
11886 timestamp: number;
11887 requestHeaders: Record<string, string>;
11888 }
11889
11890 interface OpenDevToolsOptions {
11891 /**
11892 * Opens the devtools with specified dock state, can be `right`, `bottom`,
11893 * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
11894 * possible to dock back. In `detach` mode it's not.
11895 */
11896 mode: ('right' | 'bottom' | 'undocked' | 'detach');
11897 /**
11898 * Whether to bring the opened devtools window to the foreground. The default is
11899 * `true`.
11900 */
11901 activate?: boolean;
11902 }
11903
11904 interface OpenDialogOptions {
11905 title?: string;
11906 defaultPath?: string;
11907 /**
11908 * Custom label for the confirmation button, when left empty the default label will
11909 * be used.
11910 */
11911 buttonLabel?: string;
11912 filters?: FileFilter[];
11913 /**
11914 * Contains which features the dialog should use. The following values are
11915 * supported:
11916 */
11917 properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'>;
11918 /**
11919 * Message to display above input boxes.
11920 *
11921 * @platform darwin
11922 */
11923 message?: string;
11924 /**
11925 * Create security scoped bookmarks when packaged for the Mac App Store.
11926 *
11927 * @platform darwin,mas
11928 */
11929 securityScopedBookmarks?: boolean;
11930 }
11931
11932 interface OpenDialogReturnValue {
11933 /**
11934 * whether or not the dialog was canceled.
11935 */
11936 canceled: boolean;
11937 /**
11938 * An array of file paths chosen by the user. If the dialog is cancelled this will
11939 * be an empty array.
11940 */
11941 filePaths: string[];
11942 /**
11943 * An array matching the `filePaths` array of base64 encoded strings which contains
11944 * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
11945 * this to be populated.
11946 *
11947 * @platform darwin,mas
11948 */
11949 bookmarks?: string[];
11950 }
11951
11952 interface OpenDialogSyncOptions {
11953 title?: string;
11954 defaultPath?: string;
11955 /**
11956 * Custom label for the confirmation button, when left empty the default label will
11957 * be used.
11958 */
11959 buttonLabel?: string;
11960 filters?: FileFilter[];
11961 /**
11962 * Contains which features the dialog should use. The following values are
11963 * supported:
11964 */
11965 properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'>;
11966 /**
11967 * Message to display above input boxes.
11968 *
11969 * @platform darwin
11970 */
11971 message?: string;
11972 /**
11973 * Create security scoped bookmarks when packaged for the Mac App Store.
11974 *
11975 * @platform darwin,mas
11976 */
11977 securityScopedBookmarks?: boolean;
11978 }
11979
11980 interface OpenExternalOptions {
11981 /**
11982 * `true` to bring the opened application to the foreground. The default is `true`.
11983 *
11984 * @platform darwin
11985 */
11986 activate?: boolean;
11987 /**
11988 * The working directory.
11989 *
11990 * @platform win32
11991 */
11992 workingDirectory?: string;
11993 }
11994
11995 interface PageFaviconUpdatedEvent extends Event {
11996 /**
11997 * Array of URLs.
11998 */
11999 favicons: string[];
12000 }
12001
12002 interface PageTitleUpdatedEvent extends Event {
12003 title: string;
12004 explicitSet: boolean;
12005 }
12006
12007 interface Parameters {
12008 /**
12009 * Specify the screen type to emulate (default: `desktop`):
12010 */
12011 screenPosition: ('desktop' | 'mobile');
12012 /**
12013 * Set the emulated screen size (screenPosition == mobile).
12014 */
12015 screenSize: Size;
12016 /**
12017 * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
12018 * 0 }`).
12019 */
12020 viewPosition: Point;
12021 /**
12022 * Set the device scale factor (if zero defaults to original device scale factor)
12023 * (default: `0`).
12024 */
12025 deviceScaleFactor: number;
12026 /**
12027 * Set the emulated view size (empty means no override)
12028 */
12029 viewSize: Size;
12030 /**
12031 * Scale of emulated view inside available space (not in fit to view mode)
12032 * (default: `1`).
12033 */
12034 scale: number;
12035 }
12036
12037 interface Payment {
12038 /**
12039 * The identifier of the purchased product.
12040 */
12041 productIdentifier: string;
12042 /**
12043 * The quantity purchased.
12044 */
12045 quantity: number;
12046 }
12047
12048 interface PermissionRequestHandlerHandlerDetails {
12049 /**
12050 * The url of the `openExternal` request.
12051 */
12052 externalURL?: string;
12053 /**
12054 * The types of media access being requested, elements can be `video` or `audio`
12055 */
12056 mediaTypes?: Array<'video' | 'audio'>;
12057 /**
12058 * The last URL the requesting frame loaded
12059 */
12060 requestingUrl: string;
12061 /**
12062 * Whether the frame making the request is the main frame
12063 */
12064 isMainFrame: boolean;
12065 }
12066
12067 interface PluginCrashedEvent extends Event {
12068 name: string;
12069 version: string;
12070 }
12071
12072 interface PopupOptions {
12073 /**
12074 * Default is the focused window.
12075 */
12076 window?: BrowserWindow;
12077 /**
12078 * Default is the current mouse cursor position. Must be declared if `y` is
12079 * declared.
12080 */
12081 x?: number;
12082 /**
12083 * Default is the current mouse cursor position. Must be declared if `x` is
12084 * declared.
12085 */
12086 y?: number;
12087 /**
12088 * The index of the menu item to be positioned under the mouse cursor at the
12089 * specified coordinates. Default is -1.
12090 *
12091 * @platform darwin
12092 */
12093 positioningItem?: number;
12094 /**
12095 * Called when menu is closed.
12096 */
12097 callback?: () => void;
12098 }
12099
12100 interface PreconnectOptions {
12101 /**
12102 * URL for preconnect. Only the origin is relevant for opening the socket.
12103 */
12104 url: string;
12105 /**
12106 * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
12107 */
12108 numSockets?: number;
12109 }
12110
12111 interface PrintToPDFOptions {
12112 /**
12113 * Specifies the type of margins to use. Uses 0 for default margin, 1 for no
12114 * margin, and 2 for minimum margin.
12115 */
12116 marginsType?: number;
12117 /**
12118 * Specify page size of the generated PDF. Can be `A3`, `A4`, `A5`, `Legal`,
12119 * `Letter`, `Tabloid` or an Object containing `height` and `width` in microns.
12120 */
12121 pageSize?: (string) | (Size);
12122 /**
12123 * Whether to print CSS backgrounds.
12124 */
12125 printBackground?: boolean;
12126 /**
12127 * Whether to print selection only.
12128 */
12129 printSelectionOnly?: boolean;
12130 /**
12131 * `true` for landscape, `false` for portrait.
12132 */
12133 landscape?: boolean;
12134 }
12135
12136 interface Privileges {
12137 /**
12138 * Default false.
12139 */
12140 standard?: boolean;
12141 /**
12142 * Default false.
12143 */
12144 secure?: boolean;
12145 /**
12146 * Default false.
12147 */
12148 bypassCSP?: boolean;
12149 /**
12150 * Default false.
12151 */
12152 allowServiceWorkers?: boolean;
12153 /**
12154 * Default false.
12155 */
12156 supportFetchAPI?: boolean;
12157 /**
12158 * Default false.
12159 */
12160 corsEnabled?: boolean;
12161 }
12162
12163 interface ProcRequest {
12164 hostname: string;
12165 certificate: Certificate;
12166 /**
12167 * Verification result from chromium.
12168 */
12169 verificationResult: string;
12170 /**
12171 * Error code.
12172 */
12173 errorCode: number;
12174 }
12175
12176 interface ProgressBarOptions {
12177 /**
12178 * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
12179 * `paused`.
12180 *
12181 * @platform win32
12182 */
12183 mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
12184 }
12185
12186 interface Provider {
12187 spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
12188 }
12189
12190 interface ReadBookmark {
12191 title: string;
12192 url: string;
12193 }
12194
12195 interface RedirectRequest {
12196 url: string;
12197 method?: string;
12198 session?: (Session) | (null);
12199 uploadData?: ProtocolResponseUploadData;
12200 }
12201
12202 interface RelaunchOptions {
12203 args?: string[];
12204 execPath?: string;
12205 }
12206
12207 interface Request {
12208 url: string;
12209 headers: Record<string, string>;
12210 referrer: string;
12211 method: string;
12212 uploadData: UploadData[];
12213 }
12214
12215 interface ResizeOptions {
12216 /**
12217 * Defaults to the image's width.
12218 */
12219 width?: number;
12220 /**
12221 * Defaults to the image's height.
12222 */
12223 height?: number;
12224 /**
12225 * The desired quality of the resize image. Possible values are `good`, `better` or
12226 * `best`. The default is `best`. These values express a desired quality/speed
12227 * tradeoff. They are translated into an algorithm-specific method that depends on
12228 * the capabilities (CPU, GPU) of the underlying platform. It is possible for all
12229 * three methods to be mapped to the same algorithm on a given platform.
12230 */
12231 quality?: string;
12232 }
12233
12234 interface ResourceUsage {
12235 images: MemoryUsageDetails;
12236 scripts: MemoryUsageDetails;
12237 cssStyleSheets: MemoryUsageDetails;
12238 xslStyleSheets: MemoryUsageDetails;
12239 fonts: MemoryUsageDetails;
12240 other: MemoryUsageDetails;
12241 }
12242
12243 interface Response {
12244 cancel?: boolean;
12245 /**
12246 * The original request is prevented from being sent or completed and is instead
12247 * redirected to the given URL.
12248 */
12249 redirectURL?: string;
12250 }
12251
12252 interface Result {
12253 requestId: number;
12254 /**
12255 * Position of the active match.
12256 */
12257 activeMatchOrdinal: number;
12258 /**
12259 * Number of Matches.
12260 */
12261 matches: number;
12262 /**
12263 * Coordinates of first match region.
12264 */
12265 selectionArea: Rectangle;
12266 finalUpdate: boolean;
12267 }
12268
12269 interface SaveDialogOptions {
12270 title?: string;
12271 /**
12272 * Absolute directory path, absolute file path, or file name to use by default.
12273 */
12274 defaultPath?: string;
12275 /**
12276 * Custom label for the confirmation button, when left empty the default label will
12277 * be used.
12278 */
12279 buttonLabel?: string;
12280 filters?: FileFilter[];
12281 /**
12282 * Message to display above text fields.
12283 *
12284 * @platform darwin
12285 */
12286 message?: string;
12287 /**
12288 * Custom label for the text displayed in front of the filename text field.
12289 *
12290 * @platform darwin
12291 */
12292 nameFieldLabel?: string;
12293 /**
12294 * Show the tags input box, defaults to `true`.
12295 *
12296 * @platform darwin
12297 */
12298 showsTagField?: boolean;
12299 /**
12300 * Create a security scoped bookmark when packaged for the Mac App Store. If this
12301 * option is enabled and the file doesn't already exist a blank file will be
12302 * created at the chosen path.
12303 *
12304 * @platform darwin,mas
12305 */
12306 securityScopedBookmarks?: boolean;
12307 }
12308
12309 interface SaveDialogReturnValue {
12310 /**
12311 * whether or not the dialog was canceled.
12312 */
12313 canceled: boolean;
12314 /**
12315 * If the dialog is canceled, this will be `undefined`.
12316 */
12317 filePath?: string;
12318 /**
12319 * Base64 encoded string which contains the security scoped bookmark data for the
12320 * saved file. `securityScopedBookmarks` must be enabled for this to be present.
12321 *
12322 * @platform darwin,mas
12323 */
12324 bookmark?: string;
12325 }
12326
12327 interface SaveDialogSyncOptions {
12328 title?: string;
12329 /**
12330 * Absolute directory path, absolute file path, or file name to use by default.
12331 */
12332 defaultPath?: string;
12333 /**
12334 * Custom label for the confirmation button, when left empty the default label will
12335 * be used.
12336 */
12337 buttonLabel?: string;
12338 filters?: FileFilter[];
12339 /**
12340 * Message to display above text fields.
12341 *
12342 * @platform darwin
12343 */
12344 message?: string;
12345 /**
12346 * Custom label for the text displayed in front of the filename text field.
12347 *
12348 * @platform darwin
12349 */
12350 nameFieldLabel?: string;
12351 /**
12352 * Show the tags input box, defaults to `true`.
12353 *
12354 * @platform darwin
12355 */
12356 showsTagField?: boolean;
12357 /**
12358 * Create a security scoped bookmark when packaged for the Mac App Store. If this
12359 * option is enabled and the file doesn't already exist a blank file will be
12360 * created at the chosen path.
12361 *
12362 * @platform darwin,mas
12363 */
12364 securityScopedBookmarks?: boolean;
12365 }
12366
12367 interface Settings {
12368 /**
12369 * `true` to open the app at login, `false` to remove the app as a login item.
12370 * Defaults to `false`.
12371 */
12372 openAtLogin?: boolean;
12373 /**
12374 * `true` to open the app as hidden. Defaults to `false`. The user can edit this
12375 * setting from the System Preferences so
12376 * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
12377 * opened to know the current value. This setting is not available on MAS builds.
12378 *
12379 * @platform darwin
12380 */
12381 openAsHidden?: boolean;
12382 /**
12383 * The executable to launch at login. Defaults to `process.execPath`.
12384 *
12385 * @platform win32
12386 */
12387 path?: string;
12388 /**
12389 * The command-line arguments to pass to the executable. Defaults to an empty
12390 * array. Take care to wrap paths in quotes.
12391 *
12392 * @platform win32
12393 */
12394 args?: string[];
12395 }
12396
12397 interface SourcesOptions {
12398 /**
12399 * An array of Strings that lists the types of desktop sources to be captured,
12400 * available types are `screen` and `window`.
12401 */
12402 types: string[];
12403 /**
12404 * The size that the media source thumbnail should be scaled to. Default is `150` x
12405 * `150`. Set width or height to 0 when you do not need the thumbnails. This will
12406 * save the processing time required for capturing the content of each window and
12407 * screen.
12408 */
12409 thumbnailSize?: Size;
12410 /**
12411 * Set to true to enable fetching window icons. The default value is false. When
12412 * false the appIcon property of the sources return null. Same if a source has the
12413 * type screen.
12414 */
12415 fetchWindowIcons?: boolean;
12416 }
12417
12418 interface StartLoggingOptions {
12419 /**
12420 * What kinds of data should be captured. By default, only metadata about requests
12421 * will be captured. Setting this to `includeSensitive` will include cookies and
12422 * authentication data. Setting it to `everything` will include all bytes
12423 * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
12424 */
12425 captureMode?: ('default' | 'includeSensitive' | 'everything');
12426 /**
12427 * When the log grows beyond this size, logging will automatically stop. Defaults
12428 * to unlimited.
12429 */
12430 maxFileSize?: number;
12431 }
12432
12433 interface SystemMemoryInfo {
12434 /**
12435 * The total amount of physical memory in Kilobytes available to the system.
12436 */
12437 total: number;
12438 /**
12439 * The total amount of memory not being used by applications or disk cache.
12440 */
12441 free: number;
12442 /**
12443 * The total amount of swap memory in Kilobytes available to the system.
12444 *
12445 * @platform win32,linux
12446 */
12447 swapTotal: number;
12448 /**
12449 * The free amount of swap memory in Kilobytes available to the system.
12450 *
12451 * @platform win32,linux
12452 */
12453 swapFree: number;
12454 }
12455
12456 interface ToBitmapOptions {
12457 /**
12458 * Defaults to 1.0.
12459 */
12460 scaleFactor?: number;
12461 }
12462
12463 interface ToDataURLOptions {
12464 /**
12465 * Defaults to 1.0.
12466 */
12467 scaleFactor?: number;
12468 }
12469
12470 interface ToPNGOptions {
12471 /**
12472 * Defaults to 1.0.
12473 */
12474 scaleFactor?: number;
12475 }
12476
12477 interface TouchBarButtonConstructorOptions {
12478 /**
12479 * Button text.
12480 */
12481 label?: string;
12482 /**
12483 * Button background color in hex format, i.e `#ABCDEF`.
12484 */
12485 backgroundColor?: string;
12486 /**
12487 * Button icon.
12488 */
12489 icon?: (NativeImage) | (string);
12490 /**
12491 * Can be `left`, `right` or `overlay`.
12492 */
12493 iconPosition?: ('left' | 'right' | 'overlay');
12494 /**
12495 * Function to call when the button is clicked.
12496 */
12497 click?: () => void;
12498 }
12499
12500 interface TouchBarColorPickerConstructorOptions {
12501 /**
12502 * Array of hex color strings to appear as possible colors to select.
12503 */
12504 availableColors?: string[];
12505 /**
12506 * The selected hex color in the picker, i.e `#ABCDEF`.
12507 */
12508 selectedColor?: string;
12509 /**
12510 * Function to call when a color is selected.
12511 */
12512 change?: (color: string) => void;
12513 }
12514
12515 interface TouchBarConstructorOptions {
12516 items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
12517 escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
12518 }
12519
12520 interface TouchBarGroupConstructorOptions {
12521 /**
12522 * Items to display as a group.
12523 */
12524 items: TouchBar;
12525 }
12526
12527 interface TouchBarLabelConstructorOptions {
12528 /**
12529 * Text to display.
12530 */
12531 label?: string;
12532 /**
12533 * Hex color of text, i.e `#ABCDEF`.
12534 */
12535 textColor?: string;
12536 }
12537
12538 interface TouchBarPopoverConstructorOptions {
12539 /**
12540 * Popover button text.
12541 */
12542 label?: string;
12543 /**
12544 * Popover button icon.
12545 */
12546 icon?: NativeImage;
12547 /**
12548 * Items to display in the popover.
12549 */
12550 items?: TouchBar;
12551 /**
12552 * `true` to display a close button on the left of the popover, `false` to not show
12553 * it. Default is `true`.
12554 */
12555 showCloseButton?: boolean;
12556 }
12557
12558 interface TouchBarScrubberConstructorOptions {
12559 /**
12560 * An array of items to place in this scrubber.
12561 */
12562 items: ScrubberItem[];
12563 /**
12564 * Called when the user taps an item that was not the last tapped item.
12565 */
12566 select?: (selectedIndex: number) => void;
12567 /**
12568 * Called when the user taps any item.
12569 */
12570 highlight?: (highlightedIndex: number) => void;
12571 /**
12572 * Selected item style. Defaults to `null`.
12573 */
12574 selectedStyle?: string;
12575 /**
12576 * Selected overlay item style. Defaults to `null`.
12577 */
12578 overlayStyle?: string;
12579 /**
12580 * Defaults to `false`.
12581 */
12582 showArrowButtons?: boolean;
12583 /**
12584 * Defaults to `free`.
12585 */
12586 mode?: string;
12587 /**
12588 * Defaults to `true`.
12589 */
12590 continuous?: boolean;
12591 }
12592
12593 interface TouchBarSegmentedControlConstructorOptions {
12594 /**
12595 * Style of the segments:
12596 */
12597 segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
12598 /**
12599 * The selection mode of the control:
12600 */
12601 mode?: ('single' | 'multiple' | 'buttons');
12602 /**
12603 * An array of segments to place in this control.
12604 */
12605 segments: SegmentedControlSegment[];
12606 /**
12607 * The index of the currently selected segment, will update automatically with user
12608 * interaction. When the mode is multiple it will be the last selected item.
12609 */
12610 selectedIndex?: number;
12611 /**
12612 * Called when the user selects a new segment.
12613 */
12614 change?: (selectedIndex: number, isSelected: boolean) => void;
12615 }
12616
12617 interface TouchBarSliderConstructorOptions {
12618 /**
12619 * Label text.
12620 */
12621 label?: string;
12622 /**
12623 * Selected value.
12624 */
12625 value?: number;
12626 /**
12627 * Minimum value.
12628 */
12629 minValue?: number;
12630 /**
12631 * Maximum value.
12632 */
12633 maxValue?: number;
12634 /**
12635 * Function to call when the slider is changed.
12636 */
12637 change?: (newValue: number) => void;
12638 }
12639
12640 interface TouchBarSpacerConstructorOptions {
12641 /**
12642 * Size of spacer, possible values are:
12643 */
12644 size?: ('small' | 'large' | 'flexible');
12645 }
12646
12647 interface TraceBufferUsageReturnValue {
12648 value: number;
12649 percentage: number;
12650 }
12651
12652 interface UpdateTargetUrlEvent extends Event {
12653 url: string;
12654 }
12655
12656 interface UploadProgress {
12657 /**
12658 * Whether the request is currently active. If this is false no other properties
12659 * will be set
12660 */
12661 active: boolean;
12662 /**
12663 * Whether the upload has started. If this is false both `current` and `total` will
12664 * be set to 0.
12665 */
12666 started: boolean;
12667 /**
12668 * The number of bytes that have been uploaded so far
12669 */
12670 current: number;
12671 /**
12672 * The number of bytes that will be uploaded this request
12673 */
12674 total: number;
12675 }
12676
12677 interface VisibleOnAllWorkspacesOptions {
12678 /**
12679 * Sets whether the window should be visible above fullscreen windows
12680 *
12681 * @platform darwin
12682 */
12683 visibleOnFullScreen?: boolean;
12684 }
12685
12686 interface WebContentsPrintOptions {
12687 /**
12688 * Don't ask user for print settings. Default is `false`.
12689 */
12690 silent?: boolean;
12691 /**
12692 * Prints the background color and image of the web page. Default is `false`.
12693 */
12694 printBackground?: boolean;
12695 /**
12696 * Set the printer device name to use. Default is `''`.
12697 */
12698 deviceName?: string;
12699 /**
12700 * Set whether the printed web page will be in color or grayscale. Default is
12701 * `true`.
12702 */
12703 color?: boolean;
12704 margins?: Margins;
12705 /**
12706 * Whether the web page should be printed in landscape mode. Default is `false`.
12707 */
12708 landscape?: boolean;
12709 /**
12710 * The scale factor of the web page.
12711 */
12712 scaleFactor?: number;
12713 /**
12714 * The number of pages to print per page sheet.
12715 */
12716 pagesPerSheet?: number;
12717 /**
12718 * Whether the web page should be collated.
12719 */
12720 collate?: boolean;
12721 /**
12722 * The number of copies of the web page to print.
12723 */
12724 copies?: number;
12725 /**
12726 * The page range to print. Should have two keys: `from` and `to`.
12727 */
12728 pageRanges?: Record<string, number>;
12729 /**
12730 * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
12731 * `longEdge`.
12732 */
12733 duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
12734 dpi?: Dpi;
12735 }
12736
12737 interface WebviewTagPrintOptions {
12738 /**
12739 * Don't ask user for print settings. Default is `false`.
12740 */
12741 silent?: boolean;
12742 /**
12743 * Also prints the background color and image of the web page. Default is `false`.
12744 */
12745 printBackground?: boolean;
12746 /**
12747 * Set the printer device name to use. Default is `''`.
12748 */
12749 deviceName?: string;
12750 }
12751
12752 interface WillNavigateEvent extends Event {
12753 url: string;
12754 }
12755
12756 interface Dpi {
12757 /**
12758 * The horizontal dpi.
12759 */
12760 horizontal?: number;
12761 /**
12762 * The vertical dpi.
12763 */
12764 vertical?: number;
12765 }
12766
12767 interface EditFlags {
12768 /**
12769 * Whether the renderer believes it can undo.
12770 */
12771 canUndo: boolean;
12772 /**
12773 * Whether the renderer believes it can redo.
12774 */
12775 canRedo: boolean;
12776 /**
12777 * Whether the renderer believes it can cut.
12778 */
12779 canCut: boolean;
12780 /**
12781 * Whether the renderer believes it can copy
12782 */
12783 canCopy: boolean;
12784 /**
12785 * Whether the renderer believes it can paste.
12786 */
12787 canPaste: boolean;
12788 /**
12789 * Whether the renderer believes it can delete.
12790 */
12791 canDelete: boolean;
12792 /**
12793 * Whether the renderer believes it can select all.
12794 */
12795 canSelectAll: boolean;
12796 }
12797
12798 interface FoundInPageResult {
12799 requestId: number;
12800 /**
12801 * Position of the active match.
12802 */
12803 activeMatchOrdinal: number;
12804 /**
12805 * Number of Matches.
12806 */
12807 matches: number;
12808 /**
12809 * Coordinates of first match region.
12810 */
12811 selectionArea: Rectangle;
12812 finalUpdate: boolean;
12813 }
12814
12815 interface Margins {
12816 /**
12817 * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
12818 * you will also need to specify `top`, `bottom`, `left`, and `right`.
12819 */
12820 marginType?: ('default' | 'none' | 'printableArea' | 'custom');
12821 /**
12822 * The top margin of the printed web page, in pixels.
12823 */
12824 top?: number;
12825 /**
12826 * The bottom margin of the printed web page, in pixels.
12827 */
12828 bottom?: number;
12829 /**
12830 * The left margin of the printed web page, in pixels.
12831 */
12832 left?: number;
12833 /**
12834 * The right margin of the printed web page, in pixels.
12835 */
12836 right?: number;
12837 }
12838
12839 interface MediaFlags {
12840 /**
12841 * Whether the media element has crashed.
12842 */
12843 inError: boolean;
12844 /**
12845 * Whether the media element is paused.
12846 */
12847 isPaused: boolean;
12848 /**
12849 * Whether the media element is muted.
12850 */
12851 isMuted: boolean;
12852 /**
12853 * Whether the media element has audio.
12854 */
12855 hasAudio: boolean;
12856 /**
12857 * Whether the media element is looping.
12858 */
12859 isLooping: boolean;
12860 /**
12861 * Whether the media element's controls are visible.
12862 */
12863 isControlsVisible: boolean;
12864 /**
12865 * Whether the media element's controls are toggleable.
12866 */
12867 canToggleControls: boolean;
12868 /**
12869 * Whether the media element can be rotated.
12870 */
12871 canRotate: boolean;
12872 }
12873
12874 interface WebPreferences {
12875 /**
12876 * Whether to enable DevTools. If it is set to `false`, can not use
12877 * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
12878 */
12879 devTools?: boolean;
12880 /**
12881 * Whether node integration is enabled. Default is `false`.
12882 */
12883 nodeIntegration?: boolean;
12884 /**
12885 * Whether node integration is enabled in web workers. Default is `false`. More
12886 * about this can be found in Multithreading.
12887 */
12888 nodeIntegrationInWorker?: boolean;
12889 /**
12890 * Experimental option for enabling Node.js support in sub-frames such as iframes
12891 * and child windows. All your preloads will load for every iframe, you can use
12892 * `process.isMainFrame` to determine if you are in the main frame or not.
12893 */
12894 nodeIntegrationInSubFrames?: boolean;
12895 /**
12896 * Specifies a script that will be loaded before other scripts run in the page.
12897 * This script will always have access to node APIs no matter whether node
12898 * integration is turned on or off. The value should be the absolute file path to
12899 * the script. When node integration is turned off, the preload script can
12900 * reintroduce Node global symbols back to the global scope. See example here.
12901 */
12902 preload?: string;
12903 /**
12904 * If set, this will sandbox the renderer associated with the window, making it
12905 * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
12906 * This is not the same as the `nodeIntegration` option and the APIs available to
12907 * the preload script are more limited. Read more about the option here. **Note:**
12908 * This option is currently experimental and may change or be removed in future
12909 * Electron releases.
12910 */
12911 sandbox?: boolean;
12912 /**
12913 * Whether to enable the `remote` module. Default is `true`.
12914 */
12915 enableRemoteModule?: boolean;
12916 /**
12917 * Sets the session used by the page. Instead of passing the Session object
12918 * directly, you can also choose to use the `partition` option instead, which
12919 * accepts a partition string. When both `session` and `partition` are provided,
12920 * `session` will be preferred. Default is the default session.
12921 */
12922 session?: Session;
12923 /**
12924 * Sets the session used by the page according to the session's partition string.
12925 * If `partition` starts with `persist:`, the page will use a persistent session
12926 * available to all pages in the app with the same `partition`. If there is no
12927 * `persist:` prefix, the page will use an in-memory session. By assigning the same
12928 * `partition`, multiple pages can share the same session. Default is the default
12929 * session.
12930 */
12931 partition?: string;
12932 /**
12933 * When specified, web pages with the same `affinity` will run in the same renderer
12934 * process. Note that due to reusing the renderer process, certain `webPreferences`
12935 * options will also be shared between the web pages even when you specified
12936 * different values for them, including but not limited to `preload`, `sandbox` and
12937 * `nodeIntegration`. So it is suggested to use exact same `webPreferences` for web
12938 * pages with the same `affinity`. _This property is experimental_
12939 */
12940 affinity?: string;
12941 /**
12942 * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
12943 */
12944 zoomFactor?: number;
12945 /**
12946 * Enables JavaScript support. Default is `true`.
12947 */
12948 javascript?: boolean;
12949 /**
12950 * When `false`, it will disable the same-origin policy (usually using testing
12951 * websites by people), and set `allowRunningInsecureContent` to `true` if this
12952 * options has not been set by user. Default is `true`.
12953 */
12954 webSecurity?: boolean;
12955 /**
12956 * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
12957 * `false`.
12958 */
12959 allowRunningInsecureContent?: boolean;
12960 /**
12961 * Enables image support. Default is `true`.
12962 */
12963 images?: boolean;
12964 /**
12965 * Make TextArea elements resizable. Default is `true`.
12966 */
12967 textAreasAreResizable?: boolean;
12968 /**
12969 * Enables WebGL support. Default is `true`.
12970 */
12971 webgl?: boolean;
12972 /**
12973 * Whether plugins should be enabled. Default is `false`.
12974 */
12975 plugins?: boolean;
12976 /**
12977 * Enables Chromium's experimental features. Default is `false`.
12978 */
12979 experimentalFeatures?: boolean;
12980 /**
12981 * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
12982 */
12983 scrollBounce?: boolean;
12984 /**
12985 * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
12986 * to enable. The full list of supported feature strings can be found in the
12987 * RuntimeEnabledFeatures.json5 file.
12988 */
12989 enableBlinkFeatures?: string;
12990 /**
12991 * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
12992 * to disable. The full list of supported feature strings can be found in the
12993 * RuntimeEnabledFeatures.json5 file.
12994 */
12995 disableBlinkFeatures?: string;
12996 /**
12997 * Sets the default font for the font-family.
12998 */
12999 defaultFontFamily?: DefaultFontFamily;
13000 /**
13001 * Defaults to `16`.
13002 */
13003 defaultFontSize?: number;
13004 /**
13005 * Defaults to `13`.
13006 */
13007 defaultMonospaceFontSize?: number;
13008 /**
13009 * Defaults to `0`.
13010 */
13011 minimumFontSize?: number;
13012 /**
13013 * Defaults to `ISO-8859-1`.
13014 */
13015 defaultEncoding?: string;
13016 /**
13017 * Whether to throttle animations and timers when the page becomes background. This
13018 * also affects the Page Visibility API. Defaults to `true`.
13019 */
13020 backgroundThrottling?: boolean;
13021 /**
13022 * Whether to enable offscreen rendering for the browser window. Defaults to
13023 * `false`. See the offscreen rendering tutorial for more details.
13024 */
13025 offscreen?: boolean;
13026 /**
13027 * Whether to run Electron APIs and the specified `preload` script in a separate
13028 * JavaScript context. Defaults to `false`. The context that the `preload` script
13029 * runs in will still have full access to the `document` and `window` globals but
13030 * it will use its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.)
13031 * and will be isolated from any changes made to the global environment by the
13032 * loaded page. The Electron API will only be available in the `preload` script and
13033 * not the loaded page. This option should be used when loading potentially
13034 * untrusted remote content to ensure the loaded content cannot tamper with the
13035 * `preload` script and any Electron APIs being used. This option uses the same
13036 * technique used by Chrome Content Scripts. You can access this context in the dev
13037 * tools by selecting the 'Electron Isolated Context' entry in the combo box at the
13038 * top of the Console tab.
13039 */
13040 contextIsolation?: boolean;
13041 /**
13042 * Whether to use native `window.open()`. Defaults to `false`. Child windows will
13043 * always have node integration disabled unless `nodeIntegrationInSubFrames` is
13044 * true. **Note:** This option is currently experimental.
13045 */
13046 nativeWindowOpen?: boolean;
13047 /**
13048 * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
13049 * `preload` script configured for the `<webview>` will have node integration
13050 * enabled when it is executed so you should ensure remote/untrusted content is not
13051 * able to create a `<webview>` tag with a possibly malicious `preload` script. You
13052 * can use the `will-attach-webview` event on webContents to strip away the
13053 * `preload` script and to validate or alter the `<webview>`'s initial settings.
13054 */
13055 webviewTag?: boolean;
13056 /**
13057 * A list of strings that will be appended to `process.argv` in the renderer
13058 * process of this app. Useful for passing small bits of data down to renderer
13059 * process preload scripts.
13060 */
13061 additionalArguments?: string[];
13062 /**
13063 * Whether to enable browser style consecutive dialog protection. Default is
13064 * `false`.
13065 */
13066 safeDialogs?: boolean;
13067 /**
13068 * The message to display when consecutive dialog protection is triggered. If not
13069 * defined the default message would be used, note that currently the default
13070 * message is in English and not localized.
13071 */
13072 safeDialogsMessage?: string;
13073 /**
13074 * Whether dragging and dropping a file or link onto the page causes a navigation.
13075 * Default is `false`.
13076 */
13077 navigateOnDragDrop?: boolean;
13078 /**
13079 * Autoplay policy to apply to content in the window, can be
13080 * `no-user-gesture-required`, `user-gesture-required`,
13081 * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
13082 */
13083 autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
13084 /**
13085 * Whether to prevent the window from resizing when entering HTML Fullscreen.
13086 * Default is `false`.
13087 */
13088 disableHtmlFullscreenWindowResize?: boolean;
13089 }
13090
13091 interface DefaultFontFamily {
13092 /**
13093 * Defaults to `Times New Roman`.
13094 */
13095 standard?: string;
13096 /**
13097 * Defaults to `Times New Roman`.
13098 */
13099 serif?: string;
13100 /**
13101 * Defaults to `Arial`.
13102 */
13103 sansSerif?: string;
13104 /**
13105 * Defaults to `Courier New`.
13106 */
13107 monospace?: string;
13108 /**
13109 * Defaults to `Script`.
13110 */
13111 cursive?: string;
13112 /**
13113 * Defaults to `Impact`.
13114 */
13115 fantasy?: string;
13116 }
13117
13118}
13119
13120declare module 'electron' {
13121 export = Electron;
13122}
13123
13124interface NodeRequireFunction {
13125 (moduleName: 'electron'): typeof Electron;
13126}
13127
13128interface File {
13129 /**
13130 * The real path to the file on the users filesystem
13131 */
13132 path: string;
13133}
13134
13135declare module 'original-fs' {
13136 import * as fs from 'fs';
13137 export = fs;
13138}
13139
13140interface Document {
13141 createElement(tagName: 'webview'): Electron.WebviewTag;
13142}
13143
13144declare namespace NodeJS {
13145 interface Process extends NodeJS.EventEmitter {
13146
13147 // Docs: http://electronjs.org/docs/api/process
13148
13149 /**
13150 * Emitted when Electron has loaded its internal initialization script and is
13151 * beginning to load the web page or the main script.
13152 *
13153 * It can be used by the preload script to add removed Node global symbols back to
13154 * the global scope when node integration is turned off:
13155 */
13156 on(event: 'loaded', listener: Function): this;
13157 once(event: 'loaded', listener: Function): this;
13158 addListener(event: 'loaded', listener: Function): this;
13159 removeListener(event: 'loaded', listener: Function): this;
13160 /**
13161 * Causes the main thread of the current process crash.
13162 */
13163 crash(): void;
13164 /**
13165 * * `allocated` Integer - Size of all allocated objects in Kilobytes.
13166 * * `marked` Integer - Size of all marked objects in Kilobytes.
13167 * * `total` Integer - Total allocated space in Kilobytes.
13168 *
13169 * Returns an object with Blink memory information. It can be useful for debugging
13170 * rendering / DOM related memory issues. Note that all values are reported in
13171 * Kilobytes.
13172 */
13173 getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
13174 getCPUUsage(): Electron.CPUUsage;
13175 /**
13176 * The number of milliseconds since epoch, or `null` if the information is
13177 * unavailable
13178 *
13179 * Indicates the creation time of the application. The time is represented as
13180 * number of milliseconds since epoch. It returns null if it is unable to get the
13181 * process creation time.
13182 */
13183 getCreationTime(): (number) | (null);
13184 /**
13185 * * `totalHeapSize` Integer
13186 * * `totalHeapSizeExecutable` Integer
13187 * * `totalPhysicalSize` Integer
13188 * * `totalAvailableSize` Integer
13189 * * `usedHeapSize` Integer
13190 * * `heapSizeLimit` Integer
13191 * * `mallocedMemory` Integer
13192 * * `peakMallocedMemory` Integer
13193 * * `doesZapGarbage` Boolean
13194 *
13195 * Returns an object with V8 heap statistics. Note that all statistics are reported
13196 * in Kilobytes.
13197 */
13198 getHeapStatistics(): Electron.HeapStatistics;
13199 getIOCounters(): Electron.IOCounters;
13200 /**
13201 * Resolves with a ProcessMemoryInfo
13202 *
13203 * Returns an object giving memory usage statistics about the current process. Note
13204 * that all statistics are reported in Kilobytes. This api should be called after
13205 * app ready.
13206 *
13207 * Chromium does not provide `residentSet` value for macOS. This is because macOS
13208 * performs in-memory compression of pages that haven't been recently used. As a
13209 * result the resident set size value is not what one would expect. `private`
13210 * memory is more representative of the actual pre-compression memory usage of the
13211 * process on macOS.
13212 */
13213 getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
13214 /**
13215 * * `total` Integer - The total amount of physical memory in Kilobytes available
13216 * to the system.
13217 * * `free` Integer - The total amount of memory not being used by applications or
13218 * disk cache.
13219 * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
13220 * Kilobytes available to the system.
13221 * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
13222 * Kilobytes available to the system.
13223 *
13224 * Returns an object giving memory usage statistics about the entire system. Note
13225 * that all statistics are reported in Kilobytes.
13226 */
13227 getSystemMemoryInfo(): Electron.SystemMemoryInfo;
13228 /**
13229 * The version of the host operating system.
13230 *
13231 * Example:
13232 *
13233 * **Note:** It returns the actual operating system version instead of kernel
13234 * version on macOS unlike `os.release()`.
13235 */
13236 getSystemVersion(): string;
13237 /**
13238 * Causes the main thread of the current process hang.
13239 */
13240 hang(): void;
13241 /**
13242 * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
13243 * whichever is lower for the current process.
13244 *
13245 * @platform darwin,linux
13246 */
13247 setFdLimit(maxDescriptors: number): void;
13248 /**
13249 * Indicates whether the snapshot has been created successfully.
13250 *
13251Takes a V8 heap snapshot and saves it to `filePath`.
13252 */
13253 takeHeapSnapshot(filePath: string): boolean;
13254 /**
13255 * A `String` representing Chrome's version string.
13256 *
13257 */
13258 readonly chrome: string;
13259 /**
13260 * A `Boolean`. When app is started by being passed as parameter to the default
13261 * app, this property is `true` in the main process, otherwise it is `undefined`.
13262 *
13263 */
13264 readonly defaultApp: boolean;
13265 /**
13266 * A `String` representing Electron's version string.
13267 *
13268 */
13269 readonly electron: string;
13270 /**
13271 * A `Boolean` that controls whether or not deprecation warnings are printed to
13272 * `stderr` when formerly callback-based APIs converted to Promises are invoked
13273 * using callbacks. Setting this to `true` will enable deprecation warnings.
13274 */
13275 enablePromiseAPIs: boolean;
13276 /**
13277 * A `Boolean`, `true` when the current renderer context is the "main" renderer
13278 * frame. If you want the ID of the current frame you should use
13279 * `webFrame.routingId`.
13280 *
13281 */
13282 readonly isMainFrame: boolean;
13283 /**
13284 * A `Boolean`. For Mac App Store build, this property is `true`, for other builds
13285 * it is `undefined`.
13286 *
13287 */
13288 readonly mas: boolean;
13289 /**
13290 * A `Boolean` that controls ASAR support inside your application. Setting this to
13291 * `true` will disable the support for `asar` archives in Node's built-in modules.
13292 */
13293 noAsar: boolean;
13294 /**
13295 * A `Boolean` that controls whether or not deprecation warnings are printed to
13296 * `stderr`. Setting this to `true` will silence deprecation warnings. This
13297 * property is used instead of the `--no-deprecation` command line flag.
13298 */
13299 noDeprecation: boolean;
13300 /**
13301 * A `String` representing the path to the resources directory.
13302 *
13303 */
13304 readonly resourcesPath: string;
13305 /**
13306 * A `Boolean`. When the renderer process is sandboxed, this property is `true`,
13307 * otherwise it is `undefined`.
13308 *
13309 */
13310 readonly sandboxed: boolean;
13311 /**
13312 * A `Boolean` that controls whether or not deprecation warnings will be thrown as
13313 * exceptions. Setting this to `true` will throw errors for deprecations. This
13314 * property is used instead of the `--throw-deprecation` command line flag.
13315 */
13316 throwDeprecation: boolean;
13317 /**
13318 * A `Boolean` that controls whether or not deprecations printed to `stderr`
13319 * include their stack trace. Setting this to `true` will print stack traces for
13320 * deprecations. This property is instead of the `--trace-deprecation` command line
13321 * flag.
13322 */
13323 traceDeprecation: boolean;
13324 /**
13325 * A `Boolean` that controls whether or not process warnings printed to `stderr`
13326 * include their stack trace. Setting this to `true` will print stack traces for
13327 * process warnings (including deprecations). This property is instead of the
13328 * `--trace-warnings` command line flag.
13329 */
13330 traceProcessWarnings: boolean;
13331 /**
13332 * A `String` representing the current process's type, can be `"browser"` (i.e.
13333 * main process), `"renderer"`, or `"worker"` (i.e. web worker).
13334 *
13335 */
13336 readonly type: string;
13337 /**
13338 * A `Boolean`. If the app is running as a Windows Store app (appx), this property
13339 * is `true`, for otherwise it is `undefined`.
13340 *
13341 */
13342 readonly windowsStore: boolean;
13343 }
13344 interface ProcessVersions {
13345 readonly electron: string;
13346 readonly chrome: string;
13347 }
13348}
\No newline at end of file