1 // Type definitions for Electron 22.0.0
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
6 /// <reference types="node" />
8 type GlobalEvent = Event & { returnValue: any };
10 declare namespace Electron {
11 const NodeEventEmitter: typeof import('events').EventEmitter;
13 class Accelerator extends String {
16 interface App extends NodeJS.EventEmitter {
18 // Docs: https://electronjs.org/docs/api/app
21 * Emitted when Chrome's accessibility support changes. This event fires when
22 * assistive technologies, such as screen readers, are enabled or disabled. See
23 * https://www.chromium.org/developers/design-documents/accessibility for more
26 * @platform darwin,win32
28 on(event: 'accessibility-support-changed', listener: (event: Event,
30 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
32 accessibilitySupportEnabled: boolean) => void): this;
33 once(event: 'accessibility-support-changed', listener: (event: Event,
35 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
37 accessibilitySupportEnabled: boolean) => void): this;
38 addListener(event: 'accessibility-support-changed', listener: (event: Event,
40 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
42 accessibilitySupportEnabled: boolean) => void): this;
43 removeListener(event: 'accessibility-support-changed', listener: (event: Event,
45 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
47 accessibilitySupportEnabled: boolean) => void): this;
49 * Emitted when the application is activated. Various actions can trigger this
50 * event, such as launching the application for the first time, attempting to
51 * re-launch the application when it's already running, or clicking on the
52 * application's dock or taskbar icon.
56 on(event: 'activate', listener: (event: Event,
57 hasVisibleWindows: boolean) => void): this;
58 once(event: 'activate', listener: (event: Event,
59 hasVisibleWindows: boolean) => void): this;
60 addListener(event: 'activate', listener: (event: Event,
61 hasVisibleWindows: boolean) => void): this;
62 removeListener(event: 'activate', listener: (event: Event,
63 hasVisibleWindows: boolean) => void): this;
65 * Emitted during Handoff after an activity from this device was successfully
66 * resumed on another one.
70 on(event: 'activity-was-continued', listener: (event: Event,
72 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
76 * Contains app-specific state stored by the activity.
78 userInfo: unknown) => void): this;
79 once(event: 'activity-was-continued', listener: (event: Event,
81 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
85 * Contains app-specific state stored by the activity.
87 userInfo: unknown) => void): this;
88 addListener(event: 'activity-was-continued', listener: (event: Event,
90 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
94 * Contains app-specific state stored by the activity.
96 userInfo: unknown) => void): this;
97 removeListener(event: 'activity-was-continued', listener: (event: Event,
99 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
103 * Contains app-specific state stored by the activity.
105 userInfo: unknown) => void): this;
107 * Emitted before the application starts closing its windows. Calling
108 * `event.preventDefault()` will prevent the default behavior, which is terminating
111 * **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
112 * then `before-quit` is emitted *after* emitting `close` event on all windows and
115 * **Note:** On Windows, this event will not be emitted if the app is closed due to
116 * a shutdown/restart of the system or a user logout.
118 on(event: 'before-quit', listener: (event: Event) => void): this;
119 once(event: 'before-quit', listener: (event: Event) => void): this;
120 addListener(event: 'before-quit', listener: (event: Event) => void): this;
121 removeListener(event: 'before-quit', listener: (event: Event) => void): this;
123 * Emitted when a browserWindow gets blurred.
125 on(event: 'browser-window-blur', listener: (event: Event,
126 window: BrowserWindow) => void): this;
127 once(event: 'browser-window-blur', listener: (event: Event,
128 window: BrowserWindow) => void): this;
129 addListener(event: 'browser-window-blur', listener: (event: Event,
130 window: BrowserWindow) => void): this;
131 removeListener(event: 'browser-window-blur', listener: (event: Event,
132 window: BrowserWindow) => void): this;
134 * Emitted when a new browserWindow is created.
136 on(event: 'browser-window-created', listener: (event: Event,
137 window: BrowserWindow) => void): this;
138 once(event: 'browser-window-created', listener: (event: Event,
139 window: BrowserWindow) => void): this;
140 addListener(event: 'browser-window-created', listener: (event: Event,
141 window: BrowserWindow) => void): this;
142 removeListener(event: 'browser-window-created', listener: (event: Event,
143 window: BrowserWindow) => void): this;
145 * Emitted when a browserWindow gets focused.
147 on(event: 'browser-window-focus', listener: (event: Event,
148 window: BrowserWindow) => void): this;
149 once(event: 'browser-window-focus', listener: (event: Event,
150 window: BrowserWindow) => void): this;
151 addListener(event: 'browser-window-focus', listener: (event: Event,
152 window: BrowserWindow) => void): this;
153 removeListener(event: 'browser-window-focus', listener: (event: Event,
154 window: BrowserWindow) => void): this;
156 * Emitted when failed to verify the `certificate` for `url`, to trust the
157 * certificate you should prevent the default behavior with
158 * `event.preventDefault()` and call `callback(true)`.
160 on(event: 'certificate-error', listener: (event: Event,
161 webContents: WebContents,
167 certificate: Certificate,
168 callback: (isTrusted: boolean) => void,
169 isMainFrame: boolean) => void): this;
170 once(event: 'certificate-error', listener: (event: Event,
171 webContents: WebContents,
177 certificate: Certificate,
178 callback: (isTrusted: boolean) => void,
179 isMainFrame: boolean) => void): this;
180 addListener(event: 'certificate-error', listener: (event: Event,
181 webContents: WebContents,
187 certificate: Certificate,
188 callback: (isTrusted: boolean) => void,
189 isMainFrame: boolean) => void): this;
190 removeListener(event: 'certificate-error', listener: (event: Event,
191 webContents: WebContents,
197 certificate: Certificate,
198 callback: (isTrusted: boolean) => void,
199 isMainFrame: boolean) => void): this;
201 * Emitted when the child process unexpectedly disappears. This is normally because
202 * it was crashed or killed. It does not include renderer processes.
204 on(event: 'child-process-gone', listener: (event: Event,
205 details: Details) => void): this;
206 once(event: 'child-process-gone', listener: (event: Event,
207 details: Details) => void): this;
208 addListener(event: 'child-process-gone', listener: (event: Event,
209 details: Details) => void): this;
210 removeListener(event: 'child-process-gone', listener: (event: Event,
211 details: Details) => void): this;
213 * Emitted during Handoff when an activity from a different device wants to be
214 * resumed. You should call `event.preventDefault()` if you want to handle this
217 * A user activity can be continued only in an app that has the same developer Team
218 * ID as the activity's source app and that supports the activity's type. Supported
219 * activity types are specified in the app's `Info.plist` under the
220 * `NSUserActivityTypes` key.
224 on(event: 'continue-activity', listener: (event: Event,
226 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
230 * Contains app-specific state stored by the activity on another device.
233 details: ContinueActivityDetails) => void): this;
234 once(event: 'continue-activity', listener: (event: Event,
236 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
240 * Contains app-specific state stored by the activity on another device.
243 details: ContinueActivityDetails) => void): this;
244 addListener(event: 'continue-activity', listener: (event: Event,
246 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
250 * Contains app-specific state stored by the activity on another device.
253 details: ContinueActivityDetails) => void): this;
254 removeListener(event: 'continue-activity', listener: (event: Event,
256 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
260 * Contains app-specific state stored by the activity on another device.
263 details: ContinueActivityDetails) => void): this;
265 * Emitted during Handoff when an activity from a different device fails to be
270 on(event: 'continue-activity-error', listener: (event: Event,
272 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
276 * A string with the error's localized description.
278 error: string) => void): this;
279 once(event: 'continue-activity-error', listener: (event: Event,
281 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
285 * A string with the error's localized description.
287 error: string) => void): this;
288 addListener(event: 'continue-activity-error', listener: (event: Event,
290 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
294 * A string with the error's localized description.
296 error: string) => void): this;
297 removeListener(event: 'continue-activity-error', listener: (event: Event,
299 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
303 * A string with the error's localized description.
305 error: string) => void): this;
307 * Emitted when mac application become active. Difference from `activate` event is
308 * that `did-become-active` is emitted every time the app becomes active, not only
309 * when Dock icon is clicked or application is re-launched.
313 on(event: 'did-become-active', listener: (event: Event) => void): this;
314 once(event: 'did-become-active', listener: (event: Event) => void): this;
315 addListener(event: 'did-become-active', listener: (event: Event) => void): this;
316 removeListener(event: 'did-become-active', listener: (event: Event) => void): this;
318 * Emitted whenever there is a GPU info update.
320 on(event: 'gpu-info-update', listener: Function): this;
321 once(event: 'gpu-info-update', listener: Function): this;
322 addListener(event: 'gpu-info-update', listener: Function): this;
323 removeListener(event: 'gpu-info-update', listener: Function): this;
325 * Emitted when the GPU process crashes or is killed.
327 * **Deprecated:** This event is superceded by the `child-process-gone` event which
328 * contains more information about why the child process disappeared. It isn't
329 * always because it crashed. The `killed` boolean can be replaced by checking
330 * `reason === 'killed'` when you switch to that event.
334 on(event: 'gpu-process-crashed', listener: (event: Event,
335 killed: boolean) => void): this;
336 once(event: 'gpu-process-crashed', listener: (event: Event,
337 killed: boolean) => void): this;
338 addListener(event: 'gpu-process-crashed', listener: (event: Event,
339 killed: boolean) => void): this;
340 removeListener(event: 'gpu-process-crashed', listener: (event: Event,
341 killed: boolean) => void): this;
343 * Emitted when `webContents` wants to do basic auth.
345 * The default behavior is to cancel all authentications. To override this you
346 * should prevent the default behavior with `event.preventDefault()` and call
347 * `callback(username, password)` with the credentials.
349 * If `callback` is called without a username or password, the authentication
350 * request will be cancelled and the authentication error will be returned to the
353 on(event: 'login', listener: (event: Event,
354 webContents: WebContents,
355 authenticationResponseDetails: AuthenticationResponseDetails,
357 callback: (username?: string, password?: string) => void) => void): this;
358 once(event: 'login', listener: (event: Event,
359 webContents: WebContents,
360 authenticationResponseDetails: AuthenticationResponseDetails,
362 callback: (username?: string, password?: string) => void) => void): this;
363 addListener(event: 'login', listener: (event: Event,
364 webContents: WebContents,
365 authenticationResponseDetails: AuthenticationResponseDetails,
367 callback: (username?: string, password?: string) => void) => void): this;
368 removeListener(event: 'login', listener: (event: Event,
369 webContents: WebContents,
370 authenticationResponseDetails: AuthenticationResponseDetails,
372 callback: (username?: string, password?: string) => void) => void): this;
374 * Emitted when the user clicks the native macOS new tab button. The new tab button
375 * is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
379 on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
380 once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
381 addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
382 removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
384 * Emitted when the user wants to open a file with the application. The `open-file`
385 * event is usually emitted when the application is already open and the OS wants
386 * to reuse the application to open the file. `open-file` is also emitted when a
387 * file is dropped onto the dock and the application is not yet running. Make sure
388 * to listen for the `open-file` event very early in your application startup to
389 * handle this case (even before the `ready` event is emitted).
391 * You should call `event.preventDefault()` if you want to handle this event.
393 * On Windows, you have to parse `process.argv` (in the main process) to get the
398 on(event: 'open-file', listener: (event: Event,
399 path: string) => void): this;
400 once(event: 'open-file', listener: (event: Event,
401 path: string) => void): this;
402 addListener(event: 'open-file', listener: (event: Event,
403 path: string) => void): this;
404 removeListener(event: 'open-file', listener: (event: Event,
405 path: string) => void): this;
407 * Emitted when the user wants to open a URL with the application. Your
408 * application's `Info.plist` file must define the URL scheme within the
409 * `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
411 * You should call `event.preventDefault()` if you want to handle this event.
413 * As with the `open-file` event, be sure to register a listener for the `open-url`
414 * event early in your application startup to detect if the the application being
415 * is being opened to handle a URL. If you register the listener in response to a
416 * `ready` event, you'll miss URLs that trigger the launch of your application.
420 on(event: 'open-url', listener: (event: Event,
421 url: string) => void): this;
422 once(event: 'open-url', listener: (event: Event,
423 url: string) => void): this;
424 addListener(event: 'open-url', listener: (event: Event,
425 url: string) => void): this;
426 removeListener(event: 'open-url', listener: (event: Event,
427 url: string) => void): this;
429 * Emitted when the application is quitting.
431 * **Note:** On Windows, this event will not be emitted if the app is closed due to
432 * a shutdown/restart of the system or a user logout.
434 on(event: 'quit', listener: (event: Event,
435 exitCode: number) => void): this;
436 once(event: 'quit', listener: (event: Event,
437 exitCode: number) => void): this;
438 addListener(event: 'quit', listener: (event: Event,
439 exitCode: number) => void): this;
440 removeListener(event: 'quit', listener: (event: Event,
441 exitCode: number) => void): this;
443 * Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
444 * holds the `userInfo` of the `NSUserNotification` or information from
445 * `UNNotificationResponse` that was used to open the application, if it was
446 * launched from Notification Center. You can also call `app.isReady()` to check if
447 * this event has already fired and `app.whenReady()` to get a Promise that is
448 * fulfilled when Electron is initialized.
450 on(event: 'ready', listener: (event: Event,
451 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
452 once(event: 'ready', listener: (event: Event,
453 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
454 addListener(event: 'ready', listener: (event: Event,
455 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
456 removeListener(event: 'ready', listener: (event: Event,
457 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
459 * Emitted when the renderer process unexpectedly disappears. This is normally
460 * because it was crashed or killed.
462 on(event: 'render-process-gone', listener: (event: Event,
463 webContents: WebContents,
464 details: RenderProcessGoneDetails) => void): this;
465 once(event: 'render-process-gone', listener: (event: Event,
466 webContents: WebContents,
467 details: RenderProcessGoneDetails) => void): this;
468 addListener(event: 'render-process-gone', listener: (event: Event,
469 webContents: WebContents,
470 details: RenderProcessGoneDetails) => void): this;
471 removeListener(event: 'render-process-gone', listener: (event: Event,
472 webContents: WebContents,
473 details: RenderProcessGoneDetails) => void): this;
475 * Emitted when the renderer process of `webContents` crashes or is killed.
477 * **Deprecated:** This event is superceded by the `render-process-gone` event
478 * which contains more information about why the render process disappeared. It
479 * isn't always because it crashed. The `killed` boolean can be replaced by
480 * checking `reason === 'killed'` when you switch to that event.
484 on(event: 'renderer-process-crashed', listener: (event: Event,
485 webContents: WebContents,
486 killed: boolean) => void): this;
487 once(event: 'renderer-process-crashed', listener: (event: Event,
488 webContents: WebContents,
489 killed: boolean) => void): this;
490 addListener(event: 'renderer-process-crashed', listener: (event: Event,
491 webContents: WebContents,
492 killed: boolean) => void): this;
493 removeListener(event: 'renderer-process-crashed', listener: (event: Event,
494 webContents: WebContents,
495 killed: boolean) => void): this;
497 * This event will be emitted inside the primary instance of your application when
498 * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
500 * `argv` is an Array of the second instance's command line arguments, and
501 * `workingDirectory` is its current working directory. Usually applications
502 * respond to this by making their primary window focused and non-minimized.
504 * **Note:** If the second instance is started by a different user than the first,
505 * the `argv` array will not include the arguments.
507 * This event is guaranteed to be emitted after the `ready` event of `app` gets
510 * **Note:** Extra command line arguments might be added by Chromium, such as
511 * `--original-process-start-time`.
513 on(event: 'second-instance', listener: (event: Event,
515 * An array of the second instance's command line arguments
519 * The second instance's working directory
521 workingDirectory: string,
523 * A JSON object of additional data passed from the second instance
525 additionalData: unknown) => void): this;
526 once(event: 'second-instance', listener: (event: Event,
528 * An array of the second instance's command line arguments
532 * The second instance's working directory
534 workingDirectory: string,
536 * A JSON object of additional data passed from the second instance
538 additionalData: unknown) => void): this;
539 addListener(event: 'second-instance', listener: (event: Event,
541 * An array of the second instance's command line arguments
545 * The second instance's working directory
547 workingDirectory: string,
549 * A JSON object of additional data passed from the second instance
551 additionalData: unknown) => void): this;
552 removeListener(event: 'second-instance', listener: (event: Event,
554 * An array of the second instance's command line arguments
558 * The second instance's working directory
560 workingDirectory: string,
562 * A JSON object of additional data passed from the second instance
564 additionalData: unknown) => void): this;
566 * Emitted when a client certificate is requested.
568 * The `url` corresponds to the navigation entry requesting the client certificate
569 * and `callback` can be called with an entry filtered from the list. Using
570 * `event.preventDefault()` prevents the application from using the first
571 * certificate from the store.
573 on(event: 'select-client-certificate', listener: (event: Event,
574 webContents: WebContents,
576 certificateList: Certificate[],
577 callback: (certificate?: Certificate) => void) => void): this;
578 once(event: 'select-client-certificate', listener: (event: Event,
579 webContents: WebContents,
581 certificateList: Certificate[],
582 callback: (certificate?: Certificate) => void) => void): this;
583 addListener(event: 'select-client-certificate', listener: (event: Event,
584 webContents: WebContents,
586 certificateList: Certificate[],
587 callback: (certificate?: Certificate) => void) => void): this;
588 removeListener(event: 'select-client-certificate', listener: (event: Event,
589 webContents: WebContents,
591 certificateList: Certificate[],
592 callback: (certificate?: Certificate) => void) => void): this;
594 * Emitted when Electron has created a new `session`.
596 on(event: 'session-created', listener: (session: Session) => void): this;
597 once(event: 'session-created', listener: (session: Session) => void): this;
598 addListener(event: 'session-created', listener: (session: Session) => void): this;
599 removeListener(event: 'session-created', listener: (session: Session) => void): this;
601 * Emitted when Handoff is about to be resumed on another device. If you need to
602 * update the state to be transferred, you should call `event.preventDefault()`
603 * immediately, construct a new `userInfo` dictionary and call
604 * `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
605 * fail and `continue-activity-error` will be called.
609 on(event: 'update-activity-state', listener: (event: Event,
611 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
615 * Contains app-specific state stored by the activity.
617 userInfo: unknown) => void): this;
618 once(event: 'update-activity-state', listener: (event: Event,
620 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
624 * Contains app-specific state stored by the activity.
626 userInfo: unknown) => void): this;
627 addListener(event: 'update-activity-state', listener: (event: Event,
629 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
633 * Contains app-specific state stored by the activity.
635 userInfo: unknown) => void): this;
636 removeListener(event: 'update-activity-state', listener: (event: Event,
638 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
642 * Contains app-specific state stored by the activity.
644 userInfo: unknown) => void): this;
646 * Emitted when a new webContents is created.
648 on(event: 'web-contents-created', listener: (event: Event,
649 webContents: WebContents) => void): this;
650 once(event: 'web-contents-created', listener: (event: Event,
651 webContents: WebContents) => void): this;
652 addListener(event: 'web-contents-created', listener: (event: Event,
653 webContents: WebContents) => void): this;
654 removeListener(event: 'web-contents-created', listener: (event: Event,
655 webContents: WebContents) => void): this;
657 * Emitted during Handoff before an activity from a different device wants to be
658 * resumed. You should call `event.preventDefault()` if you want to handle this
663 on(event: 'will-continue-activity', listener: (event: Event,
665 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
667 type: string) => void): this;
668 once(event: 'will-continue-activity', listener: (event: Event,
670 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
672 type: string) => void): this;
673 addListener(event: 'will-continue-activity', listener: (event: Event,
675 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
677 type: string) => void): this;
678 removeListener(event: 'will-continue-activity', listener: (event: Event,
680 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
682 type: string) => void): this;
684 * Emitted when the application has finished basic startup. On Windows and Linux,
685 * the `will-finish-launching` event is the same as the `ready` event; on macOS,
686 * this event represents the `applicationWillFinishLaunching` notification of
687 * `NSApplication`. You would usually set up listeners for the `open-file` and
688 * `open-url` events here, and start the crash reporter and auto updater.
690 * In most cases, you should do everything in the `ready` event handler.
692 on(event: 'will-finish-launching', listener: Function): this;
693 once(event: 'will-finish-launching', listener: Function): this;
694 addListener(event: 'will-finish-launching', listener: Function): this;
695 removeListener(event: 'will-finish-launching', listener: Function): this;
697 * Emitted when all windows have been closed and the application will quit. Calling
698 * `event.preventDefault()` will prevent the default behavior, which is terminating
701 * See the description of the `window-all-closed` event for the differences between
702 * the `will-quit` and `window-all-closed` events.
704 * **Note:** On Windows, this event will not be emitted if the app is closed due to
705 * a shutdown/restart of the system or a user logout.
707 on(event: 'will-quit', listener: (event: Event) => void): this;
708 once(event: 'will-quit', listener: (event: Event) => void): this;
709 addListener(event: 'will-quit', listener: (event: Event) => void): this;
710 removeListener(event: 'will-quit', listener: (event: Event) => void): this;
712 * Emitted when all windows have been closed.
714 * If you do not subscribe to this event and all windows are closed, the default
715 * behavior is to quit the app; however, if you subscribe, you control whether the
716 * app quits or not. If the user pressed `Cmd + Q`, or the developer called
717 * `app.quit()`, Electron will first try to close all the windows and then emit the
718 * `will-quit` event, and in this case the `window-all-closed` event would not be
721 on(event: 'window-all-closed', listener: Function): this;
722 once(event: 'window-all-closed', listener: Function): this;
723 addListener(event: 'window-all-closed', listener: Function): this;
724 removeListener(event: 'window-all-closed', listener: Function): this;
726 * Adds `path` to the recent documents list.
728 * This list is managed by the OS. On Windows, you can visit the list from the task
729 * bar, and on macOS, you can visit it from dock menu.
731 * @platform darwin,win32
733 addRecentDocument(path: string): void;
735 * Clears the recent documents list.
737 * @platform darwin,win32
739 clearRecentDocuments(): void;
741 * Configures host resolution (DNS and DNS-over-HTTPS). By default, the following
742 * resolvers will be used, in order:
744 * * DNS-over-HTTPS, if the DNS provider supports it, then
745 * * the built-in resolver (enabled on macOS only by default), then
746 * * the system's resolver (e.g. `getaddrinfo`).
748 * This can be configured to either restrict usage of non-encrypted DNS
749 * (`secureDnsMode: "secure"`), or disable DNS-over-HTTPS (`secureDnsMode: "off"`).
750 * It is also possible to enable or disable the built-in resolver.
752 * To disable insecure DNS, you can specify a `secureDnsMode` of `"secure"`. If you
753 * do so, you should make sure to provide a list of DNS-over-HTTPS servers to use,
754 * in case the user's DNS configuration does not include a provider that supports
757 * This API must be called after the `ready` event is emitted.
759 configureHostResolver(options: ConfigureHostResolverOptions): void;
761 * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
762 * basis if the GPU processes crashes too frequently. This function disables that
765 * This method can only be called before app is ready.
767 disableDomainBlockingFor3DAPIs(): void;
769 * Disables hardware acceleration for current app.
771 * This method can only be called before app is ready.
773 disableHardwareAcceleration(): void;
775 * Enables full sandbox mode on the app. This means that all renderers will be
776 * launched sandboxed, regardless of the value of the `sandbox` flag in
779 * This method can only be called before app is ready.
781 enableSandbox(): void;
783 * Exits immediately with `exitCode`. `exitCode` defaults to 0.
785 * All windows will be closed immediately without asking the user, and the
786 * `before-quit` and `will-quit` events will not be emitted.
788 exit(exitCode?: number): void;
790 * On Linux, focuses on the first visible window. On macOS, makes the application
791 * the active app. On Windows, focuses on the application's first window.
793 * You should seek to use the `steal` option as sparingly as possible.
795 focus(options?: FocusOptions): void;
797 * Resolve with an object containing the following:
799 * * `icon` NativeImage - the display icon of the app handling the protocol.
800 * * `path` string - installation path of the app handling the protocol.
801 * * `name` string - display name of the app handling the protocol.
803 * This method returns a promise that contains the application name, icon and path
804 * of the default handler for the protocol (aka URI scheme) of a URL.
806 * @platform darwin,win32
808 getApplicationInfoForProtocol(url: string): Promise<Electron.ApplicationInfoForProtocolReturnValue>;
810 * Name of the application handling the protocol, or an empty string if there is no
811 * handler. For instance, if Electron is the default handler of the URL, this could
812 * be `Electron` on Windows and Mac. However, don't rely on the precise format
813 * which is not guaranteed to remain unchanged. Expect a different format on Linux,
814 * possibly with a `.desktop` suffix.
816 * This method returns the application name of the default handler for the protocol
817 * (aka URI scheme) of a URL.
819 getApplicationNameForProtocol(url: string): string;
821 * Array of `ProcessMetric` objects that correspond to memory and CPU usage
822 * statistics of all the processes associated with the app.
824 getAppMetrics(): ProcessMetric[];
826 * The current application directory.
828 getAppPath(): string;
830 * The current value displayed in the counter badge.
832 * @platform linux,darwin
834 getBadgeCount(): number;
836 * The type of the currently running activity.
840 getCurrentActivityType(): string;
842 * fulfilled with the app's icon, which is a NativeImage.
844 * Fetches a path's associated icon.
846 * On _Windows_, there a 2 kinds of icons:
848 * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
849 * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
851 * On _Linux_ and _macOS_, icons depend on the application associated with file
854 getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
856 * The Graphics Feature Status from `chrome://gpu/`.
858 * **Note:** This information is only usable after the `gpu-info-update` event is
861 getGPUFeatureStatus(): GPUFeatureStatus;
863 * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
864 * containing all the GPU Information as in chromium's GPUInfo object. This
865 * includes the version and driver information that's shown on `chrome://gpu` page.
867 * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
868 * fewer attributes than when requested with `complete`. Here's an example of basic
871 * Using `basic` should be preferred if only basic information like `vendorId` or
872 * `deviceId` is needed.
874 getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
876 * * `minItems` Integer - The minimum number of items that will be shown in the
877 * Jump List (for a more detailed description of this value see the MSDN docs).
878 * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
879 * correspond to items that the user has explicitly removed from custom categories
880 * in the Jump List. These items must not be re-added to the Jump List in the
881 * **next** call to `app.setJumpList()`, Windows will not display any custom
882 * category that contains any of the removed items.
886 getJumpListSettings(): JumpListSettings;
888 * The current application locale, fetched using Chromium's `l10n_util` library.
889 * Possible return values are documented here.
891 * To set the locale, you'll want to use a command line switch at app startup,
892 * which may be found here.
894 * **Note:** When distributing your packaged app, you have to also ship the
897 * **Note:** This API must be called after the `ready` event is emitted.
899 * **Note:** To see example return values of this API compared to other locale and
900 * language APIs, see `app.getPreferredSystemLanguages()`.
904 * User operating system's locale two-letter ISO 3166 country code. The value is
905 * taken from native OS APIs.
907 * **Note:** When unable to detect locale country code, it returns empty string.
909 getLocaleCountryCode(): string;
911 * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
912 * you need to pass the same arguments here for `openAtLogin` to be set correctly.
915 * * `openAtLogin` boolean - `true` if the app is set to open at login.
916 * * `openAsHidden` boolean _macOS_ - `true` if the app is set to open as hidden at
917 * login. This setting is not available on MAS builds.
918 * * `wasOpenedAtLogin` boolean _macOS_ - `true` if the app was opened at login
919 * automatically. This setting is not available on MAS builds.
920 * * `wasOpenedAsHidden` boolean _macOS_ - `true` if the app was opened as a hidden
921 * login item. This indicates that the app should not open any windows at startup.
922 * This setting is not available on MAS builds.
923 * * `restoreState` boolean _macOS_ - `true` if the app was opened as a login item
924 * that should restore the state from the previous session. This indicates that the
925 * app should restore the windows that were open the last time the app was closed.
926 * This setting is not available on MAS builds.
927 * * `executableWillLaunchAtLogin` boolean _Windows_ - `true` if app is set to open
928 * at login and its run key is not deactivated. This differs from `openAtLogin` as
929 * it ignores the `args` option, this property will be true if the given executable
930 * would be launched at login with **any** arguments.
931 * * `launchItems` Object[] _Windows_
932 * * `name` string _Windows_ - name value of a registry entry.
933 * * `path` string _Windows_ - The executable to an app that corresponds to a
935 * * `args` string[] _Windows_ - the command-line arguments to pass to the
937 * * `scope` string _Windows_ - one of `user` or `machine`. Indicates whether the
938 * registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
939 * * `enabled` boolean _Windows_ - `true` if the app registry key is startup
940 * approved and therefore shows as `enabled` in Task Manager and Windows settings.
942 * @platform darwin,win32
944 getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
946 * The current application's name, which is the name in the application's
947 * `package.json` file.
949 * Usually the `name` field of `package.json` is a short lowercase name, according
950 * to the npm modules spec. You should usually also specify a `productName` field,
951 * which is your application's full capitalized name, and which will be preferred
952 * over `name` by Electron.
956 * A path to a special directory or file associated with `name`. On failure, an
959 * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
960 * called first, a default log directory will be created equivalent to calling
961 * `app.setAppLogsPath()` without a `path` parameter.
963 getPath(name: 'home' | 'appData' | 'userData' | 'sessionData' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'crashDumps'): string;
965 * The user's preferred system languages from most preferred to least preferred,
966 * including the country codes if applicable. A user can modify and add to this
967 * list on Windows or macOS through the Language and Region settings.
969 * The API uses `GlobalizationPreferences` (with a fallback to
970 * `GetSystemPreferredUILanguages`) on Windows, `\[NSLocale preferredLanguages\]`
971 * on macOS, and `g_get_language_names` on Linux.
973 * This API can be used for purposes such as deciding what language to present the
976 * Here are some examples of return values of the various language and locale APIs
977 * with different configurations:
979 * * For Windows, where the application locale is German, the regional format is
980 * Finnish (Finland), and the preferred system languages from most to least
981 * preferred are French (Canada), English (US), Simplified Chinese (China),
982 * Finnish, and Spanish (Latin America):
983 * * `app.getLocale()` returns `'de'`
984 * * `app.getSystemLocale()` returns `'fi-FI'`
985 * * `app.getPreferredSystemLanguages()` returns `['fr-CA', 'en-US',
986 * 'zh-Hans-CN', 'fi', 'es-419']`
987 * * On macOS, where the application locale is German, the region is Finland, and
988 * the preferred system languages from most to least preferred are French (Canada),
989 * English (US), Simplified Chinese, and Spanish (Latin America):
990 * * `app.getLocale()` returns `'de'`
991 * * `app.getSystemLocale()` returns `'fr-FI'`
992 * * `app.getPreferredSystemLanguages()` returns `['fr-CA', 'en-US',
993 * 'zh-Hans-FI', 'es-419']`
995 * Both the available languages and regions and the possible return values differ
996 * between the two operating systems.
998 * As can be seen with the example above, on Windows, it is possible that a
999 * preferred system language has no country code, and that one of the preferred
1000 * system languages corresponds with the language used for the regional format. On
1001 * macOS, the region serves more as a default country code: the user doesn't need
1002 * to have Finnish as a preferred language to use Finland as the region,and the
1003 * country code `FI` is used as the country code for preferred system languages
1004 * that do not have associated countries in the language name.
1006 getPreferredSystemLanguages(): Array<'app.getLocale()' | 'app.getSystemLocale()' | 'app.getPreferredSystemLanguages()' | 'app.getLocale()' | 'app.getSystemLocale()' | 'app.getPreferredSystemLanguages()'>;
1008 * The current system locale. On Windows and Linux, it is fetched using Chromium's
1009 * `i18n` library. On macOS, `[NSLocale currentLocale]` is used instead. To get the
1010 * user's current system language, which is not always the same as the locale, it
1011 * is better to use `app.getPreferredSystemLanguages()`.
1013 * Different operating systems also use the regional data differently:
1015 * * Windows 11 uses the regional format for numbers, dates, and times.
1016 * * macOS Monterey uses the region for formatting numbers, dates, times, and for
1017 * selecting the currency symbol to use.
1019 * Therefore, this API can be used for purposes such as choosing a format for
1020 * rendering dates and times in a calendar app, especially when the developer wants
1021 * the format to be consistent with the OS.
1023 * **Note:** This API must be called after the `ready` event is emitted.
1025 * **Note:** To see example return values of this API compared to other locale and
1026 * language APIs, see `app.getPreferredSystemLanguages()`.
1028 getSystemLocale(): string;
1030 * The version of the loaded application. If no version is found in the
1031 * application's `package.json` file, the version of the current bundle or
1032 * executable is returned.
1034 getVersion(): string;
1036 * This method returns whether or not this instance of your app is currently
1037 * holding the single instance lock. You can request the lock with
1038 * `app.requestSingleInstanceLock()` and release with
1039 * `app.releaseSingleInstanceLock()`
1041 hasSingleInstanceLock(): boolean;
1043 * Hides all application windows without minimizing them.
1049 * Imports the certificate in pkcs12 format into the platform certificate store.
1050 * `callback` is called with the `result` of import operation, a value of `0`
1051 * indicates success while any other value indicates failure according to Chromium
1056 importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
1058 * Invalidates the current Handoff user activity.
1062 invalidateCurrentActivity(): void;
1064 * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
1065 * will return `true` if the use of assistive technologies, such as screen readers,
1066 * has been detected. See
1067 * https://www.chromium.org/developers/design-documents/accessibility for more
1070 * @platform darwin,win32
1072 isAccessibilitySupportEnabled(): boolean;
1074 * Whether the current executable is the default handler for a protocol (aka URI
1077 * **Note:** On macOS, you can use this method to check if the app has been
1078 * registered as the default protocol handler for a protocol. You can also verify
1079 * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
1080 * macOS machine. Please refer to Apple's documentation for details.
1082 * The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
1085 isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1087 * whether or not the current OS version allows for native emoji pickers.
1089 isEmojiPanelSupported(): boolean;
1091 * `true` if the application—including all of its windows—is hidden (e.g. with
1092 * `Command-H`), `false` otherwise.
1096 isHidden(): boolean;
1098 * Whether the application is currently running from the systems Application
1099 * folder. Use in combination with `app.moveToApplicationsFolder()`
1103 isInApplicationsFolder(): boolean;
1105 * `true` if Electron has finished initializing, `false` otherwise. See also
1106 * `app.whenReady()`.
1110 * whether `Secure Keyboard Entry` is enabled.
1112 * By default this API will return `false`.
1116 isSecureKeyboardEntryEnabled(): boolean;
1118 * Whether the current desktop environment is Unity launcher.
1122 isUnityRunning(): boolean;
1124 * Whether the move was successful. Please note that if the move is successful,
1125 * your application will quit and relaunch.
1127 * No confirmation dialog will be presented by default. If you wish to allow the
1128 * user to confirm the operation, you may do so using the `dialog` API.
1130 * **NOTE:** This method throws errors if anything other than the user causes the
1131 * move to fail. For instance if the user cancels the authorization dialog, this
1132 * method returns false. If we fail to perform the copy, then this method will
1133 * throw an error. The message in the error should be informative and tell you
1134 * exactly what went wrong.
1136 * By default, if an app of the same name as the one being moved exists in the
1137 * Applications directory and is _not_ running, the existing app will be trashed
1138 * and the active app moved into its place. If it _is_ running, the preexisting
1139 * running app will assume focus and the previously active app will quit itself.
1140 * This behavior can be changed by providing the optional conflict handler, where
1141 * the boolean returned by the handler determines whether or not the move conflict
1142 * is resolved with default behavior. i.e. returning `false` will ensure no
1143 * further action is taken, returning `true` will result in the default behavior
1144 * and the method continuing.
1148 * Would mean that if an app already exists in the user directory, if the user
1149 * chooses to 'Continue Move' then the function would continue with its default
1150 * behavior and the existing app will be trashed and the active app moved into its
1155 moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
1157 * Try to close all windows. The `before-quit` event will be emitted first. If all
1158 * windows are successfully closed, the `will-quit` event will be emitted and by
1159 * default the application will terminate.
1161 * This method guarantees that all `beforeunload` and `unload` event handlers are
1162 * correctly executed. It is possible that a window cancels the quitting by
1163 * returning `false` in the `beforeunload` event handler.
1167 * Relaunches the app when current instance exits.
1169 * By default, the new instance will use the same working directory and command
1170 * line arguments with current instance. When `args` is specified, the `args` will
1171 * be passed as command line arguments instead. When `execPath` is specified, the
1172 * `execPath` will be executed for relaunch instead of current app.
1174 * Note that this method does not quit the app when executed, you have to call
1175 * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
1177 * When `app.relaunch` is called for multiple times, multiple instances will be
1178 * started after current instance exited.
1180 * An example of restarting current instance immediately and adding a new command
1181 * line argument to the new instance:
1183 relaunch(options?: RelaunchOptions): void;
1185 * Releases all locks that were created by `requestSingleInstanceLock`. This will
1186 * allow multiple instances of the application to once again run side by side.
1188 releaseSingleInstanceLock(): void;
1190 * Whether the call succeeded.
1192 * This method checks if the current executable as the default handler for a
1193 * protocol (aka URI scheme). If so, it will remove the app as the default handler.
1195 * @platform darwin,win32
1197 removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1199 * The return value of this method indicates whether or not this instance of your
1200 * application successfully obtained the lock. If it failed to obtain the lock,
1201 * you can assume that another instance of your application is already running with
1202 * the lock and exit immediately.
1204 * I.e. This method returns `true` if your process is the primary instance of your
1205 * application and your app should continue loading. It returns `false` if your
1206 * process should immediately quit as it has sent its parameters to another
1207 * instance that has already acquired the lock.
1209 * On macOS, the system enforces single instance automatically when users try to
1210 * open a second instance of your app in Finder, and the `open-file` and `open-url`
1211 * events will be emitted for that. However when users start your app in command
1212 * line, the system's single instance mechanism will be bypassed, and you have to
1213 * use this method to ensure single instance.
1215 * An example of activating the window of primary instance when a second instance
1218 requestSingleInstanceLock(additionalData?: Record<any, any>): boolean;
1220 * Marks the current Handoff user activity as inactive without invalidating it.
1224 resignCurrentActivity(): void;
1226 * Set the about panel options. This will override the values defined in the app's
1227 * `.plist` file on macOS. See the Apple docs for more details. On Linux, values
1228 * must be set in order to be shown; there are no defaults.
1230 * If you do not set `credits` but still wish to surface them in your app, AppKit
1231 * will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in
1232 * that order, in the bundle returned by the NSBundle class method main. The first
1233 * file found is used, and if none is found, the info area is left blank. See Apple
1234 * documentation for more information.
1236 setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
1238 * Manually enables Chrome's accessibility support, allowing to expose
1239 * accessibility switch to users in application settings. See Chromium's
1240 * accessibility docs for more details. Disabled by default.
1242 * This API must be called after the `ready` event is emitted.
1244 * **Note:** Rendering accessibility tree can significantly affect the performance
1245 * of your app. It should not be enabled by default.
1247 * @platform darwin,win32
1249 setAccessibilitySupportEnabled(enabled: boolean): void;
1251 * Sets the activation policy for a given app.
1253 * Activation policy types:
1255 * * 'regular' - The application is an ordinary app that appears in the Dock and
1256 * may have a user interface.
1257 * * 'accessory' - The application doesn’t appear in the Dock and doesn’t have a
1258 * menu bar, but it may be activated programmatically or by clicking on one of its
1260 * * 'prohibited' - The application doesn’t appear in the Dock and may not create
1261 * windows or be activated.
1265 setActivationPolicy(policy: 'regular' | 'accessory' | 'prohibited'): void;
1267 * Sets or creates a directory your app's logs which can then be manipulated with
1268 * `app.getPath()` or `app.setPath(pathName, newPath)`.
1270 * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
1271 * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
1272 * `userData` directory on _Linux_ and _Windows_.
1274 setAppLogsPath(path?: string): void;
1276 * Changes the Application User Model ID to `id`.
1280 setAppUserModelId(id: string): void;
1282 * Whether the call succeeded.
1284 * Sets the current executable as the default handler for a protocol (aka URI
1285 * scheme). It allows you to integrate your app deeper into the operating system.
1286 * Once registered, all links with `your-protocol://` will be opened with the
1287 * current executable. The whole link, including protocol, will be passed to your
1288 * application as a parameter.
1290 * **Note:** On macOS, you can only register protocols that have been added to your
1291 * app's `info.plist`, which cannot be modified at runtime. However, you can change
1292 * the file during build time via Electron Forge, Electron Packager, or by editing
1293 * `info.plist` with a text editor. Please refer to Apple's documentation for
1296 * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
1297 * will return `true` for all calls but the registry key it sets won't be
1298 * accessible by other applications. In order to register your Windows Store
1299 * application as a default protocol handler you must declare the protocol in your
1302 * The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme`
1305 setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1307 * Whether the call succeeded.
1309 * Sets the counter badge for current app. Setting the count to `0` will hide the
1312 * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
1314 * **Note:** Unity launcher requires a `.desktop` file to work. For more
1315 * information, please read the Unity integration documentation.
1317 * @platform linux,darwin
1319 setBadgeCount(count?: number): boolean;
1321 * Sets or removes a custom Jump List for the application, and returns one of the
1322 * following strings:
1324 * * `ok` - Nothing went wrong.
1325 * * `error` - One or more errors occurred, enable runtime logging to figure out
1327 * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
1328 * category in the Jump List. Separators are only allowed in the standard `Tasks`
1330 * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
1331 * Jump List for a file type the app isn't registered to handle.
1332 * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
1333 * Jump List due to user privacy or group policy settings.
1335 * If `categories` is `null` the previously set custom Jump List (if any) will be
1336 * replaced by the standard Jump List for the app (managed by Windows).
1338 * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
1339 * property set then its `type` is assumed to be `tasks`. If the `name` property is
1340 * set but the `type` property is omitted then the `type` is assumed to be
1343 * **Note:** Users can remove items from custom categories, and Windows will not
1344 * allow a removed item to be added back into a custom category until **after** the
1345 * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
1346 * removed item to a custom category earlier than that will result in the entire
1347 * custom category being omitted from the Jump List. The list of removed items can
1348 * be obtained using `app.getJumpListSettings()`.
1350 * **Note:** The maximum length of a Jump List item's `description` property is 260
1351 * characters. Beyond this limit, the item will not be added to the Jump List, nor
1352 * will it be displayed.
1354 * Here's a very simple example of creating a custom Jump List:
1358 setJumpList(categories: (JumpListCategory[]) | (null)): ('ok' | 'error' | 'invalidSeparatorError' | 'fileTypeRegistrationError' | 'customCategoryAccessDeniedError');
1360 * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
1361 * want to set the launch path to Update.exe, and pass arguments that specify your
1362 * application name. For example:
1364 * @platform darwin,win32
1366 setLoginItemSettings(settings: Settings): void;
1368 * Overrides the current application's name.
1370 * **Note:** This function overrides the name used internally by Electron; it does
1371 * not affect the name that the OS uses.
1373 setName(name: string): void;
1375 * Overrides the `path` to a special directory or file associated with `name`. If
1376 * the path specifies a directory that does not exist, an `Error` is thrown. In
1377 * that case, the directory should be created with `fs.mkdirSync` or similar.
1379 * You can only override paths of a `name` defined in `app.getPath`.
1381 * By default, web pages' cookies and caches will be stored under the `sessionData`
1382 * directory. If you want to change this location, you have to override the
1383 * `sessionData` path before the `ready` event of the `app` module is emitted.
1385 setPath(name: string, path: string): void;
1387 * Set the `Secure Keyboard Entry` is enabled in your application.
1389 * By using this API, important information such as password and other sensitive
1390 * information can be prevented from being intercepted by other processes.
1392 * See Apple's documentation for more details.
1394 * **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it
1395 * when it is no longer needed.
1399 setSecureKeyboardEntryEnabled(enabled: boolean): void;
1401 * Creates an `NSUserActivity` and sets it as the current activity. The activity is
1402 * eligible for Handoff to another device afterward.
1406 setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
1408 * Adds `tasks` to the Tasks category of the Jump List on Windows.
1410 * `tasks` is an array of `Task` objects.
1412 * Whether the call succeeded.
1414 * **Note:** If you'd like to customize the Jump List even more use
1415 * `app.setJumpList(categories)` instead.
1419 setUserTasks(tasks: Task[]): boolean;
1421 * Shows application windows after they were hidden. Does not automatically focus
1428 * Show the app's about panel options. These options can be overridden with
1429 * `app.setAboutPanelOptions(options)`.
1431 showAboutPanel(): void;
1433 * Show the platform's native emoji picker.
1435 * @platform darwin,win32
1437 showEmojiPanel(): void;
1439 * This function **must** be called once you have finished accessing the security
1440 * scoped file. If you do not remember to stop accessing the bookmark, kernel
1441 * resources will be leaked and your app will lose its ability to reach outside the
1442 * sandbox completely, until your app is restarted.
1444 * Start accessing a security scoped resource. With this method Electron
1445 * applications that are packaged for the Mac App Store may reach outside their
1446 * sandbox to access files chosen by the user. See Apple's documentation for a
1447 * description of how this system works.
1451 startAccessingSecurityScopedResource(bookmarkData: string): Function;
1453 * Updates the current activity if its type matches `type`, merging the entries
1454 * from `userInfo` into its current `userInfo` dictionary.
1458 updateCurrentActivity(type: string, userInfo: any): void;
1460 * fulfilled when Electron is initialized. May be used as a convenient alternative
1461 * to checking `app.isReady()` and subscribing to the `ready` event if the app is
1464 whenReady(): Promise<void>;
1466 * A `boolean` property that's `true` if Chrome's accessibility support is enabled,
1467 * `false` otherwise. This property will be `true` if the use of assistive
1468 * technologies, such as screen readers, has been detected. Setting this property
1469 * to `true` manually enables Chrome's accessibility support, allowing developers
1470 * to expose accessibility switch to users in application settings.
1472 * See Chromium's accessibility docs for more details. Disabled by default.
1474 * This API must be called after the `ready` event is emitted.
1476 * **Note:** Rendering accessibility tree can significantly affect the performance
1477 * of your app. It should not be enabled by default.
1479 * @platform darwin,win32
1481 accessibilitySupportEnabled: boolean;
1483 * A `Menu | null` property that returns `Menu` if one has been set and `null`
1484 * otherwise. Users can pass a Menu to set this property.
1486 applicationMenu: (Menu) | (null);
1488 * An `Integer` property that returns the badge count for current app. Setting the
1489 * count to `0` will hide the badge.
1491 * On macOS, setting this with any nonzero integer shows on the dock icon. On
1492 * Linux, this property only works for Unity launcher.
1494 * **Note:** Unity launcher requires a `.desktop` file to work. For more
1495 * information, please read the Unity integration documentation.
1497 * **Note:** On macOS, you need to ensure that your application has the permission
1498 * to display notifications for this property to take effect.
1500 * @platform linux,darwin
1504 * A `CommandLine` object that allows you to read and manipulate the command line
1505 * arguments that Chromium uses.
1508 readonly commandLine: CommandLine;
1510 * A `Dock` `| undefined` object that allows you to perform actions on your app
1511 * icon in the user's dock on macOS.
1515 readonly dock: Dock;
1517 * A `boolean` property that returns `true` if the app is packaged, `false`
1518 * otherwise. For many apps, this property can be used to distinguish development
1519 * and production environments.
1522 readonly isPackaged: boolean;
1524 * A `string` property that indicates the current application's name, which is the
1525 * name in the application's `package.json` file.
1527 * Usually the `name` field of `package.json` is a short lowercase name, according
1528 * to the npm modules spec. You should usually also specify a `productName` field,
1529 * which is your application's full capitalized name, and which will be preferred
1530 * over `name` by Electron.
1534 * A `boolean` which when `true` indicates that the app is currently running under
1535 * an ARM64 translator (like the macOS Rosetta Translator Environment or Windows
1538 * You can use this property to prompt users to download the arm64 version of your
1539 * application when they are running the x64 version under Rosetta incorrectly.
1541 * @platform darwin,win32
1543 readonly runningUnderARM64Translation: boolean;
1545 * A `boolean` which when `true` indicates that the app is currently running under
1546 * the Rosetta Translator Environment.
1548 * You can use this property to prompt users to download the arm64 version of your
1549 * application when they are running the x64 version under Rosetta incorrectly.
1551 * **Deprecated:** This property is superceded by the
1552 * `runningUnderARM64Translation` property which detects when the app is being
1553 * translated to ARM64 in both macOS and Windows.
1558 readonly runningUnderRosettaTranslation: boolean;
1560 * A `string` which is the user agent string Electron will use as a global
1563 * This is the user agent that will be used when no user agent is set at the
1564 * `webContents` or `session` level. It is useful for ensuring that your entire
1565 * app has the same user agent. Set to a custom value as early as possible in your
1566 * app's initialization to ensure that your overridden value is used.
1568 userAgentFallback: string;
1571 interface AutoUpdater extends NodeJS.EventEmitter {
1573 // Docs: https://electronjs.org/docs/api/auto-updater
1576 * This event is emitted after a user calls `quitAndInstall()`.
1578 * When this API is called, the `before-quit` event is not emitted before all
1579 * windows are closed. As a result you should listen to this event if you wish to
1580 * perform actions before the windows are closed while a process is quitting, as
1581 * well as listening to `before-quit`.
1583 on(event: 'before-quit-for-update', listener: Function): this;
1584 once(event: 'before-quit-for-update', listener: Function): this;
1585 addListener(event: 'before-quit-for-update', listener: Function): this;
1586 removeListener(event: 'before-quit-for-update', listener: Function): this;
1588 * Emitted when checking if an update has started.
1590 on(event: 'checking-for-update', listener: Function): this;
1591 once(event: 'checking-for-update', listener: Function): this;
1592 addListener(event: 'checking-for-update', listener: Function): this;
1593 removeListener(event: 'checking-for-update', listener: Function): this;
1595 * Emitted when there is an error while updating.
1597 on(event: 'error', listener: (error: Error) => void): this;
1598 once(event: 'error', listener: (error: Error) => void): this;
1599 addListener(event: 'error', listener: (error: Error) => void): this;
1600 removeListener(event: 'error', listener: (error: Error) => void): this;
1602 * Emitted when there is an available update. The update is downloaded
1605 on(event: 'update-available', listener: Function): this;
1606 once(event: 'update-available', listener: Function): this;
1607 addListener(event: 'update-available', listener: Function): this;
1608 removeListener(event: 'update-available', listener: Function): this;
1610 * Emitted when an update has been downloaded.
1612 * On Windows only `releaseName` is available.
1614 * **Note:** It is not strictly necessary to handle this event. A successfully
1615 * downloaded update will still be applied the next time the application starts.
1617 on(event: 'update-downloaded', listener: (event: Event,
1618 releaseNotes: string,
1619 releaseName: string,
1621 updateURL: string) => void): this;
1622 once(event: 'update-downloaded', listener: (event: Event,
1623 releaseNotes: string,
1624 releaseName: string,
1626 updateURL: string) => void): this;
1627 addListener(event: 'update-downloaded', listener: (event: Event,
1628 releaseNotes: string,
1629 releaseName: string,
1631 updateURL: string) => void): this;
1632 removeListener(event: 'update-downloaded', listener: (event: Event,
1633 releaseNotes: string,
1634 releaseName: string,
1636 updateURL: string) => void): this;
1638 * Emitted when there is no available update.
1640 on(event: 'update-not-available', listener: Function): this;
1641 once(event: 'update-not-available', listener: Function): this;
1642 addListener(event: 'update-not-available', listener: Function): this;
1643 removeListener(event: 'update-not-available', listener: Function): this;
1645 * Asks the server whether there is an update. You must call `setFeedURL` before
1648 * **Note:** If an update is available it will be downloaded automatically. Calling
1649 * `autoUpdater.checkForUpdates()` twice will download the update two times.
1651 checkForUpdates(): void;
1653 * The current update feed URL.
1655 getFeedURL(): string;
1657 * Restarts the app and installs the update after it has been downloaded. It should
1658 * only be called after `update-downloaded` has been emitted.
1660 * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
1661 * windows first, and automatically call `app.quit()` after all windows have been
1664 * **Note:** It is not strictly necessary to call this function to apply an update,
1665 * as a successfully downloaded update will always be applied the next time the
1666 * application starts.
1668 quitAndInstall(): void;
1670 * Sets the `url` and initialize the auto updater.
1672 setFeedURL(options: FeedURLOptions): void;
1675 interface BluetoothDevice {
1677 // Docs: https://electronjs.org/docs/api/structures/bluetooth-device
1685 // Docs: https://electronjs.org/docs/api/browser-view
1690 constructor(options?: BrowserViewConstructorOptions);
1692 * The `bounds` of this BrowserView instance as `Object`.
1696 getBounds(): Rectangle;
1697 setAutoResize(options: AutoResizeOptions): void;
1699 * Examples of valid `color` values:
1704 * * #ffffff (RRGGBB)
1705 * * #ffffffff (AARRGGBB)
1707 * * rgb(([\d]+),\s*([\d]+),\s*([\d]+))
1708 * * e.g. rgb(255, 255, 255)
1710 * * rgba(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+))
1711 * * e.g. rgba(255, 255, 255, 1.0)
1713 * * hsl((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%)
1714 * * e.g. hsl(200, 20%, 50%)
1716 * * hsla((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+))
1717 * * e.g. hsla(200, 20%, 50%, 0.5)
1719 * * Options are listed in SkParseColor.cpp
1720 * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
1721 * * e.g. `blueviolet` or `red`
1723 * **Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBA` or
1728 setBackgroundColor(color: string): void;
1730 * Resizes and moves the view to the supplied bounds relative to the window.
1734 setBounds(bounds: Rectangle): void;
1736 * A `WebContents` object owned by this view.
1740 webContents: WebContents;
1743 class BrowserWindow extends NodeEventEmitter {
1745 // Docs: https://electronjs.org/docs/api/browser-window
1748 * Emitted when the window is set or unset to show always on top of other windows.
1750 on(event: 'always-on-top-changed', listener: (event: Event,
1751 isAlwaysOnTop: boolean) => void): this;
1752 once(event: 'always-on-top-changed', listener: (event: Event,
1753 isAlwaysOnTop: boolean) => void): this;
1754 addListener(event: 'always-on-top-changed', listener: (event: Event,
1755 isAlwaysOnTop: boolean) => void): this;
1756 removeListener(event: 'always-on-top-changed', listener: (event: Event,
1757 isAlwaysOnTop: boolean) => void): this;
1759 * Emitted when an App Command is invoked. These are typically related to keyboard
1760 * media keys or browser commands, as well as the "Back" button built into some
1763 * Commands are lowercased, underscores are replaced with hyphens, and the
1764 * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
1765 * emitted as `browser-backward`.
1767 * The following app commands are explicitly supported on Linux:
1769 * * `browser-backward`
1770 * * `browser-forward`
1772 * @platform win32,linux
1774 on(event: 'app-command', listener: (event: Event,
1775 command: string) => void): this;
1776 once(event: 'app-command', listener: (event: Event,
1777 command: string) => void): this;
1778 addListener(event: 'app-command', listener: (event: Event,
1779 command: string) => void): this;
1780 removeListener(event: 'app-command', listener: (event: Event,
1781 command: string) => void): this;
1783 * Emitted when the window loses focus.
1785 on(event: 'blur', listener: Function): this;
1786 once(event: 'blur', listener: Function): this;
1787 addListener(event: 'blur', listener: Function): this;
1788 removeListener(event: 'blur', listener: Function): this;
1790 * Emitted when the window is going to be closed. It's emitted before the
1791 * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
1792 * will cancel the close.
1794 * Usually you would want to use the `beforeunload` handler to decide whether the
1795 * window should be closed, which will also be called when the window is reloaded.
1796 * In Electron, returning any value other than `undefined` would cancel the close.
1799 * _**Note**: There is a subtle difference between the behaviors of
1800 * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
1801 * handler)`. It is recommended to always set the `event.returnValue` explicitly,
1802 * instead of only returning a value, as the former works more consistently within
1805 on(event: 'close', listener: (event: Event) => void): this;
1806 once(event: 'close', listener: (event: Event) => void): this;
1807 addListener(event: 'close', listener: (event: Event) => void): this;
1808 removeListener(event: 'close', listener: (event: Event) => void): this;
1810 * Emitted when the window is closed. After you have received this event you should
1811 * remove the reference to the window and avoid using it any more.
1813 on(event: 'closed', listener: Function): this;
1814 once(event: 'closed', listener: Function): this;
1815 addListener(event: 'closed', listener: Function): this;
1816 removeListener(event: 'closed', listener: Function): this;
1818 * Emitted when the window enters a full-screen state.
1820 on(event: 'enter-full-screen', listener: Function): this;
1821 once(event: 'enter-full-screen', listener: Function): this;
1822 addListener(event: 'enter-full-screen', listener: Function): this;
1823 removeListener(event: 'enter-full-screen', listener: Function): this;
1825 * Emitted when the window enters a full-screen state triggered by HTML API.
1827 on(event: 'enter-html-full-screen', listener: Function): this;
1828 once(event: 'enter-html-full-screen', listener: Function): this;
1829 addListener(event: 'enter-html-full-screen', listener: Function): this;
1830 removeListener(event: 'enter-html-full-screen', listener: Function): this;
1832 * Emitted when the window gains focus.
1834 on(event: 'focus', listener: Function): this;
1835 once(event: 'focus', listener: Function): this;
1836 addListener(event: 'focus', listener: Function): this;
1837 removeListener(event: 'focus', listener: Function): this;
1839 * Emitted when the window is hidden.
1841 on(event: 'hide', listener: Function): this;
1842 once(event: 'hide', listener: Function): this;
1843 addListener(event: 'hide', listener: Function): this;
1844 removeListener(event: 'hide', listener: Function): this;
1846 * Emitted when the window leaves a full-screen state.
1848 on(event: 'leave-full-screen', listener: Function): this;
1849 once(event: 'leave-full-screen', listener: Function): this;
1850 addListener(event: 'leave-full-screen', listener: Function): this;
1851 removeListener(event: 'leave-full-screen', listener: Function): this;
1853 * Emitted when the window leaves a full-screen state triggered by HTML API.
1855 on(event: 'leave-html-full-screen', listener: Function): this;
1856 once(event: 'leave-html-full-screen', listener: Function): this;
1857 addListener(event: 'leave-html-full-screen', listener: Function): this;
1858 removeListener(event: 'leave-html-full-screen', listener: Function): this;
1860 * Emitted when window is maximized.
1862 on(event: 'maximize', listener: Function): this;
1863 once(event: 'maximize', listener: Function): this;
1864 addListener(event: 'maximize', listener: Function): this;
1865 removeListener(event: 'maximize', listener: Function): this;
1867 * Emitted when the window is minimized.
1869 on(event: 'minimize', listener: Function): this;
1870 once(event: 'minimize', listener: Function): this;
1871 addListener(event: 'minimize', listener: Function): this;
1872 removeListener(event: 'minimize', listener: Function): this;
1874 * Emitted when the window is being moved to a new position.
1876 on(event: 'move', listener: Function): this;
1877 once(event: 'move', listener: Function): this;
1878 addListener(event: 'move', listener: Function): this;
1879 removeListener(event: 'move', listener: Function): this;
1881 * Emitted once when the window is moved to a new position.
1883 * __Note__: On macOS this event is an alias of `move`.
1885 * @platform darwin,win32
1887 on(event: 'moved', listener: Function): this;
1888 once(event: 'moved', listener: Function): this;
1889 addListener(event: 'moved', listener: Function): this;
1890 removeListener(event: 'moved', listener: Function): this;
1892 * Emitted when the native new tab button is clicked.
1896 on(event: 'new-window-for-tab', listener: Function): this;
1897 once(event: 'new-window-for-tab', listener: Function): this;
1898 addListener(event: 'new-window-for-tab', listener: Function): this;
1899 removeListener(event: 'new-window-for-tab', listener: Function): this;
1901 * Emitted when the document changed its title, calling `event.preventDefault()`
1902 * will prevent the native window's title from changing. `explicitSet` is false
1903 * when title is synthesized from file URL.
1905 on(event: 'page-title-updated', listener: (event: Event,
1907 explicitSet: boolean) => void): this;
1908 once(event: 'page-title-updated', listener: (event: Event,
1910 explicitSet: boolean) => void): this;
1911 addListener(event: 'page-title-updated', listener: (event: Event,
1913 explicitSet: boolean) => void): this;
1914 removeListener(event: 'page-title-updated', listener: (event: Event,
1916 explicitSet: boolean) => void): this;
1918 * Emitted when the web page has been rendered (while not being shown) and window
1919 * can be displayed without a visual flash.
1921 * Please note that using this event implies that the renderer will be considered
1922 * "visible" and paint even though `show` is false. This event will never fire if
1923 * you use `paintWhenInitiallyHidden: false`
1925 on(event: 'ready-to-show', listener: Function): this;
1926 once(event: 'ready-to-show', listener: Function): this;
1927 addListener(event: 'ready-to-show', listener: Function): this;
1928 removeListener(event: 'ready-to-show', listener: Function): this;
1930 * Emitted after the window has been resized.
1932 on(event: 'resize', listener: Function): this;
1933 once(event: 'resize', listener: Function): this;
1934 addListener(event: 'resize', listener: Function): this;
1935 removeListener(event: 'resize', listener: Function): this;
1937 * Emitted once when the window has finished being resized.
1939 * This is usually emitted when the window has been resized manually. On macOS,
1940 * resizing the window with `setBounds`/`setSize` and setting the `animate`
1941 * parameter to `true` will also emit this event once resizing has finished.
1943 * @platform darwin,win32
1945 on(event: 'resized', listener: Function): this;
1946 once(event: 'resized', listener: Function): this;
1947 addListener(event: 'resized', listener: Function): this;
1948 removeListener(event: 'resized', listener: Function): this;
1950 * Emitted when the unresponsive web page becomes responsive again.
1952 on(event: 'responsive', listener: Function): this;
1953 once(event: 'responsive', listener: Function): this;
1954 addListener(event: 'responsive', listener: Function): this;
1955 removeListener(event: 'responsive', listener: Function): this;
1957 * Emitted when the window is restored from a minimized state.
1959 on(event: 'restore', listener: Function): this;
1960 once(event: 'restore', listener: Function): this;
1961 addListener(event: 'restore', listener: Function): this;
1962 removeListener(event: 'restore', listener: Function): this;
1964 * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
1965 * is ended. The `rotation` value on each emission is the angle in degrees rotated
1966 * since the last emission. The last emitted event upon a rotation gesture will
1967 * always be of value `0`. Counter-clockwise rotation values are positive, while
1968 * clockwise ones are negative.
1972 on(event: 'rotate-gesture', listener: (event: Event,
1973 rotation: number) => void): this;
1974 once(event: 'rotate-gesture', listener: (event: Event,
1975 rotation: number) => void): this;
1976 addListener(event: 'rotate-gesture', listener: (event: Event,
1977 rotation: number) => void): this;
1978 removeListener(event: 'rotate-gesture', listener: (event: Event,
1979 rotation: number) => void): this;
1981 * Emitted when scroll wheel event phase has begun.
1983 * > **Note** This event is deprecated beginning in Electron 22.0.0. See Breaking
1984 * Changes for details of how to migrate to using the WebContents `input-event`
1990 on(event: 'scroll-touch-begin', listener: Function): this;
1991 once(event: 'scroll-touch-begin', listener: Function): this;
1992 addListener(event: 'scroll-touch-begin', listener: Function): this;
1993 removeListener(event: 'scroll-touch-begin', listener: Function): this;
1995 * Emitted when scroll wheel event phase filed upon reaching the edge of element.
1997 * > **Note** This event is deprecated beginning in Electron 22.0.0. See Breaking
1998 * Changes for details of how to migrate to using the WebContents `input-event`
2004 on(event: 'scroll-touch-edge', listener: Function): this;
2005 once(event: 'scroll-touch-edge', listener: Function): this;
2006 addListener(event: 'scroll-touch-edge', listener: Function): this;
2007 removeListener(event: 'scroll-touch-edge', listener: Function): this;
2009 * Emitted when scroll wheel event phase has ended.
2011 * > **Note** This event is deprecated beginning in Electron 22.0.0. See Breaking
2012 * Changes for details of how to migrate to using the WebContents `input-event`
2018 on(event: 'scroll-touch-end', listener: Function): this;
2019 once(event: 'scroll-touch-end', listener: Function): this;
2020 addListener(event: 'scroll-touch-end', listener: Function): this;
2021 removeListener(event: 'scroll-touch-end', listener: Function): this;
2023 * Emitted when window session is going to end due to force shutdown or machine
2024 * restart or session log off.
2028 on(event: 'session-end', listener: Function): this;
2029 once(event: 'session-end', listener: Function): this;
2030 addListener(event: 'session-end', listener: Function): this;
2031 removeListener(event: 'session-end', listener: Function): this;
2033 * Emitted when the window opens a sheet.
2037 on(event: 'sheet-begin', listener: Function): this;
2038 once(event: 'sheet-begin', listener: Function): this;
2039 addListener(event: 'sheet-begin', listener: Function): this;
2040 removeListener(event: 'sheet-begin', listener: Function): this;
2042 * Emitted when the window has closed a sheet.
2046 on(event: 'sheet-end', listener: Function): this;
2047 once(event: 'sheet-end', listener: Function): this;
2048 addListener(event: 'sheet-end', listener: Function): this;
2049 removeListener(event: 'sheet-end', listener: Function): this;
2051 * Emitted when the window is shown.
2053 on(event: 'show', listener: Function): this;
2054 once(event: 'show', listener: Function): this;
2055 addListener(event: 'show', listener: Function): this;
2056 removeListener(event: 'show', listener: Function): this;
2058 * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
2061 * The method underlying this event is built to handle older macOS-style trackpad
2062 * swiping, where the content on the screen doesn't move with the swipe. Most macOS
2063 * trackpads are not configured to allow this kind of swiping anymore, so in order
2064 * for it to emit properly the 'Swipe between pages' preference in `System
2065 * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
2070 on(event: 'swipe', listener: (event: Event,
2071 direction: string) => void): this;
2072 once(event: 'swipe', listener: (event: Event,
2073 direction: string) => void): this;
2074 addListener(event: 'swipe', listener: (event: Event,
2075 direction: string) => void): this;
2076 removeListener(event: 'swipe', listener: (event: Event,
2077 direction: string) => void): this;
2079 * Emitted when the system context menu is triggered on the window, this is
2080 * normally only triggered when the user right clicks on the non-client area of
2081 * your window. This is the window titlebar or any area you have declared as
2082 * `-webkit-app-region: drag` in a frameless window.
2084 * Calling `event.preventDefault()` will prevent the menu from being displayed.
2088 on(event: 'system-context-menu', listener: (event: Event,
2090 * The screen coordinates the context menu was triggered at
2092 point: Point) => void): this;
2093 once(event: 'system-context-menu', listener: (event: Event,
2095 * The screen coordinates the context menu was triggered at
2097 point: Point) => void): this;
2098 addListener(event: 'system-context-menu', listener: (event: Event,
2100 * The screen coordinates the context menu was triggered at
2102 point: Point) => void): this;
2103 removeListener(event: 'system-context-menu', listener: (event: Event,
2105 * The screen coordinates the context menu was triggered at
2107 point: Point) => void): this;
2109 * Emitted when the window exits from a maximized state.
2111 on(event: 'unmaximize', listener: Function): this;
2112 once(event: 'unmaximize', listener: Function): this;
2113 addListener(event: 'unmaximize', listener: Function): this;
2114 removeListener(event: 'unmaximize', listener: Function): this;
2116 * Emitted when the web page becomes unresponsive.
2118 on(event: 'unresponsive', listener: Function): this;
2119 once(event: 'unresponsive', listener: Function): this;
2120 addListener(event: 'unresponsive', listener: Function): this;
2121 removeListener(event: 'unresponsive', listener: Function): this;
2123 * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
2124 * will prevent the window from being moved.
2126 * Note that this is only emitted when the window is being moved manually. Moving
2127 * the window with `setPosition`/`setBounds`/`center` will not emit this event.
2129 * @platform darwin,win32
2131 on(event: 'will-move', listener: (event: Event,
2133 * Location the window is being moved to.
2135 newBounds: Rectangle) => void): this;
2136 once(event: 'will-move', listener: (event: Event,
2138 * Location the window is being moved to.
2140 newBounds: Rectangle) => void): this;
2141 addListener(event: 'will-move', listener: (event: Event,
2143 * Location the window is being moved to.
2145 newBounds: Rectangle) => void): this;
2146 removeListener(event: 'will-move', listener: (event: Event,
2148 * Location the window is being moved to.
2150 newBounds: Rectangle) => void): this;
2152 * Emitted before the window is resized. Calling `event.preventDefault()` will
2153 * prevent the window from being resized.
2155 * Note that this is only emitted when the window is being resized manually.
2156 * Resizing the window with `setBounds`/`setSize` will not emit this event.
2158 * The possible values and behaviors of the `edge` option are platform dependent.
2159 * Possible values are:
2161 * * On Windows, possible values are `bottom`, `top`, `left`, `right`, `top-left`,
2162 * `top-right`, `bottom-left`, `bottom-right`.
2163 * * On macOS, possible values are `bottom` and `right`.
2164 * * The value `bottom` is used to denote vertical resizing.
2165 * * The value `right` is used to denote horizontal resizing.
2167 * @platform darwin,win32
2169 on(event: 'will-resize', listener: (event: Event,
2171 * Size the window is being resized to.
2173 newBounds: Rectangle,
2174 details: WillResizeDetails) => void): this;
2175 once(event: 'will-resize', listener: (event: Event,
2177 * Size the window is being resized to.
2179 newBounds: Rectangle,
2180 details: WillResizeDetails) => void): this;
2181 addListener(event: 'will-resize', listener: (event: Event,
2183 * Size the window is being resized to.
2185 newBounds: Rectangle,
2186 details: WillResizeDetails) => void): this;
2187 removeListener(event: 'will-resize', listener: (event: Event,
2189 * Size the window is being resized to.
2191 newBounds: Rectangle,
2192 details: WillResizeDetails) => void): this;
2196 constructor(options?: BrowserWindowConstructorOptions);
2198 * The window that owns the given `browserView`. If the given view is not attached
2199 * to any window, returns `null`.
2201 static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
2203 * The window with the given `id`.
2205 static fromId(id: number): (BrowserWindow) | (null);
2207 * The window that owns the given `webContents` or `null` if the contents are not
2208 * owned by a window.
2210 static fromWebContents(webContents: WebContents): (BrowserWindow) | (null);
2212 * An array of all opened browser windows.
2214 static getAllWindows(): BrowserWindow[];
2216 * The window that is focused in this application, otherwise returns `null`.
2218 static getFocusedWindow(): (BrowserWindow) | (null);
2220 * Replacement API for setBrowserView supporting work with multi browser views.
2224 addBrowserView(browserView: BrowserView): void;
2226 * Adds a window as a tab on this window, after the tab for the window instance.
2230 addTabbedWindow(browserWindow: BrowserWindow): void;
2232 * Removes focus from the window.
2235 blurWebView(): void;
2237 * Resolves with a NativeImage
2239 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
2240 * whole visible page. If the page is not visible, `rect` may be empty.
2242 capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
2244 * Moves window to the center of the screen.
2248 * Try to close the window. This has the same effect as a user manually clicking
2249 * the close button of the window. The web page may cancel the close though. See
2254 * Closes the currently open Quick Look panel.
2258 closeFilePreview(): void;
2260 * Force closing the window, the `unload` and `beforeunload` event won't be emitted
2261 * for the web page, and `close` event will also not be emitted for this window,
2262 * but it guarantees the `closed` event will be emitted.
2266 * Starts or stops flashing the window to attract user's attention.
2268 flashFrame(flag: boolean): void;
2270 * Focuses on the window.
2273 focusOnWebView(): void;
2275 * Gets the background color of the window in Hex (`#RRGGBB`) format.
2277 * See Setting `backgroundColor`.
2279 * **Note:** The alpha value is _not_ returned alongside the red, green, and blue
2282 getBackgroundColor(): string;
2284 * The `bounds` of the window as `Object`.
2286 getBounds(): Rectangle;
2288 * The `BrowserView` attached to `win`. Returns `null` if one is not attached.
2289 * Throws an error if multiple `BrowserView`s are attached.
2293 getBrowserView(): (BrowserView) | (null);
2295 * an array of all BrowserViews that have been attached with `addBrowserView` or
2298 * **Note:** The BrowserView API is currently experimental and may change or be
2299 * removed in future Electron releases.
2303 getBrowserViews(): BrowserView[];
2305 * All child windows.
2307 getChildWindows(): BrowserWindow[];
2309 * The `bounds` of the window's client area as `Object`.
2311 getContentBounds(): Rectangle;
2313 * Contains the window's client area's width and height.
2315 getContentSize(): number[];
2317 * Contains the window's maximum width and height.
2319 getMaximumSize(): number[];
2321 * Window id in the format of DesktopCapturerSource's id. For example
2324 * More precisely the format is `window:id:other_id` where `id` is `HWND` on
2325 * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
2326 * Linux. `other_id` is used to identify web contents (tabs) so within the same top
2329 getMediaSourceId(): string;
2331 * Contains the window's minimum width and height.
2333 getMinimumSize(): number[];
2335 * The platform-specific handle of the window.
2337 * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
2338 * `Window` (`unsigned long`) on Linux.
2340 getNativeWindowHandle(): Buffer;
2342 * Contains the window bounds of the normal state
2344 * **Note:** whatever the current state of the window : maximized, minimized or in
2345 * fullscreen, this function always returns the position and size of the window in
2346 * normal state. In normal state, getBounds and getNormalBounds returns the same
2349 getNormalBounds(): Rectangle;
2351 * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
2354 getOpacity(): number;
2356 * The parent window or `null` if there is no parent.
2358 getParentWindow(): (BrowserWindow) | (null);
2360 * Contains the window's current position.
2362 getPosition(): number[];
2364 * The pathname of the file the window represents.
2368 getRepresentedFilename(): string;
2370 * Contains the window's width and height.
2372 getSize(): number[];
2374 * The title of the native window.
2376 * **Note:** The title of the web page can be different from the title of the
2381 * The custom position for the traffic light buttons in frameless window.
2385 getTrafficLightPosition(): Point;
2387 * Whether the window has a shadow.
2389 hasShadow(): boolean;
2395 * Hooks a windows message. The `callback` is called when the message is received
2400 hookWindowMessage(message: number, callback: (wParam: any, lParam: any) => void): void;
2402 * Whether the window is always on top of other windows.
2404 isAlwaysOnTop(): boolean;
2406 * Whether the window can be manually closed by user.
2408 * On Linux always returns `true`.
2410 * @platform darwin,win32
2412 isClosable(): boolean;
2414 * Whether the window is destroyed.
2416 isDestroyed(): boolean;
2418 * Whether the window's document has been edited.
2422 isDocumentEdited(): boolean;
2424 * whether the window is enabled.
2426 isEnabled(): boolean;
2428 * Returns whether the window can be focused.
2430 * @platform darwin,win32
2432 isFocusable(): void;
2434 * Whether the window is focused.
2436 isFocused(): boolean;
2438 * Whether the window is in fullscreen mode.
2440 isFullScreen(): boolean;
2442 * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
2445 isFullScreenable(): boolean;
2447 * Whether the window is in kiosk mode.
2451 * Whether the window can be manually maximized by user.
2453 * On Linux always returns `true`.
2455 * @platform darwin,win32
2457 isMaximizable(): boolean;
2459 * Whether the window is maximized.
2461 isMaximized(): boolean;
2463 * Whether menu bar automatically hides itself.
2465 * @platform win32,linux
2467 isMenuBarAutoHide(): boolean;
2469 * Whether the menu bar is visible.
2471 * @platform win32,linux
2473 isMenuBarVisible(): boolean;
2475 * Whether the window can be manually minimized by the user.
2477 * On Linux always returns `true`.
2479 * @platform darwin,win32
2481 isMinimizable(): boolean;
2483 * Whether the window is minimized.
2485 isMinimized(): boolean;
2487 * Whether current window is a modal window.
2491 * Whether the window can be moved by user.
2493 * On Linux always returns `true`.
2495 * @platform darwin,win32
2497 isMovable(): boolean;
2499 * Whether the window is in normal state (not maximized, not minimized, not in
2502 isNormal(): boolean;
2504 * Whether the window can be manually resized by the user.
2506 isResizable(): boolean;
2508 * Whether the window is in simple (pre-Lion) fullscreen mode.
2512 isSimpleFullScreen(): boolean;
2514 * Whether the window is in Windows 10 tablet mode.
2516 * Since Windows 10 users can use their PC as tablet, under this mode apps can
2517 * choose to optimize their UI for tablets, such as enlarging the titlebar and
2518 * hiding titlebar buttons.
2520 * This API returns whether the window is in tablet mode, and the `resize` event
2521 * can be be used to listen to changes to tablet mode.
2525 isTabletMode(): boolean;
2527 * Whether the window is visible to the user.
2529 isVisible(): boolean;
2531 * Whether the window is visible on all workspaces.
2533 * **Note:** This API always returns false on Windows.
2535 * @platform darwin,linux
2537 isVisibleOnAllWorkspaces(): boolean;
2539 * `true` or `false` depending on whether the message is hooked.
2543 isWindowMessageHooked(message: number): boolean;
2545 * the promise will resolve when the page has finished loading (see
2546 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
2548 * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
2549 * relative to the root of your application. See the `webContents` docs for more
2552 loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
2554 * the promise will resolve when the page has finished loading (see
2555 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
2557 * Same as `webContents.loadURL(url[, options])`.
2559 * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
2560 * file using the `file://` protocol.
2562 * To ensure that file URLs are properly formatted, it is recommended to use Node's
2563 * `url.format` method:
2565 * You can load a URL using a `POST` request with URL-encoded data by doing the
2568 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
2570 * Maximizes the window. This will also show (but not focus) the window if it isn't
2571 * being displayed already.
2575 * Merges all windows into one window with multiple tabs when native tabs are
2576 * enabled and there is more than one open window.
2580 mergeAllWindows(): void;
2582 * Minimizes the window. On some platforms the minimized window will be shown in
2587 * Moves window above the source window in the sense of z-order. If the
2588 * `mediaSourceId` is not of type window or if the window does not exist then this
2589 * method throws an error.
2591 moveAbove(mediaSourceId: string): void;
2593 * Moves the current tab into a new window if native tabs are enabled and there is
2594 * more than one tab in the current window.
2598 moveTabToNewWindow(): void;
2600 * Moves window to top(z-order) regardless of focus
2604 * Uses Quick Look to preview a file at a given path.
2608 previewFile(path: string, displayName?: string): void;
2610 * Same as `webContents.reload`.
2613 removeBrowserView(browserView: BrowserView): void;
2615 * Remove the window's menu bar.
2617 * @platform linux,win32
2621 * Restores the window from minimized state to its previous state.
2625 * Selects the next tab when native tabs are enabled and there are other tabs in
2630 selectNextTab(): void;
2632 * Selects the previous tab when native tabs are enabled and there are other tabs
2637 selectPreviousTab(): void;
2639 * Sets whether the window should show always on top of other windows. After
2640 * setting this, the window is still a normal window, not a toolbox window which
2641 * can not be focused on.
2643 setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
2645 * Sets the properties for the window's taskbar button.
2647 * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
2648 * together. If one of those properties is not set, then neither will be used.
2652 setAppDetails(options: AppDetailsOptions): void;
2654 * This will make a window maintain an aspect ratio. The extra size allows a
2655 * developer to have space, specified in pixels, not included within the aspect
2656 * ratio calculations. This API already takes into account the difference between a
2657 * window's size and its content size.
2659 * Consider a normal window with an HD video player and associated controls.
2660 * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
2661 * on the right edge and 50 pixels of controls below the player. In order to
2662 * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
2663 * the player itself we would call this function with arguments of 16/9 and {
2664 * width: 40, height: 50 }. The second argument doesn't care where the extra width
2665 * and height are within the content view--only that they exist. Sum any extra
2666 * width and height areas you have within the overall content view.
2668 * The aspect ratio is not respected when window is resized programmatically with
2669 * APIs like `win.setSize`.
2671 setAspectRatio(aspectRatio: number, extraSize?: Size): void;
2673 * Controls whether to hide cursor when typing.
2677 setAutoHideCursor(autoHide: boolean): void;
2679 * Sets whether the window menu bar should hide itself automatically. Once set the
2680 * menu bar will only show when users press the single `Alt` key.
2682 * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
2683 * hide it immediately.
2685 * @platform win32,linux
2687 setAutoHideMenuBar(hide: boolean): void;
2689 * Examples of valid `backgroundColor` values:
2692 * * #fff (shorthand RGB)
2693 * * #ffff (shorthand ARGB)
2695 * * #ffffffff (ARGB)
2697 * * rgb(([\d]+),\s*([\d]+),\s*([\d]+))
2698 * * e.g. rgb(255, 255, 255)
2700 * * rgba(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+))
2701 * * e.g. rgba(255, 255, 255, 1.0)
2703 * * hsl((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%)
2704 * * e.g. hsl(200, 20%, 50%)
2706 * * hsla((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+))
2707 * * e.g. hsla(200, 20%, 50%, 0.5)
2709 * * Options are listed in SkParseColor.cpp
2710 * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
2711 * * e.g. `blueviolet` or `red`
2713 * Sets the background color of the window. See Setting `backgroundColor`.
2715 setBackgroundColor(backgroundColor: string): void;
2717 * Resizes and moves the window to the supplied bounds. Any properties that are not
2718 * supplied will default to their current values.
2720 setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
2721 setBrowserView(browserView: (BrowserView) | (null)): void;
2723 * Sets whether the window can be manually closed by user. On Linux does nothing.
2725 * @platform darwin,win32
2727 setClosable(closable: boolean): void;
2729 * Resizes and moves the window's client area (e.g. the web page) to the supplied
2732 setContentBounds(bounds: Rectangle, animate?: boolean): void;
2734 * Prevents the window contents from being captured by other apps.
2736 * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
2737 * it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`. For Windows 10
2738 * version 2004 and up the window will be removed from capture entirely, older
2739 * Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
2741 * @platform darwin,win32
2743 setContentProtection(enable: boolean): void;
2745 * Resizes the window's client area (e.g. the web page) to `width` and `height`.
2747 setContentSize(width: number, height: number, animate?: boolean): void;
2749 * Specifies whether the window’s document has been edited, and the icon in title
2750 * bar will become gray when set to `true`.
2754 setDocumentEdited(edited: boolean): void;
2756 * Disable or enable the window.
2758 setEnabled(enable: boolean): void;
2760 * Changes whether the window can be focused.
2762 * On macOS it does not remove the focus from the window.
2764 * @platform darwin,win32
2766 setFocusable(focusable: boolean): void;
2768 * Sets whether the window should be in fullscreen mode.
2770 setFullScreen(flag: boolean): void;
2772 * Sets whether the maximize/zoom window button toggles fullscreen mode or
2773 * maximizes the window.
2775 setFullScreenable(fullscreenable: boolean): void;
2777 * Sets whether the window should have a shadow.
2779 setHasShadow(hasShadow: boolean): void;
2781 * Changes window icon.
2783 * @platform win32,linux
2785 setIcon(icon: (NativeImage) | (string)): void;
2787 * Makes the window ignore all mouse events.
2789 * All mouse events happened in this window will be passed to the window below this
2790 * window, but if this window has focus, it will still receive keyboard events.
2792 setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
2794 * Enters or leaves kiosk mode.
2796 setKiosk(flag: boolean): void;
2798 * Sets whether the window can be manually maximized by user. On Linux does
2801 * @platform darwin,win32
2803 setMaximizable(maximizable: boolean): void;
2805 * Sets the maximum size of window to `width` and `height`.
2807 setMaximumSize(width: number, height: number): void;
2809 * Sets the `menu` as the window's menu bar.
2811 * @platform linux,win32
2813 setMenu(menu: (Menu) | (null)): void;
2815 * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
2816 * can still bring up the menu bar by pressing the single `Alt` key.
2818 * @platform win32,linux
2820 setMenuBarVisibility(visible: boolean): void;
2822 * Sets whether the window can be manually minimized by user. On Linux does
2825 * @platform darwin,win32
2827 setMinimizable(minimizable: boolean): void;
2829 * Sets the minimum size of window to `width` and `height`.
2831 setMinimumSize(width: number, height: number): void;
2833 * Sets whether the window can be moved by user. On Linux does nothing.
2835 * @platform darwin,win32
2837 setMovable(movable: boolean): void;
2839 * Sets the opacity of the window. On Linux, does nothing. Out of bound number
2840 * values are clamped to the [0, 1] range.
2842 * @platform win32,darwin
2844 setOpacity(opacity: number): void;
2846 * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
2847 * convey some sort of application status or to passively notify the user.
2851 setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
2853 * Sets `parent` as current window's parent window, passing `null` will turn
2854 * current window into a top-level window.
2856 setParentWindow(parent: (BrowserWindow) | (null)): void;
2858 * Moves window to `x` and `y`.
2860 setPosition(x: number, y: number, animate?: boolean): void;
2862 * Sets progress value in progress bar. Valid range is [0, 1.0].
2864 * Remove progress bar when progress < 0; Change to indeterminate mode when
2867 * On Linux platform, only supports Unity desktop environment, you need to specify
2868 * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
2869 * it will assume `{app.name}.desktop`.
2871 * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
2872 * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
2873 * mode set (but with a value within the valid range), `normal` will be assumed.
2875 setProgressBar(progress: number, options?: ProgressBarOptions): void;
2877 * Sets the pathname of the file the window represents, and the icon of the file
2878 * will show in window's title bar.
2882 setRepresentedFilename(filename: string): void;
2884 * Sets whether the window can be manually resized by the user.
2886 setResizable(resizable: boolean): void;
2888 * Setting a window shape determines the area within the window where the system
2889 * permits drawing and user interaction. Outside of the given region, no pixels
2890 * will be drawn and no mouse events will be registered. Mouse events outside of
2891 * the region will not be received by that window, but will fall through to
2892 * whatever is behind the window.
2895 * @platform win32,linux
2897 setShape(rects: Rectangle[]): void;
2899 * Changes the attachment point for sheets on macOS. By default, sheets are
2900 * attached just below the window frame, but you may want to display them beneath a
2901 * HTML-rendered toolbar. For example:
2905 setSheetOffset(offsetY: number, offsetX?: number): void;
2907 * Enters or leaves simple fullscreen mode.
2909 * Simple fullscreen mode emulates the native fullscreen behavior found in versions
2910 * of macOS prior to Lion (10.7).
2914 setSimpleFullScreen(flag: boolean): void;
2916 * Resizes the window to `width` and `height`. If `width` or `height` are below any
2917 * set minimum size constraints the window will snap to its minimum size.
2919 setSize(width: number, height: number, animate?: boolean): void;
2921 * Makes the window not show in the taskbar.
2923 * @platform darwin,win32
2925 setSkipTaskbar(skip: boolean): void;
2927 * Whether the buttons were added successfully
2929 * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
2930 * of a window in a taskbar button layout. Returns a `boolean` object indicates
2931 * whether the thumbnail has been added successfully.
2933 * The number of buttons in thumbnail toolbar should be no greater than 7 due to
2934 * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
2935 * removed due to the platform's limitation. But you can call the API with an empty
2936 * array to clean the buttons.
2938 * The `buttons` is an array of `Button` objects:
2941 * * `icon` NativeImage - The icon showing in thumbnail toolbar.
2942 * * `click` Function
2943 * * `tooltip` string (optional) - The text of the button's tooltip.
2944 * * `flags` string[] (optional) - Control specific states and behaviors of the
2945 * button. By default, it is `['enabled']`.
2947 * The `flags` is an array that can include following `string`s:
2949 * * `enabled` - The button is active and available to the user.
2950 * * `disabled` - The button is disabled. It is present, but has a visual state
2951 * indicating it will not respond to user action.
2952 * * `dismissonclick` - When the button is clicked, the thumbnail window closes
2954 * * `nobackground` - Do not draw a button border, use only the image.
2955 * * `hidden` - The button is not shown to the user.
2956 * * `noninteractive` - The button is enabled but not interactive; no pressed
2957 * button state is drawn. This value is intended for instances where the button is
2958 * used in a notification.
2962 setThumbarButtons(buttons: ThumbarButton[]): boolean;
2964 * Sets the region of the window to show as the thumbnail image displayed when
2965 * hovering over the window in the taskbar. You can reset the thumbnail to be the
2966 * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
2971 setThumbnailClip(region: Rectangle): void;
2973 * Sets the toolTip that is displayed when hovering over the window thumbnail in
2978 setThumbnailToolTip(toolTip: string): void;
2980 * Changes the title of native window to `title`.
2982 setTitle(title: string): void;
2984 * On a Window with Window Controls Overlay already enabled, this method updates
2985 * the style of the title bar overlay.
2989 setTitleBarOverlay(options: TitleBarOverlayOptions): void;
2991 * Raises `browserView` above other `BrowserView`s attached to `win`. Throws an
2992 * error if `browserView` is not attached to `win`.
2996 setTopBrowserView(browserView: BrowserView): void;
2998 * Sets the touchBar layout for the current window. Specifying `null` or
2999 * `undefined` clears the touch bar. This method only has an effect if the machine
3000 * has a touch bar and is running on macOS 10.12.1+.
3002 * **Note:** The TouchBar API is currently experimental and may change or be
3003 * removed in future Electron releases.
3007 setTouchBar(touchBar: (TouchBar) | (null)): void;
3009 * Set a custom position for the traffic light buttons in frameless window.
3013 setTrafficLightPosition(position: Point): void;
3015 * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
3016 * will remove the vibrancy effect on the window.
3018 * Note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
3019 * have been deprecated and will be removed in an upcoming version of macOS.
3023 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;
3025 * Sets whether the window should be visible on all workspaces.
3027 * **Note:** This API does nothing on Windows.
3029 * @platform darwin,linux
3031 setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
3033 * Sets whether the window traffic light buttons should be visible.
3037 setWindowButtonVisibility(visible: boolean): void;
3039 * Shows and gives focus to the window.
3043 * Same as `webContents.showDefinitionForSelection()`.
3047 showDefinitionForSelection(): void;
3049 * Shows the window but doesn't focus on it.
3051 showInactive(): void;
3053 * Toggles the visibility of the tab bar if native tabs are enabled and there is
3054 * only one tab in the current window.
3058 toggleTabBar(): void;
3060 * Unhooks all of the window messages.
3064 unhookAllWindowMessages(): void;
3066 * Unhook the window message.
3070 unhookWindowMessage(message: number): void;
3072 * Unmaximizes the window.
3076 * A `string` property that defines an alternative title provided only to
3077 * accessibility tools such as screen readers. This string is not directly visible
3080 accessibleTitle: string;
3082 * A `boolean` property that determines whether the window menu bar should hide
3083 * itself automatically. Once set, the menu bar will only show when users press the
3086 * If the menu bar is already visible, setting this property to `true` won't hide
3089 autoHideMenuBar: boolean;
3091 * A `boolean` property that determines whether the window can be manually closed
3094 * On Linux the setter is a no-op, although the getter returns `true`.
3096 * @platform darwin,win32
3100 * A `boolean` property that specifies whether the window’s document has been
3103 * The icon in title bar will become gray when set to `true`.
3107 documentEdited: boolean;
3109 * A `boolean` property that determines whether the window is excluded from the
3110 * application’s Windows menu. `false` by default.
3114 excludedFromShownWindowsMenu: boolean;
3116 * A `boolean` property that determines whether the window is focusable.
3118 * @platform win32,darwin
3122 * A `boolean` property that determines whether the window is in fullscreen mode.
3124 fullScreen: boolean;
3126 * A `boolean` property that determines whether the maximize/zoom window button
3127 * toggles fullscreen mode or maximizes the window.
3129 fullScreenable: boolean;
3131 * A `Integer` property representing the unique ID of the window. Each ID is unique
3132 * among all `BrowserWindow` instances of the entire Electron application.
3135 readonly id: number;
3137 * A `boolean` property that determines whether the window is in kiosk mode.
3141 * A `boolean` property that determines whether the window can be manually
3142 * maximized by user.
3144 * On Linux the setter is a no-op, although the getter returns `true`.
3146 * @platform darwin,win32
3148 maximizable: boolean;
3150 * A `boolean` property that determines whether the menu bar should be visible.
3152 * **Note:** If the menu bar is auto-hide, users can still bring up the menu bar by
3153 * pressing the single `Alt` key.
3155 * @platform win32,linux
3157 menuBarVisible: boolean;
3159 * A `boolean` property that determines whether the window can be manually
3160 * minimized by user.
3162 * On Linux the setter is a no-op, although the getter returns `true`.
3164 * @platform darwin,win32
3166 minimizable: boolean;
3168 * A `boolean` property that determines Whether the window can be moved by user.
3170 * On Linux the setter is a no-op, although the getter returns `true`.
3172 * @platform darwin,win32
3176 * A `string` property that determines the pathname of the file the window
3177 * represents, and the icon of the file will show in window's title bar.
3181 representedFilename: string;
3183 * A `boolean` property that determines whether the window can be manually resized
3188 * A `boolean` property that determines whether the window has a shadow.
3192 * A `boolean` property that determines whether the window is in simple (pre-Lion)
3195 simpleFullScreen: boolean;
3197 * A `string` property that determines the title of the native window.
3199 * **Note:** The title of the web page can be different from the title of the
3204 * A `boolean` property that determines whether the window is visible on all
3207 * **Note:** Always returns false on Windows.
3209 * @platform darwin,linux
3211 visibleOnAllWorkspaces: boolean;
3213 * A `WebContents` object this window owns. All web page related events and
3214 * operations will be done via it.
3216 * See the `webContents` documentation for its methods and events.
3219 readonly webContents: WebContents;
3222 interface Certificate {
3224 // Docs: https://electronjs.org/docs/api/structures/certificate
3231 * Fingerprint of the certificate
3233 fingerprint: string;
3237 issuer: CertificatePrincipal;
3239 * Issuer certificate (if not self-signed)
3241 issuerCert: Certificate;
3243 * Issuer's Common Name
3247 * Hex value represented string
3249 serialNumber: string;
3253 subject: CertificatePrincipal;
3255 * Subject's Common Name
3257 subjectName: string;
3259 * End date of the certificate being valid in seconds
3261 validExpiry: number;
3263 * Start date of the certificate being valid in seconds
3268 interface CertificatePrincipal {
3270 // Docs: https://electronjs.org/docs/api/structures/certificate-principal
3277 * Country or region.
3285 * Organization names.
3287 organizations: string[];
3289 * Organization Unit names.
3291 organizationUnits: string[];
3293 * State or province.
3298 class ClientRequest extends NodeEventEmitter {
3300 // Docs: https://electronjs.org/docs/api/client-request
3303 * Emitted when the `request` is aborted. The `abort` event will not be fired if
3304 * the `request` is already closed.
3306 on(event: 'abort', listener: Function): this;
3307 once(event: 'abort', listener: Function): this;
3308 addListener(event: 'abort', listener: Function): this;
3309 removeListener(event: 'abort', listener: Function): this;
3311 * Emitted as the last event in the HTTP request-response transaction. The `close`
3312 * event indicates that no more events will be emitted on either the `request` or
3313 * `response` objects.
3315 on(event: 'close', listener: Function): this;
3316 once(event: 'close', listener: Function): this;
3317 addListener(event: 'close', listener: Function): this;
3318 removeListener(event: 'close', listener: Function): this;
3320 * Emitted when the `net` module fails to issue a network request. Typically when
3321 * the `request` object emits an `error` event, a `close` event will subsequently
3322 * follow and no response object will be provided.
3324 on(event: 'error', listener: (
3326 * an error object providing some information about the failure.
3328 error: Error) => void): this;
3329 once(event: 'error', listener: (
3331 * an error object providing some information about the failure.
3333 error: Error) => void): this;
3334 addListener(event: 'error', listener: (
3336 * an error object providing some information about the failure.
3338 error: Error) => void): this;
3339 removeListener(event: 'error', listener: (
3341 * an error object providing some information about the failure.
3343 error: Error) => void): this;
3345 * Emitted just after the last chunk of the `request`'s data has been written into
3346 * the `request` object.
3348 on(event: 'finish', listener: Function): this;
3349 once(event: 'finish', listener: Function): this;
3350 addListener(event: 'finish', listener: Function): this;
3351 removeListener(event: 'finish', listener: Function): this;
3353 * Emitted when an authenticating proxy is asking for user credentials.
3355 * The `callback` function is expected to be called back with user credentials:
3357 * * `username` string
3358 * * `password` string
3360 * Providing empty credentials will cancel the request and report an authentication
3361 * error on the response object:
3363 on(event: 'login', listener: (authInfo: AuthInfo,
3364 callback: (username?: string, password?: string) => void) => void): this;
3365 once(event: 'login', listener: (authInfo: AuthInfo,
3366 callback: (username?: string, password?: string) => void) => void): this;
3367 addListener(event: 'login', listener: (authInfo: AuthInfo,
3368 callback: (username?: string, password?: string) => void) => void): this;
3369 removeListener(event: 'login', listener: (authInfo: AuthInfo,
3370 callback: (username?: string, password?: string) => void) => void): this;
3372 * Emitted when the server returns a redirect response (e.g. 301 Moved
3373 * Permanently). Calling `request.followRedirect` will continue with the
3374 * redirection. If this event is handled, `request.followRedirect` must be called
3375 * **synchronously**, otherwise the request will be cancelled.
3377 on(event: 'redirect', listener: (statusCode: number,
3379 redirectUrl: string,
3380 responseHeaders: Record<string, string[]>) => void): this;
3381 once(event: 'redirect', listener: (statusCode: number,
3383 redirectUrl: string,
3384 responseHeaders: Record<string, string[]>) => void): this;
3385 addListener(event: 'redirect', listener: (statusCode: number,
3387 redirectUrl: string,
3388 responseHeaders: Record<string, string[]>) => void): this;
3389 removeListener(event: 'redirect', listener: (statusCode: number,
3391 redirectUrl: string,
3392 responseHeaders: Record<string, string[]>) => void): this;
3393 on(event: 'response', listener: (
3395 * An object representing the HTTP response message.
3397 response: IncomingMessage) => void): this;
3398 once(event: 'response', listener: (
3400 * An object representing the HTTP response message.
3402 response: IncomingMessage) => void): this;
3403 addListener(event: 'response', listener: (
3405 * An object representing the HTTP response message.
3407 response: IncomingMessage) => void): this;
3408 removeListener(event: 'response', listener: (
3410 * An object representing the HTTP response message.
3412 response: IncomingMessage) => void): this;
3416 constructor(options: (ClientRequestConstructorOptions) | (string));
3418 * Cancels an ongoing HTTP transaction. If the request has already emitted the
3419 * `close` event, the abort operation will have no effect. Otherwise an ongoing
3420 * event will emit `abort` and `close` events. Additionally, if there is an ongoing
3421 * response object,it will emit the `aborted` event.
3425 * Sends the last chunk of the request data. Subsequent write or end operations
3426 * will not be allowed. The `finish` event is emitted just after the end operation.
3428 end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): void;
3430 * Continues any pending redirection. Can only be called during a `'redirect'`
3433 followRedirect(): void;
3435 * The value of a previously set extra header name.
3437 getHeader(name: string): string;
3439 * * `active` boolean - Whether the request is currently active. If this is false
3440 * no other properties will be set
3441 * * `started` boolean - Whether the upload has started. If this is false both
3442 * `current` and `total` will be set to 0.
3443 * * `current` Integer - The number of bytes that have been uploaded so far
3444 * * `total` Integer - The number of bytes that will be uploaded this request
3446 * You can use this method in conjunction with `POST` requests to get the progress
3447 * of a file upload or other data transfer.
3449 getUploadProgress(): UploadProgress;
3451 * Removes a previously set extra header name. This method can be called only
3452 * before first write. Trying to call it after the first write will throw an error.
3454 removeHeader(name: string): void;
3456 * Adds an extra HTTP header. The header name will be issued as-is without
3457 * lowercasing. It can be called only before first write. Calling this method after
3458 * the first write will throw an error. If the passed value is not a `string`, its
3459 * `toString()` method will be called to obtain the final value.
3461 * Certain headers are restricted from being set by apps. These headers are listed
3462 * below. More information on restricted headers can be found in Chromium's header
3465 * * `Content-Length`
3467 * * `Trailer` or `Te`
3471 * * `Transfer-Encoding`
3473 * Additionally, setting the `Connection` header to the value `upgrade` is also
3476 setHeader(name: string, value: string): void;
3478 * `callback` is essentially a dummy function introduced in the purpose of keeping
3479 * similarity with the Node.js API. It is called asynchronously in the next tick
3480 * after `chunk` content have been delivered to the Chromium networking layer.
3481 * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
3482 * content have been flushed on the wire before `callback` is called.
3484 * Adds a chunk of data to the request body. The first write operation may cause
3485 * the request headers to be issued on the wire. After the first write operation,
3486 * it is not allowed to add or remove a custom header.
3488 write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
3490 * A `boolean` specifying whether the request will use HTTP chunked transfer
3491 * encoding or not. Defaults to false. The property is readable and writable,
3492 * however it can be set only before the first write operation as the HTTP headers
3493 * are not yet put on the wire. Trying to set the `chunkedEncoding` property after
3494 * the first write will throw an error.
3496 * Using chunked encoding is strongly recommended if you need to send a large
3497 * request body as data will be streamed in small chunks instead of being
3498 * internally buffered inside Electron process memory.
3500 chunkedEncoding: boolean;
3503 interface Clipboard {
3505 // Docs: https://electronjs.org/docs/api/clipboard
3508 * An array of supported formats for the clipboard `type`.
3510 availableFormats(type?: 'selection' | 'clipboard'): string[];
3512 * Clears the clipboard content.
3514 clear(type?: 'selection' | 'clipboard'): void;
3516 * Whether the clipboard supports the specified `format`.
3520 has(format: string, type?: 'selection' | 'clipboard'): boolean;
3522 * Reads `format` type from the clipboard.
3524 * `format` should contain valid ASCII characters and have `/` separator. `a/c`,
3525 * `a/bc` are valid formats while `/abc`, `abc/`, `a/`, `/a`, `a` are not valid.
3529 read(format: string): string;
3534 * Returns an Object containing `title` and `url` keys representing the bookmark in
3535 * the clipboard. The `title` and `url` values will be empty strings when the
3536 * bookmark is unavailable. The `title` value will always be empty on Windows.
3538 * @platform darwin,win32
3540 readBookmark(): ReadBookmark;
3542 * Reads `format` type from the clipboard.
3546 readBuffer(format: string): Buffer;
3548 * The text on the find pasteboard, which is the pasteboard that holds information
3549 * about the current state of the active application’s find panel.
3551 * This method uses synchronous IPC when called from the renderer process. The
3552 * cached value is reread from the find pasteboard whenever the application is
3557 readFindText(): string;
3559 * The content in the clipboard as markup.
3561 readHTML(type?: 'selection' | 'clipboard'): string;
3563 * The image content in the clipboard.
3565 readImage(type?: 'selection' | 'clipboard'): NativeImage;
3567 * The content in the clipboard as RTF.
3569 readRTF(type?: 'selection' | 'clipboard'): string;
3571 * The content in the clipboard as plain text.
3573 readText(type?: 'selection' | 'clipboard'): string;
3575 * Writes `data` to the clipboard.
3577 write(data: Data, type?: 'selection' | 'clipboard'): void;
3579 * Writes the `title` (macOS only) and `url` into the clipboard as a bookmark.
3581 * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
3582 * can use `clipboard.write` to write both a bookmark and fallback text to the
3585 * @platform darwin,win32
3587 writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
3589 * Writes the `buffer` into the clipboard as `format`.
3593 writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
3595 * Writes the `text` into the find pasteboard (the pasteboard that holds
3596 * information about the current state of the active application’s find panel) as
3597 * plain text. This method uses synchronous IPC when called from the renderer
3602 writeFindText(text: string): void;
3604 * Writes `markup` to the clipboard.
3606 writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
3608 * Writes `image` to the clipboard.
3610 writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
3612 * Writes the `text` into the clipboard in RTF.
3614 writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
3616 * Writes the `text` into the clipboard as plain text.
3618 writeText(text: string, type?: 'selection' | 'clipboard'): void;
3623 // Docs: https://electronjs.org/docs/api/command-line
3626 * Append an argument to Chromium's command line. The argument will be quoted
3627 * correctly. Switches will precede arguments regardless of appending order.
3629 * If you're appending an argument like `--switch=value`, consider using
3630 * `appendSwitch('switch', 'value')` instead.
3632 * **Note:** This will not affect `process.argv`. The intended usage of this
3633 * function is to control Chromium's behavior.
3635 appendArgument(value: string): void;
3637 * Append a switch (with optional `value`) to Chromium's command line.
3639 * **Note:** This will not affect `process.argv`. The intended usage of this
3640 * function is to control Chromium's behavior.
3642 appendSwitch(the_switch: string, value?: string): void;
3644 * The command-line switch value.
3646 * **Note:** When the switch is not present or has no value, it returns empty
3649 getSwitchValue(the_switch: string): string;
3651 * Whether the command-line switch is present.
3653 hasSwitch(the_switch: string): boolean;
3655 * Removes the specified switch from Chromium's command line.
3657 * **Note:** This will not affect `process.argv`. The intended usage of this
3658 * function is to control Chromium's behavior.
3660 removeSwitch(the_switch: string): void;
3663 interface ContentTracing {
3665 // Docs: https://electronjs.org/docs/api/content-tracing
3668 * resolves with an array of category groups once all child processes have
3669 * acknowledged the `getCategories` request
3671 * Get a set of category groups. The category groups can change as new code paths
3672 * are reached. See also the list of built-in tracing categories.
3674 * > **NOTE:** Electron adds a non-default tracing category called `"electron"`.
3675 * This category can be used to capture Electron-specific tracing events.
3677 getCategories(): Promise<string[]>;
3679 * Resolves with an object containing the `value` and `percentage` of trace buffer
3683 * * `percentage` number
3685 * Get the maximum usage across processes of trace buffer as a percentage of the
3688 getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
3690 * resolved once all child processes have acknowledged the `startRecording`
3693 * Start recording on all processes.
3695 * Recording begins immediately locally and asynchronously on child processes as
3696 * soon as they receive the EnableRecording request.
3698 * If a recording is already running, the promise will be immediately resolved, as
3699 * only one trace operation can be in progress at a time.
3701 startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
3703 * resolves with a path to a file that contains the traced data once all child
3704 * processes have acknowledged the `stopRecording` request
3706 * Stop recording on all processes.
3708 * Child processes typically cache trace data and only rarely flush and send trace
3709 * data back to the main process. This helps to minimize the runtime overhead of
3710 * tracing since sending trace data over IPC can be an expensive operation. So, to
3711 * end tracing, Chromium asynchronously asks all child processes to flush any
3712 * pending trace data.
3714 * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
3715 * or not provided, trace data will be written to a temporary file, and the path
3716 * will be returned in the promise.
3718 stopRecording(resultFilePath?: string): Promise<string>;
3721 interface ContextBridge {
3723 // Docs: https://electronjs.org/docs/api/context-bridge
3725 exposeInIsolatedWorld(worldId: number, apiKey: string, api: any): void;
3726 exposeInMainWorld(apiKey: string, api: any): void;
3731 // Docs: https://electronjs.org/docs/api/structures/cookie
3734 * The domain of the cookie; this will be normalized with a preceding dot so that
3735 * it's also valid for subdomains.
3739 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
3740 * Not provided for session cookies.
3742 expirationDate?: number;
3744 * Whether the cookie is a host-only cookie; this will only be `true` if no domain
3749 * Whether the cookie is marked as HTTP only.
3753 * The name of the cookie.
3757 * The path of the cookie.
3761 * The Same Site policy applied to this cookie. Can be `unspecified`,
3762 * `no_restriction`, `lax` or `strict`.
3764 sameSite: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
3766 * Whether the cookie is marked as secure.
3770 * Whether the cookie is a session cookie or a persistent cookie with an expiration
3775 * The value of the cookie.
3780 class Cookies extends NodeEventEmitter {
3782 // Docs: https://electronjs.org/docs/api/cookies
3785 * Emitted when a cookie is changed because it was added, edited, removed, or
3788 on(event: 'changed', listener: (event: Event,
3790 * The cookie that was changed.
3794 * The cause of the change with one of the following values:
3796 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
3798 * `true` if the cookie was removed, `false` otherwise.
3800 removed: boolean) => void): this;
3801 once(event: 'changed', listener: (event: Event,
3803 * The cookie that was changed.
3807 * The cause of the change with one of the following values:
3809 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
3811 * `true` if the cookie was removed, `false` otherwise.
3813 removed: boolean) => void): this;
3814 addListener(event: 'changed', listener: (event: Event,
3816 * The cookie that was changed.
3820 * The cause of the change with one of the following values:
3822 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
3824 * `true` if the cookie was removed, `false` otherwise.
3826 removed: boolean) => void): this;
3827 removeListener(event: 'changed', listener: (event: Event,
3829 * The cookie that was changed.
3833 * The cause of the change with one of the following values:
3835 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
3837 * `true` if the cookie was removed, `false` otherwise.
3839 removed: boolean) => void): this;
3841 * A promise which resolves when the cookie store has been flushed
3843 * Writes any unwritten cookies data to disk.
3845 flushStore(): Promise<void>;
3847 * A promise which resolves an array of cookie objects.
3849 * Sends a request to get all cookies matching `filter`, and resolves a promise
3850 * with the response.
3852 get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
3854 * A promise which resolves when the cookie has been removed
3856 * Removes the cookies matching `url` and `name`
3858 remove(url: string, name: string): Promise<void>;
3860 * A promise which resolves when the cookie has been set
3862 * Sets a cookie with `details`.
3864 set(details: CookiesSetDetails): Promise<void>;
3867 interface CPUUsage {
3869 // Docs: https://electronjs.org/docs/api/structures/cpu-usage
3872 * The number of average idle CPU wakeups per second since the last call to
3873 * getCPUUsage. First call returns 0. Will always return 0 on Windows.
3875 idleWakeupsPerSecond: number;
3877 * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
3879 percentCPUUsage: number;
3882 interface CrashReport {
3884 // Docs: https://electronjs.org/docs/api/structures/crash-report
3890 interface CrashReporter {
3892 // Docs: https://electronjs.org/docs/api/crash-reporter
3895 * Set an extra parameter to be sent with the crash report. The values specified
3896 * here will be sent in addition to any values set via the `extra` option when
3897 * `start` was called.
3899 * Parameters added in this fashion (or via the `extra` parameter to
3900 * `crashReporter.start`) are specific to the calling process. Adding extra
3901 * parameters in the main process will not cause those parameters to be sent along
3902 * with crashes from renderer or other child processes. Similarly, adding extra
3903 * parameters in a renderer process will not result in those parameters being sent
3904 * with crashes that occur in other renderer processes or in the main process.
3906 * **Note:** Parameters have limits on the length of the keys and values. Key names
3907 * must be no longer than 39 bytes, and values must be no longer than 20320 bytes.
3908 * Keys with names longer than the maximum will be silently ignored. Key values
3909 * longer than the maximum length will be truncated.
3911 addExtraParameter(key: string, value: string): void;
3913 * The date and ID of the last crash report. Only crash reports that have been
3914 * uploaded will be returned; even if a crash report is present on disk it will not
3915 * be returned until it is uploaded. In the case that there are no uploaded
3916 * reports, `null` is returned.
3918 * **Note:** This method is only available in the main process.
3920 getLastCrashReport(): CrashReport;
3922 * The current 'extra' parameters of the crash reporter.
3924 getParameters(): Record<string, string>;
3926 * Returns all uploaded crash reports. Each report contains the date and uploaded
3929 * **Note:** This method is only available in the main process.
3931 getUploadedReports(): CrashReport[];
3933 * Whether reports should be submitted to the server. Set through the `start`
3934 * method or `setUploadToServer`.
3936 * **Note:** This method is only available in the main process.
3938 getUploadToServer(): boolean;
3940 * Remove an extra parameter from the current set of parameters. Future crashes
3941 * will not include this parameter.
3943 removeExtraParameter(key: string): void;
3945 * This would normally be controlled by user preferences. This has no effect if
3946 * called before `start` is called.
3948 * **Note:** This method is only available in the main process.
3950 setUploadToServer(uploadToServer: boolean): void;
3952 * This method must be called before using any other `crashReporter` APIs. Once
3953 * initialized this way, the crashpad handler collects crashes from all
3954 * subsequently created processes. The crash reporter cannot be disabled once
3957 * This method should be called as early as possible in app startup, preferably
3958 * before `app.on('ready')`. If the crash reporter is not initialized at the time a
3959 * renderer process is created, then that renderer process will not be monitored by
3960 * the crash reporter.
3962 * **Note:** You can test out the crash reporter by generating a crash using
3963 * `process.crash()`.
3965 * **Note:** If you need to send additional/updated `extra` parameters after your
3966 * first call `start` you can call `addExtraParameter`.
3968 * **Note:** Parameters passed in `extra`, `globalExtra` or set with
3969 * `addExtraParameter` have limits on the length of the keys and values. Key names
3970 * must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys
3971 * with names longer than the maximum will be silently ignored. Key values longer
3972 * than the maximum length will be truncated.
3974 * **Note:** This method is only available in the main process.
3976 start(options: CrashReporterStartOptions): void;
3979 interface CustomScheme {
3981 // Docs: https://electronjs.org/docs/api/structures/custom-scheme
3983 privileges?: Privileges;
3985 * Custom schemes to be registered with options.
3990 class Debugger extends NodeEventEmitter {
3992 // Docs: https://electronjs.org/docs/api/debugger
3995 * Emitted when the debugging session is terminated. This happens either when
3996 * `webContents` is closed or devtools is invoked for the attached `webContents`.
3998 on(event: 'detach', listener: (event: Event,
4000 * Reason for detaching debugger.
4002 reason: string) => void): this;
4003 once(event: 'detach', listener: (event: Event,
4005 * Reason for detaching debugger.
4007 reason: string) => void): this;
4008 addListener(event: 'detach', listener: (event: Event,
4010 * Reason for detaching debugger.
4012 reason: string) => void): this;
4013 removeListener(event: 'detach', listener: (event: Event,
4015 * Reason for detaching debugger.
4017 reason: string) => void): this;
4019 * Emitted whenever the debugging target issues an instrumentation event.
4021 on(event: 'message', listener: (event: Event,
4027 * Event parameters defined by the 'parameters' attribute in the remote debugging
4032 * Unique identifier of attached debugging session, will match the value sent from
4033 * `debugger.sendCommand`.
4035 sessionId: string) => void): this;
4036 once(event: 'message', listener: (event: Event,
4042 * Event parameters defined by the 'parameters' attribute in the remote debugging
4047 * Unique identifier of attached debugging session, will match the value sent from
4048 * `debugger.sendCommand`.
4050 sessionId: string) => void): this;
4051 addListener(event: 'message', listener: (event: Event,
4057 * Event parameters defined by the 'parameters' attribute in the remote debugging
4062 * Unique identifier of attached debugging session, will match the value sent from
4063 * `debugger.sendCommand`.
4065 sessionId: string) => void): this;
4066 removeListener(event: 'message', listener: (event: Event,
4072 * Event parameters defined by the 'parameters' attribute in the remote debugging
4077 * Unique identifier of attached debugging session, will match the value sent from
4078 * `debugger.sendCommand`.
4080 sessionId: string) => void): this;
4082 * Attaches the debugger to the `webContents`.
4084 attach(protocolVersion?: string): void;
4086 * Detaches the debugger from the `webContents`.
4090 * Whether a debugger is attached to the `webContents`.
4092 isAttached(): boolean;
4094 * A promise that resolves with the response defined by the 'returns' attribute of
4095 * the command description in the remote debugging protocol or is rejected
4096 * indicating the failure of the command.
4098 * Send given command to the debugging target.
4100 sendCommand(method: string, commandParams?: any, sessionId?: string): Promise<any>;
4103 interface DesktopCapturer {
4105 // Docs: https://electronjs.org/docs/api/desktop-capturer
4108 * Resolves with an array of `DesktopCapturerSource` objects, each
4109 * `DesktopCapturerSource` represents a screen or an individual window that can be
4112 * **Note** Capturing the screen contents requires user consent on macOS 10.15
4113 * Catalina or higher, which can detected by
4114 * `systemPreferences.getMediaAccessStatus`.
4116 getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
4119 interface DesktopCapturerSource {
4121 // Docs: https://electronjs.org/docs/api/structures/desktop-capturer-source
4124 * An icon image of the application that owns the window or null if the source has
4125 * a type screen. The size of the icon is not known in advance and depends on what
4126 * the application provides.
4128 appIcon: NativeImage;
4130 * A unique identifier that will correspond to the `id` of the matching Display
4131 * returned by the Screen API. On some platforms, this is equivalent to the `XX`
4132 * portion of the `id` field above and on others it will differ. It will be an
4133 * empty string if not available.
4137 * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
4138 * constraint when calling `navigator.getUserMedia`. The format of the identifier
4139 * will be `window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle. YY is 1 for
4140 * the current process, and 0 for all others. ZZ is a sequential number that
4141 * represents the screen, and it does not equal to the index in the source's name.
4145 * A screen source will be named either `Entire Screen` or `Screen <index>`, while
4146 * the name of a window source will match the window title.
4150 * A thumbnail image. **Note:** There is no guarantee that the size of the
4151 * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
4152 * to `desktopCapturer.getSources`. The actual size depends on the scale of the
4155 thumbnail: NativeImage;
4160 // Docs: https://electronjs.org/docs/api/dialog
4163 * resolves when the certificate trust dialog is shown.
4165 * On macOS, this displays a modal dialog that shows a message and certificate
4166 * information, and gives the user the option of trusting/importing the
4167 * certificate. If you provide a `browserWindow` argument the dialog will be
4168 * attached to the parent window, making it modal.
4170 * On Windows the options are more limited, due to the Win32 APIs used:
4172 * * The `message` argument is not used, as the OS provides its own confirmation
4174 * * The `browserWindow` argument is ignored since it is not possible to make this
4175 * confirmation dialog modal.
4177 * @platform darwin,win32
4179 showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
4181 * resolves when the certificate trust dialog is shown.
4183 * On macOS, this displays a modal dialog that shows a message and certificate
4184 * information, and gives the user the option of trusting/importing the
4185 * certificate. If you provide a `browserWindow` argument the dialog will be
4186 * attached to the parent window, making it modal.
4188 * On Windows the options are more limited, due to the Win32 APIs used:
4190 * * The `message` argument is not used, as the OS provides its own confirmation
4192 * * The `browserWindow` argument is ignored since it is not possible to make this
4193 * confirmation dialog modal.
4195 * @platform darwin,win32
4197 showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
4199 * Displays a modal dialog that shows an error message.
4201 * This API can be called safely before the `ready` event the `app` module emits,
4202 * it is usually used to report errors in early stage of startup. If called before
4203 * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
4204 * dialog will appear.
4206 showErrorBox(title: string, content: string): void;
4208 * resolves with a promise containing the following properties:
4210 * * `response` number - The index of the clicked button.
4211 * * `checkboxChecked` boolean - The checked state of the checkbox if
4212 * `checkboxLabel` was set. Otherwise `false`.
4214 * Shows a message box.
4216 * The `browserWindow` argument allows the dialog to attach itself to a parent
4217 * window, making it modal.
4219 showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
4221 * resolves with a promise containing the following properties:
4223 * * `response` number - The index of the clicked button.
4224 * * `checkboxChecked` boolean - The checked state of the checkbox if
4225 * `checkboxLabel` was set. Otherwise `false`.
4227 * Shows a message box.
4229 * The `browserWindow` argument allows the dialog to attach itself to a parent
4230 * window, making it modal.
4232 showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
4234 * the index of the clicked button.
4236 * Shows a message box, it will block the process until the message box is closed.
4237 * It returns the index of the clicked button.
4239 * The `browserWindow` argument allows the dialog to attach itself to a parent
4240 * window, making it modal. If `browserWindow` is not shown dialog will not be
4241 * attached to it. In such case it will be displayed as an independent window.
4243 showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
4245 * the index of the clicked button.
4247 * Shows a message box, it will block the process until the message box is closed.
4248 * It returns the index of the clicked button.
4250 * The `browserWindow` argument allows the dialog to attach itself to a parent
4251 * window, making it modal. If `browserWindow` is not shown dialog will not be
4252 * attached to it. In such case it will be displayed as an independent window.
4254 showMessageBoxSync(options: MessageBoxSyncOptions): number;
4256 * Resolve with an object containing the following:
4258 * * `canceled` boolean - whether or not the dialog was canceled.
4259 * * `filePaths` string[] - An array of file paths chosen by the user. If the
4260 * dialog is cancelled this will be an empty array.
4261 * * `bookmarks` string[] (optional) _macOS_ _mas_ - An array matching the
4262 * `filePaths` array of base64 encoded strings which contains security scoped
4263 * bookmark data. `securityScopedBookmarks` must be enabled for this to be
4264 * populated. (For return values, see table here.)
4266 * The `browserWindow` argument allows the dialog to attach itself to a parent
4267 * window, making it modal.
4269 * The `filters` specifies an array of file types that can be displayed or selected
4270 * when you want to limit the user to a specific type. For example:
4272 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4273 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4274 * `'*'` wildcard (no other wildcard is supported).
4276 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4277 * and a directory selector, so if you set `properties` to `['openFile',
4278 * 'openDirectory']` on these platforms, a directory selector will be shown.
4280 showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
4282 * Resolve with an object containing the following:
4284 * * `canceled` boolean - whether or not the dialog was canceled.
4285 * * `filePaths` string[] - An array of file paths chosen by the user. If the
4286 * dialog is cancelled this will be an empty array.
4287 * * `bookmarks` string[] (optional) _macOS_ _mas_ - An array matching the
4288 * `filePaths` array of base64 encoded strings which contains security scoped
4289 * bookmark data. `securityScopedBookmarks` must be enabled for this to be
4290 * populated. (For return values, see table here.)
4292 * The `browserWindow` argument allows the dialog to attach itself to a parent
4293 * window, making it modal.
4295 * The `filters` specifies an array of file types that can be displayed or selected
4296 * when you want to limit the user to a specific type. For example:
4298 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4299 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4300 * `'*'` wildcard (no other wildcard is supported).
4302 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4303 * and a directory selector, so if you set `properties` to `['openFile',
4304 * 'openDirectory']` on these platforms, a directory selector will be shown.
4306 showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
4308 * the file paths chosen by the user; if the dialog is cancelled it returns
4311 * The `browserWindow` argument allows the dialog to attach itself to a parent
4312 * window, making it modal.
4314 * The `filters` specifies an array of file types that can be displayed or selected
4315 * when you want to limit the user to a specific type. For example:
4317 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4318 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4319 * `'*'` wildcard (no other wildcard is supported).
4321 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4322 * and a directory selector, so if you set `properties` to `['openFile',
4323 * 'openDirectory']` on these platforms, a directory selector will be shown.
4325 showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
4327 * the file paths chosen by the user; if the dialog is cancelled it returns
4330 * The `browserWindow` argument allows the dialog to attach itself to a parent
4331 * window, making it modal.
4333 * The `filters` specifies an array of file types that can be displayed or selected
4334 * when you want to limit the user to a specific type. For example:
4336 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4337 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4338 * `'*'` wildcard (no other wildcard is supported).
4340 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4341 * and a directory selector, so if you set `properties` to `['openFile',
4342 * 'openDirectory']` on these platforms, a directory selector will be shown.
4344 showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
4346 * Resolve with an object containing the following:
4348 * * `canceled` boolean - whether or not the dialog was canceled.
4349 * * `filePath` string (optional) - If the dialog is canceled, this will be
4351 * * `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which
4352 * contains the security scoped bookmark data for the saved file.
4353 * `securityScopedBookmarks` must be enabled for this to be present. (For return
4354 * values, see table here.)
4356 * The `browserWindow` argument allows the dialog to attach itself to a parent
4357 * window, making it modal.
4359 * The `filters` specifies an array of file types that can be displayed, see
4360 * `dialog.showOpenDialog` for an example.
4362 * **Note:** On macOS, using the asynchronous version is recommended to avoid
4363 * issues when expanding and collapsing the dialog.
4365 showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
4367 * Resolve with an object containing the following:
4369 * * `canceled` boolean - whether or not the dialog was canceled.
4370 * * `filePath` string (optional) - If the dialog is canceled, this will be
4372 * * `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which
4373 * contains the security scoped bookmark data for the saved file.
4374 * `securityScopedBookmarks` must be enabled for this to be present. (For return
4375 * values, see table here.)
4377 * The `browserWindow` argument allows the dialog to attach itself to a parent
4378 * window, making it modal.
4380 * The `filters` specifies an array of file types that can be displayed, see
4381 * `dialog.showOpenDialog` for an example.
4383 * **Note:** On macOS, using the asynchronous version is recommended to avoid
4384 * issues when expanding and collapsing the dialog.
4386 showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
4388 * the path of the file chosen by the user; if the dialog is cancelled it returns
4391 * The `browserWindow` argument allows the dialog to attach itself to a parent
4392 * window, making it modal.
4394 * The `filters` specifies an array of file types that can be displayed, see
4395 * `dialog.showOpenDialog` for an example.
4397 showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined);
4399 * the path of the file chosen by the user; if the dialog is cancelled it returns
4402 * The `browserWindow` argument allows the dialog to attach itself to a parent
4403 * window, making it modal.
4405 * The `filters` specifies an array of file types that can be displayed, see
4406 * `dialog.showOpenDialog` for an example.
4408 showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined);
4413 // Docs: https://electronjs.org/docs/api/structures/display
4416 * Can be `available`, `unavailable`, `unknown`.
4418 accelerometerSupport: ('available' | 'unavailable' | 'unknown');
4420 * the bounds of the display in DIP points.
4424 * The number of bits per pixel.
4428 * represent a color space (three-dimensional object which contains all realizable
4429 * color combinations) for the purpose of color conversions
4433 * The number of bits per color component.
4435 depthPerComponent: number;
4437 * The display refresh rate.
4439 displayFrequency: number;
4441 * Unique identifier associated with the display.
4445 * `true` for an internal display and `false` for an external display
4449 * Whether or not the display is a monochrome display.
4451 monochrome: boolean;
4453 * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
4457 * Output device's pixel scale factor.
4459 scaleFactor: number;
4462 * Can be `available`, `unavailable`, `unknown`.
4464 touchSupport: ('available' | 'unavailable' | 'unknown');
4466 * the work area of the display in DIP points.
4468 workArea: Rectangle;
4474 // Docs: https://electronjs.org/docs/api/dock
4477 * an ID representing the request.
4479 * When `critical` is passed, the dock icon will bounce until either the
4480 * application becomes active or the request is canceled.
4482 * When `informational` is passed, the dock icon will bounce for one second.
4483 * However, the request remains active until either the application becomes active
4484 * or the request is canceled.
4486 * **Note:** This method can only be used while the app is not focused; when the
4487 * app is focused it will return -1.
4491 bounce(type?: 'critical' | 'informational'): number;
4493 * Cancel the bounce of `id`.
4497 cancelBounce(id: number): void;
4499 * Bounces the Downloads stack if the filePath is inside the Downloads folder.
4503 downloadFinished(filePath: string): void;
4505 * The badge string of the dock.
4511 * The application's dock menu.
4515 getMenu(): (Menu) | (null);
4517 * Hides the dock icon.
4523 * Whether the dock icon is visible.
4527 isVisible(): boolean;
4529 * Sets the string to be displayed in the dock’s badging area.
4533 setBadge(text: string): void;
4535 * Sets the `image` associated with this dock icon.
4539 setIcon(image: (NativeImage) | (string)): void;
4541 * Sets the application's dock menu.
4545 setMenu(menu: Menu): void;
4547 * Resolves when the dock icon is shown.
4551 show(): Promise<void>;
4554 class DownloadItem extends NodeEventEmitter {
4556 // Docs: https://electronjs.org/docs/api/download-item
4559 * Emitted when the download is in a terminal state. This includes a completed
4560 * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
4561 * download that can't be resumed.
4563 * The `state` can be one of following:
4565 * * `completed` - The download completed successfully.
4566 * * `cancelled` - The download has been cancelled.
4567 * * `interrupted` - The download has interrupted and can not resume.
4569 on(event: 'done', listener: (event: Event,
4571 * Can be `completed`, `cancelled` or `interrupted`.
4573 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4574 once(event: 'done', listener: (event: Event,
4576 * Can be `completed`, `cancelled` or `interrupted`.
4578 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4579 addListener(event: 'done', listener: (event: Event,
4581 * Can be `completed`, `cancelled` or `interrupted`.
4583 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4584 removeListener(event: 'done', listener: (event: Event,
4586 * Can be `completed`, `cancelled` or `interrupted`.
4588 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4590 * Emitted when the download has been updated and is not done.
4592 * The `state` can be one of following:
4594 * * `progressing` - The download is in-progress.
4595 * * `interrupted` - The download has interrupted and can be resumed.
4597 on(event: 'updated', listener: (event: Event,
4599 * Can be `progressing` or `interrupted`.
4601 state: ('progressing' | 'interrupted')) => void): this;
4602 once(event: 'updated', listener: (event: Event,
4604 * Can be `progressing` or `interrupted`.
4606 state: ('progressing' | 'interrupted')) => void): this;
4607 addListener(event: 'updated', listener: (event: Event,
4609 * Can be `progressing` or `interrupted`.
4611 state: ('progressing' | 'interrupted')) => void): this;
4612 removeListener(event: 'updated', listener: (event: Event,
4614 * Can be `progressing` or `interrupted`.
4616 state: ('progressing' | 'interrupted')) => void): this;
4618 * Cancels the download operation.
4622 * Whether the download can resume.
4624 canResume(): boolean;
4626 * The Content-Disposition field from the response header.
4628 getContentDisposition(): string;
4630 * ETag header value.
4634 * The file name of the download item.
4636 * **Note:** The file name is not always the same as the actual one saved in local
4637 * disk. If user changes the file name in a prompted download saving dialog, the
4638 * actual name of saved file will be different.
4640 getFilename(): string;
4642 * Last-Modified header value.
4644 getLastModifiedTime(): string;
4646 * The files mime type.
4648 getMimeType(): string;
4650 * The received bytes of the download item.
4652 getReceivedBytes(): number;
4654 * Returns the object previously set by
4655 * `downloadItem.setSaveDialogOptions(options)`.
4657 getSaveDialogOptions(): SaveDialogOptions;
4659 * The save path of the download item. This will be either the path set via
4660 * `downloadItem.setSavePath(path)` or the path selected from the shown save
4663 getSavePath(): string;
4665 * Number of seconds since the UNIX epoch when the download was started.
4667 getStartTime(): number;
4669 * The current state. Can be `progressing`, `completed`, `cancelled` or
4672 * **Note:** The following methods are useful specifically to resume a `cancelled`
4673 * item when session is restarted.
4675 getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
4677 * The total size in bytes of the download item.
4679 * If the size is unknown, it returns 0.
4681 getTotalBytes(): number;
4683 * The origin URL where the item is downloaded from.
4687 * The complete URL chain of the item including any redirects.
4689 getURLChain(): string[];
4691 * Whether the download has user gesture.
4693 hasUserGesture(): boolean;
4695 * Whether the download is paused.
4697 isPaused(): boolean;
4699 * Pauses the download.
4703 * Resumes the download that has been paused.
4705 * **Note:** To enable resumable downloads the server you are downloading from must
4706 * support range requests and provide both `Last-Modified` and `ETag` header
4707 * values. Otherwise `resume()` will dismiss previously received bytes and restart
4708 * the download from the beginning.
4712 * This API allows the user to set custom options for the save dialog that opens
4713 * for the download item by default. The API is only available in session's
4714 * `will-download` callback function.
4716 setSaveDialogOptions(options: SaveDialogOptions): void;
4718 * The API is only available in session's `will-download` callback function. If
4719 * `path` doesn't exist, Electron will try to make the directory recursively. If
4720 * user doesn't set the save path via the API, Electron will use the original
4721 * routine to determine the save path; this usually prompts a save dialog.
4723 setSavePath(path: string): void;
4725 * A `string` property that determines the save file path of the download item.
4727 * The property is only available in session's `will-download` callback function.
4728 * If user doesn't set the save path via the property, Electron will use the
4729 * original routine to determine the save path; this usually prompts a save dialog.
4734 interface Event extends GlobalEvent {
4736 // Docs: https://electronjs.org/docs/api/structures/event
4738 preventDefault: (() => void);
4741 interface Extension {
4743 // Docs: https://electronjs.org/docs/api/structures/extension
4747 * Copy of the extension's manifest data.
4752 * The extension's file path.
4756 * The extension's `chrome-extension://` URL.
4762 interface ExtensionInfo {
4764 // Docs: https://electronjs.org/docs/api/structures/extension-info
4770 interface FileFilter {
4772 // Docs: https://electronjs.org/docs/api/structures/file-filter
4774 extensions: string[];
4778 interface FilePathWithHeaders {
4780 // Docs: https://electronjs.org/docs/api/structures/file-path-with-headers
4783 * Additional headers to be sent.
4785 headers?: Record<string, string>;
4787 * The path to the file to send.
4792 interface GlobalShortcut {
4794 // Docs: https://electronjs.org/docs/api/global-shortcut
4797 * Whether this application has registered `accelerator`.
4799 * When the accelerator is already taken by other applications, this call will
4800 * still return `false`. This behavior is intended by operating systems, since they
4801 * don't want applications to fight for global shortcuts.
4803 isRegistered(accelerator: Accelerator): boolean;
4805 * Whether or not the shortcut was registered successfully.
4807 * Registers a global shortcut of `accelerator`. The `callback` is called when the
4808 * registered shortcut is pressed by the user.
4810 * When the accelerator is already taken by other applications, this call will
4811 * silently fail. This behavior is intended by operating systems, since they don't
4812 * want applications to fight for global shortcuts.
4814 * The following accelerators will not be registered successfully on macOS 10.14
4815 * Mojave unless the app has been authorized as a trusted accessibility client:
4817 * * "Media Play/Pause"
4818 * * "Media Next Track"
4819 * * "Media Previous Track"
4822 register(accelerator: Accelerator, callback: () => void): boolean;
4824 * Registers a global shortcut of all `accelerator` items in `accelerators`. The
4825 * `callback` is called when any of the registered shortcuts are pressed by the
4828 * When a given accelerator is already taken by other applications, this call will
4829 * silently fail. This behavior is intended by operating systems, since they don't
4830 * want applications to fight for global shortcuts.
4832 * The following accelerators will not be registered successfully on macOS 10.14
4833 * Mojave unless the app has been authorized as a trusted accessibility client:
4835 * * "Media Play/Pause"
4836 * * "Media Next Track"
4837 * * "Media Previous Track"
4840 registerAll(accelerators: string[], callback: () => void): void;
4842 * Unregisters the global shortcut of `accelerator`.
4844 unregister(accelerator: Accelerator): void;
4846 * Unregisters all of the global shortcuts.
4848 unregisterAll(): void;
4851 interface GPUFeatureStatus {
4853 // Docs: https://electronjs.org/docs/api/structures/gpu-feature-status
4858 '2d_canvas': string;
4866 flash_stage3d: string;
4868 * Flash Stage3D Baseline profile.
4870 flash_stage3d_baseline: string;
4874 gpu_compositing: string;
4876 * Multiple Raster Threads.
4878 multiple_raster_threads: string;
4880 * Native GpuMemoryBuffers.
4882 native_gpu_memory_buffers: string;
4886 rasterization: string;
4890 video_decode: string;
4894 video_encode: string;
4909 interface HIDDevice {
4911 // Docs: https://electronjs.org/docs/api/structures/hid-device
4914 * Unique identifier for the device.
4918 * Unique identifier for the HID interface. A device may have multiple HID
4923 * Name of the device.
4927 * The USB product ID.
4931 * The USB device serial number.
4933 serialNumber?: string;
4935 * The USB vendor ID.
4940 interface InAppPurchase extends NodeJS.EventEmitter {
4942 // Docs: https://electronjs.org/docs/api/in-app-purchase
4944 on(event: 'transactions-updated', listener: Function): this;
4945 once(event: 'transactions-updated', listener: Function): this;
4946 addListener(event: 'transactions-updated', listener: Function): this;
4947 removeListener(event: 'transactions-updated', listener: Function): this;
4949 * whether a user can make a payment.
4951 canMakePayments(): boolean;
4953 * Completes all pending transactions.
4955 finishAllTransactions(): void;
4957 * Completes the pending transactions corresponding to the date.
4959 finishTransactionByDate(date: string): void;
4961 * Resolves with an array of `Product` objects.
4963 * Retrieves the product descriptions.
4965 getProducts(productIDs: string[]): Promise<Electron.Product[]>;
4967 * the path to the receipt.
4969 getReceiptURL(): string;
4971 * Returns `true` if the product is valid and added to the payment queue.
4973 * You should listen for the `transactions-updated` event as soon as possible and
4974 * certainly before you call `purchaseProduct`.
4976 purchaseProduct(productID: string, quantity?: number): Promise<boolean>;
4978 * Restores finished transactions. This method can be called either to install
4979 * purchases on additional devices, or to restore purchases for an application that
4980 * the user deleted and reinstalled.
4982 * The payment queue delivers a new transaction for each previously completed
4983 * transaction that can be restored. Each transaction includes a copy of the
4984 * original transaction.
4986 restoreCompletedTransactions(): void;
4989 class IncomingMessage extends NodeEventEmitter {
4991 // Docs: https://electronjs.org/docs/api/incoming-message
4994 * Emitted when a request has been canceled during an ongoing HTTP transaction.
4996 on(event: 'aborted', listener: Function): this;
4997 once(event: 'aborted', listener: Function): this;
4998 addListener(event: 'aborted', listener: Function): this;
4999 removeListener(event: 'aborted', listener: Function): this;
5001 * The `data` event is the usual method of transferring response data into
5004 on(event: 'data', listener: (
5006 * A chunk of response body's data.
5008 chunk: Buffer) => void): this;
5009 once(event: 'data', listener: (
5011 * A chunk of response body's data.
5013 chunk: Buffer) => void): this;
5014 addListener(event: 'data', listener: (
5016 * A chunk of response body's data.
5018 chunk: Buffer) => void): this;
5019 removeListener(event: 'data', listener: (
5021 * A chunk of response body's data.
5023 chunk: Buffer) => void): this;
5025 * Indicates that response body has ended. Must be placed before 'data' event.
5027 on(event: 'end', listener: Function): this;
5028 once(event: 'end', listener: Function): this;
5029 addListener(event: 'end', listener: Function): this;
5030 removeListener(event: 'end', listener: Function): this;
5034 * `error` Error - Typically holds an error string identifying failure root cause.
5036 * Emitted when an error was encountered while streaming response data events. For
5037 * instance, if the server closes the underlying while the response is still
5038 * streaming, an `error` event will be emitted on the response object and a `close`
5039 * event will subsequently follow on the request object.
5041 on(event: 'error', listener: Function): this;
5042 once(event: 'error', listener: Function): this;
5043 addListener(event: 'error', listener: Function): this;
5044 removeListener(event: 'error', listener: Function): this;
5046 * A `Record<string, string | string[]>` representing the HTTP response headers.
5047 * The `headers` object is formatted as follows:
5049 * * All header names are lowercased.
5050 * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,
5051 * `etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,
5052 * `last-modified`, `location`, `max-forwards`, `proxy-authorization`, `referer`,
5053 * `retry-after`, `server`, or `user-agent` are discarded.
5054 * * `set-cookie` is always an array. Duplicates are added to the array.
5055 * * For duplicate `cookie` headers, the values are joined together with '; '.
5056 * * For all other headers, the values are joined together with ', '.
5058 headers: Record<string, (string) | (string[])>;
5060 * A `string` indicating the HTTP protocol version number. Typical values are '1.0'
5061 * or '1.1'. Additionally `httpVersionMajor` and `httpVersionMinor` are two
5062 * Integer-valued readable properties that return respectively the HTTP major and
5063 * minor version numbers.
5065 httpVersion: string;
5067 * An `Integer` indicating the HTTP protocol major version number.
5069 httpVersionMajor: number;
5071 * An `Integer` indicating the HTTP protocol minor version number.
5073 httpVersionMinor: number;
5075 * A `string[]` containing the raw HTTP response headers exactly as they were
5076 * received. The keys and values are in the same list. It is not a list of tuples.
5077 * So, the even-numbered offsets are key values, and the odd-numbered offsets are
5078 * the associated values. Header names are not lowercased, and duplicates are not
5081 rawHeaders: string[];
5083 * An `Integer` indicating the HTTP response status code.
5087 * A `string` representing the HTTP status message.
5089 statusMessage: string;
5092 interface InputEvent {
5094 // Docs: https://electronjs.org/docs/api/structures/input-event
5097 * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
5098 * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
5099 * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
5101 modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
5103 * Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`,
5104 * `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`,
5105 * `char`, `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`,
5106 * `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`,
5107 * `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`,
5108 * `gestureTap`, `gestureTapCancel`, `gestureShortPress`, `gestureLongPress`,
5109 * `gestureLongTap`, `gestureTwoFingerTap`, `gestureTapUnconfirmed`,
5110 * `gestureDoubleTap`, `touchStart`, `touchMove`, `touchEnd`, `touchCancel`,
5111 * `touchScrollStarted`, `pointerDown`, `pointerUp`, `pointerMove`,
5112 * `pointerRawUpdate`, `pointerCancel` or `pointerCausedUaAction`.
5114 type: ('undefined' | 'mouseDown' | 'mouseUp' | 'mouseMove' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'rawKeyDown' | 'keyDown' | 'keyUp' | 'char' | 'gestureScrollBegin' | 'gestureScrollEnd' | 'gestureScrollUpdate' | 'gestureFlingStart' | 'gestureFlingCancel' | 'gesturePinchBegin' | 'gesturePinchEnd' | 'gesturePinchUpdate' | 'gestureTapDown' | 'gestureShowPress' | 'gestureTap' | 'gestureTapCancel' | 'gestureShortPress' | 'gestureLongPress' | 'gestureLongTap' | 'gestureTwoFingerTap' | 'gestureTapUnconfirmed' | 'gestureDoubleTap' | 'touchStart' | 'touchMove' | 'touchEnd' | 'touchCancel' | 'touchScrollStarted' | 'pointerDown' | 'pointerUp' | 'pointerMove' | 'pointerRawUpdate' | 'pointerCancel' | 'pointerCausedUaAction');
5117 interface IOCounters {
5119 // Docs: https://electronjs.org/docs/api/structures/io-counters
5122 * Then number of I/O other operations.
5124 otherOperationCount: number;
5126 * Then number of I/O other transfers.
5128 otherTransferCount: number;
5130 * The number of I/O read operations.
5132 readOperationCount: number;
5134 * The number of I/O read transfers.
5136 readTransferCount: number;
5138 * The number of I/O write operations.
5140 writeOperationCount: number;
5142 * The number of I/O write transfers.
5144 writeTransferCount: number;
5147 interface IpcMain extends NodeJS.EventEmitter {
5149 // Docs: https://electronjs.org/docs/api/ipc-main
5152 * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
5153 * renderer calls `ipcRenderer.invoke(channel, ...args)`.
5155 * If `listener` returns a Promise, the eventual result of the promise will be
5156 * returned as a reply to the remote caller. Otherwise, the return value of the
5157 * listener will be used as the value of the reply.
5159 * The `event` that is passed as the first argument to the handler is the same as
5160 * that passed to a regular event listener. It includes information about which
5161 * WebContents is the source of the invoke request.
5163 * Errors thrown through `handle` in the main process are not transparent as they
5164 * are serialized and only the `message` property from the original error is
5165 * provided to the renderer process. Please refer to #24427 for details.
5167 handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
5169 * Handles a single `invoke`able IPC message, then removes the listener. See
5170 * `ipcMain.handle(channel, listener)`.
5172 handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
5174 * Listens to `channel`, when a new message arrives `listener` would be called with
5175 * `listener(event, args...)`.
5177 on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
5179 * Adds a one time `listener` function for the event. This `listener` is invoked
5180 * only the next time a message is sent to `channel`, after which it is removed.
5182 once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
5184 * Removes listeners of the specified `channel`.
5186 removeAllListeners(channel?: string): this;
5188 * Removes any handler for `channel`, if present.
5190 removeHandler(channel: string): void;
5192 * Removes the specified `listener` from the listener array for the specified
5195 removeListener(channel: string, listener: (...args: any[]) => void): this;
5198 interface IpcMainEvent extends Event {
5200 // Docs: https://electronjs.org/docs/api/structures/ipc-main-event
5203 * The ID of the renderer frame that sent this message
5207 * A list of MessagePorts that were transferred with this message
5209 ports: MessagePortMain[];
5211 * The internal ID of the renderer process that sent this message
5215 * A function that will send an IPC message to the renderer frame that sent the
5216 * original message that you are currently handling. You should use this method to
5217 * "reply" to the sent message in order to guarantee the reply will go to the
5218 * correct process and frame.
5222 * Set this to the value to be returned in a synchronous message
5226 * Returns the `webContents` that sent the message
5228 sender: WebContents;
5230 * The frame that sent this message
5233 readonly senderFrame: WebFrameMain;
5236 interface IpcMainInvokeEvent extends Event {
5238 // Docs: https://electronjs.org/docs/api/structures/ipc-main-invoke-event
5241 * The ID of the renderer frame that sent this message
5245 * The internal ID of the renderer process that sent this message
5249 * Returns the `webContents` that sent the message
5251 sender: WebContents;
5253 * The frame that sent this message
5256 readonly senderFrame: WebFrameMain;
5259 interface IpcRenderer extends NodeJS.EventEmitter {
5261 // Docs: https://electronjs.org/docs/api/ipc-renderer
5264 * Resolves with the response from the main process.
5266 * Send a message to the main process via `channel` and expect a result
5267 * asynchronously. Arguments will be serialized with the Structured Clone
5268 * Algorithm, just like `window.postMessage`, so prototype chains will not be
5269 * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
5272 * The main process should listen for `channel` with `ipcMain.handle()`.
5276 * If you need to transfer a `MessagePort` to the main process, use
5277 * `ipcRenderer.postMessage`.
5279 * If you do not need a response to the message, consider using `ipcRenderer.send`.
5281 * > **Note** Sending non-standard JavaScript types such as DOM objects or special
5282 * Electron objects will throw an exception.
5284 * Since the main process does not have support for DOM objects such as
5285 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
5286 * Electron's IPC to the main process, as the main process would have no way to
5287 * decode them. Attempting to send such objects over IPC will result in an error.
5289 * > **Note** If the handler in the main process throws an error, the promise
5290 * returned by `invoke` will reject. However, the `Error` object in the renderer
5291 * process will not be the same as the one thrown in the main process.
5293 invoke(channel: string, ...args: any[]): Promise<any>;
5295 * Listens to `channel`, when a new message arrives `listener` would be called with
5296 * `listener(event, args...)`.
5298 on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
5300 * Adds a one time `listener` function for the event. This `listener` is invoked
5301 * only the next time a message is sent to `channel`, after which it is removed.
5303 once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
5305 * Send a message to the main process, optionally transferring ownership of zero or
5306 * more `MessagePort` objects.
5308 * The transferred `MessagePort` objects will be available in the main process as
5309 * `MessagePortMain` objects by accessing the `ports` property of the emitted
5314 * For more information on using `MessagePort` and `MessageChannel`, see the MDN
5317 postMessage(channel: string, message: any, transfer?: MessagePort[]): void;
5319 * Removes all listeners, or those of the specified `channel`.
5321 removeAllListeners(channel: string): this;
5323 * Removes the specified `listener` from the listener array for the specified
5326 removeListener(channel: string, listener: (...args: any[]) => void): this;
5328 * Send an asynchronous message to the main process via `channel`, along with
5329 * arguments. Arguments will be serialized with the Structured Clone Algorithm,
5330 * just like `window.postMessage`, so prototype chains will not be included.
5331 * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
5334 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
5335 * Electron objects will throw an exception.
5337 * Since the main process does not have support for DOM objects such as
5338 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
5339 * Electron's IPC to the main process, as the main process would have no way to
5340 * decode them. Attempting to send such objects over IPC will result in an error.
5342 * The main process handles it by listening for `channel` with the `ipcMain`
5345 * If you need to transfer a `MessagePort` to the main process, use
5346 * `ipcRenderer.postMessage`.
5348 * If you want to receive a single response from the main process, like the result
5349 * of a method call, consider using `ipcRenderer.invoke`.
5351 send(channel: string, ...args: any[]): void;
5353 * The value sent back by the `ipcMain` handler.
5355 * Send a message to the main process via `channel` and expect a result
5356 * synchronously. Arguments will be serialized with the Structured Clone Algorithm,
5357 * just like `window.postMessage`, so prototype chains will not be included.
5358 * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
5361 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
5362 * Electron objects will throw an exception.
5364 * Since the main process does not have support for DOM objects such as
5365 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
5366 * Electron's IPC to the main process, as the main process would have no way to
5367 * decode them. Attempting to send such objects over IPC will result in an error.
5369 * The main process handles it by listening for `channel` with `ipcMain` module,
5370 * and replies by setting `event.returnValue`.
5372 * > :warning: **WARNING**: Sending a synchronous message will block the whole
5373 * renderer process until the reply is received, so use this method only as a last
5374 * resort. It's much better to use the asynchronous version, `invoke()`.
5376 sendSync(channel: string, ...args: any[]): any;
5378 * Sends a message to a window with `webContentsId` via `channel`.
5380 sendTo(webContentsId: number, channel: string, ...args: any[]): void;
5382 * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
5383 * the host page instead of the main process.
5385 sendToHost(channel: string, ...args: any[]): void;
5388 interface IpcRendererEvent extends Event {
5390 // Docs: https://electronjs.org/docs/api/structures/ipc-renderer-event
5393 * A list of MessagePorts that were transferred with this message
5395 ports: MessagePort[];
5397 * The `IpcRenderer` instance that emitted the event originally
5399 sender: IpcRenderer;
5401 * The `webContents.id` that sent the message, you can call
5402 * `event.sender.sendTo(event.senderId, ...)` to reply to the message, see
5403 * ipcRenderer.sendTo for more information. This only applies to messages sent from
5404 * a different renderer. Messages sent directly from the main process set
5405 * `event.senderId` to `0`.
5410 interface JumpListCategory {
5412 // Docs: https://electronjs.org/docs/api/structures/jump-list-category
5415 * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
5416 * should be omitted.
5418 items?: JumpListItem[];
5420 * Must be set if `type` is `custom`, otherwise it should be omitted.
5424 * One of the following:
5426 type?: ('tasks' | 'frequent' | 'recent' | 'custom');
5429 interface JumpListItem {
5431 // Docs: https://electronjs.org/docs/api/structures/jump-list-item
5434 * The command line arguments when `program` is executed. Should only be set if
5439 * Description of the task (displayed in a tooltip). Should only be set if `type`
5440 * is `task`. Maximum length 260 characters.
5442 description?: string;
5444 * The index of the icon in the resource file. If a resource file contains multiple
5445 * icons this value can be used to specify the zero-based index of the icon that
5446 * should be displayed for this task. If a resource file contains only one icon,
5447 * this property should be set to zero.
5451 * The absolute path to an icon to be displayed in a Jump List, which can be an
5452 * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
5453 * can usually specify `process.execPath` to show the program icon.
5457 * Path of the file to open, should only be set if `type` is `file`.
5461 * Path of the program to execute, usually you should specify `process.execPath`
5462 * which opens the current program. Should only be set if `type` is `task`.
5466 * The text to be displayed for the item in the Jump List. Should only be set if
5471 * One of the following:
5473 type?: ('task' | 'separator' | 'file');
5475 * The working directory. Default is empty.
5477 workingDirectory?: string;
5480 interface KeyboardEvent {
5482 // Docs: https://electronjs.org/docs/api/structures/keyboard-event
5485 * whether an Alt key was used in an accelerator to trigger the Event
5489 * whether the Control key was used in an accelerator to trigger the Event
5493 * whether a meta key was used in an accelerator to trigger the Event
5497 * whether a Shift key was used in an accelerator to trigger the Event
5501 * whether an accelerator was used to trigger the event as opposed to another user
5502 * gesture like mouse click
5504 triggeredByAccelerator?: boolean;
5507 interface KeyboardInputEvent extends InputEvent {
5509 // Docs: https://electronjs.org/docs/api/structures/keyboard-input-event
5512 * The character that will be sent as the keyboard event. Should only use the valid
5513 * key codes in Accelerator.
5517 * The type of the event, can be `rawKeyDown`, `keyDown`, `keyUp` or `char`.
5519 type: ('rawKeyDown' | 'keyDown' | 'keyUp' | 'char');
5522 interface MemoryInfo {
5524 // Docs: https://electronjs.org/docs/api/structures/memory-info
5527 * The maximum amount of memory that has ever been pinned to actual physical RAM.
5529 peakWorkingSetSize: number;
5531 * The amount of memory not shared by other processes, such as JS heap or HTML
5536 privateBytes?: number;
5538 * The amount of memory currently pinned to actual physical RAM.
5540 workingSetSize: number;
5543 interface MemoryUsageDetails {
5545 // Docs: https://electronjs.org/docs/api/structures/memory-usage-details
5554 // Docs: https://electronjs.org/docs/api/menu
5557 * Emitted when a popup is closed either manually or with `menu.closePopup()`.
5559 on(event: 'menu-will-close', listener: (event: Event) => void): this;
5560 once(event: 'menu-will-close', listener: (event: Event) => void): this;
5561 addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
5562 removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
5564 * Emitted when `menu.popup()` is called.
5566 on(event: 'menu-will-show', listener: (event: Event) => void): this;
5567 once(event: 'menu-will-show', listener: (event: Event) => void): this;
5568 addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
5569 removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
5575 * Generally, the `template` is an array of `options` for constructing a MenuItem.
5576 * The usage can be referenced above.
5578 * You can also attach other fields to the element of the `template` and they will
5579 * become properties of the constructed menu items.
5581 static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
5583 * The application menu, if set, or `null`, if not set.
5585 * **Note:** The returned `Menu` instance doesn't support dynamic addition or
5586 * removal of menu items. Instance properties can still be dynamically modified.
5588 static getApplicationMenu(): (Menu) | (null);
5590 * Sends the `action` to the first responder of application. This is used for
5591 * emulating default macOS menu behaviors. Usually you would use the `role`
5592 * property of a `MenuItem`.
5594 * See the macOS Cocoa Event Handling Guide for more information on macOS' native
5599 static sendActionToFirstResponder(action: string): void;
5601 * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
5602 * will be set as each window's top menu.
5604 * Also on Windows and Linux, you can use a `&` in the top-level item name to
5605 * indicate which letter should get a generated accelerator. For example, using
5606 * `&File` for the file menu would result in a generated `Alt-F` accelerator that
5607 * opens the associated menu. The indicated character in the button label then gets
5608 * an underline, and the `&` character is not displayed on the button label.
5610 * In order to escape the `&` character in an item name, add a proceeding `&`. For
5611 * example, `&&File` would result in `&File` displayed on the button label.
5613 * Passing `null` will suppress the default menu. On Windows and Linux, this has
5614 * the additional effect of removing the menu bar from the window.
5616 * **Note:** The default menu will be created automatically if the app does not set
5617 * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
5620 static setApplicationMenu(menu: (Menu) | (null)): void;
5622 * Appends the `menuItem` to the menu.
5624 append(menuItem: MenuItem): void;
5626 * Closes the context menu in the `browserWindow`.
5628 closePopup(browserWindow?: BrowserWindow): void;
5630 * the item with the specified `id`
5632 getMenuItemById(id: string): (MenuItem) | (null);
5634 * Inserts the `menuItem` to the `pos` position of the menu.
5636 insert(pos: number, menuItem: MenuItem): void;
5638 * Pops up this menu as a context menu in the `BrowserWindow`.
5640 popup(options?: PopupOptions): void;
5642 * A `MenuItem[]` array containing the menu's items.
5644 * Each `Menu` consists of multiple `MenuItem`s and each `MenuItem` can have a
5652 // Docs: https://electronjs.org/docs/api/menu-item
5657 constructor(options: MenuItemConstructorOptions);
5659 * An `Accelerator` (optional) indicating the item's accelerator, if set.
5661 accelerator?: Accelerator;
5663 * A `boolean` indicating whether the item is checked, this property can be
5664 * dynamically changed.
5666 * A `checkbox` menu item will toggle the `checked` property on and off when
5669 * A `radio` menu item will turn on its `checked` property when clicked, and will
5670 * turn off that property for all adjacent items in the same menu.
5672 * You can add a `click` function for additional behavior.
5676 * A `Function` that is fired when the MenuItem receives a click event. It can be
5677 * called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
5679 * * `event` KeyboardEvent
5680 * * `focusedWindow` BrowserWindow
5681 * * `focusedWebContents` WebContents
5685 * A `number` indicating an item's sequential unique id.
5689 * A `boolean` indicating whether the item is enabled, this property can be
5690 * dynamically changed.
5694 * A `NativeImage | string` (optional) indicating the item's icon, if set.
5696 icon?: (NativeImage) | (string);
5698 * A `string` indicating the item's unique id, this property can be dynamically
5703 * A `string` indicating the item's visible label.
5707 * A `Menu` that the item is a part of.
5711 * A `boolean` indicating if the accelerator should be registered with the system
5712 * or just displayed.
5714 * This property can be dynamically changed.
5716 registerAccelerator: boolean;
5718 * A `string` (optional) indicating the item's role, if set. Can be `undo`, `redo`,
5719 * `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`,
5720 * `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`,
5721 * `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`,
5722 * `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
5723 * `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,
5724 * `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`,
5725 * `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`,
5726 * `moveTabToNewWindow` or `windowMenu`
5728 role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'toggleSpellChecker' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'shareMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
5730 * A `SharingItem` indicating the item to share when the `role` is `shareMenu`.
5732 * This property can be dynamically changed.
5736 sharingItem: SharingItem;
5738 * A `string` indicating the item's sublabel.
5742 * A `Menu` (optional) containing the menu item's submenu, if present.
5746 * A `string` indicating the item's hover text.
5752 * A `string` indicating the type of the item. Can be `normal`, `separator`,
5753 * `submenu`, `checkbox` or `radio`.
5755 type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
5757 * An `Accelerator | null` indicating the item's user-assigned accelerator for the
5760 * **Note:** This property is only initialized after the `MenuItem` has been added
5761 * to a `Menu`. Either via `Menu.buildFromTemplate` or via
5762 * `Menu.append()/insert()`. Accessing before initialization will just return
5767 readonly userAccelerator: (Accelerator) | (null);
5769 * A `boolean` indicating whether the item is visible, this property can be
5770 * dynamically changed.
5775 class MessageChannelMain extends NodeEventEmitter {
5777 // Docs: https://electronjs.org/docs/api/message-channel-main
5780 * A `MessagePortMain` property.
5782 port1: MessagePortMain;
5784 * A `MessagePortMain` property.
5786 port2: MessagePortMain;
5789 class MessagePortMain extends NodeEventEmitter {
5791 // Docs: https://electronjs.org/docs/api/message-port-main
5794 * Emitted when the remote end of a MessagePortMain object becomes disconnected.
5796 on(event: 'close', listener: Function): this;
5797 once(event: 'close', listener: Function): this;
5798 addListener(event: 'close', listener: Function): this;
5799 removeListener(event: 'close', listener: Function): this;
5801 * Emitted when a MessagePortMain object receives a message.
5803 on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
5804 once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
5805 addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
5806 removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
5808 * Disconnects the port, so it is no longer active.
5812 * Sends a message from the port, and optionally, transfers ownership of objects to
5813 * other browsing contexts.
5815 postMessage(message: any, transfer?: MessagePortMain[]): void;
5817 * Starts the sending of messages queued on the port. Messages will be queued until
5818 * this method is called.
5823 interface MimeTypedBuffer {
5825 // Docs: https://electronjs.org/docs/api/structures/mime-typed-buffer
5828 * Charset of the buffer.
5832 * The actual Buffer content.
5836 * MIME type of the buffer.
5841 interface MouseInputEvent extends InputEvent {
5843 // Docs: https://electronjs.org/docs/api/structures/mouse-input-event
5846 * The button pressed, can be `left`, `middle`, `right`.
5848 button?: ('left' | 'middle' | 'right');
5849 clickCount?: number;
5855 * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
5856 * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
5858 type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
5863 interface MouseWheelInputEvent extends MouseInputEvent {
5865 // Docs: https://electronjs.org/docs/api/structures/mouse-wheel-input-event
5867 accelerationRatioX?: number;
5868 accelerationRatioY?: number;
5869 canScroll?: boolean;
5872 hasPreciseScrollingDeltas?: boolean;
5874 * The type of the event, can be `mouseWheel`.
5876 type: ('mouseWheel');
5877 wheelTicksX?: number;
5878 wheelTicksY?: number;
5883 // Docs: https://electronjs.org/docs/api/native-image
5886 * Creates an empty `NativeImage` instance.
5888 static createEmpty(): NativeImage;
5890 * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
5891 * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
5893 static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
5895 * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
5898 static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
5900 * Creates a new `NativeImage` instance from `dataURL`.
5902 static createFromDataURL(dataURL: string): NativeImage;
5904 * Creates a new `NativeImage` instance from the NSImage that maps to the given
5905 * image name. See `System Icons` for a list of possible values.
5907 * The `hslShift` is applied to the image with the following rules:
5909 * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
5910 * and 360 on the hue color wheel (red).
5911 * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
5912 * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
5913 * saturate the image.
5914 * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
5915 * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
5916 * leave unchanged. 1 = full lightness (make all pixels white).
5918 * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
5919 * 0]` will make the image completely black.
5921 * In some cases, the `NSImageName` doesn't match its string representation; one
5922 * example of this is `NSFolderImageName`, whose string representation would
5923 * actually be `NSFolder`. Therefore, you'll need to determine the correct string
5924 * representation for your image before passing it in. This can be done with the
5927 * `echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME);
5928 * }' | clang -otest -x objective-c -framework Cocoa - && ./test`
5930 * where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
5934 static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
5936 * Creates a new `NativeImage` instance from a file located at `path`. This method
5937 * returns an empty image if the `path` does not exist, cannot be read, or is not a
5940 static createFromPath(path: string): NativeImage;
5942 * fulfilled with the file's thumbnail preview image, which is a NativeImage.
5944 * @platform darwin,win32
5946 static createThumbnailFromPath(path: string, maxSize: Size): Promise<Electron.NativeImage>;
5948 * Add an image representation for a specific scale factor. This can be used to
5949 * explicitly add different scale factor representations to an image. This can be
5950 * called on empty images.
5952 addRepresentation(options: AddRepresentationOptions): void;
5954 * The cropped image.
5956 crop(rect: Rectangle): NativeImage;
5958 * The image's aspect ratio.
5960 * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
5961 * the image representation most closely matching the passed value.
5963 getAspectRatio(scaleFactor?: number): number;
5965 * A Buffer that contains the image's raw bitmap pixel data.
5967 * The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does
5968 * not copy the bitmap data, so you have to use the returned Buffer immediately in
5969 * current event loop tick; otherwise the data might be changed or destroyed.
5971 getBitmap(options?: BitmapOptions): Buffer;
5973 * A Buffer that stores C pointer to underlying native handle of the image. On
5974 * macOS, a pointer to `NSImage` instance would be returned.
5976 * Notice that the returned pointer is a weak pointer to the underlying native
5977 * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
5978 * instance is kept around.
5982 getNativeHandle(): Buffer;
5984 * An array of all scale factors corresponding to representations for a given
5987 getScaleFactors(): number[];
5989 * If `scaleFactor` is passed, this will return the size corresponding to the image
5990 * representation most closely matching the passed value.
5992 getSize(scaleFactor?: number): Size;
5994 * Whether the image is empty.
5998 * Whether the image is a template image.
6000 isTemplateImage(): boolean;
6002 * The resized image.
6004 * If only the `height` or the `width` are specified then the current aspect ratio
6005 * will be preserved in the resized image.
6007 resize(options: ResizeOptions): NativeImage;
6009 * Marks the image as a template image.
6011 setTemplateImage(option: boolean): void;
6013 * A Buffer that contains a copy of the image's raw bitmap pixel data.
6015 toBitmap(options?: ToBitmapOptions): Buffer;
6017 * The data URL of the image.
6019 toDataURL(options?: ToDataURLOptions): string;
6021 * A Buffer that contains the image's `JPEG` encoded data.
6023 toJPEG(quality: number): Buffer;
6025 * A Buffer that contains the image's `PNG` encoded data.
6027 toPNG(options?: ToPNGOptions): Buffer;
6029 * A `boolean` property that determines whether the image is considered a template
6032 * Please note that this property only has an effect on macOS.
6036 isMacTemplateImage: boolean;
6039 interface NativeTheme extends NodeJS.EventEmitter {
6041 // Docs: https://electronjs.org/docs/api/native-theme
6044 * Emitted when something in the underlying NativeTheme has changed. This normally
6045 * means that either the value of `shouldUseDarkColors`,
6046 * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
6047 * will have to check them to determine which one has changed.
6049 on(event: 'updated', listener: Function): this;
6050 once(event: 'updated', listener: Function): this;
6051 addListener(event: 'updated', listener: Function): this;
6052 removeListener(event: 'updated', listener: Function): this;
6054 * A `boolean` indicating whether Chromium is in forced colors mode, controlled by
6055 * system accessibility settings. Currently, Windows high contrast is the only
6056 * system setting that triggers forced colors mode.
6060 readonly inForcedColorsMode: boolean;
6062 * A `boolean` for if the OS / Chromium currently has a dark mode enabled or is
6063 * being instructed to show a dark-style UI. If you want to modify this value you
6064 * should use `themeSource` below.
6067 readonly shouldUseDarkColors: boolean;
6069 * A `boolean` for if the OS / Chromium currently has high-contrast mode enabled or
6070 * is being instructed to show a high-contrast UI.
6072 * @platform darwin,win32
6074 readonly shouldUseHighContrastColors: boolean;
6076 * A `boolean` for if the OS / Chromium currently has an inverted color scheme or
6077 * is being instructed to use an inverted color scheme.
6079 * @platform darwin,win32
6081 readonly shouldUseInvertedColorScheme: boolean;
6083 * A `string` property that can be `system`, `light` or `dark`. It is used to
6084 * override and supersede the value that Chromium has chosen to use internally.
6086 * Setting this property to `system` will remove the override and everything will
6087 * be reset to the OS default. By default `themeSource` is `system`.
6089 * Settings this property to `dark` will have the following effects:
6091 * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
6092 * * Any UI Electron renders on Linux and Windows including context menus,
6093 * devtools, etc. will use the dark UI.
6094 * * Any UI the OS renders on macOS including menus, window frames, etc. will use
6096 * * The `prefers-color-scheme` CSS query will match `dark` mode.
6097 * * The `updated` event will be emitted
6099 * Settings this property to `light` will have the following effects:
6101 * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
6102 * * Any UI Electron renders on Linux and Windows including context menus,
6103 * devtools, etc. will use the light UI.
6104 * * Any UI the OS renders on macOS including menus, window frames, etc. will use
6106 * * The `prefers-color-scheme` CSS query will match `light` mode.
6107 * * The `updated` event will be emitted
6109 * The usage of this property should align with a classic "dark mode" state machine
6110 * in your application where the user has three options.
6112 * * `Follow OS` --> `themeSource = 'system'`
6113 * * `Dark Mode` --> `themeSource = 'dark'`
6114 * * `Light Mode` --> `themeSource = 'light'`
6116 * Your application should then always use `shouldUseDarkColors` to determine what
6119 themeSource: ('system' | 'light' | 'dark');
6124 // Docs: https://electronjs.org/docs/api/net
6127 * Whether there is currently internet connection.
6129 * A return value of `false` is a pretty strong indicator that the user won't be
6130 * able to connect to remote sites. However, a return value of `true` is
6131 * inconclusive; even if some link is up, it is uncertain whether a particular
6132 * connection attempt to a particular remote site will be successful.
6134 isOnline(): boolean;
6136 * Creates a `ClientRequest` instance using the provided `options` which are
6137 * directly forwarded to the `ClientRequest` constructor. The `net.request` method
6138 * would be used to issue both secure and insecure HTTP requests according to the
6139 * specified protocol scheme in the `options` object.
6141 request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
6143 * A `boolean` property. Whether there is currently internet connection.
6145 * A return value of `false` is a pretty strong indicator that the user won't be
6146 * able to connect to remote sites. However, a return value of `true` is
6147 * inconclusive; even if some link is up, it is uncertain whether a particular
6148 * connection attempt to a particular remote site will be successful.
6151 readonly online: boolean;
6156 // Docs: https://electronjs.org/docs/api/net-log
6159 * resolves when the net log has begun recording.
6161 * Starts recording network events to `path`.
6163 startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
6165 * resolves when the net log has been flushed to disk.
6167 * Stops recording network events. If not called, net logging will automatically
6168 * end when app quits.
6170 stopLogging(): Promise<void>;
6172 * A `boolean` property that indicates whether network logs are currently being
6176 readonly currentlyLogging: boolean;
6179 class Notification extends NodeEventEmitter {
6181 // Docs: https://electronjs.org/docs/api/notification
6183 on(event: 'action', listener: (event: Event,
6185 * The index of the action that was activated.
6187 index: number) => void): this;
6188 once(event: 'action', listener: (event: Event,
6190 * The index of the action that was activated.
6192 index: number) => void): this;
6193 addListener(event: 'action', listener: (event: Event,
6195 * The index of the action that was activated.
6197 index: number) => void): this;
6198 removeListener(event: 'action', listener: (event: Event,
6200 * The index of the action that was activated.
6202 index: number) => void): this;
6204 * Emitted when the notification is clicked by the user.
6206 on(event: 'click', listener: (event: Event) => void): this;
6207 once(event: 'click', listener: (event: Event) => void): this;
6208 addListener(event: 'click', listener: (event: Event) => void): this;
6209 removeListener(event: 'click', listener: (event: Event) => void): this;
6211 * Emitted when the notification is closed by manual intervention from the user.
6213 * This event is not guaranteed to be emitted in all cases where the notification
6216 on(event: 'close', listener: (event: Event) => void): this;
6217 once(event: 'close', listener: (event: Event) => void): this;
6218 addListener(event: 'close', listener: (event: Event) => void): this;
6219 removeListener(event: 'close', listener: (event: Event) => void): this;
6221 * Emitted when an error is encountered while creating and showing the native
6226 on(event: 'failed', listener: (event: Event,
6228 * The error encountered during execution of the `show()` method.
6230 error: string) => void): this;
6231 once(event: 'failed', listener: (event: Event,
6233 * The error encountered during execution of the `show()` method.
6235 error: string) => void): this;
6236 addListener(event: 'failed', listener: (event: Event,
6238 * The error encountered during execution of the `show()` method.
6240 error: string) => void): this;
6241 removeListener(event: 'failed', listener: (event: Event,
6243 * The error encountered during execution of the `show()` method.
6245 error: string) => void): this;
6247 * Emitted when the user clicks the "Reply" button on a notification with
6252 on(event: 'reply', listener: (event: Event,
6254 * The string the user entered into the inline reply field.
6256 reply: string) => void): this;
6257 once(event: 'reply', listener: (event: Event,
6259 * The string the user entered into the inline reply field.
6261 reply: string) => void): this;
6262 addListener(event: 'reply', listener: (event: Event,
6264 * The string the user entered into the inline reply field.
6266 reply: string) => void): this;
6267 removeListener(event: 'reply', listener: (event: Event,
6269 * The string the user entered into the inline reply field.
6271 reply: string) => void): this;
6273 * Emitted when the notification is shown to the user, note this could be fired
6274 * multiple times as a notification can be shown multiple times through the
6277 on(event: 'show', listener: (event: Event) => void): this;
6278 once(event: 'show', listener: (event: Event) => void): this;
6279 addListener(event: 'show', listener: (event: Event) => void): this;
6280 removeListener(event: 'show', listener: (event: Event) => void): this;
6284 constructor(options?: NotificationConstructorOptions);
6286 * Whether or not desktop notifications are supported on the current system
6288 static isSupported(): boolean;
6290 * Dismisses the notification.
6294 * Immediately shows the notification to the user, please note this means unlike
6295 * the HTML5 Notification implementation, instantiating a `new Notification` does
6296 * not immediately show it to the user, you need to call this method before the OS
6299 * If the notification has been shown before, this method will dismiss the
6300 * previously shown notification and create a new one with identical properties.
6304 * A `NotificationAction[]` property representing the actions of the notification.
6306 actions: NotificationAction[];
6308 * A `string` property representing the body of the notification.
6312 * A `string` property representing the close button text of the notification.
6314 closeButtonText: string;
6316 * A `boolean` property representing whether the notification has a reply action.
6320 * A `string` property representing the reply placeholder of the notification.
6322 replyPlaceholder: string;
6324 * A `boolean` property representing whether the notification is silent.
6328 * A `string` property representing the sound of the notification.
6332 * A `string` property representing the subtitle of the notification.
6336 * A `string` property representing the type of timeout duration for the
6337 * notification. Can be 'default' or 'never'.
6339 * If `timeoutType` is set to 'never', the notification never expires. It stays
6340 * open until closed by the calling API or the user.
6342 * @platform linux,win32
6344 timeoutType: ('default' | 'never');
6346 * A `string` property representing the title of the notification.
6350 * A `string` property representing the custom Toast XML of the notification.
6356 * A `string` property representing the urgency level of the notification. Can be
6357 * 'normal', 'critical', or 'low'.
6359 * Default is 'low' - see NotifyUrgency for more information.
6363 urgency: ('normal' | 'critical' | 'low');
6366 interface NotificationAction {
6368 // Docs: https://electronjs.org/docs/api/structures/notification-action
6371 * The label for the given action.
6375 * The type of action, can be `button`.
6380 interface NotificationResponse {
6382 // Docs: https://electronjs.org/docs/api/structures/notification-response
6385 * The identifier string of the action that the user selected.
6387 actionIdentifier: string;
6389 * The delivery date of the notification.
6393 * The unique identifier for this notification request.
6397 * A dictionary of custom information associated with the notification.
6399 userInfo: Record<string, any>;
6401 * The text entered or chosen by the user.
6406 interface ParentPort extends NodeJS.EventEmitter {
6408 // Docs: https://electronjs.org/docs/api/parent-port
6411 * Emitted when the process receives a message. Messages received on this port will
6412 * be queued up until a handler is registered for this event.
6414 on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
6415 once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
6416 addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
6417 removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
6419 * Sends a message from the process to its parent.
6421 postMessage(message: any): void;
6424 interface PaymentDiscount {
6426 // Docs: https://electronjs.org/docs/api/structures/payment-discount
6429 * A string used to uniquely identify a discount offer for a product.
6433 * A string that identifies the key used to generate the signature.
6435 keyIdentifier: string;
6437 * A universally unique ID (UUID) value that you define.
6441 * A UTF-8 string representing the properties of a specific discount offer,
6442 * cryptographically signed.
6446 * The date and time of the signature's creation in milliseconds, formatted in Unix
6454 // Docs: https://electronjs.org/docs/api/structures/point
6460 interface PostBody {
6462 // Docs: https://electronjs.org/docs/api/structures/post-body
6465 * The boundary used to separate multiple parts of the message. Only valid when
6466 * `contentType` is `multipart/form-data`.
6470 * The `content-type` header used for the data. One of
6471 * `application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to the
6472 * `enctype` attribute of the submitted HTML form.
6474 contentType: string;
6476 * The post data to be sent to the new window.
6478 data: Array<(UploadRawData) | (UploadFile)>;
6481 interface PowerMonitor extends NodeJS.EventEmitter {
6483 // Docs: https://electronjs.org/docs/api/power-monitor
6486 * Emitted when the system is about to lock the screen.
6488 * @platform darwin,win32
6490 on(event: 'lock-screen', listener: Function): this;
6491 once(event: 'lock-screen', listener: Function): this;
6492 addListener(event: 'lock-screen', listener: Function): this;
6493 removeListener(event: 'lock-screen', listener: Function): this;
6495 * Emitted when the system changes to AC power.
6497 * @platform darwin,win32
6499 on(event: 'on-ac', listener: Function): this;
6500 once(event: 'on-ac', listener: Function): this;
6501 addListener(event: 'on-ac', listener: Function): this;
6502 removeListener(event: 'on-ac', listener: Function): this;
6504 * Emitted when system changes to battery power.
6508 on(event: 'on-battery', listener: Function): this;
6509 once(event: 'on-battery', listener: Function): this;
6510 addListener(event: 'on-battery', listener: Function): this;
6511 removeListener(event: 'on-battery', listener: Function): this;
6513 * Emitted when system is resuming.
6515 on(event: 'resume', listener: Function): this;
6516 once(event: 'resume', listener: Function): this;
6517 addListener(event: 'resume', listener: Function): this;
6518 removeListener(event: 'resume', listener: Function): this;
6520 * Emitted when the system is about to reboot or shut down. If the event handler
6521 * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
6522 * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
6523 * should exit as soon as possible by calling something like `app.quit()`.
6525 * @platform linux,darwin
6527 on(event: 'shutdown', listener: Function): this;
6528 once(event: 'shutdown', listener: Function): this;
6529 addListener(event: 'shutdown', listener: Function): this;
6530 removeListener(event: 'shutdown', listener: Function): this;
6532 * Emitted when the system is suspending.
6534 on(event: 'suspend', listener: Function): this;
6535 once(event: 'suspend', listener: Function): this;
6536 addListener(event: 'suspend', listener: Function): this;
6537 removeListener(event: 'suspend', listener: Function): this;
6539 * Emitted as soon as the systems screen is unlocked.
6541 * @platform darwin,win32
6543 on(event: 'unlock-screen', listener: Function): this;
6544 once(event: 'unlock-screen', listener: Function): this;
6545 addListener(event: 'unlock-screen', listener: Function): this;
6546 removeListener(event: 'unlock-screen', listener: Function): this;
6548 * Emitted when a login session is activated. See documentation for more
6553 on(event: 'user-did-become-active', listener: Function): this;
6554 once(event: 'user-did-become-active', listener: Function): this;
6555 addListener(event: 'user-did-become-active', listener: Function): this;
6556 removeListener(event: 'user-did-become-active', listener: Function): this;
6558 * Emitted when a login session is deactivated. See documentation for more
6563 on(event: 'user-did-resign-active', listener: Function): this;
6564 once(event: 'user-did-resign-active', listener: Function): this;
6565 addListener(event: 'user-did-resign-active', listener: Function): this;
6566 removeListener(event: 'user-did-resign-active', listener: Function): this;
6568 * The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
6570 * Calculate the system idle state. `idleThreshold` is the amount of time (in
6571 * seconds) before considered idle. `locked` is available on supported systems
6574 getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
6576 * Idle time in seconds
6578 * Calculate system idle time in seconds.
6580 getSystemIdleTime(): number;
6582 * Whether the system is on battery power.
6584 * To monitor for changes in this property, use the `on-battery` and `on-ac`
6587 isOnBatteryPower(): boolean;
6589 * A `boolean` property. True if the system is on battery power.
6591 * See `powerMonitor.isOnBatteryPower()`.
6593 onBatteryPower: boolean;
6596 interface PowerSaveBlocker {
6598 // Docs: https://electronjs.org/docs/api/power-save-blocker
6601 * Whether the corresponding `powerSaveBlocker` has started.
6603 isStarted(id: number): boolean;
6605 * The blocker ID that is assigned to this power blocker.
6607 * Starts preventing the system from entering lower-power mode. Returns an integer
6608 * identifying the power save blocker.
6610 * **Note:** `prevent-display-sleep` has higher precedence over
6611 * `prevent-app-suspension`. Only the highest precedence type takes effect. In
6612 * other words, `prevent-display-sleep` always takes precedence over
6613 * `prevent-app-suspension`.
6615 * For example, an API calling A requests for `prevent-app-suspension`, and another
6616 * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
6617 * used until B stops its request. After that, `prevent-app-suspension` is used.
6619 start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
6621 * Stops the specified power save blocker.
6623 stop(id: number): void;
6626 interface PrinterInfo {
6628 // Docs: https://electronjs.org/docs/api/structures/printer-info
6631 * a longer description of the printer's type.
6633 description: string;
6635 * the name of the printer as shown in Print Preview.
6637 displayName: string;
6639 * whether or not a given printer is set as the default printer on the OS.
6643 * the name of the printer as understood by the OS.
6647 * an object containing a variable number of platform-specific printer information.
6651 * the current status of the printer.
6656 interface ProcessMemoryInfo {
6658 // Docs: https://electronjs.org/docs/api/structures/process-memory-info
6661 * The amount of memory not shared by other processes, such as JS heap or HTML
6662 * content in Kilobytes.
6666 * The amount of memory currently pinned to actual physical RAM in Kilobytes.
6668 * @platform linux,win32
6670 residentSet: number;
6672 * The amount of memory shared between processes, typically memory consumed by the
6673 * Electron code itself in Kilobytes.
6678 interface ProcessMetric {
6680 // Docs: https://electronjs.org/docs/api/structures/process-metric
6683 * CPU usage of the process.
6687 * Creation time for this process. The time is represented as number of
6688 * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
6689 * is useful to use both the `pid` and the `creationTime` to uniquely identify a
6692 creationTime: number;
6694 * One of the following values:
6698 integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
6700 * Memory information for the process.
6704 * The name of the process. Examples for utility: `Audio Service`, `Content
6705 * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
6709 * Process id of the process.
6713 * Whether the process is sandboxed on OS level.
6715 * @platform darwin,win32
6717 sandboxed?: boolean;
6719 * The non-localized name of the process.
6721 serviceName?: string;
6723 * Process type. One of the following values:
6725 type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
6730 // Docs: https://electronjs.org/docs/api/structures/product
6733 * The total size of the content, in bytes.
6735 contentLengths: number[];
6737 * A string that identifies the version of the content.
6739 contentVersion: string;
6741 * 3 character code presenting a product's currency based on the ISO 4217 standard.
6743 currencyCode: string;
6745 * An array of discount offers
6747 discounts: ProductDiscount[];
6749 * The total size of the content, in bytes.
6751 downloadContentLengths: number[];
6753 * A string that identifies the version of the content.
6755 downloadContentVersion: string;
6757 * The locale formatted price of the product.
6759 formattedPrice: string;
6761 * The object containing introductory price information for the product. available
6764 introductoryPrice?: ProductDiscount;
6766 * A boolean value that indicates whether the App Store has downloadable content
6767 * for this product. `true` if at least one file has been associated with the
6770 isDownloadable: boolean;
6772 * A description of the product.
6774 localizedDescription: string;
6776 * The name of the product.
6778 localizedTitle: string;
6780 * The cost of the product in the local currency.
6784 * The string that identifies the product to the Apple App Store.
6786 productIdentifier: string;
6788 * The identifier of the subscription group to which the subscription belongs.
6790 subscriptionGroupIdentifier: string;
6792 * The period details for products that are subscriptions.
6794 subscriptionPeriod?: ProductSubscriptionPeriod;
6797 interface ProductDiscount {
6799 // Docs: https://electronjs.org/docs/api/structures/product-discount
6802 * A string used to uniquely identify a discount offer for a product.
6806 * An integer that indicates the number of periods the product discount is
6809 numberOfPeriods: number;
6811 * The payment mode for this product discount. Can be `payAsYouGo`, `payUpFront`,
6814 paymentMode: ('payAsYouGo' | 'payUpFront' | 'freeTrial');
6816 * The discount price of the product in the local currency.
6820 * The locale used to format the discount price of the product.
6822 priceLocale: string;
6824 * An object that defines the period for the product discount.
6826 subscriptionPeriod?: ProductSubscriptionPeriod;
6828 * The type of discount offer.
6833 interface ProductSubscriptionPeriod {
6835 // Docs: https://electronjs.org/docs/api/structures/product-subscription-period
6838 * The number of units per subscription period.
6840 numberOfUnits: number;
6842 * The increment of time that a subscription period is specified in. Can be `day`,
6843 * `week`, `month`, `year`.
6845 unit: ('day' | 'week' | 'month' | 'year');
6848 interface Protocol {
6850 // Docs: https://electronjs.org/docs/api/protocol
6853 * Whether the protocol was successfully intercepted
6855 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
6856 * which sends a `Buffer` as a response.
6858 interceptBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
6860 * Whether the protocol was successfully intercepted
6862 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
6863 * which sends a file as a response.
6865 interceptFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
6867 * Whether the protocol was successfully intercepted
6869 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
6870 * which sends a new HTTP request as a response.
6872 interceptHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
6874 * Whether the protocol was successfully intercepted
6876 * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
6879 interceptStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
6881 * Whether the protocol was successfully intercepted
6883 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
6884 * which sends a `string` as a response.
6886 interceptStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
6888 * Whether `scheme` is already intercepted.
6890 isProtocolIntercepted(scheme: string): boolean;
6892 * Whether `scheme` is already registered.
6894 isProtocolRegistered(scheme: string): boolean;
6896 * Whether the protocol was successfully registered
6898 * Registers a protocol of `scheme` that will send a `Buffer` as a response.
6900 * The usage is the same with `registerFileProtocol`, except that the `callback`
6901 * should be called with either a `Buffer` object or an object that has the `data`
6906 registerBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
6908 * Whether the protocol was successfully registered
6910 * Registers a protocol of `scheme` that will send a file as the response. The
6911 * `handler` will be called with `request` and `callback` where `request` is an
6912 * incoming request for the `scheme`.
6914 * To handle the `request`, the `callback` should be called with either the file's
6915 * path or an object that has a `path` property, e.g. `callback(filePath)` or
6916 * `callback({ path: filePath })`. The `filePath` must be an absolute path.
6918 * By default the `scheme` is treated like `http:`, which is parsed differently
6919 * from protocols that follow the "generic URI syntax" like `file:`.
6921 registerFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
6923 * Whether the protocol was successfully registered
6925 * Registers a protocol of `scheme` that will send an HTTP request as a response.
6927 * The usage is the same with `registerFileProtocol`, except that the `callback`
6928 * should be called with an object that has the `url` property.
6930 registerHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
6932 * **Note:** This method can only be used before the `ready` event of the `app`
6933 * module gets emitted and can be called only once.
6935 * Registers the `scheme` as standard, secure, bypasses content security policy for
6936 * resources, allows registering ServiceWorker, supports fetch API, and streaming
6937 * video/audio. Specify a privilege with the value of `true` to enable the
6940 * An example of registering a privileged scheme, that bypasses Content Security
6943 * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
6944 * `http` and `https` are standard schemes, while `file` is not.
6946 * Registering a scheme as standard allows relative and absolute resources to be
6947 * resolved correctly when served. Otherwise the scheme will behave like the `file`
6948 * protocol, but without the ability to resolve relative URLs.
6950 * For example when you load following page with custom protocol without
6951 * registering it as standard scheme, the image will not be loaded because
6952 * non-standard schemes can not recognize relative URLs:
6954 * Registering a scheme as standard will allow access to files through the
6955 * FileSystem API. Otherwise the renderer will throw a security error for the
6958 * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
6959 * cookies) are disabled for non standard schemes. So in general if you want to
6960 * register a custom protocol to replace the `http` protocol, you have to register
6961 * it as a standard scheme.
6963 * Protocols that use streams (http and stream protocols) should set `stream:
6964 * true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
6965 * their responses by default. The `stream` flag configures those elements to
6966 * correctly expect streaming responses.
6968 registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
6970 * Whether the protocol was successfully registered
6972 * Registers a protocol of `scheme` that will send a stream as a response.
6974 * The usage is the same with `registerFileProtocol`, except that the `callback`
6975 * should be called with either a `ReadableStream` object or an object that has the
6980 * It is possible to pass any object that implements the readable stream API (emits
6981 * `data`/`end`/`error` events). For example, here's how a file could be returned:
6983 registerStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
6985 * Whether the protocol was successfully registered
6987 * Registers a protocol of `scheme` that will send a `string` as a response.
6989 * The usage is the same with `registerFileProtocol`, except that the `callback`
6990 * should be called with either a `string` or an object that has the `data`
6993 registerStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
6995 * Whether the protocol was successfully unintercepted
6997 * Remove the interceptor installed for `scheme` and restore its original handler.
6999 uninterceptProtocol(scheme: string): boolean;
7001 * Whether the protocol was successfully unregistered
7003 * Unregisters the custom protocol of `scheme`.
7005 unregisterProtocol(scheme: string): boolean;
7008 interface ProtocolRequest {
7010 // Docs: https://electronjs.org/docs/api/structures/protocol-request
7012 headers: Record<string, string>;
7015 uploadData?: UploadData[];
7019 interface ProtocolResponse {
7021 // Docs: https://electronjs.org/docs/api/structures/protocol-response
7024 * The charset of response body, default is `"utf-8"`.
7028 * The response body. When returning stream as response, this is a Node.js readable
7029 * stream representing the response body. When returning `Buffer` as response, this
7030 * is a `Buffer`. When returning `string` as response, this is a `string`. This is
7031 * ignored for other types of responses.
7033 data?: (Buffer) | (string) | (NodeJS.ReadableStream);
7035 * When assigned, the `request` will fail with the `error` number . For the
7036 * available error numbers you can use, please see the net error list.
7040 * An object containing the response headers. The keys must be string, and values
7041 * must be either string or Array of string.
7043 headers?: Record<string, (string) | (string[])>;
7045 * The HTTP `method`. This is only used for file and URL responses.
7049 * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
7050 * would implicitly set the `content-type` header in response, but if
7051 * `content-type` is already set in `headers`, the `mimeType` would be ignored.
7055 * Path to the file which would be sent as response body. This is only used for
7060 * The `referrer` URL. This is only used for file and URL responses.
7064 * The session used for requesting URL, by default the HTTP request will reuse the
7065 * current session. Setting `session` to `null` would use a random independent
7066 * session. This is only used for URL responses.
7070 * The HTTP response code, default is 200.
7072 statusCode?: number;
7074 * The data used as upload data. This is only used for URL responses when `method`
7077 uploadData?: ProtocolResponseUploadData;
7079 * Download the `url` and pipe the result as response body. This is only used for
7085 interface ProtocolResponseUploadData {
7087 // Docs: https://electronjs.org/docs/api/structures/protocol-response-upload-data
7090 * MIME type of the content.
7092 contentType: string;
7094 * Content to be sent.
7096 data: (string) | (Buffer);
7099 interface PushNotifications extends NodeJS.EventEmitter {
7101 // Docs: https://electronjs.org/docs/api/push-notifications
7104 * Emitted when the app receives a remote notification while running. See:
7129 * com/documentation/appkit/nsapplicationdelegate/1428430-application?language=objc
7133 on(event: 'received-apns-notification', listener: (userInfo: Record<string, any>) => void): this;
7134 once(event: 'received-apns-notification', listener: (userInfo: Record<string, any>) => void): this;
7135 addListener(event: 'received-apns-notification', listener: (userInfo: Record<string, any>) => void): this;
7136 removeListener(event: 'received-apns-notification', listener: (userInfo: Record<string, any>) => void): this;
7138 * Registers the app with Apple Push Notification service (APNS) to receive Badge,
7139 * Sound, and Alert notifications. If registration is successful, the promise will
7140 * be resolved with the APNS device token. Otherwise, the promise will be rejected
7141 * with an error message. See:
7179 * tion/appkit/nsapplication/1428476-registerforremotenotificationtyp?language=objc
7183 registerForAPNSNotifications(): Promise<string>;
7185 * Unregisters the app from notifications received from APNS. See:
7223 * tion/appkit/nsapplication/1428747-unregisterforremotenotifications?language=objc
7227 unregisterForAPNSNotifications(): void;
7230 interface Rectangle {
7232 // Docs: https://electronjs.org/docs/api/structures/rectangle
7235 * The height of the rectangle (must be an integer).
7239 * The width of the rectangle (must be an integer).
7243 * The x coordinate of the origin of the rectangle (must be an integer).
7247 * The y coordinate of the origin of the rectangle (must be an integer).
7252 interface Referrer {
7254 // Docs: https://electronjs.org/docs/api/structures/referrer
7257 * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
7258 * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
7259 * See the Referrer-Policy spec for more details on the meaning of these values.
7261 policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
7263 * HTTP Referrer URL.
7268 interface SafeStorage extends NodeJS.EventEmitter {
7270 // Docs: https://electronjs.org/docs/api/safe-storage
7273 * the decrypted string. Decrypts the encrypted buffer obtained with
7274 * `safeStorage.encryptString` back into a string.
7276 * This function will throw an error if decryption fails.
7278 decryptString(encrypted: Buffer): string;
7280 * An array of bytes representing the encrypted string.
7282 * This function will throw an error if encryption fails.
7284 encryptString(plainText: string): Buffer;
7286 * Whether encryption is available.
7288 * On Linux, returns true if the app has emitted the `ready` event and the secret
7289 * key is available. On MacOS, returns true if Keychain is available. On Windows,
7290 * returns true once the app has emitted the `ready` event.
7292 isEncryptionAvailable(): boolean;
7295 interface Screen extends NodeJS.EventEmitter {
7297 // Docs: https://electronjs.org/docs/api/screen
7300 * Emitted when `newDisplay` has been added.
7302 on(event: 'display-added', listener: (event: Event,
7303 newDisplay: Display) => void): this;
7304 once(event: 'display-added', listener: (event: Event,
7305 newDisplay: Display) => void): this;
7306 addListener(event: 'display-added', listener: (event: Event,
7307 newDisplay: Display) => void): this;
7308 removeListener(event: 'display-added', listener: (event: Event,
7309 newDisplay: Display) => void): this;
7311 * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
7312 * an array of strings that describe the changes. Possible changes are `bounds`,
7313 * `workArea`, `scaleFactor` and `rotation`.
7315 on(event: 'display-metrics-changed', listener: (event: Event,
7317 changedMetrics: string[]) => void): this;
7318 once(event: 'display-metrics-changed', listener: (event: Event,
7320 changedMetrics: string[]) => void): this;
7321 addListener(event: 'display-metrics-changed', listener: (event: Event,
7323 changedMetrics: string[]) => void): this;
7324 removeListener(event: 'display-metrics-changed', listener: (event: Event,
7326 changedMetrics: string[]) => void): this;
7328 * Emitted when `oldDisplay` has been removed.
7330 on(event: 'display-removed', listener: (event: Event,
7331 oldDisplay: Display) => void): this;
7332 once(event: 'display-removed', listener: (event: Event,
7333 oldDisplay: Display) => void): this;
7334 addListener(event: 'display-removed', listener: (event: Event,
7335 oldDisplay: Display) => void): this;
7336 removeListener(event: 'display-removed', listener: (event: Event,
7337 oldDisplay: Display) => void): this;
7339 * Converts a screen DIP point to a screen physical point. The DPI scale is
7340 * performed relative to the display containing the DIP point.
7344 dipToScreenPoint(point: Point): Point;
7346 * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
7347 * relative to the display nearest to `window`. If `window` is null, scaling will
7348 * be performed to the display nearest to `rect`.
7352 dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
7354 * An array of displays that are currently available.
7356 getAllDisplays(): Display[];
7358 * The current absolute position of the mouse pointer.
7360 * **Note:** The return value is a DIP point, not a screen physical point.
7362 getCursorScreenPoint(): Point;
7364 * The display that most closely intersects the provided bounds.
7366 getDisplayMatching(rect: Rectangle): Display;
7368 * The display nearest the specified point.
7370 getDisplayNearestPoint(point: Point): Display;
7372 * The primary display.
7374 getPrimaryDisplay(): Display;
7376 * Converts a screen physical point to a screen DIP point. The DPI scale is
7377 * performed relative to the display containing the physical point.
7381 screenToDipPoint(point: Point): Point;
7383 * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
7384 * relative to the display nearest to `window`. If `window` is null, scaling will
7385 * be performed to the display nearest to `rect`.
7389 screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
7392 interface ScrubberItem {
7394 // Docs: https://electronjs.org/docs/api/structures/scrubber-item
7397 * The image to appear in this item.
7401 * The text to appear in this item.
7406 interface SegmentedControlSegment {
7408 // Docs: https://electronjs.org/docs/api/structures/segmented-control-segment
7411 * Whether this segment is selectable. Default: true.
7415 * The image to appear in this segment.
7419 * The text to appear in this segment.
7424 interface SerialPort {
7426 // Docs: https://electronjs.org/docs/api/structures/serial-port
7429 * A stable identifier on Windows that can be used for device permissions.
7431 deviceInstanceId?: string;
7433 * A string suitable for display to the user for describing this device.
7435 displayName: string;
7437 * Unique identifier for the port.
7445 * Optional USB product ID.
7449 * The USB device serial number.
7451 serialNumber: string;
7453 * Represents a single serial port on macOS can be enumerated by multiple drivers.
7455 usbDriverName?: string;
7457 * Optional USB vendor ID.
7462 interface ServiceWorkerInfo {
7464 // Docs: https://electronjs.org/docs/api/structures/service-worker-info
7467 * The virtual ID of the process that this service worker is running in. This is
7468 * not an OS level PID. This aligns with the ID set used for
7469 * `webContents.getProcessId()`.
7471 renderProcessId: number;
7473 * The base URL that this service worker is active for.
7477 * The full URL to the script that this service worker runs
7482 class ServiceWorkers extends NodeEventEmitter {
7484 // Docs: https://electronjs.org/docs/api/service-workers
7487 * Emitted when a service worker logs something to the console.
7489 on(event: 'console-message', listener: (event: Event,
7491 * Information about the console message
7493 messageDetails: MessageDetails) => void): this;
7494 once(event: 'console-message', listener: (event: Event,
7496 * Information about the console message
7498 messageDetails: MessageDetails) => void): this;
7499 addListener(event: 'console-message', listener: (event: Event,
7501 * Information about the console message
7503 messageDetails: MessageDetails) => void): this;
7504 removeListener(event: 'console-message', listener: (event: Event,
7506 * Information about the console message
7508 messageDetails: MessageDetails) => void): this;
7510 * Emitted when a service worker has been registered. Can occur after a call to
7511 * `navigator.serviceWorker.register('/sw.js')` successfully resolves or when a
7512 * Chrome extension is loaded.
7514 on(event: 'registration-completed', listener: (event: Event,
7516 * Information about the registered service worker
7518 details: RegistrationCompletedDetails) => void): this;
7519 once(event: 'registration-completed', listener: (event: Event,
7521 * Information about the registered service worker
7523 details: RegistrationCompletedDetails) => void): this;
7524 addListener(event: 'registration-completed', listener: (event: Event,
7526 * Information about the registered service worker
7528 details: RegistrationCompletedDetails) => void): this;
7529 removeListener(event: 'registration-completed', listener: (event: Event,
7531 * Information about the registered service worker
7533 details: RegistrationCompletedDetails) => void): this;
7535 * A ServiceWorkerInfo object where the keys are the service worker version ID and
7536 * the values are the information about that service worker.
7538 getAllRunning(): Record<number, ServiceWorkerInfo>;
7540 * Information about this service worker
7542 * If the service worker does not exist or is not running this method will throw an
7545 getFromVersionID(versionId: number): ServiceWorkerInfo;
7548 class Session extends NodeEventEmitter {
7550 // Docs: https://electronjs.org/docs/api/session
7553 * A session instance from `partition` string. When there is an existing `Session`
7554 * with the same `partition`, it will be returned; otherwise a new `Session`
7555 * instance will be created with `options`.
7557 * If `partition` starts with `persist:`, the page will use a persistent session
7558 * available to all pages in the app with the same `partition`. if there is no
7559 * `persist:` prefix, the page will use an in-memory session. If the `partition` is
7560 * empty then default session of the app will be returned.
7562 * To create a `Session` with `options`, you have to ensure the `Session` with the
7563 * `partition` has never been used before. There is no way to change the `options`
7564 * of an existing `Session` object.
7566 static fromPartition(partition: string, options?: FromPartitionOptions): Session;
7568 * A `Session` object, the default session object of the app.
7570 static defaultSession: Session;
7572 * Emitted after an extension is loaded. This occurs whenever an extension is added
7573 * to the "enabled" set of extensions. This includes:
7575 * * Extensions being loaded from `Session.loadExtension`.
7576 * * Extensions being reloaded:
7578 * * if the extension requested it (`chrome.runtime.reload()`).
7580 on(event: 'extension-loaded', listener: (event: Event,
7581 extension: Extension) => void): this;
7582 once(event: 'extension-loaded', listener: (event: Event,
7583 extension: Extension) => void): this;
7584 addListener(event: 'extension-loaded', listener: (event: Event,
7585 extension: Extension) => void): this;
7586 removeListener(event: 'extension-loaded', listener: (event: Event,
7587 extension: Extension) => void): this;
7589 * Emitted after an extension is loaded and all necessary browser state is
7590 * initialized to support the start of the extension's background page.
7592 on(event: 'extension-ready', listener: (event: Event,
7593 extension: Extension) => void): this;
7594 once(event: 'extension-ready', listener: (event: Event,
7595 extension: Extension) => void): this;
7596 addListener(event: 'extension-ready', listener: (event: Event,
7597 extension: Extension) => void): this;
7598 removeListener(event: 'extension-ready', listener: (event: Event,
7599 extension: Extension) => void): this;
7601 * Emitted after an extension is unloaded. This occurs when
7602 * `Session.removeExtension` is called.
7604 on(event: 'extension-unloaded', listener: (event: Event,
7605 extension: Extension) => void): this;
7606 once(event: 'extension-unloaded', listener: (event: Event,
7607 extension: Extension) => void): this;
7608 addListener(event: 'extension-unloaded', listener: (event: Event,
7609 extension: Extension) => void): this;
7610 removeListener(event: 'extension-unloaded', listener: (event: Event,
7611 extension: Extension) => void): this;
7613 * Emitted after `navigator.hid.requestDevice` has been called and
7614 * `select-hid-device` has fired if a new device becomes available before the
7615 * callback from `select-hid-device` is called. This event is intended for use
7616 * when using a UI to ask users to pick a device so that the UI can be updated with
7617 * the newly added device.
7619 on(event: 'hid-device-added', listener: (event: Event,
7620 details: HidDeviceAddedDetails) => void): this;
7621 once(event: 'hid-device-added', listener: (event: Event,
7622 details: HidDeviceAddedDetails) => void): this;
7623 addListener(event: 'hid-device-added', listener: (event: Event,
7624 details: HidDeviceAddedDetails) => void): this;
7625 removeListener(event: 'hid-device-added', listener: (event: Event,
7626 details: HidDeviceAddedDetails) => void): this;
7628 * Emitted after `navigator.hid.requestDevice` has been called and
7629 * `select-hid-device` has fired if a device has been removed before the callback
7630 * from `select-hid-device` is called. This event is intended for use when using a
7631 * UI to ask users to pick a device so that the UI can be updated to remove the
7634 on(event: 'hid-device-removed', listener: (event: Event,
7635 details: HidDeviceRemovedDetails) => void): this;
7636 once(event: 'hid-device-removed', listener: (event: Event,
7637 details: HidDeviceRemovedDetails) => void): this;
7638 addListener(event: 'hid-device-removed', listener: (event: Event,
7639 details: HidDeviceRemovedDetails) => void): this;
7640 removeListener(event: 'hid-device-removed', listener: (event: Event,
7641 details: HidDeviceRemovedDetails) => void): this;
7643 * Emitted after `HIDDevice.forget()` has been called. This event can be used to
7644 * help maintain persistent storage of permissions when
7645 * `setDevicePermissionHandler` is used.
7647 on(event: 'hid-device-revoked', listener: (event: Event,
7648 details: HidDeviceRevokedDetails) => void): this;
7649 once(event: 'hid-device-revoked', listener: (event: Event,
7650 details: HidDeviceRevokedDetails) => void): this;
7651 addListener(event: 'hid-device-revoked', listener: (event: Event,
7652 details: HidDeviceRevokedDetails) => void): this;
7653 removeListener(event: 'hid-device-revoked', listener: (event: Event,
7654 details: HidDeviceRevokedDetails) => void): this;
7656 * Emitted when a render process requests preconnection to a URL, generally due to
7659 on(event: 'preconnect', listener: (event: Event,
7661 * The URL being requested for preconnection by the renderer.
7663 preconnectUrl: string,
7665 * True if the renderer is requesting that the connection include credentials (see
7666 * the spec for more details.)
7668 allowCredentials: boolean) => void): this;
7669 once(event: 'preconnect', listener: (event: Event,
7671 * The URL being requested for preconnection by the renderer.
7673 preconnectUrl: string,
7675 * True if the renderer is requesting that the connection include credentials (see
7676 * the spec for more details.)
7678 allowCredentials: boolean) => void): this;
7679 addListener(event: 'preconnect', listener: (event: Event,
7681 * The URL being requested for preconnection by the renderer.
7683 preconnectUrl: string,
7685 * True if the renderer is requesting that the connection include credentials (see
7686 * the spec for more details.)
7688 allowCredentials: boolean) => void): this;
7689 removeListener(event: 'preconnect', listener: (event: Event,
7691 * The URL being requested for preconnection by the renderer.
7693 preconnectUrl: string,
7695 * True if the renderer is requesting that the connection include credentials (see
7696 * the spec for more details.)
7698 allowCredentials: boolean) => void): this;
7700 * Emitted when a HID device needs to be selected when a call to
7701 * `navigator.hid.requestDevice` is made. `callback` should be called with
7702 * `deviceId` to be selected; passing no arguments to `callback` will cancel the
7703 * request. Additionally, permissioning on `navigator.hid` can be further managed
7704 * by using ses.setPermissionCheckHandler(handler) and
7705 * ses.setDevicePermissionHandler(handler)`.
7707 on(event: 'select-hid-device', listener: (event: Event,
7708 details: SelectHidDeviceDetails,
7709 callback: (deviceId?: (string) | (null)) => void) => void): this;
7710 once(event: 'select-hid-device', listener: (event: Event,
7711 details: SelectHidDeviceDetails,
7712 callback: (deviceId?: (string) | (null)) => void) => void): this;
7713 addListener(event: 'select-hid-device', listener: (event: Event,
7714 details: SelectHidDeviceDetails,
7715 callback: (deviceId?: (string) | (null)) => void) => void): this;
7716 removeListener(event: 'select-hid-device', listener: (event: Event,
7717 details: SelectHidDeviceDetails,
7718 callback: (deviceId?: (string) | (null)) => void) => void): this;
7720 * Emitted when a serial port needs to be selected when a call to
7721 * `navigator.serial.requestPort` is made. `callback` should be called with
7722 * `portId` to be selected, passing an empty string to `callback` will cancel the
7723 * request. Additionally, permissioning on `navigator.serial` can be managed by
7724 * using ses.setPermissionCheckHandler(handler) with the `serial` permission.
7726 on(event: 'select-serial-port', listener: (event: Event,
7727 portList: SerialPort[],
7728 webContents: WebContents,
7729 callback: (portId: string) => void) => void): this;
7730 once(event: 'select-serial-port', listener: (event: Event,
7731 portList: SerialPort[],
7732 webContents: WebContents,
7733 callback: (portId: string) => void) => void): this;
7734 addListener(event: 'select-serial-port', listener: (event: Event,
7735 portList: SerialPort[],
7736 webContents: WebContents,
7737 callback: (portId: string) => void) => void): this;
7738 removeListener(event: 'select-serial-port', listener: (event: Event,
7739 portList: SerialPort[],
7740 webContents: WebContents,
7741 callback: (portId: string) => void) => void): this;
7743 * Emitted after `navigator.serial.requestPort` has been called and
7744 * `select-serial-port` has fired if a new serial port becomes available before the
7745 * callback from `select-serial-port` is called. This event is intended for use
7746 * when using a UI to ask users to pick a port so that the UI can be updated with
7747 * the newly added port.
7749 on(event: 'serial-port-added', listener: (event: Event,
7751 webContents: WebContents) => void): this;
7752 once(event: 'serial-port-added', listener: (event: Event,
7754 webContents: WebContents) => void): this;
7755 addListener(event: 'serial-port-added', listener: (event: Event,
7757 webContents: WebContents) => void): this;
7758 removeListener(event: 'serial-port-added', listener: (event: Event,
7760 webContents: WebContents) => void): this;
7762 * Emitted after `navigator.serial.requestPort` has been called and
7763 * `select-serial-port` has fired if a serial port has been removed before the
7764 * callback from `select-serial-port` is called. This event is intended for use
7765 * when using a UI to ask users to pick a port so that the UI can be updated to
7766 * remove the specified port.
7768 on(event: 'serial-port-removed', listener: (event: Event,
7770 webContents: WebContents) => void): this;
7771 once(event: 'serial-port-removed', listener: (event: Event,
7773 webContents: WebContents) => void): this;
7774 addListener(event: 'serial-port-removed', listener: (event: Event,
7776 webContents: WebContents) => void): this;
7777 removeListener(event: 'serial-port-removed', listener: (event: Event,
7779 webContents: WebContents) => void): this;
7781 * Emitted after `SerialPort.forget()` has been called. This event can be used to
7782 * help maintain persistent storage of permissions when
7783 * `setDevicePermissionHandler` is used.
7785 on(event: 'serial-port-revoked', listener: (event: Event,
7786 details: SerialPortRevokedDetails) => void): this;
7787 once(event: 'serial-port-revoked', listener: (event: Event,
7788 details: SerialPortRevokedDetails) => void): this;
7789 addListener(event: 'serial-port-revoked', listener: (event: Event,
7790 details: SerialPortRevokedDetails) => void): this;
7791 removeListener(event: 'serial-port-revoked', listener: (event: Event,
7792 details: SerialPortRevokedDetails) => void): this;
7794 * Emitted when a hunspell dictionary file starts downloading
7796 on(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
7798 * The language code of the dictionary file
7800 languageCode: string) => void): this;
7801 once(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
7803 * The language code of the dictionary file
7805 languageCode: string) => void): this;
7806 addListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
7808 * The language code of the dictionary file
7810 languageCode: string) => void): this;
7811 removeListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
7813 * The language code of the dictionary file
7815 languageCode: string) => void): this;
7817 * Emitted when a hunspell dictionary file download fails. For details on the
7818 * failure you should collect a netlog and inspect the download request.
7820 on(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
7822 * The language code of the dictionary file
7824 languageCode: string) => void): this;
7825 once(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
7827 * The language code of the dictionary file
7829 languageCode: string) => void): this;
7830 addListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
7832 * The language code of the dictionary file
7834 languageCode: string) => void): this;
7835 removeListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
7837 * The language code of the dictionary file
7839 languageCode: string) => void): this;
7841 * Emitted when a hunspell dictionary file has been successfully downloaded
7843 on(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
7845 * The language code of the dictionary file
7847 languageCode: string) => void): this;
7848 once(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
7850 * The language code of the dictionary file
7852 languageCode: string) => void): this;
7853 addListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
7855 * The language code of the dictionary file
7857 languageCode: string) => void): this;
7858 removeListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
7860 * The language code of the dictionary file
7862 languageCode: string) => void): this;
7864 * Emitted when a hunspell dictionary file has been successfully initialized. This
7865 * occurs after the file has been downloaded.
7867 on(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
7869 * The language code of the dictionary file
7871 languageCode: string) => void): this;
7872 once(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
7874 * The language code of the dictionary file
7876 languageCode: string) => void): this;
7877 addListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
7879 * The language code of the dictionary file
7881 languageCode: string) => void): this;
7882 removeListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
7884 * The language code of the dictionary file
7886 languageCode: string) => void): this;
7888 * Emitted when Electron is about to download `item` in `webContents`.
7890 * Calling `event.preventDefault()` will cancel the download and `item` will not be
7891 * available from next tick of the process.
7893 on(event: 'will-download', listener: (event: Event,
7895 webContents: WebContents) => void): this;
7896 once(event: 'will-download', listener: (event: Event,
7898 webContents: WebContents) => void): this;
7899 addListener(event: 'will-download', listener: (event: Event,
7901 webContents: WebContents) => void): this;
7902 removeListener(event: 'will-download', listener: (event: Event,
7904 webContents: WebContents) => void): this;
7906 * Whether the word was successfully written to the custom dictionary. This API
7907 * will not work on non-persistent (in-memory) sessions.
7909 * **Note:** On macOS and Windows 10 this word will be written to the OS custom
7910 * dictionary as well
7912 addWordToSpellCheckerDictionary(word: string): boolean;
7914 * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
7917 allowNTLMCredentialsForDomains(domains: string): void;
7919 * resolves when the session’s HTTP authentication cache has been cleared.
7921 clearAuthCache(): Promise<void>;
7923 * resolves when the cache clear operation is complete.
7925 * Clears the session’s HTTP cache.
7927 clearCache(): Promise<void>;
7929 * resolves when the code cache clear operation is complete.
7931 clearCodeCaches(options: ClearCodeCachesOptions): Promise<void>;
7933 * Resolves when the operation is complete.
7935 * Clears the host resolver cache.
7937 clearHostResolverCache(): Promise<void>;
7939 * resolves when the storage data has been cleared.
7941 clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
7943 * Resolves when all connections are closed.
7945 * **Note:** It will terminate / fail all requests currently in flight.
7947 closeAllConnections(): Promise<void>;
7949 * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
7950 * The API will generate a DownloadItem that can be accessed with the will-download
7951 * event. The DownloadItem will not have any `WebContents` associated with it and
7952 * the initial state will be `interrupted`. The download will start only when the
7953 * `resume` API is called on the DownloadItem.
7955 createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
7957 * Disables any network emulation already active for the `session`. Resets to the
7958 * original network configuration.
7960 disableNetworkEmulation(): void;
7962 * Initiates a download of the resource at `url`. The API will generate a
7963 * DownloadItem that can be accessed with the will-download event.
7965 * **Note:** This does not perform any security checks that relate to a page's
7966 * origin, unlike `webContents.downloadURL`.
7968 downloadURL(url: string): void;
7970 * Emulates network with the given configuration for the `session`.
7972 enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
7974 * Writes any unwritten DOMStorage data to disk.
7976 flushStorageData(): void;
7978 * Resolves when the all internal states of proxy service is reset and the latest
7979 * proxy configuration is reapplied if it's already available. The pac script will
7980 * be fetched from `pacScript` again if the proxy mode is `pac_script`.
7982 forceReloadProxyConfig(): Promise<void>;
7984 * A list of all loaded extensions.
7986 * **Note:** This API cannot be called before the `ready` event of the `app` module
7989 getAllExtensions(): Extension[];
7991 * resolves with blob data.
7993 getBlobData(identifier: string): Promise<Buffer>;
7995 * the session's current cache size, in bytes.
7997 getCacheSize(): Promise<number>;
7999 * | `null` - The loaded extension with the given ID.
8001 * **Note:** This API cannot be called before the `ready` event of the `app` module
8004 getExtension(extensionId: string): Extension;
8006 * an array of paths to preload scripts that have been registered.
8008 getPreloads(): string[];
8010 * An array of language codes the spellchecker is enabled for. If this list is
8011 * empty the spellchecker will fallback to using `en-US`. By default on launch if
8012 * this setting is an empty list Electron will try to populate this setting with
8013 * the current OS locale. This setting is persisted across restarts.
8015 * **Note:** On macOS the OS spellchecker is used and has its own list of
8016 * languages. On macOS, this API will return whichever languages have been
8017 * configured by the OS.
8019 getSpellCheckerLanguages(): string[];
8021 * The absolute file system path where data for this session is persisted on disk.
8022 * For in memory sessions this returns `null`.
8024 getStoragePath(): (string) | (null);
8026 * The user agent for this session.
8028 getUserAgent(): string;
8030 * Whether or not this session is a persistent one. The default `webContents`
8031 * session of a `BrowserWindow` is persistent. When creating a session from a
8032 * partition, session prefixed with `persist:` will be persistent, while others
8033 * will be temporary.
8035 isPersistent(): boolean;
8037 * Whether the builtin spell checker is enabled.
8039 isSpellCheckerEnabled(): boolean;
8041 * An array of all words in app's custom dictionary. Resolves when the full
8042 * dictionary is loaded from disk.
8044 listWordsInSpellCheckerDictionary(): Promise<string[]>;
8046 * resolves when the extension is loaded.
8048 * This method will raise an exception if the extension could not be loaded. If
8049 * there are warnings when installing the extension (e.g. if the extension requests
8050 * an API that Electron does not support) then they will be logged to the console.
8052 * Note that Electron does not support the full range of Chrome extensions APIs.
8053 * See Supported Extensions APIs for more details on what is supported.
8055 * Note that in previous versions of Electron, extensions that were loaded would be
8056 * remembered for future runs of the application. This is no longer the case:
8057 * `loadExtension` must be called on every boot of your app if you want the
8058 * extension to be loaded.
8060 * This API does not support loading packed (.crx) extensions.
8062 * **Note:** This API cannot be called before the `ready` event of the `app` module
8065 * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
8066 * supported and will throw an error.
8068 loadExtension(path: string, options?: LoadExtensionOptions): Promise<Electron.Extension>;
8070 * Preconnects the given number of sockets to an origin.
8072 preconnect(options: PreconnectOptions): void;
8074 * Unloads an extension.
8076 * **Note:** This API cannot be called before the `ready` event of the `app` module
8079 removeExtension(extensionId: string): void;
8081 * Whether the word was successfully removed from the custom dictionary. This API
8082 * will not work on non-persistent (in-memory) sessions.
8084 * **Note:** On macOS and Windows 10 this word will be removed from the OS custom
8085 * dictionary as well
8087 removeWordFromSpellCheckerDictionary(word: string): boolean;
8089 * Resolves with the proxy information for `url`.
8091 resolveProxy(url: string): Promise<string>;
8093 * Sets a handler to respond to Bluetooth pairing requests. This handler allows
8094 * developers to handle devices that require additional validation before pairing.
8095 * When a handler is not defined, any pairing on Linux or Windows that requires
8096 * additional validation will be automatically cancelled. macOS does not require a
8097 * handler because macOS handles the pairing automatically. To clear the handler,
8098 * call `setBluetoothPairingHandler(null)`.
8100 * @platform win32,linux
8102 setBluetoothPairingHandler(handler: ((details: BluetoothPairingHandlerHandlerDetails, callback: (response: Response) => void) => void) | (null)): void;
8104 * Sets the certificate verify proc for `session`, the `proc` will be called with
8105 * `proc(request, callback)` whenever a server certificate verification is
8106 * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
8109 * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
8112 * > **NOTE:** The result of this procedure is cached by the network service.
8114 setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
8116 * Sets the directory to store the generated JS code cache for this session. The
8117 * directory is not required to be created by the user before this call, the
8118 * runtime will create if it does not exist otherwise will use the existing
8119 * directory. If directory cannot be created, then code cache will not be used and
8120 * all operations related to code cache will fail silently inside the runtime. By
8121 * default, the directory will be `Code Cache` under the respective user data
8124 setCodeCachePath(path: string): void;
8126 * Sets the handler which can be used to respond to device permission checks for
8127 * the `session`. Returning `true` will allow the device to be permitted and
8128 * `false` will reject it. To clear the handler, call
8129 * `setDevicePermissionHandler(null)`. This handler can be used to provide default
8130 * permissioning to devices without first calling for permission to devices (eg via
8131 * `navigator.hid.requestDevice`). If this handler is not defined, the default
8132 * device permissions as granted through device selection (eg via
8133 * `navigator.hid.requestDevice`) will be used. Additionally, the default behavior
8134 * of Electron is to store granted device permision in memory. If longer term
8135 * storage is needed, a developer can store granted device permissions (eg when
8136 * handling the `select-hid-device` event) and then read from that storage with
8137 * `setDevicePermissionHandler`.
8139 setDevicePermissionHandler(handler: ((details: DevicePermissionHandlerHandlerDetails) => boolean) | (null)): void;
8141 * This handler will be called when web content requests access to display media
8142 * via the `navigator.mediaDevices.getDisplayMedia` API. Use the desktopCapturer
8143 * API to choose which stream(s) to grant access to.
8145 * Passing a WebFrameMain object as a video or audio stream will capture the video
8146 * or audio stream from that frame.
8148 * Passing `null` instead of a function resets the handler to its default state.
8150 setDisplayMediaRequestHandler(handler: ((request: DisplayMediaRequestHandlerHandlerRequest, callback: (streams: Streams) => void) => void) | (null)): void;
8152 * Sets download saving directory. By default, the download directory will be the
8153 * `Downloads` under the respective app folder.
8155 setDownloadPath(path: string): void;
8157 * Sets the handler which can be used to respond to permission checks for the
8158 * `session`. Returning `true` will allow the permission and `false` will reject
8159 * it. Please note that you must also implement `setPermissionRequestHandler` to
8160 * get complete permission handling. Most web APIs do a permission check and then
8161 * make a permission request if the check is denied. To clear the handler, call
8162 * `setPermissionCheckHandler(null)`.
8164 setPermissionCheckHandler(handler: ((webContents: (WebContents) | (null), permission: string, requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void;
8166 * Sets the handler which can be used to respond to permission requests for the
8167 * `session`. Calling `callback(true)` will allow the permission and
8168 * `callback(false)` will reject it. To clear the handler, call
8169 * `setPermissionRequestHandler(null)`. Please note that you must also implement
8170 * `setPermissionCheckHandler` to get complete permission handling. Most web APIs
8171 * do a permission check and then make a permission request if the check is denied.
8173 setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'media' | 'display-capture' | 'mediaKeySystem' | 'geolocation' | 'notifications' | 'midi' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal' | 'unknown', callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void;
8175 * Adds scripts that will be executed on ALL web contents that are associated with
8176 * this session just before normal `preload` scripts run.
8178 setPreloads(preloads: string[]): void;
8180 * Resolves when the proxy setting process is complete.
8182 * Sets the proxy settings.
8184 * When `mode` is unspecified, `pacScript` and `proxyRules` are provided together,
8185 * the `proxyRules` option is ignored and `pacScript` configuration is applied.
8187 * You may need `ses.closeAllConnections` to close currently in flight connections
8188 * to prevent pooled sockets using previous proxy from being reused by future
8191 * The `proxyRules` has to follow the rules below:
8195 * * `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
8196 * HTTP proxy `foopy2:80` for `ftp://` URLs.
8197 * * `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
8198 * * `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
8199 * over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
8200 * * `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
8201 * * `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
8202 * over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
8203 * * `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
8204 * proxy if `foopy` is unavailable.
8205 * * `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
8206 * `socks4://foopy2` for all other URLs.
8208 * The `proxyBypassRules` is a comma separated list of rules described below:
8210 * * `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
8212 * Match all hostnames that match the pattern HOSTNAME_PATTERN.
8214 * Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
8215 * "https://x.*.y.com:99"
8216 * * `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
8218 * Match a particular domain suffix.
8220 * Examples: ".google.com", ".com", "http://.google.com"
8221 * * `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
8223 * Match URLs which are IP address literals.
8225 * Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
8226 * * `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
8228 * Match any URL that is to an IP literal that falls between the given range. IP
8229 * range is specified using CIDR notation.
8231 * Examples: "192.168.1.1/16", "fefe:13::abc/33".
8234 * Match local addresses. The meaning of `<local>` is whether the host matches one
8235 * of: "127.0.0.1", "::1", "localhost".
8237 setProxy(config: Config): Promise<void>;
8239 * By default Electron will download hunspell dictionaries from the Chromium CDN.
8240 * If you want to override this behavior you can use this API to point the
8241 * dictionary downloader at your own hosted version of the hunspell dictionaries.
8242 * We publish a `hunspell_dictionaries.zip` file with each release which contains
8243 * the files you need to host here.
8245 * The file server must be **case insensitive**. If you cannot do this, you must
8246 * upload each file twice: once with the case it has in the ZIP file and once with
8247 * the filename as all lowercase.
8249 * If the files present in `hunspell_dictionaries.zip` are available at
8250 * `https://example.com/dictionaries/language-code.bdic` then you should call this
8252 * `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`.
8253 * Please note the trailing slash. The URL to the dictionaries is formed as
8254 * `${url}${filename}`.
8256 * **Note:** On macOS the OS spellchecker is used and therefore we do not download
8257 * any dictionary files. This API is a no-op on macOS.
8259 setSpellCheckerDictionaryDownloadURL(url: string): void;
8261 * Sets whether to enable the builtin spell checker.
8263 setSpellCheckerEnabled(enable: boolean): void;
8265 * The built in spellchecker does not automatically detect what language a user is
8266 * typing in. In order for the spell checker to correctly check their words you
8267 * must call this API with an array of language codes. You can get the list of
8268 * supported language codes with the `ses.availableSpellCheckerLanguages` property.
8270 * **Note:** On macOS the OS spellchecker is used and will detect your language
8271 * automatically. This API is a no-op on macOS.
8273 setSpellCheckerLanguages(languages: string[]): void;
8275 * Sets the SSL configuration for the session. All subsequent network requests will
8276 * use the new configuration. Existing network connections (such as WebSocket
8277 * connections) will not be terminated, but old sockets in the pool will not be
8278 * reused for new connections.
8280 setSSLConfig(config: SSLConfigConfig): void;
8282 * Overrides the `userAgent` and `acceptLanguages` for this session.
8284 * The `acceptLanguages` must a comma separated ordered list of language codes, for
8285 * example `"en-US,fr,de,ko,zh-CN,ja"`.
8287 * This doesn't affect existing `WebContents`, and each `WebContents` can use
8288 * `webContents.setUserAgent` to override the session-wide user agent.
8290 setUserAgent(userAgent: string, acceptLanguages?: string): void;
8292 * A `string[]` array which consists of all the known available spell checker
8293 * languages. Providing a language code to the `setSpellCheckerLanguages` API that
8294 * isn't in this array will result in an error.
8297 readonly availableSpellCheckerLanguages: string[];
8299 * A `Cookies` object for this session.
8302 readonly cookies: Cookies;
8304 * A `NetLog` object for this session.
8307 readonly netLog: NetLog;
8309 * A `Protocol` object for this session.
8312 readonly protocol: Protocol;
8314 * A `ServiceWorkers` object for this session.
8317 readonly serviceWorkers: ServiceWorkers;
8319 * A `boolean` indicating whether builtin spell checker is enabled.
8321 spellCheckerEnabled: boolean;
8323 * A `string | null` indicating the absolute file system path where data for this
8324 * session is persisted on disk. For in memory sessions this returns `null`.
8327 readonly storagePath: (string) | (null);
8329 * A `WebRequest` object for this session.
8332 readonly webRequest: WebRequest;
8335 interface SharedWorkerInfo {
8337 // Docs: https://electronjs.org/docs/api/structures/shared-worker-info
8340 * The unique id of the shared worker.
8344 * The url of the shared worker.
8349 class ShareMenu extends NodeEventEmitter {
8351 // Docs: https://electronjs.org/docs/api/share-menu
8356 constructor(sharingItem: SharingItem);
8358 * Closes the context menu in the `browserWindow`.
8360 closePopup(browserWindow?: BrowserWindow): void;
8362 * Pops up this menu as a context menu in the `BrowserWindow`.
8364 popup(options?: PopupOptions): void;
8367 interface SharingItem {
8369 // Docs: https://electronjs.org/docs/api/structures/sharing-item
8372 * An array of files to share.
8374 filePaths?: string[];
8376 * An array of text to share.
8380 * An array of URLs to share.
8387 // Docs: https://electronjs.org/docs/api/shell
8390 * Play the beep sound.
8394 * Open the given external protocol URL in the desktop's default manner. (For
8395 * example, mailto: URLs in the user's default mail agent).
8397 openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
8399 * Resolves with a string containing the error message corresponding to the failure
8400 * if a failure occurred, otherwise "".
8402 * Open the given file in the desktop's default manner.
8404 openPath(path: string): Promise<string>;
8406 * Resolves the shortcut link at `shortcutPath`.
8408 * An exception will be thrown when any error happens.
8412 readShortcutLink(shortcutPath: string): ShortcutDetails;
8414 * Show the given file in a file manager. If possible, select the file.
8416 showItemInFolder(fullPath: string): void;
8418 * Resolves when the operation has been completed. Rejects if there was an error
8419 * while deleting the requested item.
8421 * This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin
8422 * on Windows, and a desktop-environment-specific location on Linux).
8424 trashItem(path: string): Promise<void>;
8426 * Whether the shortcut was created successfully.
8428 * Creates or updates a shortcut link at `shortcutPath`.
8432 writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
8434 * Whether the shortcut was created successfully.
8436 * Creates or updates a shortcut link at `shortcutPath`.
8440 writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
8443 interface ShortcutDetails {
8445 // Docs: https://electronjs.org/docs/api/structures/shortcut-details
8448 * The Application User Model ID. Default is empty.
8450 appUserModelId?: string;
8452 * The arguments to be applied to `target` when launching from this shortcut.
8457 * The working directory. Default is empty.
8461 * The description of the shortcut. Default is empty.
8463 description?: string;
8465 * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
8466 * together. Default is empty, which uses the target's icon.
8470 * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
8474 * The target to launch from this shortcut.
8478 * The Application Toast Activator CLSID. Needed for participating in Action
8481 toastActivatorClsid?: string;
8486 // Docs: https://electronjs.org/docs/api/structures/size
8492 interface SystemPreferences extends NodeJS.EventEmitter {
8494 // Docs: https://electronjs.org/docs/api/system-preferences
8496 on(event: 'accent-color-changed', listener: (event: Event,
8498 * The new RGBA color the user assigned to be their system accent color.
8500 newColor: string) => void): this;
8501 once(event: 'accent-color-changed', listener: (event: Event,
8503 * The new RGBA color the user assigned to be their system accent color.
8505 newColor: string) => void): this;
8506 addListener(event: 'accent-color-changed', listener: (event: Event,
8508 * The new RGBA color the user assigned to be their system accent color.
8510 newColor: string) => void): this;
8511 removeListener(event: 'accent-color-changed', listener: (event: Event,
8513 * The new RGBA color the user assigned to be their system accent color.
8515 newColor: string) => void): this;
8516 on(event: 'color-changed', listener: (event: Event) => void): this;
8517 once(event: 'color-changed', listener: (event: Event) => void): this;
8518 addListener(event: 'color-changed', listener: (event: Event) => void): this;
8519 removeListener(event: 'color-changed', listener: (event: Event) => void): this;
8521 * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
8526 on(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
8528 * `true` if a high contrast theme is being used, `false` otherwise.
8530 highContrastColorScheme: boolean) => void): this;
8531 once(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
8533 * `true` if a high contrast theme is being used, `false` otherwise.
8535 highContrastColorScheme: boolean) => void): this;
8536 addListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
8538 * `true` if a high contrast theme is being used, `false` otherwise.
8540 highContrastColorScheme: boolean) => void): this;
8541 removeListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
8543 * `true` if a high contrast theme is being used, `false` otherwise.
8545 highContrastColorScheme: boolean) => void): this;
8547 * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
8552 on(event: 'inverted-color-scheme-changed', listener: (event: Event,
8554 * `true` if an inverted color scheme (a high contrast color scheme with light text
8555 * and dark backgrounds) is being used, `false` otherwise.
8557 invertedColorScheme: boolean) => void): this;
8558 once(event: 'inverted-color-scheme-changed', listener: (event: Event,
8560 * `true` if an inverted color scheme (a high contrast color scheme with light text
8561 * and dark backgrounds) is being used, `false` otherwise.
8563 invertedColorScheme: boolean) => void): this;
8564 addListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
8566 * `true` if an inverted color scheme (a high contrast color scheme with light text
8567 * and dark backgrounds) is being used, `false` otherwise.
8569 invertedColorScheme: boolean) => void): this;
8570 removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
8572 * `true` if an inverted color scheme (a high contrast color scheme with light text
8573 * and dark backgrounds) is being used, `false` otherwise.
8575 invertedColorScheme: boolean) => void): this;
8577 * A promise that resolves with `true` if consent was granted and `false` if it was
8578 * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
8579 * access request was denied and later is changed through the System Preferences
8580 * pane, a restart of the app will be required for the new permissions to take
8581 * effect. If access has already been requested and denied, it _must_ be changed
8582 * through the preference pane; an alert will not pop up and the promise will
8583 * resolve with the existing access status.
8585 * **Important:** In order to properly leverage this API, you must set the
8586 * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
8587 * app's `Info.plist` file. The values for these keys will be used to populate the
8588 * permission dialogs so that the user will be properly informed as to the purpose
8589 * of the permission request. See Electron Application Distribution for more
8590 * information about how to set these in the context of Electron.
8592 * This user consent was not required until macOS 10.14 Mojave, so this method will
8593 * always return `true` if your system is running 10.13 High Sierra or lower.
8597 askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
8599 * whether or not this device has the ability to use Touch ID.
8601 * **NOTE:** This API will return `false` on macOS systems older than Sierra
8606 canPromptTouchID(): boolean;
8608 * The users current system wide accent color preference in RGBA hexadecimal form.
8610 * This API is only available on macOS 10.14 Mojave or newer.
8612 * @platform win32,darwin
8614 getAccentColor(): string;
8616 * * `shouldRenderRichAnimation` boolean - Returns true if rich animations should
8617 * be rendered. Looks at session type (e.g. remote desktop) and accessibility
8618 * settings to give guidance for heavy animations.
8619 * * `scrollAnimationsEnabledBySystem` boolean - Determines on a per-platform basis
8620 * whether scroll animations (e.g. produced by home/end key) should be enabled.
8621 * * `prefersReducedMotion` boolean - Determines whether the user desires reduced
8622 * motion based on platform APIs.
8624 * Returns an object with system animation settings.
8626 getAnimationSettings(): AnimationSettings;
8628 * | `null` - Can be `dark`, `light` or `unknown`.
8630 * Gets the macOS appearance setting that you have declared you want for your
8631 * application, maps to NSApplication.appearance. You can use the
8632 * `setAppLevelAppearance` API to set this value.
8637 getAppLevelAppearance(): ('dark' | 'light' | 'unknown');
8639 * The system color setting in RGB hexadecimal form (`#ABCDEF`). See the Windows
8640 * docs and the macOS docs for more details.
8642 * The following colors are only available on macOS 10.14: `find-highlight`,
8643 * `selected-content-background`, `separator`,
8644 * `unemphasized-selected-content-background`,
8645 * `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
8647 * @platform win32,darwin
8649 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-text' | '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;
8651 * Can be `dark`, `light` or `unknown`.
8653 * Gets the macOS appearance setting that is currently applied to your application,
8654 * maps to NSApplication.effectiveAppearance
8658 getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
8660 * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
8662 * This user consent was not required on macOS 10.13 High Sierra or lower so this
8663 * method will always return `granted`. macOS 10.14 Mojave or higher requires
8664 * consent for `microphone` and `camera` access. macOS 10.15 Catalina or higher
8665 * requires consent for `screen` access.
8667 * Windows 10 has a global setting controlling `microphone` and `camera` access for
8668 * all win32 applications. It will always return `granted` for `screen` and for all
8669 * media types on older versions of Windows.
8671 * @platform win32,darwin
8673 getMediaAccessStatus(mediaType: 'microphone' | 'camera' | 'screen'): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
8675 * The standard system color formatted as `#RRGGBBAA`.
8677 * Returns one of several standard system colors that automatically adapt to
8678 * vibrancy and changes in accessibility settings like 'Increase contrast' and
8679 * 'Reduce transparency'. See Apple Documentation for more details.
8683 getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
8685 * The value of `key` in `NSUserDefaults`.
8687 * Some popular `key` and `type`s are:
8689 * * `AppleInterfaceStyle`: `string`
8690 * * `AppleAquaColorVariant`: `integer`
8691 * * `AppleHighlightColor`: `string`
8692 * * `AppleShowScrollBars`: `string`
8693 * * `NSNavRecentPlaces`: `array`
8694 * * `NSPreferredWebServices`: `dictionary`
8695 * * `NSUserDictionaryReplacementItems`: `array`
8699 getUserDefault<Type extends keyof UserDefaultTypes>(key: string, type: Type): UserDefaultTypes[Type];
8701 * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
8703 * An example of using it to determine if you should create a transparent window or
8704 * not (transparent windows won't work correctly when DWM composition is disabled):
8708 isAeroGlassEnabled(): boolean;
8710 * Whether the system is in Dark Mode.
8712 * **Deprecated:** Should use the new `nativeTheme.shouldUseDarkColors` API.
8715 * @platform darwin,win32
8717 isDarkMode(): boolean;
8719 * `true` if a high contrast theme is active, `false` otherwise.
8721 * **Deprecated:** Should use the new `nativeTheme.shouldUseHighContrastColors`
8725 * @platform darwin,win32
8727 isHighContrastColorScheme(): boolean;
8729 * `true` if an inverted color scheme (a high contrast color scheme with light text
8730 * and dark backgrounds) is active, `false` otherwise.
8732 * **Deprecated:** Should use the new `nativeTheme.shouldUseInvertedColorScheme`
8738 isInvertedColorScheme(): boolean;
8740 * Whether the Swipe between pages setting is on.
8744 isSwipeTrackingFromScrollEventsEnabled(): boolean;
8746 * `true` if the current process is a trusted accessibility client and `false` if
8751 isTrustedAccessibilityClient(prompt: boolean): boolean;
8753 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
8754 * contains the user information dictionary sent along with the notification.
8758 postLocalNotification(event: string, userInfo: Record<string, any>): void;
8760 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
8761 * contains the user information dictionary sent along with the notification.
8765 postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
8767 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
8768 * contains the user information dictionary sent along with the notification.
8772 postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
8774 * resolves if the user has successfully authenticated with Touch ID.
8776 * This API itself will not protect your user data; rather, it is a mechanism to
8777 * allow you to do so. Native apps will need to set Access Control Constants like
8778 * `kSecAccessControlUserPresence` on their keychain entry so that reading it would
8779 * auto-prompt for Touch ID biometric consent. This could be done with
8780 * `node-keytar`, such that one would store an encryption key with `node-keytar`
8781 * and only fetch it if `promptTouchID()` resolves.
8783 * **NOTE:** This API will return a rejected Promise on macOS systems older than
8788 promptTouchID(reason: string): Promise<void>;
8790 * Add the specified defaults to your application's `NSUserDefaults`.
8794 registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
8796 * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
8797 * or global value of a `key` previously set with `setUserDefault`.
8801 removeUserDefault(key: string): void;
8803 * Sets the appearance setting for your application, this should override the
8804 * system default and override the value of `getEffectiveAppearance`.
8809 setAppLevelAppearance(appearance: (('dark' | 'light')) | (null)): void;
8811 * Set the value of `key` in `NSUserDefaults`.
8813 * Note that `type` should match actual type of `value`. An exception is thrown if
8816 * Some popular `key` and `type`s are:
8818 * * `ApplePressAndHoldEnabled`: `boolean`
8822 setUserDefault<Type extends keyof UserDefaultTypes>(key: string, type: Type, value: UserDefaultTypes[Type]): void;
8824 * The ID of this subscription
8826 * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
8827 * defaults. This is necessary for events such as
8828 * `NSUserDefaultsDidChangeNotification`.
8830 * If `event` is null, the `NSNotificationCenter` doesn’t use it as criteria for
8831 * delivery to the observer. See docs for more information.
8835 subscribeLocalNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
8837 * The ID of this subscription
8839 * Subscribes to native notifications of macOS, `callback` will be called with
8840 * `callback(event, userInfo)` when the corresponding `event` happens. The
8841 * `userInfo` is an Object that contains the user information dictionary sent along
8842 * with the notification. The `object` is the sender of the notification, and only
8843 * supports `NSString` values for now.
8845 * The `id` of the subscriber is returned, which can be used to unsubscribe the
8848 * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
8849 * values of `event` are:
8851 * * `AppleInterfaceThemeChangedNotification`
8852 * * `AppleAquaColorVariantChanged`
8853 * * `AppleColorPreferencesChangedNotification`
8854 * * `AppleShowScrollBarsSettingChanged`
8856 * If `event` is null, the `NSDistributedNotificationCenter` doesn’t use it as
8857 * criteria for delivery to the observer. See docs for more information.
8861 subscribeNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
8863 * The ID of this subscription
8865 * Same as `subscribeNotification`, but uses
8866 * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
8867 * such as `NSWorkspaceDidActivateApplicationNotification`.
8869 * If `event` is null, the `NSWorkspaceNotificationCenter` doesn’t use it as
8870 * criteria for delivery to the observer. See docs for more information.
8874 subscribeWorkspaceNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
8876 * Same as `unsubscribeNotification`, but removes the subscriber from
8877 * `NSNotificationCenter`.
8881 unsubscribeLocalNotification(id: number): void;
8883 * Removes the subscriber with `id`.
8887 unsubscribeNotification(id: number): void;
8889 * Same as `unsubscribeNotification`, but removes the subscriber from
8890 * `NSWorkspace.sharedWorkspace.notificationCenter`.
8894 unsubscribeWorkspaceNotification(id: number): void;
8896 * A `string` property that can be `dark`, `light` or `unknown`. It determines the
8897 * macOS appearance setting for your application. This maps to values in:
8898 * NSApplication.appearance. Setting this will override the system default as well
8899 * as the value of `getEffectiveAppearance`.
8901 * Possible values that can be set are `dark` and `light`, and possible return
8902 * values are `dark`, `light`, and `unknown`.
8904 * This property is only available on macOS 10.14 Mojave or newer.
8908 appLevelAppearance: ('dark' | 'light' | 'unknown');
8910 * A `string` property that can be `dark`, `light` or `unknown`.
8912 * Returns the macOS appearance setting that is currently applied to your
8913 * application, maps to NSApplication.effectiveAppearance
8917 readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
8922 // Docs: https://electronjs.org/docs/api/structures/task
8925 * The command line arguments when `program` is executed.
8929 * Description of this task.
8931 description: string;
8933 * The icon index in the icon file. If an icon file consists of two or more icons,
8934 * set this value to identify the icon. If an icon file consists of one icon, this
8939 * The absolute path to an icon to be displayed in a JumpList, which can be an
8940 * arbitrary resource file that contains an icon. You can usually specify
8941 * `process.execPath` to show the icon of the program.
8945 * Path of the program to execute, usually you should specify `process.execPath`
8946 * which opens the current program.
8950 * The string to be displayed in a JumpList.
8954 * The working directory. Default is empty.
8956 workingDirectory?: string;
8959 interface ThumbarButton {
8961 // Docs: https://electronjs.org/docs/api/structures/thumbar-button
8965 * Control specific states and behaviors of the button. By default, it is
8970 * The icon showing in thumbnail toolbar.
8974 * The text of the button's tooltip.
8981 // Docs: https://electronjs.org/docs/api/touch-bar
8986 constructor(options: TouchBarConstructorOptions);
8988 * A `TouchBarItem` that will replace the "esc" button on the touch bar when set.
8989 * Setting to `null` restores the default "esc" button. Changing this value
8990 * immediately updates the escape item in the touch bar.
8992 escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
8994 * A `typeof TouchBarButton` reference to the `TouchBarButton` class.
8996 static TouchBarButton: typeof TouchBarButton;
8998 * A `typeof TouchBarColorPicker` reference to the `TouchBarColorPicker` class.
9000 static TouchBarColorPicker: typeof TouchBarColorPicker;
9002 * A `typeof TouchBarGroup` reference to the `TouchBarGroup` class.
9004 static TouchBarGroup: typeof TouchBarGroup;
9006 * A `typeof TouchBarLabel` reference to the `TouchBarLabel` class.
9008 static TouchBarLabel: typeof TouchBarLabel;
9010 * A `typeof TouchBarOtherItemsProxy` reference to the `TouchBarOtherItemsProxy`
9013 static TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
9015 * A `typeof TouchBarPopover` reference to the `TouchBarPopover` class.
9017 static TouchBarPopover: typeof TouchBarPopover;
9019 * A `typeof TouchBarScrubber` reference to the `TouchBarScrubber` class.
9021 static TouchBarScrubber: typeof TouchBarScrubber;
9023 * A `typeof TouchBarSegmentedControl` reference to the `TouchBarSegmentedControl`
9026 static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
9028 * A `typeof TouchBarSlider` reference to the `TouchBarSlider` class.
9030 static TouchBarSlider: typeof TouchBarSlider;
9032 * A `typeof TouchBarSpacer` reference to the `TouchBarSpacer` class.
9034 static TouchBarSpacer: typeof TouchBarSpacer;
9037 class TouchBarButton {
9039 // Docs: https://electronjs.org/docs/api/touch-bar-button
9044 constructor(options: TouchBarButtonConstructorOptions);
9046 * A `string` representing the description of the button to be read by a screen
9047 * reader. Will only be read by screen readers if no label is set.
9049 accessibilityLabel: string;
9051 * A `string` hex code representing the button's current background color. Changing
9052 * this value immediately updates the button in the touch bar.
9054 backgroundColor: string;
9056 * A `boolean` representing whether the button is in an enabled state.
9060 * A `NativeImage` representing the button's current icon. Changing this value
9061 * immediately updates the button in the touch bar.
9065 * A `string` - Can be `left`, `right` or `overlay`. Defaults to `overlay`.
9067 iconPosition: ('left' | 'right' | 'overlay');
9069 * A `string` representing the button's current text. Changing this value
9070 * immediately updates the button in the touch bar.
9075 class TouchBarColorPicker extends NodeEventEmitter {
9077 // Docs: https://electronjs.org/docs/api/touch-bar-color-picker
9080 * TouchBarColorPicker
9082 constructor(options: TouchBarColorPickerConstructorOptions);
9084 * A `string[]` array representing the color picker's available colors to select.
9085 * Changing this value immediately updates the color picker in the touch bar.
9087 availableColors: string[];
9089 * A `string` hex code representing the color picker's currently selected color.
9090 * Changing this value immediately updates the color picker in the touch bar.
9092 selectedColor: string;
9095 class TouchBarGroup extends NodeEventEmitter {
9097 // Docs: https://electronjs.org/docs/api/touch-bar-group
9102 constructor(options: TouchBarGroupConstructorOptions);
9105 class TouchBarLabel extends NodeEventEmitter {
9107 // Docs: https://electronjs.org/docs/api/touch-bar-label
9112 constructor(options: TouchBarLabelConstructorOptions);
9114 * A `string` representing the description of the label to be read by a screen
9117 accessibilityLabel: string;
9119 * A `string` representing the label's current text. Changing this value
9120 * immediately updates the label in the touch bar.
9124 * A `string` hex code representing the label's current text color. Changing this
9125 * value immediately updates the label in the touch bar.
9130 class TouchBarOtherItemsProxy extends NodeEventEmitter {
9132 // Docs: https://electronjs.org/docs/api/touch-bar-other-items-proxy
9135 * TouchBarOtherItemsProxy
9140 class TouchBarPopover extends NodeEventEmitter {
9142 // Docs: https://electronjs.org/docs/api/touch-bar-popover
9147 constructor(options: TouchBarPopoverConstructorOptions);
9149 * A `NativeImage` representing the popover's current button icon. Changing this
9150 * value immediately updates the popover in the touch bar.
9154 * A `string` representing the popover's current button text. Changing this value
9155 * immediately updates the popover in the touch bar.
9160 class TouchBarScrubber extends NodeEventEmitter {
9162 // Docs: https://electronjs.org/docs/api/touch-bar-scrubber
9167 constructor(options: TouchBarScrubberConstructorOptions);
9169 * A `boolean` representing whether this scrubber is continuous or not. Updating
9170 * this value immediately updates the control in the touch bar.
9172 continuous: boolean;
9174 * A `ScrubberItem[]` array representing the items in this scrubber. Updating this
9175 * value immediately updates the control in the touch bar. Updating deep properties
9176 * inside this array **does not update the touch bar**.
9178 items: ScrubberItem[];
9180 * A `string` representing the mode of this scrubber. Updating this value
9181 * immediately updates the control in the touch bar. Possible values:
9183 * * `fixed` - Maps to `NSScrubberModeFixed`.
9184 * * `free` - Maps to `NSScrubberModeFree`.
9186 mode: ('fixed' | 'free');
9188 * A `string` representing the style that selected items in the scrubber should
9189 * have. This style is overlayed on top of the scrubber item instead of being
9190 * placed behind it. Updating this value immediately updates the control in the
9191 * touch bar. Possible values:
9193 * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
9194 * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
9195 * * `none` - Removes all styles.
9197 overlayStyle: ('background' | 'outline' | 'none');
9199 * A `string` representing the style that selected items in the scrubber should
9200 * have. Updating this value immediately updates the control in the touch bar.
9203 * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
9204 * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
9205 * * `none` - Removes all styles.
9207 selectedStyle: ('background' | 'outline' | 'none');
9209 * A `boolean` representing whether to show the left / right selection arrows in
9210 * this scrubber. Updating this value immediately updates the control in the touch
9213 showArrowButtons: boolean;
9216 class TouchBarSegmentedControl extends NodeEventEmitter {
9218 // Docs: https://electronjs.org/docs/api/touch-bar-segmented-control
9221 * TouchBarSegmentedControl
9223 constructor(options: TouchBarSegmentedControlConstructorOptions);
9225 * A `string` representing the current selection mode of the control. Can be
9226 * `single`, `multiple` or `buttons`.
9228 mode: ('single' | 'multiple' | 'buttons');
9230 * A `SegmentedControlSegment[]` array representing the segments in this control.
9231 * Updating this value immediately updates the control in the touch bar. Updating
9232 * deep properties inside this array **does not update the touch bar**.
9234 segments: SegmentedControlSegment[];
9236 * A `string` representing the controls current segment style. Updating this value
9237 * immediately updates the control in the touch bar.
9239 segmentStyle: string;
9241 * An `Integer` representing the currently selected segment. Changing this value
9242 * immediately updates the control in the touch bar. User interaction with the
9243 * touch bar will update this value automatically.
9245 selectedIndex: number;
9248 class TouchBarSlider extends NodeEventEmitter {
9250 // Docs: https://electronjs.org/docs/api/touch-bar-slider
9255 constructor(options: TouchBarSliderConstructorOptions);
9257 * A `string` representing the slider's current text. Changing this value
9258 * immediately updates the slider in the touch bar.
9262 * A `number` representing the slider's current maximum value. Changing this value
9263 * immediately updates the slider in the touch bar.
9267 * A `number` representing the slider's current minimum value. Changing this value
9268 * immediately updates the slider in the touch bar.
9272 * A `number` representing the slider's current value. Changing this value
9273 * immediately updates the slider in the touch bar.
9278 class TouchBarSpacer extends NodeEventEmitter {
9280 // Docs: https://electronjs.org/docs/api/touch-bar-spacer
9285 constructor(options: TouchBarSpacerConstructorOptions);
9287 * A `string` representing the size of the spacer. Can be `small`, `large` or
9290 size: ('small' | 'large' | 'flexible');
9293 interface TraceCategoriesAndOptions {
9295 // Docs: https://electronjs.org/docs/api/structures/trace-categories-and-options
9298 * A filter to control what category groups should be traced. A filter can have an
9299 * optional '-' prefix to exclude category groups that contain a matching category.
9300 * Having both included and excluded category patterns in the same list is not
9301 * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
9302 * `-excluded_category1,-excluded_category2`.
9304 categoryFilter: string;
9306 * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
9307 * the following strings: `record-until-full`, `record-continuously`,
9308 * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
9309 * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
9310 * modes and hence mutually exclusive. If more than one trace recording modes
9311 * appear in the `traceOptions` string, the last one takes precedence. If none of
9312 * the trace recording modes are specified, recording mode is `record-until-full`.
9313 * The trace option will first be reset to the default option (`record_mode` set to
9314 * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
9315 * before options parsed from `traceOptions` are applied on it.
9317 traceOptions: string;
9320 interface TraceConfig {
9322 // Docs: https://electronjs.org/docs/api/structures/trace-config
9325 * if true, filter event data according to a specific list of events that have been
9326 * manually vetted to not include any PII. See the implementation in Chromium for
9329 enable_argument_filter?: boolean;
9331 * a list of tracing categories to exclude. Can include glob-like patterns using
9332 * `*` at the end of the category name. See tracing categories for the list of
9335 excluded_categories?: string[];
9337 * a list of histogram names to report with the trace.
9339 histogram_names?: string[];
9341 * a list of tracing categories to include. Can include glob-like patterns using
9342 * `*` at the end of the category name. See tracing categories for the list of
9345 included_categories?: string[];
9347 * a list of process IDs to include in the trace. If not specified, trace all
9350 included_process_ids?: number[];
9352 * if the `disabled-by-default-memory-infra` category is enabled, this contains
9353 * optional additional configuration for data collection. See the Chromium
9354 * memory-infra docs for more information.
9356 memory_dump_config?: Record<string, any>;
9358 * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
9359 * or `trace-to-console`. Defaults to `record-until-full`.
9361 recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
9363 * maximum size of the trace recording buffer in events.
9365 trace_buffer_size_in_events?: number;
9367 * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
9369 trace_buffer_size_in_kb?: number;
9372 interface Transaction {
9374 // Docs: https://electronjs.org/docs/api/structures/transaction
9377 * The error code if an error occurred while processing the transaction.
9381 * The error message if an error occurred while processing the transaction.
9383 errorMessage: string;
9385 * The identifier of the restored transaction by the App Store.
9387 originalTransactionIdentifier: string;
9390 * The date the transaction was added to the App Store’s payment queue.
9392 transactionDate: string;
9394 * A string that uniquely identifies a successful payment transaction.
9396 transactionIdentifier: string;
9398 * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
9401 transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
9404 class Tray extends NodeEventEmitter {
9406 // Docs: https://electronjs.org/docs/api/tray
9409 * Emitted when the tray balloon is clicked.
9413 on(event: 'balloon-click', listener: Function): this;
9414 once(event: 'balloon-click', listener: Function): this;
9415 addListener(event: 'balloon-click', listener: Function): this;
9416 removeListener(event: 'balloon-click', listener: Function): this;
9418 * Emitted when the tray balloon is closed because of timeout or user manually
9423 on(event: 'balloon-closed', listener: Function): this;
9424 once(event: 'balloon-closed', listener: Function): this;
9425 addListener(event: 'balloon-closed', listener: Function): this;
9426 removeListener(event: 'balloon-closed', listener: Function): this;
9428 * Emitted when the tray balloon shows.
9432 on(event: 'balloon-show', listener: Function): this;
9433 once(event: 'balloon-show', listener: Function): this;
9434 addListener(event: 'balloon-show', listener: Function): this;
9435 removeListener(event: 'balloon-show', listener: Function): this;
9437 * Emitted when the tray icon is clicked.
9439 * Note that on Linux this event is emitted when the tray icon receives an
9440 * activation, which might not necessarily be left mouse click.
9442 on(event: 'click', listener: (event: KeyboardEvent,
9444 * The bounds of tray icon.
9448 * The position of the event.
9450 position: Point) => void): this;
9451 once(event: 'click', listener: (event: KeyboardEvent,
9453 * The bounds of tray icon.
9457 * The position of the event.
9459 position: Point) => void): this;
9460 addListener(event: 'click', listener: (event: KeyboardEvent,
9462 * The bounds of tray icon.
9466 * The position of the event.
9468 position: Point) => void): this;
9469 removeListener(event: 'click', listener: (event: KeyboardEvent,
9471 * The bounds of tray icon.
9475 * The position of the event.
9477 position: Point) => void): this;
9479 * Emitted when the tray icon is double clicked.
9481 * @platform darwin,win32
9483 on(event: 'double-click', listener: (event: KeyboardEvent,
9485 * The bounds of tray icon.
9487 bounds: Rectangle) => void): this;
9488 once(event: 'double-click', listener: (event: KeyboardEvent,
9490 * The bounds of tray icon.
9492 bounds: Rectangle) => void): this;
9493 addListener(event: 'double-click', listener: (event: KeyboardEvent,
9495 * The bounds of tray icon.
9497 bounds: Rectangle) => void): this;
9498 removeListener(event: 'double-click', listener: (event: KeyboardEvent,
9500 * The bounds of tray icon.
9502 bounds: Rectangle) => void): this;
9504 * Emitted when a drag operation ends on the tray or ends at another location.
9508 on(event: 'drag-end', listener: Function): this;
9509 once(event: 'drag-end', listener: Function): this;
9510 addListener(event: 'drag-end', listener: Function): this;
9511 removeListener(event: 'drag-end', listener: Function): this;
9513 * Emitted when a drag operation enters the tray icon.
9517 on(event: 'drag-enter', listener: Function): this;
9518 once(event: 'drag-enter', listener: Function): this;
9519 addListener(event: 'drag-enter', listener: Function): this;
9520 removeListener(event: 'drag-enter', listener: Function): this;
9522 * Emitted when a drag operation exits the tray icon.
9526 on(event: 'drag-leave', listener: Function): this;
9527 once(event: 'drag-leave', listener: Function): this;
9528 addListener(event: 'drag-leave', listener: Function): this;
9529 removeListener(event: 'drag-leave', listener: Function): this;
9531 * Emitted when any dragged items are dropped on the tray icon.
9535 on(event: 'drop', listener: Function): this;
9536 once(event: 'drop', listener: Function): this;
9537 addListener(event: 'drop', listener: Function): this;
9538 removeListener(event: 'drop', listener: Function): this;
9540 * Emitted when dragged files are dropped in the tray icon.
9544 on(event: 'drop-files', listener: (event: Event,
9546 * The paths of the dropped files.
9548 files: string[]) => void): this;
9549 once(event: 'drop-files', listener: (event: Event,
9551 * The paths of the dropped files.
9553 files: string[]) => void): this;
9554 addListener(event: 'drop-files', listener: (event: Event,
9556 * The paths of the dropped files.
9558 files: string[]) => void): this;
9559 removeListener(event: 'drop-files', listener: (event: Event,
9561 * The paths of the dropped files.
9563 files: string[]) => void): this;
9565 * Emitted when dragged text is dropped in the tray icon.
9569 on(event: 'drop-text', listener: (event: Event,
9571 * the dropped text string.
9573 text: string) => void): this;
9574 once(event: 'drop-text', listener: (event: Event,
9576 * the dropped text string.
9578 text: string) => void): this;
9579 addListener(event: 'drop-text', listener: (event: Event,
9581 * the dropped text string.
9583 text: string) => void): this;
9584 removeListener(event: 'drop-text', listener: (event: Event,
9586 * the dropped text string.
9588 text: string) => void): this;
9590 * Emitted when the mouse clicks the tray icon.
9594 on(event: 'mouse-down', listener: (event: KeyboardEvent,
9596 * The position of the event.
9598 position: Point) => void): this;
9599 once(event: 'mouse-down', listener: (event: KeyboardEvent,
9601 * The position of the event.
9603 position: Point) => void): this;
9604 addListener(event: 'mouse-down', listener: (event: KeyboardEvent,
9606 * The position of the event.
9608 position: Point) => void): this;
9609 removeListener(event: 'mouse-down', listener: (event: KeyboardEvent,
9611 * The position of the event.
9613 position: Point) => void): this;
9615 * Emitted when the mouse enters the tray icon.
9619 on(event: 'mouse-enter', listener: (event: KeyboardEvent,
9621 * The position of the event.
9623 position: Point) => void): this;
9624 once(event: 'mouse-enter', listener: (event: KeyboardEvent,
9626 * The position of the event.
9628 position: Point) => void): this;
9629 addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
9631 * The position of the event.
9633 position: Point) => void): this;
9634 removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
9636 * The position of the event.
9638 position: Point) => void): this;
9640 * Emitted when the mouse exits the tray icon.
9644 on(event: 'mouse-leave', listener: (event: KeyboardEvent,
9646 * The position of the event.
9648 position: Point) => void): this;
9649 once(event: 'mouse-leave', listener: (event: KeyboardEvent,
9651 * The position of the event.
9653 position: Point) => void): this;
9654 addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
9656 * The position of the event.
9658 position: Point) => void): this;
9659 removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
9661 * The position of the event.
9663 position: Point) => void): this;
9665 * Emitted when the mouse moves in the tray icon.
9667 * @platform darwin,win32
9669 on(event: 'mouse-move', listener: (event: KeyboardEvent,
9671 * The position of the event.
9673 position: Point) => void): this;
9674 once(event: 'mouse-move', listener: (event: KeyboardEvent,
9676 * The position of the event.
9678 position: Point) => void): this;
9679 addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
9681 * The position of the event.
9683 position: Point) => void): this;
9684 removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
9686 * The position of the event.
9688 position: Point) => void): this;
9690 * Emitted when the mouse is released from clicking the tray icon.
9692 * Note: This will not be emitted if you have set a context menu for your Tray
9693 * using `tray.setContextMenu`, as a result of macOS-level constraints.
9697 on(event: 'mouse-up', listener: (event: KeyboardEvent,
9699 * The position of the event.
9701 position: Point) => void): this;
9702 once(event: 'mouse-up', listener: (event: KeyboardEvent,
9704 * The position of the event.
9706 position: Point) => void): this;
9707 addListener(event: 'mouse-up', listener: (event: KeyboardEvent,
9709 * The position of the event.
9711 position: Point) => void): this;
9712 removeListener(event: 'mouse-up', listener: (event: KeyboardEvent,
9714 * The position of the event.
9716 position: Point) => void): this;
9718 * Emitted when the tray icon is right clicked.
9720 * @platform darwin,win32
9722 on(event: 'right-click', listener: (event: KeyboardEvent,
9724 * The bounds of tray icon.
9726 bounds: Rectangle) => void): this;
9727 once(event: 'right-click', listener: (event: KeyboardEvent,
9729 * The bounds of tray icon.
9731 bounds: Rectangle) => void): this;
9732 addListener(event: 'right-click', listener: (event: KeyboardEvent,
9734 * The bounds of tray icon.
9736 bounds: Rectangle) => void): this;
9737 removeListener(event: 'right-click', listener: (event: KeyboardEvent,
9739 * The bounds of tray icon.
9741 bounds: Rectangle) => void): this;
9745 constructor(image: (NativeImage) | (string), guid?: string);
9747 * Closes an open context menu, as set by `tray.setContextMenu()`.
9749 * @platform darwin,win32
9751 closeContextMenu(): void;
9753 * Destroys the tray icon immediately.
9757 * Displays a tray balloon.
9761 displayBalloon(options: DisplayBalloonOptions): void;
9763 * Returns focus to the taskbar notification area. Notification area icons should
9764 * use this message when they have completed their UI operation. For example, if
9765 * the icon displays a shortcut menu, but the user presses ESC to cancel it, use
9766 * `tray.focus()` to return focus to the notification area.
9772 * The `bounds` of this tray icon as `Object`.
9774 * @platform darwin,win32
9776 getBounds(): Rectangle;
9778 * Whether double click events will be ignored.
9782 getIgnoreDoubleClickEvents(): boolean;
9784 * the title displayed next to the tray icon in the status bar
9790 * Whether the tray icon is destroyed.
9792 isDestroyed(): boolean;
9794 * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
9795 * will be shown instead of the tray icon's context menu.
9797 * The `position` is only available on Windows, and it is (0, 0) by default.
9799 * @platform darwin,win32
9801 popUpContextMenu(menu?: Menu, position?: Point): void;
9803 * Removes a tray balloon.
9807 removeBalloon(): void;
9809 * Sets the context menu for this icon.
9811 setContextMenu(menu: (Menu) | (null)): void;
9813 * Sets the option to ignore double click events. Ignoring these events allows you
9814 * to detect every individual click of the tray icon.
9816 * This value is set to false by default.
9820 setIgnoreDoubleClickEvents(ignore: boolean): void;
9822 * Sets the `image` associated with this tray icon.
9824 setImage(image: (NativeImage) | (string)): void;
9826 * Sets the `image` associated with this tray icon when pressed on macOS.
9830 setPressedImage(image: (NativeImage) | (string)): void;
9832 * Sets the title displayed next to the tray icon in the status bar (Support ANSI
9837 setTitle(title: string, options?: TitleOptions): void;
9839 * Sets the hover text for this tray icon.
9841 setToolTip(toolTip: string): void;
9844 interface UploadData {
9846 // Docs: https://electronjs.org/docs/api/structures/upload-data
9849 * UUID of blob data. Use ses.getBlobData method to retrieve the data.
9853 * Content being sent.
9857 * Path of file being uploaded.
9862 interface UploadFile {
9864 // Docs: https://electronjs.org/docs/api/structures/upload-file
9867 * Path of file to be uploaded.
9871 * Number of bytes to read from `offset`. Defaults to `0`.
9875 * Last Modification time in number of seconds since the UNIX epoch.
9877 modificationTime: number;
9888 interface UploadRawData {
9890 // Docs: https://electronjs.org/docs/api/structures/upload-raw-data
9893 * Data to be uploaded.
9902 interface UserDefaultTypes {
9904 // Docs: https://electronjs.org/docs/api/structures/user-default-types
9906 array: Array<unknown>;
9908 dictionary: Record<string, unknown>;
9916 class UtilityProcess extends NodeEventEmitter {
9918 // Docs: https://electronjs.org/docs/api/utility-process
9920 static fork(modulePath: string, args?: string[], options?: ForkOptions): UtilityProcess;
9922 * Emitted after the child process ends.
9924 on(event: 'exit', listener: (
9926 * Contains the exit code for the process obtained from waitpid on posix, or
9927 * GetExitCodeProcess on windows.
9929 code: number) => void): this;
9930 once(event: 'exit', listener: (
9932 * Contains the exit code for the process obtained from waitpid on posix, or
9933 * GetExitCodeProcess on windows.
9935 code: number) => void): this;
9936 addListener(event: 'exit', listener: (
9938 * Contains the exit code for the process obtained from waitpid on posix, or
9939 * GetExitCodeProcess on windows.
9941 code: number) => void): this;
9942 removeListener(event: 'exit', listener: (
9944 * Contains the exit code for the process obtained from waitpid on posix, or
9945 * GetExitCodeProcess on windows.
9947 code: number) => void): this;
9949 * Emitted when the child process sends a message using
9950 * `process.parentPort.postMessage()`.
9952 on(event: 'message', listener: (message: any) => void): this;
9953 once(event: 'message', listener: (message: any) => void): this;
9954 addListener(event: 'message', listener: (message: any) => void): this;
9955 removeListener(event: 'message', listener: (message: any) => void): this;
9957 * Emitted once the child process has spawned successfully.
9959 on(event: 'spawn', listener: Function): this;
9960 once(event: 'spawn', listener: Function): this;
9961 addListener(event: 'spawn', listener: Function): this;
9962 removeListener(event: 'spawn', listener: Function): this;
9964 * Terminates the process gracefully. On POSIX, it uses SIGTERM but will ensure the
9965 * process is reaped on exit. This function returns true if the kill is successful,
9966 * and false otherwise.
9970 * Send a message to the child process, optionally transferring ownership of zero
9971 * or more `MessagePortMain` objects.
9975 postMessage(message: any, transfer?: MessagePortMain[]): void;
9977 * A `Integer | undefined` representing the process identifier (PID) of the child
9978 * process. If the child process fails to spawn due to errors, then the value is
9979 * `undefined`. When the child process exits, then the value is `undefined` after
9980 * the `exit` event is emitted.
9982 pid: (number) | (undefined);
9984 * A `NodeJS.ReadableStream | null` that represents the child process's stderr. If
9985 * the child was spawned with options.stdio[2] set to anything other than 'pipe',
9986 * then this will be `null`. When the child process exits, then the value is `null`
9987 * after the `exit` event is emitted.
9989 stderr: (NodeJS.ReadableStream) | (null);
9991 * A `NodeJS.ReadableStream | null` that represents the child process's stdout. If
9992 * the child was spawned with options.stdio[1] set to anything other than 'pipe',
9993 * then this will be `null`. When the child process exits, then the value is `null`
9994 * after the `exit` event is emitted.
9996 stdout: (NodeJS.ReadableStream) | (null);
9999 class WebContents extends NodeEventEmitter {
10001 // Docs: https://electronjs.org/docs/api/web-contents
10004 * | undefined - A WebContents instance with the given TargetID, or `undefined` if
10005 * there is no WebContents associated with the given TargetID.
10007 * When communicating with the Chrome DevTools Protocol, it can be useful to lookup
10008 * a WebContents instance based on its assigned TargetID.
10010 static fromDevToolsTargetId(targetId: string): WebContents;
10012 * | undefined - A WebContents instance with the given WebFrameMain, or `undefined`
10013 * if there is no WebContents associated with the given WebFrameMain.
10015 static fromFrame(frame: WebFrameMain): WebContents;
10017 * | undefined - A WebContents instance with the given ID, or `undefined` if there
10018 * is no WebContents associated with the given ID.
10020 static fromId(id: number): WebContents;
10022 * An array of all `WebContents` instances. This will contain web contents for all
10023 * windows, webviews, opened devtools, and devtools extension background pages.
10025 static getAllWebContents(): WebContents[];
10027 * | null - The web contents that is focused in this application, otherwise returns
10030 static getFocusedWebContents(): WebContents;
10032 * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
10033 * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
10036 * To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
10038 on(event: 'before-input-event', listener: (event: Event,
10040 * Input properties.
10042 input: Input) => void): this;
10043 once(event: 'before-input-event', listener: (event: Event,
10045 * Input properties.
10047 input: Input) => void): this;
10048 addListener(event: 'before-input-event', listener: (event: Event,
10050 * Input properties.
10052 input: Input) => void): this;
10053 removeListener(event: 'before-input-event', listener: (event: Event,
10055 * Input properties.
10057 input: Input) => void): this;
10059 * Emitted when the `WebContents` loses focus.
10061 on(event: 'blur', listener: Function): this;
10062 once(event: 'blur', listener: Function): this;
10063 addListener(event: 'blur', listener: Function): this;
10064 removeListener(event: 'blur', listener: Function): this;
10066 * Emitted when failed to verify the `certificate` for `url`.
10068 * The usage is the same with the `certificate-error` event of `app`.
10070 on(event: 'certificate-error', listener: (event: Event,
10076 certificate: Certificate,
10077 callback: (isTrusted: boolean) => void,
10078 isMainFrame: boolean) => void): this;
10079 once(event: 'certificate-error', listener: (event: Event,
10085 certificate: Certificate,
10086 callback: (isTrusted: boolean) => void,
10087 isMainFrame: boolean) => void): this;
10088 addListener(event: 'certificate-error', listener: (event: Event,
10094 certificate: Certificate,
10095 callback: (isTrusted: boolean) => void,
10096 isMainFrame: boolean) => void): this;
10097 removeListener(event: 'certificate-error', listener: (event: Event,
10103 certificate: Certificate,
10104 callback: (isTrusted: boolean) => void,
10105 isMainFrame: boolean) => void): this;
10107 * Emitted when the associated window logs a console message.
10109 on(event: 'console-message', listener: (event: Event,
10111 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
10116 * The actual console message
10120 * The line number of the source that triggered this console message
10123 sourceId: string) => void): this;
10124 once(event: 'console-message', listener: (event: Event,
10126 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
10131 * The actual console message
10135 * The line number of the source that triggered this console message
10138 sourceId: string) => void): this;
10139 addListener(event: 'console-message', listener: (event: Event,
10141 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
10146 * The actual console message
10150 * The line number of the source that triggered this console message
10153 sourceId: string) => void): this;
10154 removeListener(event: 'console-message', listener: (event: Event,
10156 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
10161 * The actual console message
10165 * The line number of the source that triggered this console message
10168 sourceId: string) => void): this;
10170 * Emitted when the page calls `window.moveTo`, `window.resizeTo` or related APIs.
10172 * By default, this will move the window. To prevent that behavior, call
10173 * `event.preventDefault()`.
10175 on(event: 'content-bounds-updated', listener: (event: Event,
10177 * requested new content bounds
10179 bounds: Rectangle) => void): this;
10180 once(event: 'content-bounds-updated', listener: (event: Event,
10182 * requested new content bounds
10184 bounds: Rectangle) => void): this;
10185 addListener(event: 'content-bounds-updated', listener: (event: Event,
10187 * requested new content bounds
10189 bounds: Rectangle) => void): this;
10190 removeListener(event: 'content-bounds-updated', listener: (event: Event,
10192 * requested new content bounds
10194 bounds: Rectangle) => void): this;
10196 * Emitted when there is a new context menu that needs to be handled.
10198 on(event: 'context-menu', listener: (event: Event,
10199 params: ContextMenuParams) => void): this;
10200 once(event: 'context-menu', listener: (event: Event,
10201 params: ContextMenuParams) => void): this;
10202 addListener(event: 'context-menu', listener: (event: Event,
10203 params: ContextMenuParams) => void): this;
10204 removeListener(event: 'context-menu', listener: (event: Event,
10205 params: ContextMenuParams) => void): this;
10207 * Emitted when the renderer process crashes or is killed.
10209 * **Deprecated:** This event is superceded by the `render-process-gone` event
10210 * which contains more information about why the render process disappeared. It
10211 * isn't always because it crashed. The `killed` boolean can be replaced by
10212 * checking `reason === 'killed'` when you switch to that event.
10216 on(event: 'crashed', listener: (event: Event,
10217 killed: boolean) => void): this;
10218 once(event: 'crashed', listener: (event: Event,
10219 killed: boolean) => void): this;
10220 addListener(event: 'crashed', listener: (event: Event,
10221 killed: boolean) => void): this;
10222 removeListener(event: 'crashed', listener: (event: Event,
10223 killed: boolean) => void): this;
10225 * Emitted when the cursor's type changes. The `type` parameter can be `default`,
10226 * `crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
10227 * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
10228 * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
10229 * `row-resize`, `m-panning`, `e-panning`, `n-panning`, `ne-panning`, `nw-panning`,
10230 * `s-panning`, `se-panning`, `sw-panning`, `w-panning`, `move`, `vertical-text`,
10231 * `cell`, `context-menu`, `alias`, `progress`, `nodrop`, `copy`, `none`,
10232 * `not-allowed`, `zoom-in`, `zoom-out`, `grab`, `grabbing` or `custom`.
10234 * If the `type` parameter is `custom`, the `image` parameter will hold the custom
10235 * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
10236 * additional information about the custom cursor.
10238 on(event: 'cursor-changed', listener: (event: Event,
10240 image: NativeImage,
10242 * scaling factor for the custom cursor.
10246 * the size of the `image`.
10250 * coordinates of the custom cursor's hotspot.
10252 hotspot: Point) => void): this;
10253 once(event: 'cursor-changed', listener: (event: Event,
10255 image: NativeImage,
10257 * scaling factor for the custom cursor.
10261 * the size of the `image`.
10265 * coordinates of the custom cursor's hotspot.
10267 hotspot: Point) => void): this;
10268 addListener(event: 'cursor-changed', listener: (event: Event,
10270 image: NativeImage,
10272 * scaling factor for the custom cursor.
10276 * the size of the `image`.
10280 * coordinates of the custom cursor's hotspot.
10282 hotspot: Point) => void): this;
10283 removeListener(event: 'cursor-changed', listener: (event: Event,
10285 image: NativeImage,
10287 * scaling factor for the custom cursor.
10291 * the size of the `image`.
10295 * coordinates of the custom cursor's hotspot.
10297 hotspot: Point) => void): this;
10299 * Emitted when `webContents` is destroyed.
10301 on(event: 'destroyed', listener: Function): this;
10302 once(event: 'destroyed', listener: Function): this;
10303 addListener(event: 'destroyed', listener: Function): this;
10304 removeListener(event: 'destroyed', listener: Function): this;
10306 * Emitted when DevTools is closed.
10308 on(event: 'devtools-closed', listener: Function): this;
10309 once(event: 'devtools-closed', listener: Function): this;
10310 addListener(event: 'devtools-closed', listener: Function): this;
10311 removeListener(event: 'devtools-closed', listener: Function): this;
10313 * Emitted when DevTools is focused / opened.
10315 on(event: 'devtools-focused', listener: Function): this;
10316 once(event: 'devtools-focused', listener: Function): this;
10317 addListener(event: 'devtools-focused', listener: Function): this;
10318 removeListener(event: 'devtools-focused', listener: Function): this;
10320 * Emitted when DevTools is opened.
10322 on(event: 'devtools-opened', listener: Function): this;
10323 once(event: 'devtools-opened', listener: Function): this;
10324 addListener(event: 'devtools-opened', listener: Function): this;
10325 removeListener(event: 'devtools-opened', listener: Function): this;
10327 * Emitted when the devtools window instructs the webContents to reload
10329 on(event: 'devtools-reload-page', listener: Function): this;
10330 once(event: 'devtools-reload-page', listener: Function): this;
10331 addListener(event: 'devtools-reload-page', listener: Function): this;
10332 removeListener(event: 'devtools-reload-page', listener: Function): this;
10334 * Emitted when a `<webview>` has been attached to this web contents.
10336 on(event: 'did-attach-webview', listener: (event: Event,
10338 * The guest web contents that is used by the `<webview>`.
10340 webContents: WebContents) => void): this;
10341 once(event: 'did-attach-webview', listener: (event: Event,
10343 * The guest web contents that is used by the `<webview>`.
10345 webContents: WebContents) => void): this;
10346 addListener(event: 'did-attach-webview', listener: (event: Event,
10348 * The guest web contents that is used by the `<webview>`.
10350 webContents: WebContents) => void): this;
10351 removeListener(event: 'did-attach-webview', listener: (event: Event,
10353 * The guest web contents that is used by the `<webview>`.
10355 webContents: WebContents) => void): this;
10357 * Emitted when a page's theme color changes. This is usually due to encountering a
10360 on(event: 'did-change-theme-color', listener: (event: Event,
10362 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
10364 color: (string) | (null)) => void): this;
10365 once(event: 'did-change-theme-color', listener: (event: Event,
10367 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
10369 color: (string) | (null)) => void): this;
10370 addListener(event: 'did-change-theme-color', listener: (event: Event,
10372 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
10374 color: (string) | (null)) => void): this;
10375 removeListener(event: 'did-change-theme-color', listener: (event: Event,
10377 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
10379 color: (string) | (null)) => void): this;
10381 * Emitted _after_ successful creation of a window via `window.open` in the
10382 * renderer. Not emitted if the creation of the window is canceled from
10383 * `webContents.setWindowOpenHandler`.
10385 * See `window.open()` for more details and how to use this in conjunction with
10386 * `webContents.setWindowOpenHandler`.
10388 on(event: 'did-create-window', listener: (window: BrowserWindow,
10389 details: DidCreateWindowDetails) => void): this;
10390 once(event: 'did-create-window', listener: (window: BrowserWindow,
10391 details: DidCreateWindowDetails) => void): this;
10392 addListener(event: 'did-create-window', listener: (window: BrowserWindow,
10393 details: DidCreateWindowDetails) => void): this;
10394 removeListener(event: 'did-create-window', listener: (window: BrowserWindow,
10395 details: DidCreateWindowDetails) => void): this;
10397 * This event is like `did-finish-load` but emitted when the load failed. The full
10398 * list of error codes and their meaning is available here.
10400 on(event: 'did-fail-load', listener: (event: Event,
10402 errorDescription: string,
10403 validatedURL: string,
10404 isMainFrame: boolean,
10405 frameProcessId: number,
10406 frameRoutingId: number) => void): this;
10407 once(event: 'did-fail-load', listener: (event: Event,
10409 errorDescription: string,
10410 validatedURL: string,
10411 isMainFrame: boolean,
10412 frameProcessId: number,
10413 frameRoutingId: number) => void): this;
10414 addListener(event: 'did-fail-load', listener: (event: Event,
10416 errorDescription: string,
10417 validatedURL: string,
10418 isMainFrame: boolean,
10419 frameProcessId: number,
10420 frameRoutingId: number) => void): this;
10421 removeListener(event: 'did-fail-load', listener: (event: Event,
10423 errorDescription: string,
10424 validatedURL: string,
10425 isMainFrame: boolean,
10426 frameProcessId: number,
10427 frameRoutingId: number) => void): this;
10429 * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
10430 * `window.stop()` was invoked).
10432 on(event: 'did-fail-provisional-load', listener: (event: Event,
10434 errorDescription: string,
10435 validatedURL: string,
10436 isMainFrame: boolean,
10437 frameProcessId: number,
10438 frameRoutingId: number) => void): this;
10439 once(event: 'did-fail-provisional-load', listener: (event: Event,
10441 errorDescription: string,
10442 validatedURL: string,
10443 isMainFrame: boolean,
10444 frameProcessId: number,
10445 frameRoutingId: number) => void): this;
10446 addListener(event: 'did-fail-provisional-load', listener: (event: Event,
10448 errorDescription: string,
10449 validatedURL: string,
10450 isMainFrame: boolean,
10451 frameProcessId: number,
10452 frameRoutingId: number) => void): this;
10453 removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
10455 errorDescription: string,
10456 validatedURL: string,
10457 isMainFrame: boolean,
10458 frameProcessId: number,
10459 frameRoutingId: number) => void): this;
10461 * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
10462 * spinning, and the `onload` event was dispatched.
10464 on(event: 'did-finish-load', listener: Function): this;
10465 once(event: 'did-finish-load', listener: Function): this;
10466 addListener(event: 'did-finish-load', listener: Function): this;
10467 removeListener(event: 'did-finish-load', listener: Function): this;
10469 * Emitted when a frame has done navigation.
10471 on(event: 'did-frame-finish-load', listener: (event: Event,
10472 isMainFrame: boolean,
10473 frameProcessId: number,
10474 frameRoutingId: number) => void): this;
10475 once(event: 'did-frame-finish-load', listener: (event: Event,
10476 isMainFrame: boolean,
10477 frameProcessId: number,
10478 frameRoutingId: number) => void): this;
10479 addListener(event: 'did-frame-finish-load', listener: (event: Event,
10480 isMainFrame: boolean,
10481 frameProcessId: number,
10482 frameRoutingId: number) => void): this;
10483 removeListener(event: 'did-frame-finish-load', listener: (event: Event,
10484 isMainFrame: boolean,
10485 frameProcessId: number,
10486 frameRoutingId: number) => void): this;
10488 * Emitted when any frame navigation is done.
10490 * This event is not emitted for in-page navigations, such as clicking anchor links
10491 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
10494 on(event: 'did-frame-navigate', listener: (event: Event,
10497 * -1 for non HTTP navigations
10499 httpResponseCode: number,
10501 * empty for non HTTP navigations,
10503 httpStatusText: string,
10504 isMainFrame: boolean,
10505 frameProcessId: number,
10506 frameRoutingId: number) => void): this;
10507 once(event: 'did-frame-navigate', listener: (event: Event,
10510 * -1 for non HTTP navigations
10512 httpResponseCode: number,
10514 * empty for non HTTP navigations,
10516 httpStatusText: string,
10517 isMainFrame: boolean,
10518 frameProcessId: number,
10519 frameRoutingId: number) => void): this;
10520 addListener(event: 'did-frame-navigate', listener: (event: Event,
10523 * -1 for non HTTP navigations
10525 httpResponseCode: number,
10527 * empty for non HTTP navigations,
10529 httpStatusText: string,
10530 isMainFrame: boolean,
10531 frameProcessId: number,
10532 frameRoutingId: number) => void): this;
10533 removeListener(event: 'did-frame-navigate', listener: (event: Event,
10536 * -1 for non HTTP navigations
10538 httpResponseCode: number,
10540 * empty for non HTTP navigations,
10542 httpStatusText: string,
10543 isMainFrame: boolean,
10544 frameProcessId: number,
10545 frameRoutingId: number) => void): this;
10547 * Emitted when a main frame navigation is done.
10549 * This event is not emitted for in-page navigations, such as clicking anchor links
10550 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
10553 on(event: 'did-navigate', listener: (event: Event,
10556 * -1 for non HTTP navigations
10558 httpResponseCode: number,
10560 * empty for non HTTP navigations
10562 httpStatusText: string) => void): this;
10563 once(event: 'did-navigate', listener: (event: Event,
10566 * -1 for non HTTP navigations
10568 httpResponseCode: number,
10570 * empty for non HTTP navigations
10572 httpStatusText: string) => void): this;
10573 addListener(event: 'did-navigate', listener: (event: Event,
10576 * -1 for non HTTP navigations
10578 httpResponseCode: number,
10580 * empty for non HTTP navigations
10582 httpStatusText: string) => void): this;
10583 removeListener(event: 'did-navigate', listener: (event: Event,
10586 * -1 for non HTTP navigations
10588 httpResponseCode: number,
10590 * empty for non HTTP navigations
10592 httpStatusText: string) => void): this;
10594 * Emitted when an in-page navigation happened in any frame.
10596 * When in-page navigation happens, the page URL changes but does not cause
10597 * navigation outside of the page. Examples of this occurring are when anchor links
10598 * are clicked or when the DOM `hashchange` event is triggered.
10600 on(event: 'did-navigate-in-page', listener: (event: Event,
10602 isMainFrame: boolean,
10603 frameProcessId: number,
10604 frameRoutingId: number) => void): this;
10605 once(event: 'did-navigate-in-page', listener: (event: Event,
10607 isMainFrame: boolean,
10608 frameProcessId: number,
10609 frameRoutingId: number) => void): this;
10610 addListener(event: 'did-navigate-in-page', listener: (event: Event,
10612 isMainFrame: boolean,
10613 frameProcessId: number,
10614 frameRoutingId: number) => void): this;
10615 removeListener(event: 'did-navigate-in-page', listener: (event: Event,
10617 isMainFrame: boolean,
10618 frameProcessId: number,
10619 frameRoutingId: number) => void): this;
10621 * Emitted after a server side redirect occurs during navigation. For example a
10624 * This event cannot be prevented, if you want to prevent redirects you should
10625 * checkout out the `will-redirect` event above.
10627 on(event: 'did-redirect-navigation', listener: (event: Event,
10629 isInPlace: boolean,
10630 isMainFrame: boolean,
10631 frameProcessId: number,
10632 frameRoutingId: number) => void): this;
10633 once(event: 'did-redirect-navigation', listener: (event: Event,
10635 isInPlace: boolean,
10636 isMainFrame: boolean,
10637 frameProcessId: number,
10638 frameRoutingId: number) => void): this;
10639 addListener(event: 'did-redirect-navigation', listener: (event: Event,
10641 isInPlace: boolean,
10642 isMainFrame: boolean,
10643 frameProcessId: number,
10644 frameRoutingId: number) => void): this;
10645 removeListener(event: 'did-redirect-navigation', listener: (event: Event,
10647 isInPlace: boolean,
10648 isMainFrame: boolean,
10649 frameProcessId: number,
10650 frameRoutingId: number) => void): this;
10652 * Corresponds to the points in time when the spinner of the tab started spinning.
10654 on(event: 'did-start-loading', listener: Function): this;
10655 once(event: 'did-start-loading', listener: Function): this;
10656 addListener(event: 'did-start-loading', listener: Function): this;
10657 removeListener(event: 'did-start-loading', listener: Function): this;
10659 * Emitted when any frame (including main) starts navigating. `isInPlace` will be
10660 * `true` for in-page navigations.
10662 on(event: 'did-start-navigation', listener: (event: Event,
10664 isInPlace: boolean,
10665 isMainFrame: boolean,
10666 frameProcessId: number,
10667 frameRoutingId: number) => void): this;
10668 once(event: 'did-start-navigation', listener: (event: Event,
10670 isInPlace: boolean,
10671 isMainFrame: boolean,
10672 frameProcessId: number,
10673 frameRoutingId: number) => void): this;
10674 addListener(event: 'did-start-navigation', listener: (event: Event,
10676 isInPlace: boolean,
10677 isMainFrame: boolean,
10678 frameProcessId: number,
10679 frameRoutingId: number) => void): this;
10680 removeListener(event: 'did-start-navigation', listener: (event: Event,
10682 isInPlace: boolean,
10683 isMainFrame: boolean,
10684 frameProcessId: number,
10685 frameRoutingId: number) => void): this;
10687 * Corresponds to the points in time when the spinner of the tab stopped spinning.
10689 on(event: 'did-stop-loading', listener: Function): this;
10690 once(event: 'did-stop-loading', listener: Function): this;
10691 addListener(event: 'did-stop-loading', listener: Function): this;
10692 removeListener(event: 'did-stop-loading', listener: Function): this;
10694 * Emitted when the document in the top-level frame is loaded.
10696 on(event: 'dom-ready', listener: Function): this;
10697 once(event: 'dom-ready', listener: Function): this;
10698 addListener(event: 'dom-ready', listener: Function): this;
10699 removeListener(event: 'dom-ready', listener: Function): this;
10701 * Emitted when the window enters a full-screen state triggered by HTML API.
10703 on(event: 'enter-html-full-screen', listener: Function): this;
10704 once(event: 'enter-html-full-screen', listener: Function): this;
10705 addListener(event: 'enter-html-full-screen', listener: Function): this;
10706 removeListener(event: 'enter-html-full-screen', listener: Function): this;
10708 * Emitted when the `WebContents` gains focus.
10710 * Note that on macOS, having focus means the `WebContents` is the first responder
10711 * of window, so switching focus between windows would not trigger the `focus` and
10712 * `blur` events of `WebContents`, as the first responder of each window is not
10715 * The `focus` and `blur` events of `WebContents` should only be used to detect
10716 * focus change between different `WebContents` and `BrowserView` in the same
10719 on(event: 'focus', listener: Function): this;
10720 once(event: 'focus', listener: Function): this;
10721 addListener(event: 'focus', listener: Function): this;
10722 removeListener(event: 'focus', listener: Function): this;
10724 * Emitted when a result is available for [`webContents.findInPage`] request.
10726 on(event: 'found-in-page', listener: (event: Event,
10727 result: Result) => void): this;
10728 once(event: 'found-in-page', listener: (event: Event,
10729 result: Result) => void): this;
10730 addListener(event: 'found-in-page', listener: (event: Event,
10731 result: Result) => void): this;
10732 removeListener(event: 'found-in-page', listener: (event: Event,
10733 result: Result) => void): this;
10735 * Emitted when the mainFrame, an `<iframe>`, or a nested `<iframe>` is loaded
10738 on(event: 'frame-created', listener: (event: Event,
10739 details: FrameCreatedDetails) => void): this;
10740 once(event: 'frame-created', listener: (event: Event,
10741 details: FrameCreatedDetails) => void): this;
10742 addListener(event: 'frame-created', listener: (event: Event,
10743 details: FrameCreatedDetails) => void): this;
10744 removeListener(event: 'frame-created', listener: (event: Event,
10745 details: FrameCreatedDetails) => void): this;
10747 * Emitted when an input event is sent to the WebContents. See InputEvent for
10750 on(event: 'input-event', listener: (event: Event,
10751 inputEvent: InputEvent) => void): this;
10752 once(event: 'input-event', listener: (event: Event,
10753 inputEvent: InputEvent) => void): this;
10754 addListener(event: 'input-event', listener: (event: Event,
10755 inputEvent: InputEvent) => void): this;
10756 removeListener(event: 'input-event', listener: (event: Event,
10757 inputEvent: InputEvent) => void): this;
10759 * Emitted when the renderer process sends an asynchronous message via
10760 * `ipcRenderer.send()`.
10762 * See also `webContents.ipc`, which provides an `IpcMain`-like interface for
10763 * responding to IPC messages specifically from this WebContents.
10765 on(event: 'ipc-message', listener: (event: Event,
10767 ...args: any[]) => void): this;
10768 once(event: 'ipc-message', listener: (event: Event,
10770 ...args: any[]) => void): this;
10771 addListener(event: 'ipc-message', listener: (event: Event,
10773 ...args: any[]) => void): this;
10774 removeListener(event: 'ipc-message', listener: (event: Event,
10776 ...args: any[]) => void): this;
10778 * Emitted when the renderer process sends a synchronous message via
10779 * `ipcRenderer.sendSync()`.
10781 * See also `webContents.ipc`, which provides an `IpcMain`-like interface for
10782 * responding to IPC messages specifically from this WebContents.
10784 on(event: 'ipc-message-sync', listener: (event: Event,
10786 ...args: any[]) => void): this;
10787 once(event: 'ipc-message-sync', listener: (event: Event,
10789 ...args: any[]) => void): this;
10790 addListener(event: 'ipc-message-sync', listener: (event: Event,
10792 ...args: any[]) => void): this;
10793 removeListener(event: 'ipc-message-sync', listener: (event: Event,
10795 ...args: any[]) => void): this;
10797 * Emitted when the window leaves a full-screen state triggered by HTML API.
10799 on(event: 'leave-html-full-screen', listener: Function): this;
10800 once(event: 'leave-html-full-screen', listener: Function): this;
10801 addListener(event: 'leave-html-full-screen', listener: Function): this;
10802 removeListener(event: 'leave-html-full-screen', listener: Function): this;
10804 * Emitted when `webContents` wants to do basic auth.
10806 * The usage is the same with the `login` event of `app`.
10808 on(event: 'login', listener: (event: Event,
10809 authenticationResponseDetails: AuthenticationResponseDetails,
10810 authInfo: AuthInfo,
10811 callback: (username?: string, password?: string) => void) => void): this;
10812 once(event: 'login', listener: (event: Event,
10813 authenticationResponseDetails: AuthenticationResponseDetails,
10814 authInfo: AuthInfo,
10815 callback: (username?: string, password?: string) => void) => void): this;
10816 addListener(event: 'login', listener: (event: Event,
10817 authenticationResponseDetails: AuthenticationResponseDetails,
10818 authInfo: AuthInfo,
10819 callback: (username?: string, password?: string) => void) => void): this;
10820 removeListener(event: 'login', listener: (event: Event,
10821 authenticationResponseDetails: AuthenticationResponseDetails,
10822 authInfo: AuthInfo,
10823 callback: (username?: string, password?: string) => void) => void): this;
10825 * Emitted when media is paused or done playing.
10827 on(event: 'media-paused', listener: Function): this;
10828 once(event: 'media-paused', listener: Function): this;
10829 addListener(event: 'media-paused', listener: Function): this;
10830 removeListener(event: 'media-paused', listener: Function): this;
10832 * Emitted when media starts playing.
10834 on(event: 'media-started-playing', listener: Function): this;
10835 once(event: 'media-started-playing', listener: Function): this;
10836 addListener(event: 'media-started-playing', listener: Function): this;
10837 removeListener(event: 'media-started-playing', listener: Function): this;
10839 * Emitted when page receives favicon urls.
10841 on(event: 'page-favicon-updated', listener: (event: Event,
10845 favicons: string[]) => void): this;
10846 once(event: 'page-favicon-updated', listener: (event: Event,
10850 favicons: string[]) => void): this;
10851 addListener(event: 'page-favicon-updated', listener: (event: Event,
10855 favicons: string[]) => void): this;
10856 removeListener(event: 'page-favicon-updated', listener: (event: Event,
10860 favicons: string[]) => void): this;
10862 * Fired when page title is set during navigation. `explicitSet` is false when
10863 * title is synthesized from file url.
10865 on(event: 'page-title-updated', listener: (event: Event,
10867 explicitSet: boolean) => void): this;
10868 once(event: 'page-title-updated', listener: (event: Event,
10870 explicitSet: boolean) => void): this;
10871 addListener(event: 'page-title-updated', listener: (event: Event,
10873 explicitSet: boolean) => void): this;
10874 removeListener(event: 'page-title-updated', listener: (event: Event,
10876 explicitSet: boolean) => void): this;
10878 * Emitted when a new frame is generated. Only the dirty area is passed in the
10881 on(event: 'paint', listener: (event: Event,
10882 dirtyRect: Rectangle,
10884 * The image data of the whole frame.
10886 image: NativeImage) => void): this;
10887 once(event: 'paint', listener: (event: Event,
10888 dirtyRect: Rectangle,
10890 * The image data of the whole frame.
10892 image: NativeImage) => void): this;
10893 addListener(event: 'paint', listener: (event: Event,
10894 dirtyRect: Rectangle,
10896 * The image data of the whole frame.
10898 image: NativeImage) => void): this;
10899 removeListener(event: 'paint', listener: (event: Event,
10900 dirtyRect: Rectangle,
10902 * The image data of the whole frame.
10904 image: NativeImage) => void): this;
10906 * Emitted when a plugin process has crashed.
10908 on(event: 'plugin-crashed', listener: (event: Event,
10910 version: string) => void): this;
10911 once(event: 'plugin-crashed', listener: (event: Event,
10913 version: string) => void): this;
10914 addListener(event: 'plugin-crashed', listener: (event: Event,
10916 version: string) => void): this;
10917 removeListener(event: 'plugin-crashed', listener: (event: Event,
10919 version: string) => void): this;
10921 * Emitted when the `WebContents` preferred size has changed.
10923 * This event will only be emitted when `enablePreferredSizeMode` is set to `true`
10924 * in `webPreferences`.
10926 on(event: 'preferred-size-changed', listener: (event: Event,
10928 * The minimum size needed to contain the layout of the document—without requiring
10931 preferredSize: Size) => void): this;
10932 once(event: 'preferred-size-changed', listener: (event: Event,
10934 * The minimum size needed to contain the layout of the document—without requiring
10937 preferredSize: Size) => void): this;
10938 addListener(event: 'preferred-size-changed', listener: (event: Event,
10940 * The minimum size needed to contain the layout of the document—without requiring
10943 preferredSize: Size) => void): this;
10944 removeListener(event: 'preferred-size-changed', listener: (event: Event,
10946 * The minimum size needed to contain the layout of the document—without requiring
10949 preferredSize: Size) => void): this;
10951 * Emitted when the preload script `preloadPath` throws an unhandled exception
10954 on(event: 'preload-error', listener: (event: Event,
10955 preloadPath: string,
10956 error: Error) => void): this;
10957 once(event: 'preload-error', listener: (event: Event,
10958 preloadPath: string,
10959 error: Error) => void): this;
10960 addListener(event: 'preload-error', listener: (event: Event,
10961 preloadPath: string,
10962 error: Error) => void): this;
10963 removeListener(event: 'preload-error', listener: (event: Event,
10964 preloadPath: string,
10965 error: Error) => void): this;
10967 * Emitted when the renderer process unexpectedly disappears. This is normally
10968 * because it was crashed or killed.
10970 on(event: 'render-process-gone', listener: (event: Event,
10971 details: RenderProcessGoneDetails) => void): this;
10972 once(event: 'render-process-gone', listener: (event: Event,
10973 details: RenderProcessGoneDetails) => void): this;
10974 addListener(event: 'render-process-gone', listener: (event: Event,
10975 details: RenderProcessGoneDetails) => void): this;
10976 removeListener(event: 'render-process-gone', listener: (event: Event,
10977 details: RenderProcessGoneDetails) => void): this;
10979 * Emitted when the unresponsive web page becomes responsive again.
10981 on(event: 'responsive', listener: Function): this;
10982 once(event: 'responsive', listener: Function): this;
10983 addListener(event: 'responsive', listener: Function): this;
10984 removeListener(event: 'responsive', listener: Function): this;
10986 * Emitted when bluetooth device needs to be selected on call to
10987 * `navigator.bluetooth.requestDevice`. To use `navigator.bluetooth` api
10988 * `webBluetooth` should be enabled. If `event.preventDefault` is not called, first
10989 * available device will be selected. `callback` should be called with `deviceId`
10990 * to be selected, passing empty string to `callback` will cancel the request.
10992 * If no event listener is added for this event, all bluetooth requests will be
10995 on(event: 'select-bluetooth-device', listener: (event: Event,
10996 devices: BluetoothDevice[],
10997 callback: (deviceId: string) => void) => void): this;
10998 once(event: 'select-bluetooth-device', listener: (event: Event,
10999 devices: BluetoothDevice[],
11000 callback: (deviceId: string) => void) => void): this;
11001 addListener(event: 'select-bluetooth-device', listener: (event: Event,
11002 devices: BluetoothDevice[],
11003 callback: (deviceId: string) => void) => void): this;
11004 removeListener(event: 'select-bluetooth-device', listener: (event: Event,
11005 devices: BluetoothDevice[],
11006 callback: (deviceId: string) => void) => void): this;
11008 * Emitted when a client certificate is requested.
11010 * The usage is the same with the `select-client-certificate` event of `app`.
11012 on(event: 'select-client-certificate', listener: (event: Event,
11014 certificateList: Certificate[],
11015 callback: (certificate: Certificate) => void) => void): this;
11016 once(event: 'select-client-certificate', listener: (event: Event,
11018 certificateList: Certificate[],
11019 callback: (certificate: Certificate) => void) => void): this;
11020 addListener(event: 'select-client-certificate', listener: (event: Event,
11022 certificateList: Certificate[],
11023 callback: (certificate: Certificate) => void) => void): this;
11024 removeListener(event: 'select-client-certificate', listener: (event: Event,
11026 certificateList: Certificate[],
11027 callback: (certificate: Certificate) => void) => void): this;
11029 * Emitted when the web page becomes unresponsive.
11031 on(event: 'unresponsive', listener: Function): this;
11032 once(event: 'unresponsive', listener: Function): this;
11033 addListener(event: 'unresponsive', listener: Function): this;
11034 removeListener(event: 'unresponsive', listener: Function): this;
11036 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
11038 on(event: 'update-target-url', listener: (event: Event,
11039 url: string) => void): this;
11040 once(event: 'update-target-url', listener: (event: Event,
11041 url: string) => void): this;
11042 addListener(event: 'update-target-url', listener: (event: Event,
11043 url: string) => void): this;
11044 removeListener(event: 'update-target-url', listener: (event: Event,
11045 url: string) => void): this;
11047 * Emitted when a `<webview>`'s web contents is being attached to this web
11048 * contents. Calling `event.preventDefault()` will destroy the guest page.
11050 * This event can be used to configure `webPreferences` for the `webContents` of a
11051 * `<webview>` before it's loaded, and provides the ability to set settings that
11052 * can't be set via `<webview>` attributes.
11054 on(event: 'will-attach-webview', listener: (event: Event,
11056 * The web preferences that will be used by the guest page. This object can be
11057 * modified to adjust the preferences for the guest page.
11059 webPreferences: WebPreferences,
11061 * The other `<webview>` parameters such as the `src` URL. This object can be
11062 * modified to adjust the parameters of the guest page.
11064 params: Record<string, string>) => void): this;
11065 once(event: 'will-attach-webview', listener: (event: Event,
11067 * The web preferences that will be used by the guest page. This object can be
11068 * modified to adjust the preferences for the guest page.
11070 webPreferences: WebPreferences,
11072 * The other `<webview>` parameters such as the `src` URL. This object can be
11073 * modified to adjust the parameters of the guest page.
11075 params: Record<string, string>) => void): this;
11076 addListener(event: 'will-attach-webview', listener: (event: Event,
11078 * The web preferences that will be used by the guest page. This object can be
11079 * modified to adjust the preferences for the guest page.
11081 webPreferences: WebPreferences,
11083 * The other `<webview>` parameters such as the `src` URL. This object can be
11084 * modified to adjust the parameters of the guest page.
11086 params: Record<string, string>) => void): this;
11087 removeListener(event: 'will-attach-webview', listener: (event: Event,
11089 * The web preferences that will be used by the guest page. This object can be
11090 * modified to adjust the preferences for the guest page.
11092 webPreferences: WebPreferences,
11094 * The other `<webview>` parameters such as the `src` URL. This object can be
11095 * modified to adjust the parameters of the guest page.
11097 params: Record<string, string>) => void): this;
11099 * Emitted when a user or the page wants to start navigation. It can happen when
11100 * the `window.location` object is changed or a user clicks a link in the page.
11102 * This event will not emit when the navigation is started programmatically with
11103 * APIs like `webContents.loadURL` and `webContents.back`.
11105 * It is also not emitted for in-page navigations, such as clicking anchor links or
11106 * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
11109 * Calling `event.preventDefault()` will prevent the navigation.
11111 on(event: 'will-navigate', listener: (event: Event,
11112 url: string) => void): this;
11113 once(event: 'will-navigate', listener: (event: Event,
11114 url: string) => void): this;
11115 addListener(event: 'will-navigate', listener: (event: Event,
11116 url: string) => void): this;
11117 removeListener(event: 'will-navigate', listener: (event: Event,
11118 url: string) => void): this;
11120 * Emitted when a `beforeunload` event handler is attempting to cancel a page
11123 * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
11124 * and allow the page to be unloaded.
11126 * **Note:** This will be emitted for `BrowserViews` but will _not_ be respected -
11127 * this is because we have chosen not to tie the `BrowserView` lifecycle to its
11128 * owning BrowserWindow should one exist per the specification.
11130 on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
11131 once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
11132 addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
11133 removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
11135 * Emitted when a server side redirect occurs during navigation. For example a 302
11138 * This event will be emitted after `did-start-navigation` and always before the
11139 * `did-redirect-navigation` event for the same navigation.
11141 * Calling `event.preventDefault()` will prevent the navigation (not just the
11144 on(event: 'will-redirect', listener: (event: Event,
11146 isInPlace: boolean,
11147 isMainFrame: boolean,
11148 frameProcessId: number,
11149 frameRoutingId: number) => void): this;
11150 once(event: 'will-redirect', listener: (event: Event,
11152 isInPlace: boolean,
11153 isMainFrame: boolean,
11154 frameProcessId: number,
11155 frameRoutingId: number) => void): this;
11156 addListener(event: 'will-redirect', listener: (event: Event,
11158 isInPlace: boolean,
11159 isMainFrame: boolean,
11160 frameProcessId: number,
11161 frameRoutingId: number) => void): this;
11162 removeListener(event: 'will-redirect', listener: (event: Event,
11164 isInPlace: boolean,
11165 isMainFrame: boolean,
11166 frameProcessId: number,
11167 frameRoutingId: number) => void): this;
11169 * Emitted when the user is requesting to change the zoom level using the mouse
11172 on(event: 'zoom-changed', listener: (event: Event,
11174 * Can be `in` or `out`.
11176 zoomDirection: ('in' | 'out')) => void): this;
11177 once(event: 'zoom-changed', listener: (event: Event,
11179 * Can be `in` or `out`.
11181 zoomDirection: ('in' | 'out')) => void): this;
11182 addListener(event: 'zoom-changed', listener: (event: Event,
11184 * Can be `in` or `out`.
11186 zoomDirection: ('in' | 'out')) => void): this;
11187 removeListener(event: 'zoom-changed', listener: (event: Event,
11189 * Can be `in` or `out`.
11191 zoomDirection: ('in' | 'out')) => void): this;
11193 * Adds the specified path to DevTools workspace. Must be used after DevTools
11196 addWorkSpace(path: string): void;
11198 * Begin subscribing for presentation events and captured frames, the `callback`
11199 * will be called with `callback(image, dirtyRect)` when there is a presentation
11202 * The `image` is an instance of NativeImage that stores the captured frame.
11204 * The `dirtyRect` is an object with `x, y, width, height` properties that
11205 * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
11206 * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
11208 beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
11210 * Begin subscribing for presentation events and captured frames, the `callback`
11211 * will be called with `callback(image, dirtyRect)` when there is a presentation
11214 * The `image` is an instance of NativeImage that stores the captured frame.
11216 * The `dirtyRect` is an object with `x, y, width, height` properties that
11217 * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
11218 * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
11220 beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
11222 * Whether the browser can go back to previous web page.
11224 canGoBack(): boolean;
11226 * Whether the browser can go forward to next web page.
11228 canGoForward(): boolean;
11230 * Whether the web page can go to `offset`.
11232 canGoToOffset(offset: number): boolean;
11234 * Resolves with a NativeImage
11236 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
11237 * whole visible page.
11239 capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
11241 * Clears the navigation history.
11243 clearHistory(): void;
11245 * Closes the page, as if the web content had called `window.close()`.
11247 * If the page is successfully closed (i.e. the unload is not prevented by the
11248 * page, or `waitForBeforeUnload` is false or unspecified), the WebContents will be
11249 * destroyed and no longer usable. The `destroyed` event will be emitted.
11251 close(opts?: Opts): void;
11253 * Closes the devtools.
11255 closeDevTools(): void;
11257 * Executes the editing command `copy` in web page.
11261 * Copy the image at the given position to the clipboard.
11263 copyImageAt(x: number, y: number): void;
11265 * Executes the editing command `cut` in web page.
11269 * Decrease the capturer count by one. The page will be set to hidden or occluded
11270 * state when its browser window is hidden or occluded and the capturer count
11271 * reaches zero. If you want to decrease the hidden capturer count instead you
11272 * should set `stayHidden` to true.
11274 decrementCapturerCount(stayHidden?: boolean, stayAwake?: boolean): void;
11276 * Executes the editing command `delete` in web page.
11280 * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
11282 disableDeviceEmulation(): void;
11284 * Initiates a download of the resource at `url` without navigating. The
11285 * `will-download` event of `session` will be triggered.
11287 downloadURL(url: string): void;
11289 * Enable device emulation with the given parameters.
11291 enableDeviceEmulation(parameters: Parameters): void;
11293 * End subscribing for frame presentation events.
11295 endFrameSubscription(): void;
11297 * A promise that resolves with the result of the executed code or is rejected if
11298 * the result of the code is a rejected promise.
11300 * Evaluates `code` in page.
11302 * In the browser window some HTML APIs like `requestFullScreen` can only be
11303 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
11306 * Code execution will be suspended until web page stop loading.
11308 executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
11310 * A promise that resolves with the result of the executed code or is rejected if
11311 * the result of the code is a rejected promise.
11313 * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
11315 executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
11317 * The request id used for the request.
11319 * Starts a request to find all matches for the `text` in the web page. The result
11320 * of the request can be obtained by subscribing to `found-in-page` event.
11322 findInPage(text: string, options?: FindInPageOptions): number;
11324 * Focuses the web page.
11328 * Forcefully terminates the renderer process that is currently hosting this
11329 * `webContents`. This will cause the `render-process-gone` event to be emitted
11330 * with the `reason=killed || reason=crashed`. Please note that some webContents
11331 * share renderer processes and therefore calling this method may also crash the
11332 * host process for other webContents as well.
11334 * Calling `reload()` immediately after calling this method will force the reload
11335 * to occur in a new process. This should be used when this process is unstable or
11336 * unusable, for instance in order to recover from the `unresponsive` event.
11338 forcefullyCrashRenderer(): void;
11340 * Information about all Shared Workers.
11342 getAllSharedWorkers(): SharedWorkerInfo[];
11344 * whether or not this WebContents will throttle animations and timers when the
11345 * page becomes backgrounded. This also affects the Page Visibility API.
11347 getBackgroundThrottling(): boolean;
11349 * If *offscreen rendering* is enabled returns the current frame rate.
11351 getFrameRate(): number;
11353 * The identifier of a WebContents stream. This identifier can be used with
11354 * `navigator.mediaDevices.getUserMedia` using a `chromeMediaSource` of `tab`. The
11355 * identifier is restricted to the web contents that it is registered to and is
11356 * only valid for 10 seconds.
11358 getMediaSourceId(requestWebContents: WebContents): string;
11360 * The operating system `pid` of the associated renderer process.
11362 getOSProcessId(): number;
11364 * Get the system printer list.
11367 * **Deprecated:** Should use the new `contents.getPrintersAsync` API.
11371 getPrinters(): PrinterInfo[];
11373 * Get the system printer list.
11375 * Resolves with a `PrinterInfo[]`
11377 getPrintersAsync(): Promise<Electron.PrinterInfo[]>;
11379 * The Chromium internal `pid` of the associated renderer. Can be compared to the
11380 * `frameProcessId` passed by frame specific navigation events (e.g.
11381 * `did-frame-navigate`)
11383 getProcessId(): number;
11385 * The title of the current web page.
11387 getTitle(): string;
11389 * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
11390 * `remote`, `webview` or `offscreen`.
11392 getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
11394 * The URL of the current web page.
11398 * The user agent for this web page.
11400 getUserAgent(): string;
11402 * Returns the WebRTC IP Handling Policy.
11404 getWebRTCIPHandlingPolicy(): string;
11406 * the current zoom factor.
11408 getZoomFactor(): number;
11410 * the current zoom level.
11412 getZoomLevel(): number;
11414 * Makes the browser go back a web page.
11418 * Makes the browser go forward a web page.
11422 * Navigates browser to the specified absolute web page index.
11424 goToIndex(index: number): void;
11426 * Navigates to the specified offset from the "current entry".
11428 goToOffset(offset: number): void;
11430 * Increase the capturer count by one. The page is considered visible when its
11431 * browser window is hidden and the capturer count is non-zero. If you would like
11432 * the page to stay hidden, you should ensure that `stayHidden` is set to true.
11434 * This also affects the Page Visibility API.
11436 incrementCapturerCount(size?: Size, stayHidden?: boolean, stayAwake?: boolean): void;
11438 * A promise that resolves with a key for the inserted CSS that can later be used
11439 * to remove the CSS via `contents.removeInsertedCSS(key)`.
11441 * Injects CSS into the current web page and returns a unique key for the inserted
11444 insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
11446 * Inserts `text` to the focused element.
11448 insertText(text: string): Promise<void>;
11450 * Starts inspecting element at position (`x`, `y`).
11452 inspectElement(x: number, y: number): void;
11454 * Opens the developer tools for the service worker context.
11456 inspectServiceWorker(): void;
11458 * Opens the developer tools for the shared worker context.
11460 inspectSharedWorker(): void;
11462 * Inspects the shared worker based on its ID.
11464 inspectSharedWorkerById(workerId: string): void;
11466 * Schedules a full repaint of the window this web contents is in.
11468 * If *offscreen rendering* is enabled invalidates the frame and generates a new
11469 * one through the `'paint'` event.
11471 invalidate(): void;
11473 * Whether this page has been muted.
11475 isAudioMuted(): boolean;
11477 * Whether this page is being captured. It returns true when the capturer count is
11480 isBeingCaptured(): boolean;
11482 * Whether the renderer process has crashed.
11484 isCrashed(): boolean;
11486 * Whether audio is currently playing.
11488 isCurrentlyAudible(): boolean;
11490 * Whether the web page is destroyed.
11492 isDestroyed(): boolean;
11494 * Whether the devtools view is focused .
11496 isDevToolsFocused(): boolean;
11498 * Whether the devtools is opened.
11500 isDevToolsOpened(): boolean;
11502 * Whether the web page is focused.
11504 isFocused(): boolean;
11506 * Whether web page is still loading resources.
11508 isLoading(): boolean;
11510 * Whether the main frame (and not just iframes or frames within it) is still
11513 isLoadingMainFrame(): boolean;
11515 * Indicates whether *offscreen rendering* is enabled.
11517 isOffscreen(): boolean;
11519 * If *offscreen rendering* is enabled returns whether it is currently painting.
11521 isPainting(): boolean;
11523 * Whether the web page is waiting for a first-response from the main resource of
11526 isWaitingForResponse(): boolean;
11528 * the promise will resolve when the page has finished loading (see
11529 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
11531 * Loads the given file in the window, `filePath` should be a path to an HTML file
11532 * relative to the root of your application. For instance an app structure like
11535 * Would require code like this
11537 loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
11539 * the promise will resolve when the page has finished loading (see
11540 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
11541 * A noop rejection handler is already attached, which avoids unhandled rejection
11544 * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
11545 * the `http://` or `file://`. If the load should bypass http cache then use the
11546 * `pragma` header to achieve it.
11548 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
11550 * Opens the devtools.
11552 * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
11553 * explicitly passing an empty `mode` can force using last used dock state.
11555 * On Windows, if Windows Control Overlay is enabled, Devtools will be opened with
11556 * `mode: 'detach'`.
11558 openDevTools(options?: OpenDevToolsOptions): void;
11560 * Executes the editing command `paste` in web page.
11564 * Executes the editing command `pasteAndMatchStyle` in web page.
11566 pasteAndMatchStyle(): void;
11568 * Send a message to the renderer process, optionally transferring ownership of
11569 * zero or more `MessagePortMain` objects.
11571 * The transferred `MessagePortMain` objects will be available in the renderer
11572 * process by accessing the `ports` property of the emitted event. When they arrive
11573 * in the renderer, they will be native DOM `MessagePort` objects.
11577 postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
11579 * When a custom `pageSize` is passed, Chromium attempts to validate platform
11580 * specific minimum values for `width_microns` and `height_microns`. Width and
11581 * height must both be minimum 353 microns but may be higher on some operating
11584 * Prints window's web page. When `silent` is set to `true`, Electron will pick the
11585 * system's default printer if `deviceName` is empty and the default settings for
11588 * Use `page-break-before: always;` CSS style to force to print to a new page.
11592 print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void;
11594 * Resolves with the generated PDF data.
11596 * Prints the window's web page as PDF.
11598 * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
11600 * An example of `webContents.printToPDF`:
11602 * See Page.printToPdf for more information.
11604 printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
11606 * Executes the editing command `redo` in web page.
11610 * Reloads the current web page.
11614 * Reloads current page and ignores cache.
11616 reloadIgnoringCache(): void;
11618 * Resolves if the removal was successful.
11620 * Removes the inserted CSS from the current web page. The stylesheet is identified
11621 * by its key, which is returned from `contents.insertCSS(css)`.
11623 removeInsertedCSS(key: string): Promise<void>;
11625 * Removes the specified path from DevTools workspace.
11627 removeWorkSpace(path: string): void;
11629 * Executes the editing command `replace` in web page.
11631 replace(text: string): void;
11633 * Executes the editing command `replaceMisspelling` in web page.
11635 replaceMisspelling(text: string): void;
11637 * resolves if the page is saved.
11639 savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
11641 * Executes the editing command `selectAll` in web page.
11645 * Send an asynchronous message to the renderer process via `channel`, along with
11646 * arguments. Arguments will be serialized with the Structured Clone Algorithm,
11647 * just like `postMessage`, so prototype chains will not be included. Sending
11648 * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
11650 * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
11651 * Electron objects will throw an exception.
11653 * The renderer process can handle the message by listening to `channel` with the
11654 * `ipcRenderer` module.
11656 * An example of sending messages from the main process to the renderer process:
11658 send(channel: string, ...args: any[]): void;
11660 * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
11661 * contents needs to be focused for `sendInputEvent()` to work.
11663 sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
11665 * Send an asynchronous message to a specific frame in a renderer process via
11666 * `channel`, along with arguments. Arguments will be serialized with the
11667 * Structured Clone Algorithm, just like `postMessage`, so prototype chains will
11668 * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
11669 * will throw an exception.
11671 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
11672 * Electron objects will throw an exception.
11674 * The renderer process can handle the message by listening to `channel` with the
11675 * `ipcRenderer` module.
11677 * If you want to get the `frameId` of a given renderer context you should use the
11678 * `webFrame.routingId` value. E.g.
11680 * You can also read `frameId` from all incoming IPC messages in the main process.
11682 sendToFrame(frameId: (number) | ([number, number]), channel: string, ...args: any[]): void;
11684 * Mute the audio on the current web page.
11686 setAudioMuted(muted: boolean): void;
11688 * Controls whether or not this WebContents will throttle animations and timers
11689 * when the page becomes backgrounded. This also affects the Page Visibility API.
11691 setBackgroundThrottling(allowed: boolean): void;
11693 * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
11695 * The `devToolsWebContents` must not have done any navigation, and it should not
11696 * be used for other purposes after the call.
11698 * By default Electron manages the devtools by creating an internal `WebContents`
11699 * with native view, which developers have very limited control of. With the
11700 * `setDevToolsWebContents` method, developers can use any `WebContents` to show
11701 * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
11704 * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
11705 * caller's responsibility to destroy `devToolsWebContents`.
11707 * An example of showing devtools in a `<webview>` tag:
11709 * An example of showing devtools in a `BrowserWindow`:
11711 setDevToolsWebContents(devToolsWebContents: WebContents): void;
11713 * If *offscreen rendering* is enabled sets the frame rate to the specified number.
11714 * Only values between 1 and 240 are accepted.
11716 setFrameRate(fps: number): void;
11718 * Ignore application menu shortcuts while this web contents is focused.
11720 setIgnoreMenuShortcuts(ignore: boolean): void;
11722 * Sets the image animation policy for this webContents. The policy only affects
11723 * _new_ images, existing images that are currently being animated are unaffected.
11724 * This is a known limitation in Chromium, you can force image animation to be
11725 * recalculated with `img.src = img.src` which will result in no network traffic
11726 * but will update the animation policy.
11728 * This corresponds to the animationPolicy accessibility feature in Chromium.
11730 setImageAnimationPolicy(policy: 'animate' | 'animateOnce' | 'noAnimation'): void;
11732 * Overrides the user agent for this web page.
11734 setUserAgent(userAgent: string): void;
11736 * Sets the maximum and minimum pinch-to-zoom level.
11738 * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
11741 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
11743 * Setting the WebRTC IP handling policy allows you to control which IPs are
11744 * exposed via WebRTC. See BrowserLeaks for more details.
11746 setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
11748 * Called before creating a window a new window is requested by the renderer, e.g.
11749 * by `window.open()`, a link with `target="_blank"`, shift+clicking on a link, or
11750 * submitting a form with `<form target="_blank">`. See `window.open()` for more
11751 * details and how to use this in conjunction with `did-create-window`.
11753 setWindowOpenHandler(handler: (details: HandlerDetails) => ({action: 'deny'}) | ({action: 'allow', outlivesOpener?: boolean, overrideBrowserWindowOptions?: BrowserWindowConstructorOptions})): void;
11755 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
11756 * divided by 100, so 300% = 3.0.
11758 * The factor must be greater than 0.0.
11760 setZoomFactor(factor: number): void;
11762 * Changes the zoom level to the specified level. The original size is 0 and each
11763 * increment above or below represents zooming 20% larger or smaller to default
11764 * limits of 300% and 50% of original size, respectively. The formula for this is
11765 * `scale := 1.2 ^ level`.
11767 * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
11768 * the zoom level for a specific domain propagates across all instances of windows
11769 * with the same domain. Differentiating the window URLs will make zoom work
11772 setZoomLevel(level: number): void;
11774 * Shows pop-up dictionary that searches the selected word on the page.
11778 showDefinitionForSelection(): void;
11780 * Sets the `item` as dragging item for current drag-drop operation, `file` is the
11781 * absolute path of the file to be dragged, and `icon` is the image showing under
11782 * the cursor when dragging.
11784 startDrag(item: Item): void;
11786 * If *offscreen rendering* is enabled and not painting, start painting.
11788 startPainting(): void;
11790 * Stops any pending navigation.
11794 * Stops any `findInPage` request for the `webContents` with the provided `action`.
11796 stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
11798 * If *offscreen rendering* is enabled and painting, stop painting.
11800 stopPainting(): void;
11802 * Indicates whether the snapshot has been created successfully.
11804 * Takes a V8 heap snapshot and saves it to `filePath`.
11806 takeHeapSnapshot(filePath: string): Promise<void>;
11808 * Toggles the developer tools.
11810 toggleDevTools(): void;
11812 * Executes the editing command `undo` in web page.
11816 * Executes the editing command `unselect` in web page.
11820 * A `boolean` property that determines whether this page is muted.
11822 audioMuted: boolean;
11824 * A `boolean` property that determines whether or not this WebContents will
11825 * throttle animations and timers when the page becomes backgrounded. This also
11826 * affects the Page Visibility API.
11828 backgroundThrottling: boolean;
11830 * A `Debugger` instance for this webContents.
11833 readonly debugger: Debugger;
11835 * A `WebContents | null` property that represents the of DevTools `WebContents`
11836 * associated with a given `WebContents`.
11838 * **Note:** Users should never store this object because it may become `null` when
11839 * the DevTools has been closed.
11842 readonly devToolsWebContents: (WebContents) | (null);
11844 * An `Integer` property that sets the frame rate of the web contents to the
11845 * specified number. Only values between 1 and 240 are accepted.
11847 * Only applicable if *offscreen rendering* is enabled.
11851 * A `WebContents` instance that might own this `WebContents`.
11854 readonly hostWebContents: WebContents;
11856 * A `Integer` representing the unique ID of this WebContents. Each ID is unique
11857 * among all `WebContents` instances of the entire Electron application.
11860 readonly id: number;
11862 * An `IpcMain` scoped to just IPC messages sent from this WebContents.
11864 * IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
11865 * `ipcRenderer.postMessage` will be delivered in the following order:
11867 * * `contents.on('ipc-message')`
11868 * * `contents.mainFrame.on(channel)`
11869 * * `contents.ipc.on(channel)`
11870 * * `ipcMain.on(channel)`
11872 * Handlers registered with `invoke` will be checked in the following order. The
11873 * first one that is defined will be called, the rest will be ignored.
11875 * * `contents.mainFrame.handle(channel)`
11876 * * `contents.handle(channel)`
11877 * * `ipcMain.handle(channel)`
11879 * A handler or event listener registered on the WebContents will receive IPC
11880 * messages sent from any frame, including child frames. In most cases, only the
11881 * main frame can send IPC messages. However, if the `nodeIntegrationInSubFrames`
11882 * option is enabled, it is possible for child frames to send IPC messages also. In
11883 * that case, handlers should check the `senderFrame` property of the IPC event to
11884 * ensure that the message is coming from the expected frame. Alternatively,
11885 * register handlers on the appropriate frame directly using the `WebFrameMain.ipc`
11889 readonly ipc: IpcMain;
11891 * A `WebFrameMain` property that represents the top frame of the page's frame
11895 readonly mainFrame: WebFrameMain;
11897 * A `WebFrameMain` property that represents the frame that opened this
11898 * WebContents, either with open(), or by navigating a link with a target
11902 readonly opener: WebFrameMain;
11904 * A `Session` used by this webContents.
11907 readonly session: Session;
11909 * A `string` property that determines the user agent for this web page.
11913 * A `number` property that determines the zoom factor for this web contents.
11915 * The zoom factor is the zoom percent divided by 100, so 300% = 3.0.
11917 zoomFactor: number;
11919 * A `number` property that determines the zoom level for this web contents.
11921 * The original size is 0 and each increment above or below represents zooming 20%
11922 * larger or smaller to default limits of 300% and 50% of original size,
11923 * respectively. The formula for this is `scale := 1.2 ^ level`.
11928 interface WebFrame extends NodeJS.EventEmitter {
11930 // Docs: https://electronjs.org/docs/api/web-frame
11933 * Attempts to free memory that is no longer being used (like images from a
11934 * previous navigation).
11936 * Note that blindly calling this method probably makes Electron slower since it
11937 * will have to refill these emptied caches, you should only call it if an event in
11938 * your app has occurred that makes you think your page is actually using less
11939 * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
11940 * and intend to stay there).
11942 clearCache(): void;
11944 * A promise that resolves with the result of the executed code or is rejected if
11945 * execution throws or results in a rejected promise.
11947 * Evaluates `code` in page.
11949 * In the browser window some HTML APIs like `requestFullScreen` can only be
11950 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
11953 executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
11955 * A promise that resolves with the result of the executed code or is rejected if
11956 * execution could not start.
11958 * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
11960 * Note that when the execution of script fails, the returned promise will not
11961 * reject and the `result` would be `undefined`. This is because Chromium does not
11962 * dispatch errors of isolated worlds to foreign worlds.
11964 executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
11966 * A child of `webFrame` with the supplied `name`, `null` would be returned if
11967 * there's no such frame or if the frame is not in the current renderer process.
11969 findFrameByName(name: string): WebFrame;
11971 * that has the supplied `routingId`, `null` if not found.
11973 findFrameByRoutingId(routingId: number): WebFrame;
11975 * The frame element in `webFrame's` document selected by `selector`, `null` would
11976 * be returned if `selector` does not select a frame or if the frame is not in the
11977 * current renderer process.
11979 getFrameForSelector(selector: string): WebFrame;
11981 * * `images` MemoryUsageDetails
11982 * * `scripts` MemoryUsageDetails
11983 * * `cssStyleSheets` MemoryUsageDetails
11984 * * `xslStyleSheets` MemoryUsageDetails
11985 * * `fonts` MemoryUsageDetails
11986 * * `other` MemoryUsageDetails
11988 * Returns an object describing usage information of Blink's internal memory
11991 * This will generate:
11993 getResourceUsage(): ResourceUsage;
11995 * A list of suggested words for a given word. If the word is spelled correctly,
11996 * the result will be empty.
11998 getWordSuggestions(word: string): string[];
12000 * The current zoom factor.
12002 getZoomFactor(): number;
12004 * The current zoom level.
12006 getZoomLevel(): number;
12008 * A key for the inserted CSS that can later be used to remove the CSS via
12009 * `webFrame.removeInsertedCSS(key)`.
12011 * Injects CSS into the current web page and returns a unique key for the inserted
12014 insertCSS(css: string, options?: InsertCSSOptions): string;
12016 * Inserts `text` to the focused element.
12018 insertText(text: string): void;
12020 * True if the word is misspelled according to the built in spellchecker, false
12021 * otherwise. If no dictionary is loaded, always return false.
12023 isWordMisspelled(word: string): boolean;
12025 * Removes the inserted CSS from the current web page. The stylesheet is identified
12026 * by its key, which is returned from `webFrame.insertCSS(css)`.
12028 removeInsertedCSS(key: string): void;
12030 * Set the security origin, content security policy and name of the isolated world.
12031 * Note: If the `csp` is specified, then the `securityOrigin` also has to be
12034 setIsolatedWorldInfo(worldId: number, info: Info): void;
12036 * Sets a provider for spell checking in input fields and text areas.
12038 * If you want to use this method you must disable the builtin spellchecker when
12039 * you construct the window.
12041 * The `provider` must be an object that has a `spellCheck` method that accepts an
12042 * array of individual words for spellchecking. The `spellCheck` function runs
12043 * asynchronously and calls the `callback` function with an array of misspelt words
12046 * An example of using node-spellchecker as provider:
12048 setSpellCheckProvider(language: string, provider: Provider): void;
12050 * Sets the maximum and minimum pinch-to-zoom level.
12052 * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
12055 * > **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom
12056 * shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem
12057 * roles in the application Menu. To disable shortcuts, manually define the Menu
12058 * and omit zoom roles from the definition.
12060 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
12062 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
12063 * divided by 100, so 300% = 3.0.
12065 * The factor must be greater than 0.0.
12067 setZoomFactor(factor: number): void;
12069 * Changes the zoom level to the specified level. The original size is 0 and each
12070 * increment above or below represents zooming 20% larger or smaller to default
12071 * limits of 300% and 50% of original size, respectively.
12073 * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
12074 * the zoom level for a specific domain propagates across all instances of windows
12075 * with the same domain. Differentiating the window URLs will make zoom work
12078 setZoomLevel(level: number): void;
12080 * A `WebFrame | null` representing the first child frame of `webFrame`, the
12081 * property would be `null` if `webFrame` has no children or if first child is not
12082 * in the current renderer process.
12085 readonly firstChild: (WebFrame) | (null);
12087 * A `WebFrame | null` representing next sibling frame, the property would be
12088 * `null` if `webFrame` is the last frame in its parent or if the next sibling is
12089 * not in the current renderer process.
12092 readonly nextSibling: (WebFrame) | (null);
12094 * A `WebFrame | null` representing the frame which opened `webFrame`, the property
12095 * would be `null` if there's no opener or opener is not in the current renderer
12099 readonly opener: (WebFrame) | (null);
12101 * A `WebFrame | null` representing parent frame of `webFrame`, the property would
12102 * be `null` if `webFrame` is top or parent is not in the current renderer process.
12105 readonly parent: (WebFrame) | (null);
12107 * An `Integer` representing the unique frame id in the current renderer process.
12108 * Distinct WebFrame instances that refer to the same underlying frame will have
12109 * the same `routingId`.
12112 readonly routingId: number;
12114 * A `WebFrame | null` representing top frame in frame hierarchy to which
12115 * `webFrame` belongs, the property would be `null` if top frame is not in the
12116 * current renderer process.
12119 readonly top: (WebFrame) | (null);
12122 class WebFrameMain extends NodeEventEmitter {
12124 // Docs: https://electronjs.org/docs/api/web-frame-main
12127 * A frame with the given process and routing IDs, or `undefined` if there is no
12128 * WebFrameMain associated with the given IDs.
12130 static fromId(processId: number, routingId: number): (WebFrameMain) | (undefined);
12132 * Emitted when the document is loaded.
12134 on(event: 'dom-ready', listener: Function): this;
12135 once(event: 'dom-ready', listener: Function): this;
12136 addListener(event: 'dom-ready', listener: Function): this;
12137 removeListener(event: 'dom-ready', listener: Function): this;
12139 * A promise that resolves with the result of the executed code or is rejected if
12140 * execution throws or results in a rejected promise.
12142 * Evaluates `code` in page.
12144 * In the browser window some HTML APIs like `requestFullScreen` can only be
12145 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
12148 executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>;
12150 * Send a message to the renderer process, optionally transferring ownership of
12151 * zero or more `MessagePortMain` objects.
12153 * The transferred `MessagePortMain` objects will be available in the renderer
12154 * process by accessing the `ports` property of the emitted event. When they arrive
12155 * in the renderer, they will be native DOM `MessagePort` objects.
12159 postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
12161 * Whether the reload was initiated successfully. Only results in `false` when the
12162 * frame has no history.
12166 * Send an asynchronous message to the renderer process via `channel`, along with
12167 * arguments. Arguments will be serialized with the Structured Clone Algorithm,
12168 * just like `postMessage`, so prototype chains will not be included. Sending
12169 * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
12171 * The renderer process can handle the message by listening to `channel` with the
12172 * `ipcRenderer` module.
12174 send(channel: string, ...args: any[]): void;
12176 * A `WebFrameMain[]` collection containing the direct descendents of `frame`.
12179 readonly frames: WebFrameMain[];
12181 * A `WebFrameMain[]` collection containing every frame in the subtree of `frame`,
12182 * including itself. This can be useful when traversing through all frames.
12185 readonly framesInSubtree: WebFrameMain[];
12187 * An `Integer` representing the id of the frame's internal FrameTreeNode instance.
12188 * This id is browser-global and uniquely identifies a frame that hosts content.
12189 * The identifier is fixed at the creation of the frame and stays constant for the
12190 * lifetime of the frame. When the frame is removed, the id is not used again.
12193 readonly frameTreeNodeId: number;
12195 * An `IpcMain` instance scoped to the frame.
12197 * IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
12198 * `ipcRenderer.postMessage` will be delivered in the following order:
12200 * * `contents.on('ipc-message')`
12201 * * `contents.mainFrame.on(channel)`
12202 * * `contents.ipc.on(channel)`
12203 * * `ipcMain.on(channel)`
12205 * Handlers registered with `invoke` will be checked in the following order. The
12206 * first one that is defined will be called, the rest will be ignored.
12208 * * `contents.mainFrame.handle(channel)`
12209 * * `contents.handle(channel)`
12210 * * `ipcMain.handle(channel)`
12212 * In most cases, only the main frame of a WebContents can send or receive IPC
12213 * messages. However, if the `nodeIntegrationInSubFrames` option is enabled, it is
12214 * possible for child frames to send and receive IPC messages also. The
12215 * `WebContents.ipc` interface may be more convenient when
12216 * `nodeIntegrationInSubFrames` is not enabled.
12219 readonly ipc: IpcMain;
12221 * A `string` representing the frame name.
12224 readonly name: string;
12226 * A `string` representing the current origin of the frame, serialized according to
12227 * RFC 6454. This may be different from the URL. For instance, if the frame is a
12228 * child window opened to `about:blank`, then `frame.origin` will return the parent
12229 * frame's origin, while `frame.url` will return the empty string. Pages without a
12230 * scheme/host/port triple origin will have the serialized origin of `"null"` (that
12231 * is, the string containing the letters n, u, l, l).
12234 readonly origin: string;
12236 * An `Integer` representing the operating system `pid` of the process which owns
12240 readonly osProcessId: number;
12242 * A `WebFrameMain | null` representing parent frame of `frame`, the property would
12243 * be `null` if `frame` is the top frame in the frame hierarchy.
12246 readonly parent: (WebFrameMain) | (null);
12248 * An `Integer` representing the Chromium internal `pid` of the process which owns
12249 * this frame. This is not the same as the OS process ID; to read that use
12250 * `frame.osProcessId`.
12253 readonly processId: number;
12255 * An `Integer` representing the unique frame id in the current renderer process.
12256 * Distinct `WebFrameMain` instances that refer to the same underlying frame will
12257 * have the same `routingId`.
12260 readonly routingId: number;
12262 * A `WebFrameMain | null` representing top frame in the frame hierarchy to which
12266 readonly top: (WebFrameMain) | (null);
12268 * A `string` representing the current URL of the frame.
12271 readonly url: string;
12273 * A `string` representing the visibility state of the frame.
12275 * See also how the Page Visibility API is affected by other Electron APIs.
12278 readonly visibilityState: string;
12283 // Docs: https://electronjs.org/docs/api/web-request
12286 * The `listener` will be called with `listener(details)` when a server initiated
12287 * redirect is about to occur.
12289 onBeforeRedirect(filter: WebRequestFilter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
12291 * The `listener` will be called with `listener(details)` when a server initiated
12292 * redirect is about to occur.
12294 onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
12296 * The `listener` will be called with `listener(details, callback)` when a request
12297 * is about to occur.
12299 * The `uploadData` is an array of `UploadData` objects.
12301 * The `callback` has to be called with an `response` object.
12303 * Some examples of valid `urls`:
12305 onBeforeRequest(filter: WebRequestFilter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) => void) => void) | (null)): void;
12307 * The `listener` will be called with `listener(details, callback)` when a request
12308 * is about to occur.
12310 * The `uploadData` is an array of `UploadData` objects.
12312 * The `callback` has to be called with an `response` object.
12314 * Some examples of valid `urls`:
12316 onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) => void) => void) | (null)): void;
12318 * The `listener` will be called with `listener(details, callback)` before sending
12319 * an HTTP request, once the request headers are available. This may occur after a
12320 * TCP connection is made to the server, but before any http data is sent.
12322 * The `callback` has to be called with a `response` object.
12324 onBeforeSendHeaders(filter: WebRequestFilter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
12326 * The `listener` will be called with `listener(details, callback)` before sending
12327 * an HTTP request, once the request headers are available. This may occur after a
12328 * TCP connection is made to the server, but before any http data is sent.
12330 * The `callback` has to be called with a `response` object.
12332 onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
12334 * The `listener` will be called with `listener(details)` when a request is
12337 onCompleted(filter: WebRequestFilter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
12339 * The `listener` will be called with `listener(details)` when a request is
12342 onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
12344 * The `listener` will be called with `listener(details)` when an error occurs.
12346 onErrorOccurred(filter: WebRequestFilter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
12348 * The `listener` will be called with `listener(details)` when an error occurs.
12350 onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
12352 * The `listener` will be called with `listener(details, callback)` when HTTP
12353 * response headers of a request have been received.
12355 * The `callback` has to be called with a `response` object.
12357 onHeadersReceived(filter: WebRequestFilter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
12359 * The `listener` will be called with `listener(details, callback)` when HTTP
12360 * response headers of a request have been received.
12362 * The `callback` has to be called with a `response` object.
12364 onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
12366 * The `listener` will be called with `listener(details)` when first byte of the
12367 * response body is received. For HTTP requests, this means that the status line
12368 * and response headers are available.
12370 onResponseStarted(filter: WebRequestFilter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
12372 * The `listener` will be called with `listener(details)` when first byte of the
12373 * response body is received. For HTTP requests, this means that the status line
12374 * and response headers are available.
12376 onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
12378 * The `listener` will be called with `listener(details)` just before a request is
12379 * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
12380 * response are visible by the time this listener is fired.
12382 onSendHeaders(filter: WebRequestFilter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
12384 * The `listener` will be called with `listener(details)` just before a request is
12385 * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
12386 * response are visible by the time this listener is fired.
12388 onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
12391 interface WebRequestFilter {
12393 // Docs: https://electronjs.org/docs/api/structures/web-request-filter
12396 * Array of URL patterns that will be used to filter out the requests that do not
12397 * match the URL patterns.
12402 interface WebSource {
12404 // Docs: https://electronjs.org/docs/api/structures/web-source
12410 interface WebviewTag extends HTMLElement {
12412 // Docs: https://electronjs.org/docs/api/webview-tag
12415 * Fired when a load has committed. This includes navigation within the current
12416 * document as well as subframe document-level loads, but does not include
12417 * asynchronous resource loads.
12419 addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
12420 removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
12422 * Fired when the navigation is done, i.e. the spinner of the tab will stop
12423 * spinning, and the `onload` event is dispatched.
12425 addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this;
12426 removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this;
12428 * This event is like `did-finish-load`, but fired when the load failed or was
12429 * cancelled, e.g. `window.stop()` is invoked.
12431 addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
12432 removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
12434 * Fired when a frame has done navigation.
12436 addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
12437 removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
12439 * Corresponds to the points in time when the spinner of the tab starts spinning.
12441 addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this;
12442 removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this;
12444 * Corresponds to the points in time when the spinner of the tab stops spinning.
12446 addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this;
12447 removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this;
12449 * Fired when attached to the embedder web contents.
12451 addEventListener(event: 'did-attach', listener: (event: Event) => void, useCapture?: boolean): this;
12452 removeEventListener(event: 'did-attach', listener: (event: Event) => void): this;
12454 * Fired when document in the given frame is loaded.
12456 addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this;
12457 removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this;
12459 * Fired when page title is set during navigation. `explicitSet` is false when
12460 * title is synthesized from file url.
12462 addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
12463 removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
12465 * Fired when page receives favicon urls.
12467 addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
12468 removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
12470 * Fired when page enters fullscreen triggered by HTML API.
12472 addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
12473 removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this;
12475 * Fired when page leaves fullscreen triggered by HTML API.
12477 addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
12478 removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this;
12480 * Fired when the guest window logs a console message.
12482 * The following example code forwards all log messages to the embedder's console
12483 * without regard for log level or other properties.
12485 addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
12486 removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
12488 * Fired when a result is available for `webview.findInPage` request.
12490 addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
12491 removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
12493 * Emitted when a user or the page wants to start navigation. It can happen when
12494 * the `window.location` object is changed or a user clicks a link in the page.
12496 * This event will not emit when the navigation is started programmatically with
12497 * APIs like `<webview>.loadURL` and `<webview>.back`.
12499 * It is also not emitted during in-page navigation, such as clicking anchor links
12500 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
12503 * Calling `event.preventDefault()` does __NOT__ have any effect.
12505 addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
12506 removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
12508 * Emitted when any frame (including main) starts navigating. `isInPlace` will be
12509 * `true` for in-page navigations.
12511 addEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void, useCapture?: boolean): this;
12512 removeEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void): this;
12514 * Emitted after a server side redirect occurs during navigation. For example a 302
12517 addEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void, useCapture?: boolean): this;
12518 removeEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void): this;
12520 * Emitted when a navigation is done.
12522 * This event is not emitted for in-page navigations, such as clicking anchor links
12523 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
12526 addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
12527 removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
12529 * Emitted when any frame navigation is done.
12531 * This event is not emitted for in-page navigations, such as clicking anchor links
12532 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
12535 addEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void, useCapture?: boolean): this;
12536 removeEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void): this;
12538 * Emitted when an in-page navigation happened.
12540 * When in-page navigation happens, the page URL changes but does not cause
12541 * navigation outside of the page. Examples of this occurring are when anchor links
12542 * are clicked or when the DOM `hashchange` event is triggered.
12544 addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
12545 removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
12547 * Fired when the guest page attempts to close itself.
12549 * The following example code navigates the `webview` to `about:blank` when the
12550 * guest attempts to close itself.
12552 addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this;
12553 removeEventListener(event: 'close', listener: (event: Event) => void): this;
12555 * Fired when the guest page has sent an asynchronous message to embedder page.
12557 * With `sendToHost` method and `ipc-message` event you can communicate between
12558 * guest page and embedder page:
12560 addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
12561 removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
12563 * Fired when the renderer process is crashed.
12565 addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this;
12566 removeEventListener(event: 'crashed', listener: (event: Event) => void): this;
12568 * Fired when a plugin process is crashed.
12570 addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
12571 removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
12573 * Fired when the WebContents is destroyed.
12575 addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this;
12576 removeEventListener(event: 'destroyed', listener: (event: Event) => void): this;
12578 * Emitted when media starts playing.
12580 addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this;
12581 removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this;
12583 * Emitted when media is paused or done playing.
12585 addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this;
12586 removeEventListener(event: 'media-paused', listener: (event: Event) => void): this;
12588 * Emitted when a page's theme color changes. This is usually due to encountering a
12591 addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
12592 removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
12594 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
12596 addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
12597 removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
12599 * Emitted when DevTools is opened.
12601 addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this;
12602 removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this;
12604 * Emitted when DevTools is closed.
12606 addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this;
12607 removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this;
12609 * Emitted when DevTools is focused / opened.
12611 addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this;
12612 removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this;
12614 * Emitted when there is a new context menu that needs to be handled.
12616 addEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void, useCapture?: boolean): this;
12617 removeEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void): this;
12618 addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
12619 addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
12620 removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
12621 removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
12623 * Whether the guest page can go back.
12625 canGoBack(): boolean;
12627 * Whether the guest page can go forward.
12629 canGoForward(): boolean;
12631 * Whether the guest page can go to `offset`.
12633 canGoToOffset(offset: number): boolean;
12635 * Resolves with a NativeImage
12637 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
12638 * whole visible page.
12640 capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
12642 * Clears the navigation history.
12644 clearHistory(): void;
12646 * Closes the DevTools window of guest page.
12648 closeDevTools(): void;
12650 * Executes editing command `copy` in page.
12654 * Executes editing command `cut` in page.
12658 * Executes editing command `delete` in page.
12662 * Initiates a download of the resource at `url` without navigating.
12664 downloadURL(url: string): void;
12666 * A promise that resolves with the result of the executed code or is rejected if
12667 * the result of the code is a rejected promise.
12669 * Evaluates `code` in page. If `userGesture` is set, it will create the user
12670 * gesture context in the page. HTML APIs like `requestFullScreen`, which require
12671 * user action, can take advantage of this option for automation.
12673 executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
12675 * The request id used for the request.
12677 * Starts a request to find all matches for the `text` in the web page. The result
12678 * of the request can be obtained by subscribing to `found-in-page` event.
12680 findInPage(text: string, options?: FindInPageOptions): number;
12682 * The title of guest page.
12684 getTitle(): string;
12686 * The URL of guest page.
12690 * The user agent for guest page.
12692 getUserAgent(): string;
12694 * The WebContents ID of this `webview`.
12696 getWebContentsId(): number;
12698 * the current zoom factor.
12700 getZoomFactor(): number;
12702 * the current zoom level.
12704 getZoomLevel(): number;
12706 * Makes the guest page go back.
12710 * Makes the guest page go forward.
12714 * Navigates to the specified absolute index.
12716 goToIndex(index: number): void;
12718 * Navigates to the specified offset from the "current entry".
12720 goToOffset(offset: number): void;
12722 * A promise that resolves with a key for the inserted CSS that can later be used
12723 * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
12725 * Injects CSS into the current web page and returns a unique key for the inserted
12728 insertCSS(css: string): Promise<string>;
12730 * Inserts `text` to the focused element.
12732 insertText(text: string): Promise<void>;
12734 * Starts inspecting element at position (`x`, `y`) of guest page.
12736 inspectElement(x: number, y: number): void;
12738 * Opens the DevTools for the service worker context present in the guest page.
12740 inspectServiceWorker(): void;
12742 * Opens the DevTools for the shared worker context present in the guest page.
12744 inspectSharedWorker(): void;
12746 * Whether guest page has been muted.
12748 isAudioMuted(): boolean;
12750 * Whether the renderer process has crashed.
12752 isCrashed(): boolean;
12754 * Whether audio is currently playing.
12756 isCurrentlyAudible(): boolean;
12758 * Whether DevTools window of guest page is focused.
12760 isDevToolsFocused(): boolean;
12762 * Whether guest page has a DevTools window attached.
12764 isDevToolsOpened(): boolean;
12766 * Whether guest page is still loading resources.
12768 isLoading(): boolean;
12770 * Whether the main frame (and not just iframes or frames within it) is still
12773 isLoadingMainFrame(): boolean;
12775 * Whether the guest page is waiting for a first-response for the main resource of
12778 isWaitingForResponse(): boolean;
12780 * The promise will resolve when the page has finished loading (see
12781 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
12783 * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
12784 * the `http://` or `file://`.
12786 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
12788 * Opens a DevTools window for guest page.
12790 openDevTools(): void;
12792 * Executes editing command `paste` in page.
12796 * Executes editing command `pasteAndMatchStyle` in page.
12798 pasteAndMatchStyle(): void;
12800 * Prints `webview`'s web page. Same as `webContents.print([options])`.
12802 print(options?: WebviewTagPrintOptions): Promise<void>;
12804 * Resolves with the generated PDF data.
12806 * Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
12808 printToPDF(options: PrintToPDFOptions): Promise<Uint8Array>;
12810 * Executes editing command `redo` in page.
12814 * Reloads the guest page.
12818 * Reloads the guest page and ignores cache.
12820 reloadIgnoringCache(): void;
12822 * Resolves if the removal was successful.
12824 * Removes the inserted CSS from the current web page. The stylesheet is identified
12825 * by its key, which is returned from `<webview>.insertCSS(css)`.
12827 removeInsertedCSS(key: string): Promise<void>;
12829 * Executes editing command `replace` in page.
12831 replace(text: string): void;
12833 * Executes editing command `replaceMisspelling` in page.
12835 replaceMisspelling(text: string): void;
12837 * Executes editing command `selectAll` in page.
12841 * Send an asynchronous message to renderer process via `channel`, you can also
12842 * send arbitrary arguments. The renderer process can handle the message by
12843 * listening to the `channel` event with the `ipcRenderer` module.
12845 * See webContents.send for examples.
12847 send(channel: string, ...args: any[]): Promise<void>;
12849 * Sends an input `event` to the page.
12851 * See webContents.sendInputEvent for detailed description of `event` object.
12853 sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
12855 * Send an asynchronous message to renderer process via `channel`, you can also
12856 * send arbitrary arguments. The renderer process can handle the message by
12857 * listening to the `channel` event with the `ipcRenderer` module.
12859 * See webContents.sendToFrame for examples.
12861 sendToFrame(frameId: [number, number], channel: string, ...args: any[]): Promise<void>;
12863 * Set guest page muted.
12865 setAudioMuted(muted: boolean): void;
12867 * Overrides the user agent for the guest page.
12869 setUserAgent(userAgent: string): void;
12871 * Sets the maximum and minimum pinch-to-zoom level.
12873 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
12875 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
12876 * divided by 100, so 300% = 3.0.
12878 setZoomFactor(factor: number): void;
12880 * Changes the zoom level to the specified level. The original size is 0 and each
12881 * increment above or below represents zooming 20% larger or smaller to default
12882 * limits of 300% and 50% of original size, respectively. The formula for this is
12883 * `scale := 1.2 ^ level`.
12885 * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
12886 * the zoom level for a specific domain propagates across all instances of windows
12887 * with the same domain. Differentiating the window URLs will make zoom work
12890 setZoomLevel(level: number): void;
12892 * Shows pop-up dictionary that searches the selected word on the page.
12896 showDefinitionForSelection(): void;
12898 * Stops any pending navigation.
12902 * Stops any `findInPage` request for the `webview` with the provided `action`.
12904 stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
12906 * Executes editing command `undo` in page.
12910 * Executes editing command `unselect` in page.
12914 * A `boolean`. When this attribute is present the guest page will be allowed to
12915 * open new windows. Popups are disabled by default.
12917 allowpopups: boolean;
12919 * A `string` which is a list of strings which specifies the blink features to be
12920 * disabled separated by `,`. The full list of supported feature strings can be
12921 * found in the RuntimeEnabledFeatures.json5 file.
12923 disableblinkfeatures: string;
12925 * A `boolean`. When this attribute is present the guest page will have web
12926 * security disabled. Web security is enabled by default.
12928 disablewebsecurity: boolean;
12930 * A `string` which is a list of strings which specifies the blink features to be
12931 * enabled separated by `,`. The full list of supported feature strings can be
12932 * found in the RuntimeEnabledFeatures.json5 file.
12934 enableblinkfeatures: string;
12936 * A `string` that sets the referrer URL for the guest page.
12938 httpreferrer: string;
12940 * A `boolean`. When this attribute is present the guest page in `webview` will
12941 * have node integration and can use node APIs like `require` and `process` to
12942 * access low level system resources. Node integration is disabled by default in
12945 nodeintegration: boolean;
12947 * A `boolean` for the experimental option for enabling NodeJS support in
12948 * sub-frames such as iframes inside the `webview`. All your preloads will load for
12949 * every iframe, you can use `process.isMainFrame` to determine if you are in the
12950 * main frame or not. This option is disabled by default in the guest page.
12952 nodeintegrationinsubframes: boolean;
12954 * A `string` that sets the session used by the page. If `partition` starts with
12955 * `persist:`, the page will use a persistent session available to all pages in the
12956 * app with the same `partition`. if there is no `persist:` prefix, the page will
12957 * use an in-memory session. By assigning the same `partition`, multiple pages can
12958 * share the same session. If the `partition` is unset then default session of the
12959 * app will be used.
12961 * This value can only be modified before the first navigation, since the session
12962 * of an active renderer process cannot change. Subsequent attempts to modify the
12963 * value will fail with a DOM exception.
12967 * A `boolean`. When this attribute is present the guest page in `webview` will be
12968 * able to use browser plugins. Plugins are disabled by default.
12972 * A `string` that specifies a script that will be loaded before other scripts run
12973 * in the guest page. The protocol of script's URL must be `file:` (even when using
12974 * `asar:` archives) because it will be loaded by Node's `require` under the hood,
12975 * which treats `asar:` archives as virtual directories.
12977 * When the guest page doesn't have node integration this script will still have
12978 * access to all Node APIs, but global objects injected by Node will be deleted
12979 * after this script has finished executing.
12983 * A `string` representing the visible URL. Writing to this attribute initiates
12984 * top-level navigation.
12986 * Assigning `src` its own value will reload the current page.
12988 * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
12993 * A `string` that sets the user agent for the guest page before the page is
12994 * navigated to. Once the page is loaded, use the `setUserAgent` method to change
12999 * A `string` which is a comma separated list of strings which specifies the web
13000 * preferences to be set on the webview. The full list of supported preference
13001 * strings can be found in BrowserWindow.
13003 * The string follows the same format as the features string in `window.open`. A
13004 * name by itself is given a `true` boolean value. A preference can be set to
13005 * another value by including an `=`, followed by the value. Special values `yes`
13006 * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
13009 webpreferences: string;
13012 interface AboutPanelOptionsOptions {
13016 applicationName?: string;
13018 * The app's version.
13020 applicationVersion?: string;
13022 * Copyright information.
13024 copyright?: string;
13026 * The app's build version number.
13032 * Credit information.
13034 * @platform darwin,win32
13038 * List of app authors.
13042 authors?: string[];
13044 * The app's website.
13050 * Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as
13051 * 64x64 pixels while retaining aspect ratio.
13053 * @platform linux,win32
13058 interface AddRepresentationOptions {
13060 * The scale factor to add the image representation for.
13062 scaleFactor?: number;
13064 * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
13068 * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
13072 * The buffer containing the raw image data.
13076 * The data URL containing either a base 64 encoded PNG or JPEG image.
13081 interface AnimationSettings {
13083 * Returns true if rich animations should be rendered. Looks at session type (e.g.
13084 * remote desktop) and accessibility settings to give guidance for heavy
13087 shouldRenderRichAnimation: boolean;
13089 * Determines on a per-platform basis whether scroll animations (e.g. produced by
13090 * home/end key) should be enabled.
13092 scrollAnimationsEnabledBySystem: boolean;
13094 * Determines whether the user desires reduced motion based on platform APIs.
13096 prefersReducedMotion: boolean;
13099 interface AppDetailsOptions {
13101 * Window's App User Model ID. It has to be set, otherwise the other options will
13106 * Window's Relaunch Icon.
13108 appIconPath?: string;
13110 * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
13113 appIconIndex?: number;
13115 * Window's Relaunch Command.
13117 relaunchCommand?: string;
13119 * Window's Relaunch Display Name.
13121 relaunchDisplayName?: string;
13124 interface ApplicationInfoForProtocolReturnValue {
13126 * the display icon of the app handling the protocol.
13130 * installation path of the app handling the protocol.
13134 * display name of the app handling the protocol.
13139 interface AuthenticationResponseDetails {
13143 interface AuthInfo {
13151 interface AutoResizeOptions {
13153 * If `true`, the view's width will grow and shrink together with the window.
13154 * `false` by default.
13158 * If `true`, the view's height will grow and shrink together with the window.
13159 * `false` by default.
13163 * If `true`, the view's x position and width will grow and shrink proportionally
13164 * with the window. `false` by default.
13166 horizontal?: boolean;
13168 * If `true`, the view's y position and height will grow and shrink proportionally
13169 * with the window. `false` by default.
13171 vertical?: boolean;
13174 interface BeforeSendResponse {
13177 * When provided, request will be made with these headers.
13179 requestHeaders?: Record<string, (string) | (string[])>;
13182 interface BitmapOptions {
13186 scaleFactor?: number;
13189 interface BlinkMemoryInfo {
13191 * Size of all allocated objects in Kilobytes.
13195 * Total allocated space in Kilobytes.
13200 interface BluetoothPairingHandlerHandlerDetails {
13203 * The type of pairing prompt being requested. One of the following values:
13205 pairingKind: ('confirm' | 'confirmPin' | 'providePin');
13206 frame: WebFrameMain;
13208 * The pin value to verify if `pairingKind` is `confirmPin`.
13213 interface BrowserViewConstructorOptions {
13215 * See BrowserWindow.
13217 webPreferences?: WebPreferences;
13220 interface BrowserWindowConstructorOptions {
13222 * Window's width in pixels. Default is `800`.
13226 * Window's height in pixels. Default is `600`.
13230 * (**required** if y is used) Window's left offset from screen. Default is to
13231 * center the window.
13235 * (**required** if x is used) Window's top offset from screen. Default is to
13236 * center the window.
13240 * The `width` and `height` would be used as web page's size, which means the
13241 * actual window's size will include window frame's size and be slightly larger.
13242 * Default is `false`.
13244 useContentSize?: boolean;
13246 * Show window in the center of the screen. Default is `false`.
13250 * Window's minimum width. Default is `0`.
13254 * Window's minimum height. Default is `0`.
13256 minHeight?: number;
13258 * Window's maximum width. Default is no limit.
13262 * Window's maximum height. Default is no limit.
13264 maxHeight?: number;
13266 * Whether window is resizable. Default is `true`.
13268 resizable?: boolean;
13270 * Whether window is movable. This is not implemented on Linux. Default is `true`.
13272 * @platform darwin,win32
13276 * Whether window is minimizable. This is not implemented on Linux. Default is
13279 * @platform darwin,win32
13281 minimizable?: boolean;
13283 * Whether window is maximizable. This is not implemented on Linux. Default is
13286 * @platform darwin,win32
13288 maximizable?: boolean;
13290 * Whether window is closable. This is not implemented on Linux. Default is `true`.
13292 * @platform darwin,win32
13294 closable?: boolean;
13296 * Whether the window can be focused. Default is `true`. On Windows setting
13297 * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
13298 * `focusable: false` makes the window stop interacting with wm, so the window will
13299 * always stay on top in all workspaces.
13301 focusable?: boolean;
13303 * Whether the window should always stay on top of other windows. Default is
13306 alwaysOnTop?: boolean;
13308 * Whether the window should show in fullscreen. When explicitly set to `false` the
13309 * fullscreen button will be hidden or disabled on macOS. Default is `false`.
13311 fullscreen?: boolean;
13313 * Whether the window can be put into fullscreen mode. On macOS, also whether the
13314 * maximize/zoom button should toggle full screen mode or maximize window. Default
13317 fullscreenable?: boolean;
13319 * Use pre-Lion fullscreen on macOS. Default is `false`.
13323 simpleFullscreen?: boolean;
13325 * Whether to show the window in taskbar. Default is `false`.
13327 * @platform darwin,win32
13329 skipTaskbar?: boolean;
13331 * Whether the window is in kiosk mode. Default is `false`.
13335 * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
13336 * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
13340 * The window icon. On Windows it is recommended to use `ICO` icons to get best
13341 * visual effects, you can also leave it undefined so the executable's icon will be
13344 icon?: (NativeImage) | (string);
13346 * Whether window should be shown when created. Default is `true`.
13350 * Whether the renderer should be active when `show` is `false` and it has just
13351 * been created. In order for `document.visibilityState` to work correctly on
13352 * first load with `show: false` you should set this to `false`. Setting this to
13353 * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
13355 paintWhenInitiallyHidden?: boolean;
13357 * Specify `false` to create a frameless window. Default is `true`.
13361 * Specify parent window. Default is `null`.
13363 parent?: BrowserWindow;
13365 * Whether this is a modal window. This only works when the window is a child
13366 * window. Default is `false`.
13370 * Whether clicking an inactive window will also click through to the web contents.
13371 * Default is `false` on macOS. This option is not configurable on other platforms.
13375 acceptFirstMouse?: boolean;
13377 * Whether to hide cursor when typing. Default is `false`.
13379 disableAutoHideCursor?: boolean;
13381 * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
13383 autoHideMenuBar?: boolean;
13385 * Enable the window to be resized larger than screen. Only relevant for macOS, as
13386 * other OSes allow larger-than-screen windows by default. Default is `false`.
13390 enableLargerThanScreen?: boolean;
13392 * The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color
13393 * format. Alpha in #AARRGGBB format is supported if `transparent` is set to
13394 * `true`. Default is `#FFF` (white). See win.setBackgroundColor for more
13397 backgroundColor?: string;
13399 * Whether window should have a shadow. Default is `true`.
13401 hasShadow?: boolean;
13403 * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
13404 * (fully opaque). This is only implemented on Windows and macOS.
13406 * @platform darwin,win32
13410 * Forces using dark theme for the window, only works on some GTK+3 desktop
13411 * environments. Default is `false`.
13413 darkTheme?: boolean;
13415 * Makes the window transparent. Default is `false`. On Windows, does not work
13416 * unless the window is frameless.
13418 transparent?: boolean;
13420 * The type of window, default is normal window. See more about this below.
13424 * Specify how the material appearance should reflect window activity state on
13425 * macOS. Must be used with the `vibrancy` property. Possible values are:
13429 visualEffectState?: ('followWindow' | 'active' | 'inactive');
13431 * The style of window title bar. Default is `default`. Possible values are:
13433 * @platform darwin,win32
13435 titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
13437 * Set a custom position for the traffic light buttons in frameless windows.
13441 trafficLightPosition?: Point;
13443 * Whether frameless window should have rounded corners on macOS. Default is
13444 * `true`. Setting this property to `false` will prevent the window from being
13449 roundedCorners?: boolean;
13451 * Shows the title in the title bar in full screen mode on macOS for `hiddenInset`
13452 * titleBarStyle. Default is `false`.
13457 fullscreenWindowTitle?: boolean;
13459 * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
13460 * window frame. Setting it to `false` will remove window shadow and window
13461 * animations. Default is `true`.
13463 thickFrame?: boolean;
13465 * Add a type of vibrancy effect to the window, only on macOS. Can be
13466 * `appearance-based`, `light`, `dark`, `titlebar`, `selection`, `menu`, `popover`,
13467 * `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`,
13468 * `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please
13469 * note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
13470 * are deprecated and have been removed in macOS Catalina (10.15).
13474 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');
13476 * Controls the behavior on macOS when option-clicking the green stoplight button
13477 * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
13478 * will grow to the preferred width of the web page when zoomed, `false` will cause
13479 * it to zoom to the width of the screen. This will also affect the behavior when
13480 * calling `maximize()` directly. Default is `false`.
13484 zoomToPageWidth?: boolean;
13486 * Tab group name, allows opening the window as a native tab on macOS 10.12+.
13487 * Windows with the same tabbing identifier will be grouped together. This also
13488 * adds a native new tab button to your window's tab bar and allows your `app` and
13489 * window to receive the `new-window-for-tab` event.
13493 tabbingIdentifier?: string;
13495 * Settings of web page's features.
13497 webPreferences?: WebPreferences;
13499 * When using a frameless window in conjunction with
13500 * `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so
13501 * that the standard window controls ("traffic lights" on macOS) are visible, this
13502 * property enables the Window Controls Overlay JavaScript APIs and CSS Environment
13503 * Variables. Specifying `true` will result in an overlay with default system
13504 * colors. Default is `false`.
13506 titleBarOverlay?: (TitleBarOverlay) | (boolean);
13509 interface CallbackResponse {
13512 * The original request is prevented from being sent or completed and is instead
13513 * redirected to the given URL.
13515 redirectURL?: string;
13518 interface CertificateTrustDialogOptions {
13520 * The certificate to trust/import.
13522 certificate: Certificate;
13524 * The message to display to the user.
13529 interface ClearCodeCachesOptions {
13531 * An array of url corresponding to the resource whose generated code cache needs
13532 * to be removed. If the list is empty then all entries in the cache directory will
13538 interface ClearStorageDataOptions {
13540 * Should follow `window.location.origin`’s representation `scheme://host:port`.
13544 * The types of storages to clear, can contain: `appcache`, `cookies`,
13545 * `filesystem`, `indexdb`, `localstorage`, `shadercache`, `websql`,
13546 * `serviceworkers`, `cachestorage`. If not specified, clear all storage types.
13548 storages?: string[];
13550 * The types of quotas to clear, can contain: `temporary`, `persistent`,
13551 * `syncable`. If not specified, clear all quotas.
13556 interface ClientRequestConstructorOptions {
13558 * The HTTP request method. Defaults to the GET method.
13562 * The request URL. Must be provided in the absolute form with the protocol scheme
13563 * specified as http or https.
13567 * The `Session` instance with which the request is associated.
13571 * The name of the `partition` with which the request is associated. Defaults to
13572 * the empty string. The `session` option supersedes `partition`. Thus if a
13573 * `session` is explicitly specified, `partition` is ignored.
13575 partition?: string;
13577 * Can be `include` or `omit`. Whether to send credentials with this request. If
13578 * set to `include`, credentials from the session associated with the request will
13579 * be used. If set to `omit`, credentials will not be sent with the request (and
13580 * the `'login'` event will not be triggered in the event of a 401). This matches
13581 * the behavior of the fetch option of the same name. If this option is not
13582 * specified, authentication data from the session will be sent, and cookies will
13583 * not be sent (unless `useSessionCookies` is set).
13585 credentials?: ('include' | 'omit');
13587 * Whether to send cookies with this request from the provided session. If
13588 * `credentials` is specified, this option has no effect. Default is `false`.
13590 useSessionCookies?: boolean;
13592 * Can be `http:` or `https:`. The protocol scheme in the form 'scheme:'. Defaults
13597 * The server host provided as a concatenation of the hostname and the port number
13602 * The server host name.
13606 * The server's listening port number.
13610 * The path part of the request URL.
13614 * Can be `follow`, `error` or `manual`. The redirect mode for this request. When
13615 * mode is `error`, any redirection will be aborted. When mode is `manual` the
13616 * redirection will be cancelled unless `request.followRedirect` is invoked
13617 * synchronously during the `redirect` event. Defaults to `follow`.
13619 redirect?: ('follow' | 'error' | 'manual');
13621 * The origin URL of the request.
13628 * The proxy mode. Should be one of `direct`, `auto_detect`, `pac_script`,
13629 * `fixed_servers` or `system`. If it's unspecified, it will be automatically
13630 * determined based on other specified options.
13632 mode?: ('direct' | 'auto_detect' | 'pac_script' | 'fixed_servers' | 'system');
13634 * The URL associated with the PAC file.
13636 pacScript?: string;
13638 * Rules indicating which proxies to use.
13640 proxyRules?: string;
13642 * Rules indicating which URLs should bypass the proxy settings.
13644 proxyBypassRules?: string;
13647 interface ConfigureHostResolverOptions {
13649 * Whether the built-in host resolver is used in preference to getaddrinfo. When
13650 * enabled, the built-in resolver will attempt to use the system's DNS settings to
13651 * do DNS lookups itself. Enabled by default on macOS, disabled by default on
13652 * Windows and Linux.
13654 enableBuiltInResolver?: boolean;
13656 * Can be "off", "automatic" or "secure". Configures the DNS-over-HTTP mode. When
13657 * "off", no DoH lookups will be performed. When "automatic", DoH lookups will be
13658 * performed first if DoH is available, and insecure DNS lookups will be performed
13659 * as a fallback. When "secure", only DoH lookups will be performed. Defaults to
13662 secureDnsMode?: string;
13664 * A list of DNS-over-HTTP server templates. See RFC8484 § 3 for details on the
13665 * template format. Most servers support the POST method; the template for such
13666 * servers is simply a URI. Note that for some DNS providers, the resolver will
13667 * automatically upgrade to DoH unless DoH is explicitly disabled, even if there
13668 * are no DoH servers provided in this list.
13670 secureDnsServers?: string[];
13672 * Controls whether additional DNS query types, e.g. HTTPS (DNS type 65) will be
13673 * allowed besides the traditional A and AAAA queries when a request is being made
13674 * via insecure DNS. Has no effect on Secure DNS which always allows additional
13675 * types. Defaults to true.
13677 enableAdditionalDnsQueryTypes?: boolean;
13680 interface ConsoleMessageEvent extends Event {
13682 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
13687 * The actual console message
13691 * The line number of the source that triggered this console message
13697 interface ContextMenuEvent extends Event {
13701 interface ContextMenuParams {
13711 * Frame from which the context menu was invoked.
13713 frame: WebFrameMain;
13715 * URL of the link that encloses the node the context menu was invoked on.
13719 * Text associated with the link. May be an empty string if the contents of the
13720 * link are an image.
13724 * URL of the top level page that the context menu was invoked on.
13728 * URL of the subframe that the context menu was invoked on.
13732 * Source URL for the element that the context menu was invoked on. Elements with
13733 * source URLs are images, audio and video.
13737 * Type of the node the context menu was invoked on. Can be `none`, `image`,
13738 * `audio`, `video`, `canvas`, `file` or `plugin`.
13740 mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
13742 * Whether the context menu was invoked on an image which has non-empty contents.
13744 hasImageContents: boolean;
13746 * Whether the context is editable.
13748 isEditable: boolean;
13750 * Text of the selection that the context menu was invoked on.
13752 selectionText: string;
13754 * Title text of the selection that the context menu was invoked on.
13758 * Alt text of the selection that the context menu was invoked on.
13762 * Suggested filename to be used when saving file through 'Save Link As' option of
13765 suggestedFilename: string;
13767 * Rect representing the coordinates in the document space of the selection.
13769 selectionRect: Rectangle;
13771 * Start position of the selection text.
13773 selectionStartOffset: number;
13775 * The referrer policy of the frame on which the menu is invoked.
13777 referrerPolicy: Referrer;
13779 * The misspelled word under the cursor, if any.
13781 misspelledWord: string;
13783 * An array of suggested words to show the user to replace the `misspelledWord`.
13784 * Only available if there is a misspelled word and spellchecker is enabled.
13786 dictionarySuggestions: string[];
13788 * The character encoding of the frame on which the menu was invoked.
13790 frameCharset: string;
13792 * If the context menu was invoked on an input field, the type of that field.
13793 * Possible values are `none`, `plainText`, `password`, `other`.
13795 inputFieldType: string;
13797 * If the context is editable, whether or not spellchecking is enabled.
13799 spellcheckEnabled: boolean;
13801 * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
13802 * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
13803 * `adjustSelection`, or `adjustSelectionReset`.
13805 menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
13807 * The flags for the media element the context menu was invoked on.
13809 mediaFlags: MediaFlags;
13811 * These flags indicate whether the renderer believes it is able to perform the
13812 * corresponding action.
13814 editFlags: EditFlags;
13817 interface ContinueActivityDetails {
13819 * A string identifying the URL of the webpage accessed by the activity on another
13820 * device, if available.
13822 webpageURL?: string;
13825 interface CookiesGetFilter {
13827 * Retrieves cookies which are associated with `url`. Empty implies retrieving
13828 * cookies of all URLs.
13832 * Filters cookies by name.
13836 * Retrieves cookies whose domains match or are subdomains of `domains`.
13840 * Retrieves cookies whose path matches `path`.
13844 * Filters cookies by their Secure property.
13848 * Filters out session or persistent cookies.
13853 interface CookiesSetDetails {
13855 * The URL to associate the cookie with. The promise will be rejected if the URL is
13860 * The name of the cookie. Empty by default if omitted.
13864 * The value of the cookie. Empty by default if omitted.
13868 * The domain of the cookie; this will be normalized with a preceding dot so that
13869 * it's also valid for subdomains. Empty by default if omitted.
13873 * The path of the cookie. Empty by default if omitted.
13877 * Whether the cookie should be marked as Secure. Defaults to false unless Same
13878 * Site=None attribute is used.
13882 * Whether the cookie should be marked as HTTP only. Defaults to false.
13884 httpOnly?: boolean;
13886 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
13887 * If omitted then the cookie becomes a session cookie and will not be retained
13888 * between sessions.
13890 expirationDate?: number;
13892 * The Same Site policy to apply to this cookie. Can be `unspecified`,
13893 * `no_restriction`, `lax` or `strict`. Default is `lax`.
13895 sameSite?: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
13898 interface CrashReporterStartOptions {
13900 * URL that crash reports will be sent to as POST. Required unless `uploadToServer`
13903 submitURL?: string;
13905 * Defaults to `app.name`.
13907 productName?: string;
13909 * Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
13913 companyName?: string;
13915 * Whether crash reports should be sent to the server. If false, crash reports will
13916 * be collected and stored in the crashes directory, but not uploaded. Default is
13919 uploadToServer?: boolean;
13921 * If true, crashes generated in the main process will not be forwarded to the
13922 * system crash handler. Default is `false`.
13924 ignoreSystemCrashHandler?: boolean;
13926 * If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
13928 * @platform darwin,win32
13930 rateLimit?: boolean;
13932 * If true, crash reports will be compressed and uploaded with `Content-Encoding:
13933 * gzip`. Default is `true`.
13935 compress?: boolean;
13937 * Extra string key/value annotations that will be sent along with crash reports
13938 * that are generated in the main process. Only string values are supported.
13939 * Crashes generated in child processes will not contain these extra parameters to
13940 * crash reports generated from child processes, call `addExtraParameter` from the
13943 extra?: Record<string, string>;
13945 * Extra string key/value annotations that will be sent along with any crash
13946 * reports generated in any process. These annotations cannot be changed once the
13947 * crash reporter has been started. If a key is present in both the global extra
13948 * parameters and the process-specific extra parameters, then the global one will
13949 * take precedence. By default, `productName` and the app version are included, as
13950 * well as the Electron version.
13952 globalExtra?: Record<string, string>;
13955 interface CreateFromBitmapOptions {
13961 scaleFactor?: number;
13964 interface CreateFromBufferOptions {
13966 * Required for bitmap buffers.
13970 * Required for bitmap buffers.
13976 scaleFactor?: number;
13979 interface CreateInterruptedDownloadOptions {
13981 * Absolute path of the download.
13985 * Complete URL chain for the download.
13987 urlChain: string[];
13990 * Start range for the download.
13994 * Total length of the download.
13998 * Last-Modified header value.
14000 lastModified?: string;
14002 * ETag header value.
14006 * Time when download was started in number of seconds since UNIX epoch.
14008 startTime?: number;
14014 image?: NativeImage;
14017 * The title of the URL at `text`.
14022 interface Details {
14024 * Process type. One of the following values:
14026 type: ('Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
14028 * The reason the child process is gone. Possible values:
14030 reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
14032 * The exit code for the process (e.g. status from waitpid if on posix, from
14033 * GetExitCodeProcess on Windows).
14037 * The non-localized name of the process.
14039 serviceName?: string;
14041 * The name of the process. Examples for utility: `Audio Service`, `Content
14042 * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
14047 interface DevicePermissionHandlerHandlerDetails {
14049 * The type of device that permission is being requested on, can be `hid` or
14052 deviceType: ('hid' | 'serial');
14054 * The origin URL of the device permission check.
14058 * the device that permission is being requested for.
14060 device: (HIDDevice) | (SerialPort);
14063 interface DidChangeThemeColorEvent extends Event {
14064 themeColor: string;
14067 interface DidCreateWindowDetails {
14069 * URL for the created window.
14073 * Name given to the created window in the `window.open()` call.
14077 * The options used to create the BrowserWindow. They are merged in increasing
14078 * precedence: parsed options from the `features` string from `window.open()`,
14079 * security-related webPreferences inherited from the parent, and options given by
14080 * `webContents.setWindowOpenHandler`. Unrecognized options are not filtered out.
14082 options: BrowserWindowConstructorOptions;
14084 * The referrer that will be passed to the new window. May or may not result in the
14085 * `Referer` header being sent, depending on the referrer policy.
14087 referrer: Referrer;
14089 * The post data that will be sent to the new window, along with the appropriate
14090 * headers that will be set. If no post data is to be sent, the value will be
14091 * `null`. Only defined when the window is being created by a form that set
14094 postBody?: PostBody;
14096 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
14097 * `save-to-disk` and `other`.
14099 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
14102 interface DidFailLoadEvent extends Event {
14104 errorDescription: string;
14105 validatedURL: string;
14106 isMainFrame: boolean;
14109 interface DidFrameFinishLoadEvent extends Event {
14110 isMainFrame: boolean;
14113 interface DidFrameNavigateEvent extends Event {
14116 * -1 for non HTTP navigations
14118 httpResponseCode: number;
14120 * empty for non HTTP navigations,
14122 httpStatusText: string;
14123 isMainFrame: boolean;
14124 frameProcessId: number;
14125 frameRoutingId: number;
14128 interface DidNavigateEvent extends Event {
14132 interface DidNavigateInPageEvent extends Event {
14133 isMainFrame: boolean;
14137 interface DidRedirectNavigationEvent extends Event {
14139 isInPlace: boolean;
14140 isMainFrame: boolean;
14141 frameProcessId: number;
14142 frameRoutingId: number;
14145 interface DidStartNavigationEvent extends Event {
14147 isInPlace: boolean;
14148 isMainFrame: boolean;
14149 frameProcessId: number;
14150 frameRoutingId: number;
14153 interface DisplayBalloonOptions {
14155 * Icon to use when `iconType` is `custom`.
14157 icon?: (NativeImage) | (string);
14159 * Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
14161 iconType?: ('none' | 'info' | 'warning' | 'error' | 'custom');
14165 * The large version of the icon should be used. Default is `true`. Maps to
14166 * `NIIF_LARGE_ICON`.
14168 largeIcon?: boolean;
14170 * Do not play the associated sound. Default is `false`. Maps to `NIIF_NOSOUND`.
14174 * Do not display the balloon notification if the current user is in "quiet time".
14175 * Default is `false`. Maps to `NIIF_RESPECT_QUIET_TIME`.
14177 respectQuietTime?: boolean;
14180 interface DisplayMediaRequestHandlerHandlerRequest {
14182 * Frame that is requesting access to media.
14184 frame: WebFrameMain;
14186 * Origin of the page making the request.
14188 securityOrigin: string;
14190 * true if the web content requested a video stream.
14192 videoRequested: boolean;
14194 * true if the web content requested an audio stream.
14196 audioRequested: boolean;
14198 * Whether a user gesture was active when this request was triggered.
14200 userGesture: boolean;
14203 interface EnableNetworkEmulationOptions {
14205 * Whether to emulate network outage. Defaults to false.
14209 * RTT in ms. Defaults to 0 which will disable latency throttling.
14213 * Download rate in Bps. Defaults to 0 which will disable download throttling.
14215 downloadThroughput?: number;
14217 * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
14219 uploadThroughput?: number;
14222 interface FeedURLOptions {
14225 * HTTP request headers.
14229 headers?: Record<string, string>;
14231 * Can be `json` or `default`, see the Squirrel.Mac README for more information.
14235 serverType?: ('json' | 'default');
14238 interface FileIconOptions {
14239 size: ('small' | 'normal' | 'large');
14242 interface FindInPageOptions {
14244 * Whether to search forward or backward, defaults to `true`.
14248 * Whether to begin a new text finding session with this request. Should be `true`
14249 * for initial requests, and `false` for follow-up requests. Defaults to `false`.
14251 findNext?: boolean;
14253 * Whether search should be case-sensitive, defaults to `false`.
14255 matchCase?: boolean;
14258 interface FocusOptions {
14260 * Make the receiver the active app even if another app is currently active.
14267 interface ForkOptions {
14269 * Environment key-value pairs. Default is `process.env`.
14273 * List of string arguments passed to the executable.
14275 execArgv?: string[];
14277 * Current working directory of the child process.
14281 * Allows configuring the mode for `stdout` and `stderr` of the child process.
14282 * Default is `inherit`. String value can be one of `pipe`, `ignore`, `inherit`,
14283 * for more details on these values you can refer to stdio documentation from
14284 * Node.js. Currently this option only supports configuring `stdout` and `stderr`
14285 * to either `pipe`, `inherit` or `ignore`. Configuring `stdin` is not supported;
14286 * `stdin` will always be ignored. For example, the supported values will be
14287 * processed as following:
14289 stdio?: (Array<'pipe' | 'ignore' | 'inherit'>) | (string);
14291 * Name of the process that will appear in `name` property of `child-process-gone`
14292 * event of `app`. Default is `node.mojom.NodeService`.
14294 serviceName?: string;
14296 * With this flag, the utility process will be launched via the `Electron Helper
14297 * (Plugin).app` helper executable on macOS, which can be codesigned with
14298 * `com.apple.security.cs.disable-library-validation` and
14299 * `com.apple.security.cs.allow-unsigned-executable-memory` entitlements. This will
14300 * allow the utility process to load unsigned libraries. Unless you specifically
14301 * need this capability, it is best to leave this disabled. Default is `false`.
14305 allowLoadingUnsignedLibraries?: boolean;
14308 interface FoundInPageEvent extends Event {
14309 result: FoundInPageResult;
14312 interface FrameCreatedDetails {
14313 frame: WebFrameMain;
14316 interface FromPartitionOptions {
14318 * Whether to enable cache.
14323 interface HandlerDetails {
14325 * The _resolved_ version of the URL passed to `window.open()`. e.g. opening a
14326 * window with `window.open('foo')` will yield something like
14327 * `https://the-origin/the/current/path/foo`.
14331 * Name of the window provided in `window.open()`
14335 * Comma separated list of window features provided to `window.open()`.
14339 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
14340 * `save-to-disk` or `other`.
14342 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
14344 * The referrer that will be passed to the new window. May or may not result in the
14345 * `Referer` header being sent, depending on the referrer policy.
14347 referrer: Referrer;
14349 * The post data that will be sent to the new window, along with the appropriate
14350 * headers that will be set. If no post data is to be sent, the value will be
14351 * `null`. Only defined when the window is being created by a form that set
14354 postBody?: PostBody;
14357 interface HeadersReceivedResponse {
14360 * When provided, the server is assumed to have responded with these headers.
14362 responseHeaders?: Record<string, (string) | (string[])>;
14364 * Should be provided when overriding `responseHeaders` to change header status
14365 * otherwise original response header's status will be used.
14367 statusLine?: string;
14370 interface HeapStatistics {
14371 totalHeapSize: number;
14372 totalHeapSizeExecutable: number;
14373 totalPhysicalSize: number;
14374 totalAvailableSize: number;
14375 usedHeapSize: number;
14376 heapSizeLimit: number;
14377 mallocedMemory: number;
14378 peakMallocedMemory: number;
14379 doesZapGarbage: boolean;
14382 interface HidDeviceAddedDetails {
14383 device: HIDDevice[];
14384 frame: WebFrameMain;
14387 interface HidDeviceRemovedDetails {
14388 device: HIDDevice[];
14389 frame: WebFrameMain;
14392 interface HidDeviceRevokedDetails {
14393 device: HIDDevice[];
14395 * The origin that the device has been revoked from.
14400 interface IgnoreMouseEventsOptions {
14402 * If true, forwards mouse move messages to Chromium, enabling mouse related events
14403 * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
14404 * forwarding is always disabled regardless of this value.
14406 * @platform darwin,win32
14411 interface ImportCertificateOptions {
14413 * Path for the pkcs12 file.
14415 certificate: string;
14417 * Passphrase for the certificate.
14424 * Security origin for the isolated world.
14426 securityOrigin?: string;
14428 * Content Security Policy for the isolated world.
14432 * Name for isolated world. Useful in devtools.
14439 * Either `keyUp` or `keyDown`.
14443 * Equivalent to KeyboardEvent.key.
14447 * Equivalent to KeyboardEvent.code.
14451 * Equivalent to KeyboardEvent.repeat.
14453 isAutoRepeat: boolean;
14455 * Equivalent to KeyboardEvent.isComposing.
14457 isComposing: boolean;
14459 * Equivalent to KeyboardEvent.shiftKey.
14463 * Equivalent to KeyboardEvent.controlKey.
14467 * Equivalent to KeyboardEvent.altKey.
14471 * Equivalent to KeyboardEvent.metaKey.
14475 * Equivalent to KeyboardEvent.location.
14479 * See InputEvent.modifiers.
14481 modifiers: string[];
14484 interface InsertCSSOptions {
14486 * Can be either 'user' or 'author'. Sets the cascade origin of the inserted
14487 * stylesheet. Default is 'author'.
14489 cssOrigin?: string;
14492 interface IpcMessageEvent extends Event {
14494 * pair of `[processId, frameId]`.
14496 frameId: [number, number];
14503 * The path to the file being dragged.
14507 * The paths to the files being dragged. (`files` will override `file` field)
14511 * The image must be non-empty on macOS.
14513 icon: (NativeImage) | (string);
14516 interface JumpListSettings {
14518 * The minimum number of items that will be shown in the Jump List (for a more
14519 * detailed description of this value see the MSDN docs).
14523 * Array of `JumpListItem` objects that correspond to items that the user has
14524 * explicitly removed from custom categories in the Jump List. These items must not
14525 * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
14526 * Windows will not display any custom category that contains any of the removed
14529 removedItems: JumpListItem[];
14532 interface LoadCommitEvent extends Event {
14534 isMainFrame: boolean;
14537 interface LoadExtensionOptions {
14539 * Whether to allow the extension to read local files over `file://` protocol and
14540 * inject content scripts into `file://` pages. This is required e.g. for loading
14541 * devtools extensions on `file://` URLs. Defaults to false.
14543 allowFileAccess: boolean;
14546 interface LoadFileOptions {
14548 * Passed to `url.format()`.
14550 query?: Record<string, string>;
14552 * Passed to `url.format()`.
14556 * Passed to `url.format()`.
14561 interface LoadURLOptions {
14563 * An HTTP Referrer url.
14565 httpReferrer?: (string) | (Referrer);
14567 * A user agent originating the request.
14569 userAgent?: string;
14571 * Extra headers separated by "\n"
14573 extraHeaders?: string;
14574 postData?: Array<(UploadRawData) | (UploadFile)>;
14576 * Base url (with trailing path separator) for files to be loaded by the data url.
14577 * This is needed only if the specified `url` is a data url and needs to load other
14580 baseURLForDataURL?: string;
14583 interface LoginItemSettings {
14585 * `true` if the app is set to open at login.
14587 openAtLogin: boolean;
14589 * `true` if the app is set to open as hidden at login. This setting is not
14590 * available on MAS builds.
14594 openAsHidden: boolean;
14596 * `true` if the app was opened at login automatically. This setting is not
14597 * available on MAS builds.
14601 wasOpenedAtLogin: boolean;
14603 * `true` if the app was opened as a hidden login item. This indicates that the app
14604 * should not open any windows at startup. This setting is not available on MAS
14609 wasOpenedAsHidden: boolean;
14611 * `true` if the app was opened as a login item that should restore the state from
14612 * the previous session. This indicates that the app should restore the windows
14613 * that were open the last time the app was closed. This setting is not available
14618 restoreState: boolean;
14620 * `true` if app is set to open at login and its run key is not deactivated. This
14621 * differs from `openAtLogin` as it ignores the `args` option, this property will
14622 * be true if the given executable would be launched at login with **any**
14627 executableWillLaunchAtLogin: boolean;
14628 launchItems: LaunchItems[];
14631 interface LoginItemSettingsOptions {
14633 * The executable path to compare against. Defaults to `process.execPath`.
14639 * The command-line arguments to compare against. Defaults to an empty array.
14646 interface MenuItemConstructorOptions {
14648 * Will be called with `click(menuItem, browserWindow, event)` when the menu item
14651 click?: (menuItem: MenuItem, browserWindow: (BrowserWindow) | (undefined), event: KeyboardEvent) => void;
14653 * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
14654 * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
14655 * `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`,
14656 * `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`,
14657 * `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`,
14658 * `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`,
14659 * `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`,
14660 * `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`,
14661 * `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action
14662 * of the menu item, when specified the `click` property will be ignored. See
14665 role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'toggleSpellChecker' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'showSubstitutions' | 'toggleSmartQuotes' | 'toggleSmartDashes' | 'toggleTextReplacement' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'shareMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
14667 * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
14669 type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
14673 * Hover text for this menu item.
14678 accelerator?: Accelerator;
14679 icon?: (NativeImage) | (string);
14681 * If false, the menu item will be greyed out and unclickable.
14685 * default is `true`, and when `false` will prevent the accelerator from triggering
14686 * the item if the item is not visible`.
14690 acceleratorWorksWhenHidden?: boolean;
14692 * If false, the menu item will be entirely hidden.
14696 * Should only be specified for `checkbox` or `radio` type menu items.
14700 * If false, the accelerator won't be registered with the system, but it will still
14701 * be displayed. Defaults to true.
14703 * @platform linux,win32
14705 registerAccelerator?: boolean;
14707 * The item to share when the `role` is `shareMenu`.
14711 sharingItem?: SharingItem;
14713 * Should be specified for `submenu` type menu items. If `submenu` is specified,
14714 * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
14715 * be automatically converted to one using `Menu.buildFromTemplate`.
14717 submenu?: (MenuItemConstructorOptions[]) | (Menu);
14719 * Unique within a single menu. If defined then it can be used as a reference to
14720 * this item by the position attribute.
14724 * Inserts this item before the item with the specified label. If the referenced
14725 * item doesn't exist the item will be inserted at the end of the menu. Also
14726 * implies that the menu item in question should be placed in the same “group” as
14731 * Inserts this item after the item with the specified label. If the referenced
14732 * item doesn't exist the item will be inserted at the end of the menu.
14736 * Provides a means for a single context menu to declare the placement of their
14737 * containing group before the containing group of the item with the specified
14740 beforeGroupContaining?: string[];
14742 * Provides a means for a single context menu to declare the placement of their
14743 * containing group after the containing group of the item with the specified
14746 afterGroupContaining?: string[];
14749 interface MessageBoxOptions {
14751 * Content of the message box.
14755 * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
14756 * `"question"` displays the same icon as `"info"`, unless you set an icon using
14757 * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
14762 * Array of texts for buttons. On Windows, an empty array will result in one button
14765 buttons?: string[];
14767 * Index of the button in the buttons array which will be selected by default when
14768 * the message box opens.
14770 defaultId?: number;
14772 * Pass an instance of AbortSignal to optionally close the message box, the message
14773 * box will behave as if it was cancelled by the user. On macOS, `signal` does not
14774 * work with message boxes that do not have a parent window, since those message
14775 * boxes run synchronously due to platform limitations.
14777 signal?: AbortSignal;
14779 * Title of the message box, some platforms will not show it.
14783 * Extra information of the message.
14787 * If provided, the message box will include a checkbox with the given label.
14789 checkboxLabel?: string;
14791 * Initial checked state of the checkbox. `false` by default.
14793 checkboxChecked?: boolean;
14794 icon?: (NativeImage) | (string);
14796 * Custom width of the text in the message box.
14800 textWidth?: number;
14802 * The index of the button to be used to cancel the dialog, via the `Esc` key. By
14803 * default this is assigned to the first button with "cancel" or "no" as the label.
14804 * If no such labeled buttons exist and this option is not set, `0` will be used as
14805 * the return value.
14809 * On Windows Electron will try to figure out which one of the `buttons` are common
14810 * buttons (like "Cancel" or "Yes"), and show the others as command links in the
14811 * dialog. This can make the dialog appear in the style of modern Windows apps. If
14812 * you don't like this behavior, you can set `noLink` to `true`.
14816 * Normalize the keyboard access keys across platforms. Default is `false`.
14817 * Enabling this assumes `&` is used in the button labels for the placement of the
14818 * keyboard shortcut access key and labels will be converted so they work correctly
14819 * on each platform, `&` characters are removed on macOS, converted to `_` on
14820 * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
14821 * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
14822 * via `Alt-W` on Windows and Linux.
14824 normalizeAccessKeys?: boolean;
14827 interface MessageBoxReturnValue {
14829 * The index of the clicked button.
14833 * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
14835 checkboxChecked: boolean;
14838 interface MessageBoxSyncOptions {
14840 * Content of the message box.
14844 * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
14845 * `"question"` displays the same icon as `"info"`, unless you set an icon using
14846 * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
14851 * Array of texts for buttons. On Windows, an empty array will result in one button
14854 buttons?: string[];
14856 * Index of the button in the buttons array which will be selected by default when
14857 * the message box opens.
14859 defaultId?: number;
14861 * Title of the message box, some platforms will not show it.
14865 * Extra information of the message.
14868 icon?: (NativeImage) | (string);
14870 * Custom width of the text in the message box.
14874 textWidth?: number;
14876 * The index of the button to be used to cancel the dialog, via the `Esc` key. By
14877 * default this is assigned to the first button with "cancel" or "no" as the label.
14878 * If no such labeled buttons exist and this option is not set, `0` will be used as
14879 * the return value.
14883 * On Windows Electron will try to figure out which one of the `buttons` are common
14884 * buttons (like "Cancel" or "Yes"), and show the others as command links in the
14885 * dialog. This can make the dialog appear in the style of modern Windows apps. If
14886 * you don't like this behavior, you can set `noLink` to `true`.
14890 * Normalize the keyboard access keys across platforms. Default is `false`.
14891 * Enabling this assumes `&` is used in the button labels for the placement of the
14892 * keyboard shortcut access key and labels will be converted so they work correctly
14893 * on each platform, `&` characters are removed on macOS, converted to `_` on
14894 * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
14895 * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
14896 * via `Alt-W` on Windows and Linux.
14898 normalizeAccessKeys?: boolean;
14901 interface MessageDetails {
14903 * The actual console message
14907 * The version ID of the service worker that sent the log message
14911 * The type of source for this message. Can be `javascript`, `xml`, `network`,
14912 * `console-api`, `storage`, `rendering`, `security`, `deprecation`, `worker`,
14913 * `violation`, `intervention`, `recommendation` or `other`.
14915 source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
14917 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
14922 * The URL the message came from
14926 * The line number of the source that triggered this console message
14928 lineNumber: number;
14931 interface MessageEvent {
14933 ports: MessagePortMain[];
14936 interface MoveToApplicationsFolderOptions {
14938 * A handler for potential conflict in move failure.
14940 conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
14943 interface NotificationConstructorOptions {
14945 * A title for the notification, which will be shown at the top of the notification
14946 * window when it is shown.
14950 * A subtitle for the notification, which will be displayed below the title.
14956 * The body text of the notification, which will be displayed below the title or
14961 * Whether or not to emit an OS notification noise when showing the notification.
14965 * An icon to use in the notification.
14967 icon?: (string) | (NativeImage);
14969 * Whether or not to add an inline reply option to the notification.
14973 hasReply?: boolean;
14975 * The timeout duration of the notification. Can be 'default' or 'never'.
14977 * @platform linux,win32
14979 timeoutType?: ('default' | 'never');
14981 * The placeholder to write in the inline reply input field.
14985 replyPlaceholder?: string;
14987 * The name of the sound file to play when the notification is shown.
14993 * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
14997 urgency?: ('normal' | 'critical' | 'low');
14999 * Actions to add to the notification. Please read the available actions and
15000 * limitations in the `NotificationAction` documentation.
15004 actions?: NotificationAction[];
15006 * A custom title for the close button of an alert. An empty string will cause the
15007 * default localized text to be used.
15011 closeButtonText?: string;
15013 * A custom description of the Notification on Windows superseding all properties
15014 * above. Provides full customization of design and behavior of the notification.
15021 interface OnBeforeRedirectListenerDetails {
15025 webContentsId?: number;
15026 webContents?: WebContents;
15027 frame?: WebFrameMain;
15029 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
15030 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
15032 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
15035 redirectURL: string;
15036 statusCode: number;
15037 statusLine: string;
15039 * The server IP address that the request was actually sent to.
15042 fromCache: boolean;
15043 responseHeaders?: Record<string, string[]>;
15046 interface OnBeforeRequestListenerDetails {
15050 webContentsId?: number;
15051 webContents?: WebContents;
15052 frame?: WebFrameMain;
15054 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
15055 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
15057 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
15060 uploadData: UploadData[];
15063 interface OnBeforeSendHeadersListenerDetails {
15067 webContentsId?: number;
15068 webContents?: WebContents;
15069 frame?: WebFrameMain;
15071 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
15072 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
15074 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
15077 uploadData?: UploadData[];
15078 requestHeaders: Record<string, string>;
15081 interface OnCompletedListenerDetails {
15085 webContentsId?: number;
15086 webContents?: WebContents;
15087 frame?: WebFrameMain;
15089 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
15090 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
15092 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
15095 responseHeaders?: Record<string, string[]>;
15096 fromCache: boolean;
15097 statusCode: number;
15098 statusLine: string;
15102 interface OnErrorOccurredListenerDetails {
15106 webContentsId?: number;
15107 webContents?: WebContents;
15108 frame?: WebFrameMain;
15110 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
15111 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
15113 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
15116 fromCache: boolean;
15118 * The error description.
15123 interface OnHeadersReceivedListenerDetails {
15127 webContentsId?: number;
15128 webContents?: WebContents;
15129 frame?: WebFrameMain;
15131 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
15132 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
15134 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
15137 statusLine: string;
15138 statusCode: number;
15139 responseHeaders?: Record<string, string[]>;
15142 interface OnResponseStartedListenerDetails {
15146 webContentsId?: number;
15147 webContents?: WebContents;
15148 frame?: WebFrameMain;
15150 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
15151 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
15153 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
15156 responseHeaders?: Record<string, string[]>;
15158 * Indicates whether the response was fetched from disk cache.
15160 fromCache: boolean;
15161 statusCode: number;
15162 statusLine: string;
15165 interface OnSendHeadersListenerDetails {
15169 webContentsId?: number;
15170 webContents?: WebContents;
15171 frame?: WebFrameMain;
15173 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
15174 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
15176 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
15179 requestHeaders: Record<string, string>;
15182 interface OpenDevToolsOptions {
15184 * Opens the devtools with specified dock state, can be `left`, `right`, `bottom`,
15185 * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
15186 * possible to dock back. In `detach` mode it's not.
15188 mode: ('left' | 'right' | 'bottom' | 'undocked' | 'detach');
15190 * Whether to bring the opened devtools window to the foreground. The default is
15193 activate?: boolean;
15196 interface OpenDialogOptions {
15198 defaultPath?: string;
15200 * Custom label for the confirmation button, when left empty the default label will
15203 buttonLabel?: string;
15204 filters?: FileFilter[];
15206 * Contains which features the dialog should use. The following values are
15209 properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
15211 * Message to display above input boxes.
15217 * Create security scoped bookmarks when packaged for the Mac App Store.
15219 * @platform darwin,mas
15221 securityScopedBookmarks?: boolean;
15224 interface OpenDialogReturnValue {
15226 * whether or not the dialog was canceled.
15230 * An array of file paths chosen by the user. If the dialog is cancelled this will
15231 * be an empty array.
15233 filePaths: string[];
15235 * An array matching the `filePaths` array of base64 encoded strings which contains
15236 * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
15237 * this to be populated. (For return values, see table here.)
15239 * @platform darwin,mas
15241 bookmarks?: string[];
15244 interface OpenDialogSyncOptions {
15246 defaultPath?: string;
15248 * Custom label for the confirmation button, when left empty the default label will
15251 buttonLabel?: string;
15252 filters?: FileFilter[];
15254 * Contains which features the dialog should use. The following values are
15257 properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
15259 * Message to display above input boxes.
15265 * Create security scoped bookmarks when packaged for the Mac App Store.
15267 * @platform darwin,mas
15269 securityScopedBookmarks?: boolean;
15272 interface OpenExternalOptions {
15274 * `true` to bring the opened application to the foreground. The default is `true`.
15278 activate?: boolean;
15280 * The working directory.
15284 workingDirectory?: string;
15287 interface Options {
15292 * if true, fire the `beforeunload` event before closing the page. If the page
15293 * prevents the unload, the WebContents will not be closed. The
15294 * `will-prevent-unload` will be fired if the page requests prevention of unload.
15296 waitForBeforeUnload: boolean;
15299 interface PageFaviconUpdatedEvent extends Event {
15303 favicons: string[];
15306 interface PageTitleUpdatedEvent extends Event {
15308 explicitSet: boolean;
15311 interface Parameters {
15313 * Specify the screen type to emulate (default: `desktop`):
15315 screenPosition: ('desktop' | 'mobile');
15317 * Set the emulated screen size (screenPosition == mobile).
15321 * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
15324 viewPosition: Point;
15326 * Set the device scale factor (if zero defaults to original device scale factor)
15329 deviceScaleFactor: number;
15331 * Set the emulated view size (empty means no override)
15335 * Scale of emulated view inside available space (not in fit to view mode)
15341 interface Payment {
15343 * The identifier of the purchased product.
15345 productIdentifier: string;
15347 * The quantity purchased.
15351 * An opaque identifier for the user’s account on your system.
15353 applicationUsername: string;
15355 * The details of the discount offer to apply to the payment.
15357 paymentDiscount?: PaymentDiscount;
15360 interface PermissionCheckHandlerHandlerDetails {
15362 * The origin of the frame embedding the frame that made the permission check.
15363 * Only set for cross-origin sub frames making permission checks.
15365 embeddingOrigin?: string;
15367 * The security origin of the `media` check.
15369 securityOrigin?: string;
15371 * The type of media access being requested, can be `video`, `audio` or `unknown`
15373 mediaType?: ('video' | 'audio' | 'unknown');
15375 * The last URL the requesting frame loaded. This is not provided for cross-origin
15376 * sub frames making permission checks.
15378 requestingUrl?: string;
15380 * Whether the frame making the request is the main frame
15382 isMainFrame: boolean;
15385 interface PermissionRequestHandlerHandlerDetails {
15387 * The url of the `openExternal` request.
15389 externalURL?: string;
15391 * The security origin of the `media` request.
15393 securityOrigin?: string;
15395 * The types of media access being requested, elements can be `video` or `audio`
15397 mediaTypes?: Array<'video' | 'audio'>;
15399 * The last URL the requesting frame loaded
15401 requestingUrl: string;
15403 * Whether the frame making the request is the main frame
15405 isMainFrame: boolean;
15408 interface PluginCrashedEvent extends Event {
15413 interface PopupOptions {
15415 * Default is the focused window.
15417 window?: BrowserWindow;
15419 * Default is the current mouse cursor position. Must be declared if `y` is
15424 * Default is the current mouse cursor position. Must be declared if `x` is
15429 * The index of the menu item to be positioned under the mouse cursor at the
15430 * specified coordinates. Default is -1.
15434 positioningItem?: number;
15436 * Called when menu is closed.
15438 callback?: () => void;
15441 interface PreconnectOptions {
15443 * URL for preconnect. Only the origin is relevant for opening the socket.
15447 * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
15449 numSockets?: number;
15452 interface PrintToPDFOptions {
15454 * Paper orientation.`true` for landscape, `false` for portrait. Defaults to false.
15456 landscape?: boolean;
15458 * Whether to display header and footer. Defaults to false.
15460 displayHeaderFooter?: boolean;
15462 * Whether to print background graphics. Defaults to false.
15464 printBackground?: boolean;
15466 * Scale of the webpage rendering. Defaults to 1.
15470 * Specify page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, `A4`,
15471 * `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing
15472 * `height` and `width` in inches. Defaults to `Letter`.
15474 pageSize?: (string) | (Size);
15477 * Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string,
15478 * which means print all pages.
15480 pageRanges?: string;
15482 * HTML template for the print header. Should be valid HTML markup with following
15483 * classes used to inject printing values into them: `date` (formatted print date),
15484 * `title` (document title), `url` (document location), `pageNumber` (current page
15485 * number) and `totalPages` (total pages in the document). For example, `<span
15486 * class=title></span>` would generate span containing the title.
15488 headerTemplate?: string;
15490 * HTML template for the print footer. Should use the same format as the
15491 * `headerTemplate`.
15493 footerTemplate?: string;
15495 * Whether or not to prefer page size as defined by css. Defaults to false, in
15496 * which case the content will be scaled to fit the paper size.
15498 preferCSSPageSize?: boolean;
15501 interface Privileges {
15505 standard?: boolean;
15513 bypassCSP?: boolean;
15517 allowServiceWorkers?: boolean;
15521 supportFetchAPI?: boolean;
15525 corsEnabled?: boolean;
15532 interface ProgressBarOptions {
15534 * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
15539 mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
15542 interface Provider {
15543 spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
15546 interface ReadBookmark {
15551 interface RegistrationCompletedDetails {
15553 * The base URL that a service worker is registered for
15558 interface RelaunchOptions {
15563 interface RenderProcessGoneDetails {
15565 * The reason the render process is gone. Possible values:
15567 reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
15569 * The exit code of the process, unless `reason` is `launch-failed`, in which case
15570 * `exitCode` will be a platform-specific launch failure error code.
15575 interface Request {
15577 certificate: Certificate;
15578 validatedCertificate: Certificate;
15580 * `true` if Chromium recognises the root CA as a standard root. If it isn't then
15581 * it's probably the case that this certificate was generated by a MITM proxy whose
15582 * root has been installed locally (for example, by a corporate proxy). This should
15583 * not be trusted if the `verificationResult` is not `OK`.
15585 isIssuedByKnownRoot: boolean;
15587 * `OK` if the certificate is trusted, otherwise an error like `CERT_REVOKED`.
15589 verificationResult: string;
15596 interface ResizeOptions {
15598 * Defaults to the image's width.
15602 * Defaults to the image's height.
15606 * The desired quality of the resize image. Possible values are `good`, `better`,
15607 * or `best`. The default is `best`. These values express a desired quality/speed
15608 * tradeoff. They are translated into an algorithm-specific method that depends on
15609 * the capabilities (CPU, GPU) of the underlying platform. It is possible for all
15610 * three methods to be mapped to the same algorithm on a given platform.
15615 interface ResourceUsage {
15616 images: MemoryUsageDetails;
15617 scripts: MemoryUsageDetails;
15618 cssStyleSheets: MemoryUsageDetails;
15619 xslStyleSheets: MemoryUsageDetails;
15620 fonts: MemoryUsageDetails;
15621 other: MemoryUsageDetails;
15624 interface Response {
15626 * `false` should be passed in if the dialog is canceled. If the `pairingKind` is
15627 * `confirm` or `confirmPin`, this value should indicate if the pairing is
15628 * confirmed. If the `pairingKind` is `providePin` the value should be `true` when
15629 * a value is provided.
15631 confirmed: boolean;
15633 * When the `pairingKind` is `providePin` this value should be the required pin for
15634 * the Bluetooth device.
15636 pin?: (string) | (null);
15642 * Position of the active match.
15644 activeMatchOrdinal: number;
15646 * Number of Matches.
15650 * Coordinates of first match region.
15652 selectionArea: Rectangle;
15653 finalUpdate: boolean;
15656 interface SaveDialogOptions {
15658 * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
15662 * Absolute directory path, absolute file path, or file name to use by default.
15664 defaultPath?: string;
15666 * Custom label for the confirmation button, when left empty the default label will
15669 buttonLabel?: string;
15670 filters?: FileFilter[];
15672 * Message to display above text fields.
15678 * Custom label for the text displayed in front of the filename text field.
15682 nameFieldLabel?: string;
15684 * Show the tags input box, defaults to `true`.
15688 showsTagField?: boolean;
15689 properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
15691 * Create a security scoped bookmark when packaged for the Mac App Store. If this
15692 * option is enabled and the file doesn't already exist a blank file will be
15693 * created at the chosen path.
15695 * @platform darwin,mas
15697 securityScopedBookmarks?: boolean;
15700 interface SaveDialogReturnValue {
15702 * whether or not the dialog was canceled.
15706 * If the dialog is canceled, this will be `undefined`.
15710 * Base64 encoded string which contains the security scoped bookmark data for the
15711 * saved file. `securityScopedBookmarks` must be enabled for this to be present.
15712 * (For return values, see table here.)
15714 * @platform darwin,mas
15719 interface SaveDialogSyncOptions {
15721 * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
15725 * Absolute directory path, absolute file path, or file name to use by default.
15727 defaultPath?: string;
15729 * Custom label for the confirmation button, when left empty the default label will
15732 buttonLabel?: string;
15733 filters?: FileFilter[];
15735 * Message to display above text fields.
15741 * Custom label for the text displayed in front of the filename text field.
15745 nameFieldLabel?: string;
15747 * Show the tags input box, defaults to `true`.
15751 showsTagField?: boolean;
15752 properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
15754 * Create a security scoped bookmark when packaged for the Mac App Store. If this
15755 * option is enabled and the file doesn't already exist a blank file will be
15756 * created at the chosen path.
15758 * @platform darwin,mas
15760 securityScopedBookmarks?: boolean;
15763 interface SelectHidDeviceDetails {
15764 deviceList: HIDDevice[];
15765 frame: WebFrameMain;
15768 interface SerialPortRevokedDetails {
15770 frame: WebFrameMain;
15772 * The origin that the device has been revoked from.
15777 interface Settings {
15779 * `true` to open the app at login, `false` to remove the app as a login item.
15780 * Defaults to `false`.
15782 openAtLogin?: boolean;
15784 * `true` to open the app as hidden. Defaults to `false`. The user can edit this
15785 * setting from the System Preferences so
15786 * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
15787 * opened to know the current value. This setting is not available on MAS builds.
15791 openAsHidden?: boolean;
15793 * The executable to launch at login. Defaults to `process.execPath`.
15799 * The command-line arguments to pass to the executable. Defaults to an empty
15800 * array. Take care to wrap paths in quotes.
15806 * `true` will change the startup approved registry key and `enable / disable` the
15807 * App in Task Manager and Windows Settings. Defaults to `true`.
15813 * value name to write into registry. Defaults to the app's AppUserModelId(). Set
15814 * the app's login item settings.
15821 interface SourcesOptions {
15823 * An array of strings that lists the types of desktop sources to be captured,
15824 * available types are `screen` and `window`.
15828 * The size that the media source thumbnail should be scaled to. Default is `150` x
15829 * `150`. Set width or height to 0 when you do not need the thumbnails. This will
15830 * save the processing time required for capturing the content of each window and
15833 thumbnailSize?: Size;
15835 * Set to true to enable fetching window icons. The default value is false. When
15836 * false the appIcon property of the sources return null. Same if a source has the
15839 fetchWindowIcons?: boolean;
15842 interface SSLConfigConfig {
15844 * Can be `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. The minimum SSL version to allow
15845 * when connecting to remote servers. Defaults to `tls1`.
15847 minVersion?: string;
15849 * Can be `tls1.2` or `tls1.3`. The maximum SSL version to allow when connecting to
15850 * remote servers. Defaults to `tls1.3`.
15852 maxVersion?: string;
15854 * List of cipher suites which should be explicitly prevented from being used in
15855 * addition to those disabled by the net built-in policy. Supported literal forms:
15856 * 0xAABB, where AA is `cipher_suite[0]` and BB is `cipher_suite[1]`, as defined in
15857 * RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form
15858 * will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify
15859 * 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note
15860 * that TLSv1.3 ciphers cannot be disabled using this mechanism.
15862 disabledCipherSuites?: number[];
15865 interface StartLoggingOptions {
15867 * What kinds of data should be captured. By default, only metadata about requests
15868 * will be captured. Setting this to `includeSensitive` will include cookies and
15869 * authentication data. Setting it to `everything` will include all bytes
15870 * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
15872 captureMode?: ('default' | 'includeSensitive' | 'everything');
15874 * When the log grows beyond this size, logging will automatically stop. Defaults
15877 maxFileSize?: number;
15880 interface Streams {
15881 video?: (Video) | (WebFrameMain);
15883 * If a string is specified, can be `loopback` or `loopbackWithMute`. Specifying a
15884 * loopback device will capture system audio, and is currently only supported on
15885 * Windows. If a WebFrameMain is specified, will capture audio from that frame.
15887 audio?: (('loopback' | 'loopbackWithMute')) | (WebFrameMain);
15890 interface SystemMemoryInfo {
15892 * The total amount of physical memory in Kilobytes available to the system.
15896 * The total amount of memory not being used by applications or disk cache.
15900 * The total amount of swap memory in Kilobytes available to the system.
15902 * @platform win32,linux
15906 * The free amount of swap memory in Kilobytes available to the system.
15908 * @platform win32,linux
15913 interface TitleBarOverlayOptions {
15915 * The CSS color of the Window Controls Overlay when enabled.
15921 * The CSS color of the symbols on the Window Controls Overlay when enabled.
15925 symbolColor?: string;
15927 * The height of the title bar and Window Controls Overlay in pixels.
15934 interface TitleOptions {
15936 * The font family variant to display, can be `monospaced` or `monospacedDigit`.
15937 * `monospaced` is available in macOS 10.15+ and `monospacedDigit` is available in
15938 * macOS 10.11+. When left blank, the title uses the default system font.
15940 fontType?: ('monospaced' | 'monospacedDigit');
15943 interface ToBitmapOptions {
15947 scaleFactor?: number;
15950 interface ToDataURLOptions {
15954 scaleFactor?: number;
15957 interface ToPNGOptions {
15961 scaleFactor?: number;
15964 interface TouchBarButtonConstructorOptions {
15970 * A short description of the button for use by screenreaders like VoiceOver.
15972 accessibilityLabel?: string;
15974 * Button background color in hex format, i.e `#ABCDEF`.
15976 backgroundColor?: string;
15980 icon?: (NativeImage) | (string);
15982 * Can be `left`, `right` or `overlay`. Defaults to `overlay`.
15984 iconPosition?: ('left' | 'right' | 'overlay');
15986 * Function to call when the button is clicked.
15988 click?: () => void;
15990 * Whether the button is in an enabled state. Default is `true`.
15995 interface TouchBarColorPickerConstructorOptions {
15997 * Array of hex color strings to appear as possible colors to select.
15999 availableColors?: string[];
16001 * The selected hex color in the picker, i.e `#ABCDEF`.
16003 selectedColor?: string;
16005 * Function to call when a color is selected.
16007 change?: (color: string) => void;
16010 interface TouchBarConstructorOptions {
16011 items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
16012 escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
16015 interface TouchBarGroupConstructorOptions {
16017 * Items to display as a group.
16022 interface TouchBarLabelConstructorOptions {
16028 * A short description of the button for use by screenreaders like VoiceOver.
16030 accessibilityLabel?: string;
16032 * Hex color of text, i.e `#ABCDEF`.
16034 textColor?: string;
16037 interface TouchBarPopoverConstructorOptions {
16039 * Popover button text.
16043 * Popover button icon.
16045 icon?: NativeImage;
16047 * Items to display in the popover.
16051 * `true` to display a close button on the left of the popover, `false` to not show
16052 * it. Default is `true`.
16054 showCloseButton?: boolean;
16057 interface TouchBarScrubberConstructorOptions {
16059 * An array of items to place in this scrubber.
16061 items: ScrubberItem[];
16063 * Called when the user taps an item that was not the last tapped item.
16065 select?: (selectedIndex: number) => void;
16067 * Called when the user taps any item.
16069 highlight?: (highlightedIndex: number) => void;
16071 * Selected item style. Can be `background`, `outline` or `none`. Defaults to
16074 selectedStyle?: ('background' | 'outline' | 'none');
16076 * Selected overlay item style. Can be `background`, `outline` or `none`. Defaults
16079 overlayStyle?: ('background' | 'outline' | 'none');
16081 * Whether to show arrow buttons. Defaults to `false` and is only shown if `items`
16084 showArrowButtons?: boolean;
16086 * Can be `fixed` or `free`. The default is `free`.
16088 mode?: ('fixed' | 'free');
16090 * Defaults to `true`.
16092 continuous?: boolean;
16095 interface TouchBarSegmentedControlConstructorOptions {
16097 * Style of the segments:
16099 segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
16101 * The selection mode of the control:
16103 mode?: ('single' | 'multiple' | 'buttons');
16105 * An array of segments to place in this control.
16107 segments: SegmentedControlSegment[];
16109 * The index of the currently selected segment, will update automatically with user
16110 * interaction. When the mode is `multiple` it will be the last selected item.
16112 selectedIndex?: number;
16114 * Called when the user selects a new segment.
16116 change?: (selectedIndex: number, isSelected: boolean) => void;
16119 interface TouchBarSliderConstructorOptions {
16137 * Function to call when the slider is changed.
16139 change?: (newValue: number) => void;
16142 interface TouchBarSpacerConstructorOptions {
16144 * Size of spacer, possible values are:
16146 size?: ('small' | 'large' | 'flexible');
16149 interface TraceBufferUsageReturnValue {
16151 percentage: number;
16154 interface UpdateTargetUrlEvent extends Event {
16158 interface UploadProgress {
16160 * Whether the request is currently active. If this is false no other properties
16165 * Whether the upload has started. If this is false both `current` and `total` will
16170 * The number of bytes that have been uploaded so far
16174 * The number of bytes that will be uploaded this request
16179 interface VisibleOnAllWorkspacesOptions {
16181 * Sets whether the window should be visible above fullscreen windows.
16185 visibleOnFullScreen?: boolean;
16187 * Calling setVisibleOnAllWorkspaces will by default transform the process type
16188 * between UIElementApplication and ForegroundApplication to ensure the correct
16189 * behavior. However, this will hide the window and dock for a short time every
16190 * time it is called. If your window is already of type UIElementApplication, you
16191 * can bypass this transformation by passing true to skipTransformProcessType.
16195 skipTransformProcessType?: boolean;
16198 interface WebContentsPrintOptions {
16200 * Don't ask user for print settings. Default is `false`.
16204 * Prints the background color and image of the web page. Default is `false`.
16206 printBackground?: boolean;
16208 * Set the printer device name to use. Must be the system-defined name and not the
16209 * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
16211 deviceName?: string;
16213 * Set whether the printed web page will be in color or grayscale. Default is
16219 * Whether the web page should be printed in landscape mode. Default is `false`.
16221 landscape?: boolean;
16223 * The scale factor of the web page.
16225 scaleFactor?: number;
16227 * The number of pages to print per page sheet.
16229 pagesPerSheet?: number;
16231 * Whether the web page should be collated.
16235 * The number of copies of the web page to print.
16239 * The page range to print. On macOS, only one range is honored.
16241 pageRanges?: PageRanges[];
16243 * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
16246 duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
16247 dpi?: Record<string, number>;
16249 * string to be printed as page header.
16253 * string to be printed as page footer.
16257 * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
16258 * `Letter`, `Tabloid` or an Object containing `height` and `width`.
16260 pageSize?: (string) | (Size);
16263 interface WebviewTagPrintOptions {
16265 * Don't ask user for print settings. Default is `false`.
16269 * Prints the background color and image of the web page. Default is `false`.
16271 printBackground?: boolean;
16273 * Set the printer device name to use. Must be the system-defined name and not the
16274 * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
16276 deviceName?: string;
16278 * Set whether the printed web page will be in color or grayscale. Default is
16284 * Whether the web page should be printed in landscape mode. Default is `false`.
16286 landscape?: boolean;
16288 * The scale factor of the web page.
16290 scaleFactor?: number;
16292 * The number of pages to print per page sheet.
16294 pagesPerSheet?: number;
16296 * Whether the web page should be collated.
16300 * The number of copies of the web page to print.
16304 * The page range to print.
16306 pageRanges?: PageRanges[];
16308 * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
16311 duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
16312 dpi?: Record<string, number>;
16314 * string to be printed as page header.
16318 * string to be printed as page footer.
16322 * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
16323 * `Letter`, `Tabloid` or an Object containing `height` in microns.
16325 pageSize?: (string) | (Size);
16328 interface WillNavigateEvent extends Event {
16332 interface WillResizeDetails {
16334 * The edge of the window being dragged for resizing. Can be `bottom`, `left`,
16335 * `right`, `top-left`, `top-right`, `bottom-left` or `bottom-right`.
16337 edge: ('bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right');
16340 interface EditFlags {
16342 * Whether the renderer believes it can undo.
16346 * Whether the renderer believes it can redo.
16350 * Whether the renderer believes it can cut.
16354 * Whether the renderer believes it can copy.
16358 * Whether the renderer believes it can paste.
16362 * Whether the renderer believes it can delete.
16364 canDelete: boolean;
16366 * Whether the renderer believes it can select all.
16368 canSelectAll: boolean;
16370 * Whether the renderer believes it can edit text richly.
16372 canEditRichly: boolean;
16378 interface FoundInPageResult {
16381 * Position of the active match.
16383 activeMatchOrdinal: number;
16385 * Number of Matches.
16389 * Coordinates of first match region.
16391 selectionArea: Rectangle;
16392 finalUpdate: boolean;
16395 interface LaunchItems {
16397 * name value of a registry entry.
16403 * The executable to an app that corresponds to a registry entry.
16409 * the command-line arguments to pass to the executable.
16415 * one of `user` or `machine`. Indicates whether the registry entry is under
16416 * `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
16422 * `true` if the app registry key is startup approved and therefore shows as
16423 * `enabled` in Task Manager and Windows settings.
16430 interface Margins {
16432 * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
16433 * you will also need to specify `top`, `bottom`, `left`, and `right`.
16435 marginType?: ('default' | 'none' | 'printableArea' | 'custom');
16437 * The top margin of the printed web page, in pixels.
16441 * The bottom margin of the printed web page, in pixels.
16445 * The left margin of the printed web page, in pixels.
16449 * The right margin of the printed web page, in pixels.
16454 interface MediaFlags {
16456 * Whether the media element has crashed.
16460 * Whether the media element is paused.
16464 * Whether the media element is muted.
16468 * Whether the media element has audio.
16472 * Whether the media element is looping.
16474 isLooping: boolean;
16476 * Whether the media element's controls are visible.
16478 isControlsVisible: boolean;
16480 * Whether the media element's controls are toggleable.
16482 canToggleControls: boolean;
16484 * Whether the media element can be printed.
16488 * Whether or not the media element can be downloaded.
16492 * Whether the media element can show picture-in-picture.
16494 canShowPictureInPicture: boolean;
16496 * Whether the media element is currently showing picture-in-picture.
16498 isShowingPictureInPicture: boolean;
16500 * Whether the media element can be rotated.
16502 canRotate: boolean;
16504 * Whether the media element can be looped.
16509 interface PageRanges {
16511 * Index of the first page to print (0-based).
16515 * Index of the last page to print (inclusive) (0-based).
16530 * URL of the link that encloses the node the context menu was invoked on.
16534 * Text associated with the link. May be an empty string if the contents of the
16535 * link are an image.
16539 * URL of the top level page that the context menu was invoked on.
16543 * URL of the subframe that the context menu was invoked on.
16547 * Source URL for the element that the context menu was invoked on. Elements with
16548 * source URLs are images, audio and video.
16552 * Type of the node the context menu was invoked on. Can be `none`, `image`,
16553 * `audio`, `video`, `canvas`, `file` or `plugin`.
16555 mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
16557 * Whether the context menu was invoked on an image which has non-empty contents.
16559 hasImageContents: boolean;
16561 * Whether the context is editable.
16563 isEditable: boolean;
16565 * Text of the selection that the context menu was invoked on.
16567 selectionText: string;
16569 * Title text of the selection that the context menu was invoked on.
16573 * Alt text of the selection that the context menu was invoked on.
16577 * Suggested filename to be used when saving file through 'Save Link As' option of
16580 suggestedFilename: string;
16582 * Rect representing the coordinates in the document space of the selection.
16584 selectionRect: Rectangle;
16586 * Start position of the selection text.
16588 selectionStartOffset: number;
16590 * The referrer policy of the frame on which the menu is invoked.
16592 referrerPolicy: Referrer;
16594 * The misspelled word under the cursor, if any.
16596 misspelledWord: string;
16598 * An array of suggested words to show the user to replace the `misspelledWord`.
16599 * Only available if there is a misspelled word and spellchecker is enabled.
16601 dictionarySuggestions: string[];
16603 * The character encoding of the frame on which the menu was invoked.
16605 frameCharset: string;
16607 * If the context menu was invoked on an input field, the type of that field.
16608 * Possible values are `none`, `plainText`, `password`, `other`.
16610 inputFieldType: string;
16612 * If the context is editable, whether or not spellchecking is enabled.
16614 spellcheckEnabled: boolean;
16616 * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
16617 * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
16618 * `adjustSelection`, or `adjustSelectionReset`.
16620 menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
16622 * The flags for the media element the context menu was invoked on.
16624 mediaFlags: MediaFlags;
16626 * These flags indicate whether the renderer believes it is able to perform the
16627 * corresponding action.
16629 editFlags: EditFlags;
16632 interface TitleBarOverlay {
16634 * The CSS color of the Window Controls Overlay when enabled. Default is the system
16641 * The CSS color of the symbols on the Window Controls Overlay when enabled.
16642 * Default is the system color.
16646 symbolColor?: string;
16648 * The height of the title bar and Window Controls Overlay in pixels. Default is
16651 * @platform darwin,win32
16658 * The id of the stream being granted. This will usually come from a
16659 * DesktopCapturerSource object.
16663 * The name of the stream being granted. This will usually come from a
16664 * DesktopCapturerSource object.
16669 interface WebPreferences {
16671 * Whether to enable DevTools. If it is set to `false`, can not use
16672 * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
16674 devTools?: boolean;
16676 * Whether node integration is enabled. Default is `false`.
16678 nodeIntegration?: boolean;
16680 * Whether node integration is enabled in web workers. Default is `false`. More
16681 * about this can be found in Multithreading.
16683 nodeIntegrationInWorker?: boolean;
16685 * Experimental option for enabling Node.js support in sub-frames such as iframes
16686 * and child windows. All your preloads will load for every iframe, you can use
16687 * `process.isMainFrame` to determine if you are in the main frame or not.
16689 nodeIntegrationInSubFrames?: boolean;
16691 * Specifies a script that will be loaded before other scripts run in the page.
16692 * This script will always have access to node APIs no matter whether node
16693 * integration is turned on or off. The value should be the absolute file path to
16694 * the script. When node integration is turned off, the preload script can
16695 * reintroduce Node global symbols back to the global scope. See example here.
16699 * If set, this will sandbox the renderer associated with the window, making it
16700 * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
16701 * This is not the same as the `nodeIntegration` option and the APIs available to
16702 * the preload script are more limited. Read more about the option here.
16706 * Sets the session used by the page. Instead of passing the Session object
16707 * directly, you can also choose to use the `partition` option instead, which
16708 * accepts a partition string. When both `session` and `partition` are provided,
16709 * `session` will be preferred. Default is the default session.
16713 * Sets the session used by the page according to the session's partition string.
16714 * If `partition` starts with `persist:`, the page will use a persistent session
16715 * available to all pages in the app with the same `partition`. If there is no
16716 * `persist:` prefix, the page will use an in-memory session. By assigning the same
16717 * `partition`, multiple pages can share the same session. Default is the default
16720 partition?: string;
16722 * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
16724 zoomFactor?: number;
16726 * Enables JavaScript support. Default is `true`.
16728 javascript?: boolean;
16730 * When `false`, it will disable the same-origin policy (usually using testing
16731 * websites by people), and set `allowRunningInsecureContent` to `true` if this
16732 * options has not been set by user. Default is `true`.
16734 webSecurity?: boolean;
16736 * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
16739 allowRunningInsecureContent?: boolean;
16741 * Enables image support. Default is `true`.
16745 * Specifies how to run image animations (E.g. GIFs). Can be `animate`,
16746 * `animateOnce` or `noAnimation`. Default is `animate`.
16748 imageAnimationPolicy?: ('animate' | 'animateOnce' | 'noAnimation');
16750 * Make TextArea elements resizable. Default is `true`.
16752 textAreasAreResizable?: boolean;
16754 * Enables WebGL support. Default is `true`.
16758 * Whether plugins should be enabled. Default is `false`.
16762 * Enables Chromium's experimental features. Default is `false`.
16764 experimentalFeatures?: boolean;
16766 * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
16770 scrollBounce?: boolean;
16772 * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
16773 * to enable. The full list of supported feature strings can be found in the
16774 * RuntimeEnabledFeatures.json5 file.
16776 enableBlinkFeatures?: string;
16778 * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
16779 * to disable. The full list of supported feature strings can be found in the
16780 * RuntimeEnabledFeatures.json5 file.
16782 disableBlinkFeatures?: string;
16784 * Sets the default font for the font-family.
16786 defaultFontFamily?: DefaultFontFamily;
16788 * Defaults to `16`.
16790 defaultFontSize?: number;
16792 * Defaults to `13`.
16794 defaultMonospaceFontSize?: number;
16798 minimumFontSize?: number;
16800 * Defaults to `ISO-8859-1`.
16802 defaultEncoding?: string;
16804 * Whether to throttle animations and timers when the page becomes background. This
16805 * also affects the Page Visibility API. Defaults to `true`.
16807 backgroundThrottling?: boolean;
16809 * Whether to enable offscreen rendering for the browser window. Defaults to
16810 * `false`. See the offscreen rendering tutorial for more details.
16812 offscreen?: boolean;
16814 * Whether to run Electron APIs and the specified `preload` script in a separate
16815 * JavaScript context. Defaults to `true`. The context that the `preload` script
16816 * runs in will only have access to its own dedicated `document` and `window`
16817 * globals, as well as its own set of JavaScript builtins (`Array`, `Object`,
16818 * `JSON`, etc.), which are all invisible to the loaded content. The Electron API
16819 * will only be available in the `preload` script and not the loaded page. This
16820 * option should be used when loading potentially untrusted remote content to
16821 * ensure the loaded content cannot tamper with the `preload` script and any
16822 * Electron APIs being used. This option uses the same technique used by Chrome
16823 * Content Scripts. You can access this context in the dev tools by selecting the
16824 * 'Electron Isolated Context' entry in the combo box at the top of the Console
16827 contextIsolation?: boolean;
16829 * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
16830 * `preload` script configured for the `<webview>` will have node integration
16831 * enabled when it is executed so you should ensure remote/untrusted content is not
16832 * able to create a `<webview>` tag with a possibly malicious `preload` script. You
16833 * can use the `will-attach-webview` event on webContents to strip away the
16834 * `preload` script and to validate or alter the `<webview>`'s initial settings.
16836 webviewTag?: boolean;
16838 * A list of strings that will be appended to `process.argv` in the renderer
16839 * process of this app. Useful for passing small bits of data down to renderer
16840 * process preload scripts.
16842 additionalArguments?: string[];
16844 * Whether to enable browser style consecutive dialog protection. Default is
16847 safeDialogs?: boolean;
16849 * The message to display when consecutive dialog protection is triggered. If not
16850 * defined the default message would be used, note that currently the default
16851 * message is in English and not localized.
16853 safeDialogsMessage?: string;
16855 * Whether to disable dialogs completely. Overrides `safeDialogs`. Default is
16858 disableDialogs?: boolean;
16860 * Whether dragging and dropping a file or link onto the page causes a navigation.
16861 * Default is `false`.
16863 navigateOnDragDrop?: boolean;
16865 * Autoplay policy to apply to content in the window, can be
16866 * `no-user-gesture-required`, `user-gesture-required`,
16867 * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
16869 autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
16871 * Whether to prevent the window from resizing when entering HTML Fullscreen.
16872 * Default is `false`.
16874 disableHtmlFullscreenWindowResize?: boolean;
16876 * An alternative title string provided only to accessibility tools such as screen
16877 * readers. This string is not directly visible to users.
16879 accessibleTitle?: string;
16881 * Whether to enable the builtin spellchecker. Default is `true`.
16883 spellcheck?: boolean;
16885 * Whether to enable the WebSQL api. Default is `true`.
16887 enableWebSQL?: boolean;
16889 * Enforces the v8 code caching policy used by blink. Accepted values are
16891 v8CacheOptions?: ('none' | 'code' | 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile');
16893 * Whether to enable preferred size mode. The preferred size is the minimum size
16894 * needed to contain the layout of the document—without requiring scrolling.
16895 * Enabling this will cause the `preferred-size-changed` event to be emitted on the
16896 * `WebContents` when the preferred size changes. Default is `false`.
16898 enablePreferredSizeMode?: boolean;
16901 interface DefaultFontFamily {
16903 * Defaults to `Times New Roman`.
16907 * Defaults to `Times New Roman`.
16911 * Defaults to `Arial`.
16913 sansSerif?: string;
16915 * Defaults to `Courier New`.
16917 monospace?: string;
16919 * Defaults to `Script`.
16923 * Defaults to `Impact`.
16928 interface RemoteMainInterface {
16930 autoUpdater: AutoUpdater;
16931 BrowserView: typeof BrowserView;
16932 BrowserWindow: typeof BrowserWindow;
16933 clipboard: Clipboard;
16934 contentTracing: ContentTracing;
16935 crashReporter: CrashReporter;
16936 desktopCapturer: DesktopCapturer;
16938 globalShortcut: GlobalShortcut;
16939 inAppPurchase: InAppPurchase;
16942 MenuItem: typeof MenuItem;
16943 MessageChannelMain: typeof MessageChannelMain;
16944 nativeImage: typeof NativeImage;
16945 nativeTheme: NativeTheme;
16948 Notification: typeof Notification;
16949 powerMonitor: PowerMonitor;
16950 powerSaveBlocker: PowerSaveBlocker;
16951 protocol: Protocol;
16952 pushNotifications: PushNotifications;
16953 safeStorage: SafeStorage;
16955 session: typeof Session;
16956 ShareMenu: typeof ShareMenu;
16958 systemPreferences: SystemPreferences;
16959 TouchBar: typeof TouchBar;
16961 utilityProcess: typeof UtilityProcess;
16962 webContents: typeof WebContents;
16963 webFrameMain: typeof WebFrameMain;
16969 const clipboard: Clipboard;
16970 type Clipboard = Electron.Clipboard;
16971 const crashReporter: CrashReporter;
16972 type CrashReporter = Electron.CrashReporter;
16973 const nativeImage: typeof NativeImage;
16974 type NativeImage = Electron.NativeImage;
16975 const shell: Shell;
16976 type Shell = Electron.Shell;
16977 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
16978 type AddRepresentationOptions = Electron.AddRepresentationOptions;
16979 type AnimationSettings = Electron.AnimationSettings;
16980 type AppDetailsOptions = Electron.AppDetailsOptions;
16981 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
16982 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
16983 type AuthInfo = Electron.AuthInfo;
16984 type AutoResizeOptions = Electron.AutoResizeOptions;
16985 type BeforeSendResponse = Electron.BeforeSendResponse;
16986 type BitmapOptions = Electron.BitmapOptions;
16987 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
16988 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
16989 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
16990 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
16991 type CallbackResponse = Electron.CallbackResponse;
16992 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
16993 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
16994 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
16995 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
16996 type Config = Electron.Config;
16997 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
16998 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
16999 type ContextMenuEvent = Electron.ContextMenuEvent;
17000 type ContextMenuParams = Electron.ContextMenuParams;
17001 type ContinueActivityDetails = Electron.ContinueActivityDetails;
17002 type CookiesGetFilter = Electron.CookiesGetFilter;
17003 type CookiesSetDetails = Electron.CookiesSetDetails;
17004 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
17005 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
17006 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
17007 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
17008 type Data = Electron.Data;
17009 type Details = Electron.Details;
17010 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
17011 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
17012 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
17013 type DidFailLoadEvent = Electron.DidFailLoadEvent;
17014 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
17015 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
17016 type DidNavigateEvent = Electron.DidNavigateEvent;
17017 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
17018 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
17019 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
17020 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
17021 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
17022 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
17023 type FeedURLOptions = Electron.FeedURLOptions;
17024 type FileIconOptions = Electron.FileIconOptions;
17025 type FindInPageOptions = Electron.FindInPageOptions;
17026 type FocusOptions = Electron.FocusOptions;
17027 type ForkOptions = Electron.ForkOptions;
17028 type FoundInPageEvent = Electron.FoundInPageEvent;
17029 type FrameCreatedDetails = Electron.FrameCreatedDetails;
17030 type FromPartitionOptions = Electron.FromPartitionOptions;
17031 type HandlerDetails = Electron.HandlerDetails;
17032 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
17033 type HeapStatistics = Electron.HeapStatistics;
17034 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
17035 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
17036 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
17037 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
17038 type ImportCertificateOptions = Electron.ImportCertificateOptions;
17039 type Info = Electron.Info;
17040 type Input = Electron.Input;
17041 type InsertCSSOptions = Electron.InsertCSSOptions;
17042 type IpcMessageEvent = Electron.IpcMessageEvent;
17043 type Item = Electron.Item;
17044 type JumpListSettings = Electron.JumpListSettings;
17045 type LoadCommitEvent = Electron.LoadCommitEvent;
17046 type LoadExtensionOptions = Electron.LoadExtensionOptions;
17047 type LoadFileOptions = Electron.LoadFileOptions;
17048 type LoadURLOptions = Electron.LoadURLOptions;
17049 type LoginItemSettings = Electron.LoginItemSettings;
17050 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
17051 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
17052 type MessageBoxOptions = Electron.MessageBoxOptions;
17053 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
17054 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
17055 type MessageDetails = Electron.MessageDetails;
17056 type MessageEvent = Electron.MessageEvent;
17057 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
17058 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
17059 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
17060 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
17061 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
17062 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
17063 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
17064 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
17065 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
17066 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
17067 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
17068 type OpenDialogOptions = Electron.OpenDialogOptions;
17069 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
17070 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
17071 type OpenExternalOptions = Electron.OpenExternalOptions;
17072 type Options = Electron.Options;
17073 type Opts = Electron.Opts;
17074 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
17075 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
17076 type Parameters = Electron.Parameters;
17077 type Payment = Electron.Payment;
17078 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
17079 type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
17080 type PluginCrashedEvent = Electron.PluginCrashedEvent;
17081 type PopupOptions = Electron.PopupOptions;
17082 type PreconnectOptions = Electron.PreconnectOptions;
17083 type PrintToPDFOptions = Electron.PrintToPDFOptions;
17084 type Privileges = Electron.Privileges;
17085 type ProgressBarOptions = Electron.ProgressBarOptions;
17086 type Provider = Electron.Provider;
17087 type ReadBookmark = Electron.ReadBookmark;
17088 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
17089 type RelaunchOptions = Electron.RelaunchOptions;
17090 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
17091 type Request = Electron.Request;
17092 type ResizeOptions = Electron.ResizeOptions;
17093 type ResourceUsage = Electron.ResourceUsage;
17094 type Response = Electron.Response;
17095 type Result = Electron.Result;
17096 type SaveDialogOptions = Electron.SaveDialogOptions;
17097 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
17098 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
17099 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
17100 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
17101 type Settings = Electron.Settings;
17102 type SourcesOptions = Electron.SourcesOptions;
17103 type SSLConfigConfig = Electron.SSLConfigConfig;
17104 type StartLoggingOptions = Electron.StartLoggingOptions;
17105 type Streams = Electron.Streams;
17106 type SystemMemoryInfo = Electron.SystemMemoryInfo;
17107 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
17108 type TitleOptions = Electron.TitleOptions;
17109 type ToBitmapOptions = Electron.ToBitmapOptions;
17110 type ToDataURLOptions = Electron.ToDataURLOptions;
17111 type ToPNGOptions = Electron.ToPNGOptions;
17112 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
17113 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
17114 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
17115 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
17116 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
17117 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
17118 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
17119 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
17120 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
17121 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
17122 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
17123 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
17124 type UploadProgress = Electron.UploadProgress;
17125 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
17126 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
17127 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
17128 type WillNavigateEvent = Electron.WillNavigateEvent;
17129 type WillResizeDetails = Electron.WillResizeDetails;
17130 type EditFlags = Electron.EditFlags;
17131 type Env = Electron.Env;
17132 type FoundInPageResult = Electron.FoundInPageResult;
17133 type LaunchItems = Electron.LaunchItems;
17134 type Margins = Electron.Margins;
17135 type MediaFlags = Electron.MediaFlags;
17136 type PageRanges = Electron.PageRanges;
17137 type Params = Electron.Params;
17138 type TitleBarOverlay = Electron.TitleBarOverlay;
17139 type Video = Electron.Video;
17140 type WebPreferences = Electron.WebPreferences;
17141 type DefaultFontFamily = Electron.DefaultFontFamily;
17142 type BluetoothDevice = Electron.BluetoothDevice;
17143 type Certificate = Electron.Certificate;
17144 type CertificatePrincipal = Electron.CertificatePrincipal;
17145 type Cookie = Electron.Cookie;
17146 type CPUUsage = Electron.CPUUsage;
17147 type CrashReport = Electron.CrashReport;
17148 type CustomScheme = Electron.CustomScheme;
17149 type DesktopCapturerSource = Electron.DesktopCapturerSource;
17150 type Display = Electron.Display;
17151 type Event = Electron.Event;
17152 type Extension = Electron.Extension;
17153 type ExtensionInfo = Electron.ExtensionInfo;
17154 type FileFilter = Electron.FileFilter;
17155 type FilePathWithHeaders = Electron.FilePathWithHeaders;
17156 type GPUFeatureStatus = Electron.GPUFeatureStatus;
17157 type HIDDevice = Electron.HIDDevice;
17158 type InputEvent = Electron.InputEvent;
17159 type IOCounters = Electron.IOCounters;
17160 type IpcMainEvent = Electron.IpcMainEvent;
17161 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
17162 type IpcRendererEvent = Electron.IpcRendererEvent;
17163 type JumpListCategory = Electron.JumpListCategory;
17164 type JumpListItem = Electron.JumpListItem;
17165 type KeyboardEvent = Electron.KeyboardEvent;
17166 type KeyboardInputEvent = Electron.KeyboardInputEvent;
17167 type MemoryInfo = Electron.MemoryInfo;
17168 type MemoryUsageDetails = Electron.MemoryUsageDetails;
17169 type MimeTypedBuffer = Electron.MimeTypedBuffer;
17170 type MouseInputEvent = Electron.MouseInputEvent;
17171 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
17172 type NotificationAction = Electron.NotificationAction;
17173 type NotificationResponse = Electron.NotificationResponse;
17174 type PaymentDiscount = Electron.PaymentDiscount;
17175 type Point = Electron.Point;
17176 type PostBody = Electron.PostBody;
17177 type PrinterInfo = Electron.PrinterInfo;
17178 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
17179 type ProcessMetric = Electron.ProcessMetric;
17180 type Product = Electron.Product;
17181 type ProductDiscount = Electron.ProductDiscount;
17182 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
17183 type ProtocolRequest = Electron.ProtocolRequest;
17184 type ProtocolResponse = Electron.ProtocolResponse;
17185 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
17186 type Rectangle = Electron.Rectangle;
17187 type Referrer = Electron.Referrer;
17188 type ScrubberItem = Electron.ScrubberItem;
17189 type SegmentedControlSegment = Electron.SegmentedControlSegment;
17190 type SerialPort = Electron.SerialPort;
17191 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
17192 type SharedWorkerInfo = Electron.SharedWorkerInfo;
17193 type SharingItem = Electron.SharingItem;
17194 type ShortcutDetails = Electron.ShortcutDetails;
17195 type Size = Electron.Size;
17196 type Task = Electron.Task;
17197 type ThumbarButton = Electron.ThumbarButton;
17198 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
17199 type TraceConfig = Electron.TraceConfig;
17200 type Transaction = Electron.Transaction;
17201 type UploadData = Electron.UploadData;
17202 type UploadFile = Electron.UploadFile;
17203 type UploadRawData = Electron.UploadRawData;
17204 type UserDefaultTypes = Electron.UserDefaultTypes;
17205 type WebRequestFilter = Electron.WebRequestFilter;
17206 type WebSource = Electron.WebSource;
17211 type App = Electron.App;
17212 const autoUpdater: AutoUpdater;
17213 type AutoUpdater = Electron.AutoUpdater;
17214 class BrowserView extends Electron.BrowserView {}
17215 class BrowserWindow extends Electron.BrowserWindow {}
17216 type ClientRequest = Electron.ClientRequest;
17217 type CommandLine = Electron.CommandLine;
17218 const contentTracing: ContentTracing;
17219 type ContentTracing = Electron.ContentTracing;
17220 type Cookies = Electron.Cookies;
17221 type Debugger = Electron.Debugger;
17222 const desktopCapturer: DesktopCapturer;
17223 type DesktopCapturer = Electron.DesktopCapturer;
17224 const dialog: Dialog;
17225 type Dialog = Electron.Dialog;
17226 type Dock = Electron.Dock;
17227 type DownloadItem = Electron.DownloadItem;
17228 const globalShortcut: GlobalShortcut;
17229 type GlobalShortcut = Electron.GlobalShortcut;
17230 const inAppPurchase: InAppPurchase;
17231 type InAppPurchase = Electron.InAppPurchase;
17232 type IncomingMessage = Electron.IncomingMessage;
17233 const ipcMain: IpcMain;
17234 type IpcMain = Electron.IpcMain;
17235 class Menu extends Electron.Menu {}
17236 class MenuItem extends Electron.MenuItem {}
17237 class MessageChannelMain extends Electron.MessageChannelMain {}
17238 type MessagePortMain = Electron.MessagePortMain;
17239 const nativeTheme: NativeTheme;
17240 type NativeTheme = Electron.NativeTheme;
17242 type Net = Electron.Net;
17243 const netLog: NetLog;
17244 type NetLog = Electron.NetLog;
17245 class Notification extends Electron.Notification {}
17246 const powerMonitor: PowerMonitor;
17247 type PowerMonitor = Electron.PowerMonitor;
17248 const powerSaveBlocker: PowerSaveBlocker;
17249 type PowerSaveBlocker = Electron.PowerSaveBlocker;
17250 const protocol: Protocol;
17251 type Protocol = Electron.Protocol;
17252 const pushNotifications: PushNotifications;
17253 type PushNotifications = Electron.PushNotifications;
17254 const safeStorage: SafeStorage;
17255 type SafeStorage = Electron.SafeStorage;
17256 const screen: Screen;
17257 type Screen = Electron.Screen;
17258 type ServiceWorkers = Electron.ServiceWorkers;
17259 const session: typeof Session;
17260 type Session = Electron.Session;
17261 class ShareMenu extends Electron.ShareMenu {}
17262 const systemPreferences: SystemPreferences;
17263 type SystemPreferences = Electron.SystemPreferences;
17264 class TouchBar extends Electron.TouchBar {}
17265 type TouchBarButton = Electron.TouchBarButton;
17266 type TouchBarColorPicker = Electron.TouchBarColorPicker;
17267 type TouchBarGroup = Electron.TouchBarGroup;
17268 type TouchBarLabel = Electron.TouchBarLabel;
17269 type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
17270 type TouchBarPopover = Electron.TouchBarPopover;
17271 type TouchBarScrubber = Electron.TouchBarScrubber;
17272 type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
17273 type TouchBarSlider = Electron.TouchBarSlider;
17274 type TouchBarSpacer = Electron.TouchBarSpacer;
17275 class Tray extends Electron.Tray {}
17276 const utilityProcess: typeof UtilityProcess;
17277 type UtilityProcess = Electron.UtilityProcess;
17278 const webContents: typeof WebContents;
17279 type WebContents = Electron.WebContents;
17280 const webFrameMain: typeof WebFrameMain;
17281 type WebFrameMain = Electron.WebFrameMain;
17282 type WebRequest = Electron.WebRequest;
17283 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
17284 type AddRepresentationOptions = Electron.AddRepresentationOptions;
17285 type AnimationSettings = Electron.AnimationSettings;
17286 type AppDetailsOptions = Electron.AppDetailsOptions;
17287 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
17288 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
17289 type AuthInfo = Electron.AuthInfo;
17290 type AutoResizeOptions = Electron.AutoResizeOptions;
17291 type BeforeSendResponse = Electron.BeforeSendResponse;
17292 type BitmapOptions = Electron.BitmapOptions;
17293 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
17294 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
17295 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
17296 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
17297 type CallbackResponse = Electron.CallbackResponse;
17298 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
17299 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
17300 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
17301 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
17302 type Config = Electron.Config;
17303 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
17304 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
17305 type ContextMenuEvent = Electron.ContextMenuEvent;
17306 type ContextMenuParams = Electron.ContextMenuParams;
17307 type ContinueActivityDetails = Electron.ContinueActivityDetails;
17308 type CookiesGetFilter = Electron.CookiesGetFilter;
17309 type CookiesSetDetails = Electron.CookiesSetDetails;
17310 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
17311 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
17312 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
17313 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
17314 type Data = Electron.Data;
17315 type Details = Electron.Details;
17316 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
17317 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
17318 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
17319 type DidFailLoadEvent = Electron.DidFailLoadEvent;
17320 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
17321 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
17322 type DidNavigateEvent = Electron.DidNavigateEvent;
17323 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
17324 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
17325 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
17326 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
17327 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
17328 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
17329 type FeedURLOptions = Electron.FeedURLOptions;
17330 type FileIconOptions = Electron.FileIconOptions;
17331 type FindInPageOptions = Electron.FindInPageOptions;
17332 type FocusOptions = Electron.FocusOptions;
17333 type ForkOptions = Electron.ForkOptions;
17334 type FoundInPageEvent = Electron.FoundInPageEvent;
17335 type FrameCreatedDetails = Electron.FrameCreatedDetails;
17336 type FromPartitionOptions = Electron.FromPartitionOptions;
17337 type HandlerDetails = Electron.HandlerDetails;
17338 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
17339 type HeapStatistics = Electron.HeapStatistics;
17340 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
17341 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
17342 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
17343 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
17344 type ImportCertificateOptions = Electron.ImportCertificateOptions;
17345 type Info = Electron.Info;
17346 type Input = Electron.Input;
17347 type InsertCSSOptions = Electron.InsertCSSOptions;
17348 type IpcMessageEvent = Electron.IpcMessageEvent;
17349 type Item = Electron.Item;
17350 type JumpListSettings = Electron.JumpListSettings;
17351 type LoadCommitEvent = Electron.LoadCommitEvent;
17352 type LoadExtensionOptions = Electron.LoadExtensionOptions;
17353 type LoadFileOptions = Electron.LoadFileOptions;
17354 type LoadURLOptions = Electron.LoadURLOptions;
17355 type LoginItemSettings = Electron.LoginItemSettings;
17356 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
17357 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
17358 type MessageBoxOptions = Electron.MessageBoxOptions;
17359 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
17360 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
17361 type MessageDetails = Electron.MessageDetails;
17362 type MessageEvent = Electron.MessageEvent;
17363 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
17364 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
17365 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
17366 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
17367 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
17368 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
17369 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
17370 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
17371 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
17372 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
17373 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
17374 type OpenDialogOptions = Electron.OpenDialogOptions;
17375 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
17376 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
17377 type OpenExternalOptions = Electron.OpenExternalOptions;
17378 type Options = Electron.Options;
17379 type Opts = Electron.Opts;
17380 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
17381 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
17382 type Parameters = Electron.Parameters;
17383 type Payment = Electron.Payment;
17384 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
17385 type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
17386 type PluginCrashedEvent = Electron.PluginCrashedEvent;
17387 type PopupOptions = Electron.PopupOptions;
17388 type PreconnectOptions = Electron.PreconnectOptions;
17389 type PrintToPDFOptions = Electron.PrintToPDFOptions;
17390 type Privileges = Electron.Privileges;
17391 type ProgressBarOptions = Electron.ProgressBarOptions;
17392 type Provider = Electron.Provider;
17393 type ReadBookmark = Electron.ReadBookmark;
17394 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
17395 type RelaunchOptions = Electron.RelaunchOptions;
17396 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
17397 type Request = Electron.Request;
17398 type ResizeOptions = Electron.ResizeOptions;
17399 type ResourceUsage = Electron.ResourceUsage;
17400 type Response = Electron.Response;
17401 type Result = Electron.Result;
17402 type SaveDialogOptions = Electron.SaveDialogOptions;
17403 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
17404 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
17405 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
17406 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
17407 type Settings = Electron.Settings;
17408 type SourcesOptions = Electron.SourcesOptions;
17409 type SSLConfigConfig = Electron.SSLConfigConfig;
17410 type StartLoggingOptions = Electron.StartLoggingOptions;
17411 type Streams = Electron.Streams;
17412 type SystemMemoryInfo = Electron.SystemMemoryInfo;
17413 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
17414 type TitleOptions = Electron.TitleOptions;
17415 type ToBitmapOptions = Electron.ToBitmapOptions;
17416 type ToDataURLOptions = Electron.ToDataURLOptions;
17417 type ToPNGOptions = Electron.ToPNGOptions;
17418 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
17419 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
17420 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
17421 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
17422 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
17423 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
17424 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
17425 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
17426 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
17427 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
17428 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
17429 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
17430 type UploadProgress = Electron.UploadProgress;
17431 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
17432 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
17433 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
17434 type WillNavigateEvent = Electron.WillNavigateEvent;
17435 type WillResizeDetails = Electron.WillResizeDetails;
17436 type EditFlags = Electron.EditFlags;
17437 type Env = Electron.Env;
17438 type FoundInPageResult = Electron.FoundInPageResult;
17439 type LaunchItems = Electron.LaunchItems;
17440 type Margins = Electron.Margins;
17441 type MediaFlags = Electron.MediaFlags;
17442 type PageRanges = Electron.PageRanges;
17443 type Params = Electron.Params;
17444 type TitleBarOverlay = Electron.TitleBarOverlay;
17445 type Video = Electron.Video;
17446 type WebPreferences = Electron.WebPreferences;
17447 type DefaultFontFamily = Electron.DefaultFontFamily;
17448 type BluetoothDevice = Electron.BluetoothDevice;
17449 type Certificate = Electron.Certificate;
17450 type CertificatePrincipal = Electron.CertificatePrincipal;
17451 type Cookie = Electron.Cookie;
17452 type CPUUsage = Electron.CPUUsage;
17453 type CrashReport = Electron.CrashReport;
17454 type CustomScheme = Electron.CustomScheme;
17455 type DesktopCapturerSource = Electron.DesktopCapturerSource;
17456 type Display = Electron.Display;
17457 type Event = Electron.Event;
17458 type Extension = Electron.Extension;
17459 type ExtensionInfo = Electron.ExtensionInfo;
17460 type FileFilter = Electron.FileFilter;
17461 type FilePathWithHeaders = Electron.FilePathWithHeaders;
17462 type GPUFeatureStatus = Electron.GPUFeatureStatus;
17463 type HIDDevice = Electron.HIDDevice;
17464 type InputEvent = Electron.InputEvent;
17465 type IOCounters = Electron.IOCounters;
17466 type IpcMainEvent = Electron.IpcMainEvent;
17467 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
17468 type IpcRendererEvent = Electron.IpcRendererEvent;
17469 type JumpListCategory = Electron.JumpListCategory;
17470 type JumpListItem = Electron.JumpListItem;
17471 type KeyboardEvent = Electron.KeyboardEvent;
17472 type KeyboardInputEvent = Electron.KeyboardInputEvent;
17473 type MemoryInfo = Electron.MemoryInfo;
17474 type MemoryUsageDetails = Electron.MemoryUsageDetails;
17475 type MimeTypedBuffer = Electron.MimeTypedBuffer;
17476 type MouseInputEvent = Electron.MouseInputEvent;
17477 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
17478 type NotificationAction = Electron.NotificationAction;
17479 type NotificationResponse = Electron.NotificationResponse;
17480 type PaymentDiscount = Electron.PaymentDiscount;
17481 type Point = Electron.Point;
17482 type PostBody = Electron.PostBody;
17483 type PrinterInfo = Electron.PrinterInfo;
17484 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
17485 type ProcessMetric = Electron.ProcessMetric;
17486 type Product = Electron.Product;
17487 type ProductDiscount = Electron.ProductDiscount;
17488 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
17489 type ProtocolRequest = Electron.ProtocolRequest;
17490 type ProtocolResponse = Electron.ProtocolResponse;
17491 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
17492 type Rectangle = Electron.Rectangle;
17493 type Referrer = Electron.Referrer;
17494 type ScrubberItem = Electron.ScrubberItem;
17495 type SegmentedControlSegment = Electron.SegmentedControlSegment;
17496 type SerialPort = Electron.SerialPort;
17497 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
17498 type SharedWorkerInfo = Electron.SharedWorkerInfo;
17499 type SharingItem = Electron.SharingItem;
17500 type ShortcutDetails = Electron.ShortcutDetails;
17501 type Size = Electron.Size;
17502 type Task = Electron.Task;
17503 type ThumbarButton = Electron.ThumbarButton;
17504 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
17505 type TraceConfig = Electron.TraceConfig;
17506 type Transaction = Electron.Transaction;
17507 type UploadData = Electron.UploadData;
17508 type UploadFile = Electron.UploadFile;
17509 type UploadRawData = Electron.UploadRawData;
17510 type UserDefaultTypes = Electron.UserDefaultTypes;
17511 type WebRequestFilter = Electron.WebRequestFilter;
17512 type WebSource = Electron.WebSource;
17515 namespace Renderer {
17516 const contextBridge: ContextBridge;
17517 type ContextBridge = Electron.ContextBridge;
17518 const ipcRenderer: IpcRenderer;
17519 type IpcRenderer = Electron.IpcRenderer;
17520 const webFrame: WebFrame;
17521 type WebFrame = Electron.WebFrame;
17522 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
17523 type AddRepresentationOptions = Electron.AddRepresentationOptions;
17524 type AnimationSettings = Electron.AnimationSettings;
17525 type AppDetailsOptions = Electron.AppDetailsOptions;
17526 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
17527 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
17528 type AuthInfo = Electron.AuthInfo;
17529 type AutoResizeOptions = Electron.AutoResizeOptions;
17530 type BeforeSendResponse = Electron.BeforeSendResponse;
17531 type BitmapOptions = Electron.BitmapOptions;
17532 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
17533 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
17534 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
17535 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
17536 type CallbackResponse = Electron.CallbackResponse;
17537 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
17538 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
17539 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
17540 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
17541 type Config = Electron.Config;
17542 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
17543 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
17544 type ContextMenuEvent = Electron.ContextMenuEvent;
17545 type ContextMenuParams = Electron.ContextMenuParams;
17546 type ContinueActivityDetails = Electron.ContinueActivityDetails;
17547 type CookiesGetFilter = Electron.CookiesGetFilter;
17548 type CookiesSetDetails = Electron.CookiesSetDetails;
17549 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
17550 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
17551 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
17552 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
17553 type Data = Electron.Data;
17554 type Details = Electron.Details;
17555 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
17556 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
17557 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
17558 type DidFailLoadEvent = Electron.DidFailLoadEvent;
17559 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
17560 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
17561 type DidNavigateEvent = Electron.DidNavigateEvent;
17562 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
17563 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
17564 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
17565 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
17566 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
17567 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
17568 type FeedURLOptions = Electron.FeedURLOptions;
17569 type FileIconOptions = Electron.FileIconOptions;
17570 type FindInPageOptions = Electron.FindInPageOptions;
17571 type FocusOptions = Electron.FocusOptions;
17572 type ForkOptions = Electron.ForkOptions;
17573 type FoundInPageEvent = Electron.FoundInPageEvent;
17574 type FrameCreatedDetails = Electron.FrameCreatedDetails;
17575 type FromPartitionOptions = Electron.FromPartitionOptions;
17576 type HandlerDetails = Electron.HandlerDetails;
17577 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
17578 type HeapStatistics = Electron.HeapStatistics;
17579 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
17580 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
17581 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
17582 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
17583 type ImportCertificateOptions = Electron.ImportCertificateOptions;
17584 type Info = Electron.Info;
17585 type Input = Electron.Input;
17586 type InsertCSSOptions = Electron.InsertCSSOptions;
17587 type IpcMessageEvent = Electron.IpcMessageEvent;
17588 type Item = Electron.Item;
17589 type JumpListSettings = Electron.JumpListSettings;
17590 type LoadCommitEvent = Electron.LoadCommitEvent;
17591 type LoadExtensionOptions = Electron.LoadExtensionOptions;
17592 type LoadFileOptions = Electron.LoadFileOptions;
17593 type LoadURLOptions = Electron.LoadURLOptions;
17594 type LoginItemSettings = Electron.LoginItemSettings;
17595 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
17596 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
17597 type MessageBoxOptions = Electron.MessageBoxOptions;
17598 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
17599 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
17600 type MessageDetails = Electron.MessageDetails;
17601 type MessageEvent = Electron.MessageEvent;
17602 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
17603 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
17604 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
17605 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
17606 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
17607 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
17608 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
17609 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
17610 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
17611 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
17612 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
17613 type OpenDialogOptions = Electron.OpenDialogOptions;
17614 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
17615 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
17616 type OpenExternalOptions = Electron.OpenExternalOptions;
17617 type Options = Electron.Options;
17618 type Opts = Electron.Opts;
17619 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
17620 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
17621 type Parameters = Electron.Parameters;
17622 type Payment = Electron.Payment;
17623 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
17624 type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
17625 type PluginCrashedEvent = Electron.PluginCrashedEvent;
17626 type PopupOptions = Electron.PopupOptions;
17627 type PreconnectOptions = Electron.PreconnectOptions;
17628 type PrintToPDFOptions = Electron.PrintToPDFOptions;
17629 type Privileges = Electron.Privileges;
17630 type ProgressBarOptions = Electron.ProgressBarOptions;
17631 type Provider = Electron.Provider;
17632 type ReadBookmark = Electron.ReadBookmark;
17633 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
17634 type RelaunchOptions = Electron.RelaunchOptions;
17635 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
17636 type Request = Electron.Request;
17637 type ResizeOptions = Electron.ResizeOptions;
17638 type ResourceUsage = Electron.ResourceUsage;
17639 type Response = Electron.Response;
17640 type Result = Electron.Result;
17641 type SaveDialogOptions = Electron.SaveDialogOptions;
17642 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
17643 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
17644 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
17645 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
17646 type Settings = Electron.Settings;
17647 type SourcesOptions = Electron.SourcesOptions;
17648 type SSLConfigConfig = Electron.SSLConfigConfig;
17649 type StartLoggingOptions = Electron.StartLoggingOptions;
17650 type Streams = Electron.Streams;
17651 type SystemMemoryInfo = Electron.SystemMemoryInfo;
17652 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
17653 type TitleOptions = Electron.TitleOptions;
17654 type ToBitmapOptions = Electron.ToBitmapOptions;
17655 type ToDataURLOptions = Electron.ToDataURLOptions;
17656 type ToPNGOptions = Electron.ToPNGOptions;
17657 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
17658 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
17659 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
17660 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
17661 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
17662 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
17663 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
17664 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
17665 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
17666 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
17667 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
17668 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
17669 type UploadProgress = Electron.UploadProgress;
17670 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
17671 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
17672 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
17673 type WillNavigateEvent = Electron.WillNavigateEvent;
17674 type WillResizeDetails = Electron.WillResizeDetails;
17675 type EditFlags = Electron.EditFlags;
17676 type Env = Electron.Env;
17677 type FoundInPageResult = Electron.FoundInPageResult;
17678 type LaunchItems = Electron.LaunchItems;
17679 type Margins = Electron.Margins;
17680 type MediaFlags = Electron.MediaFlags;
17681 type PageRanges = Electron.PageRanges;
17682 type Params = Electron.Params;
17683 type TitleBarOverlay = Electron.TitleBarOverlay;
17684 type Video = Electron.Video;
17685 type WebPreferences = Electron.WebPreferences;
17686 type DefaultFontFamily = Electron.DefaultFontFamily;
17687 type BluetoothDevice = Electron.BluetoothDevice;
17688 type Certificate = Electron.Certificate;
17689 type CertificatePrincipal = Electron.CertificatePrincipal;
17690 type Cookie = Electron.Cookie;
17691 type CPUUsage = Electron.CPUUsage;
17692 type CrashReport = Electron.CrashReport;
17693 type CustomScheme = Electron.CustomScheme;
17694 type DesktopCapturerSource = Electron.DesktopCapturerSource;
17695 type Display = Electron.Display;
17696 type Event = Electron.Event;
17697 type Extension = Electron.Extension;
17698 type ExtensionInfo = Electron.ExtensionInfo;
17699 type FileFilter = Electron.FileFilter;
17700 type FilePathWithHeaders = Electron.FilePathWithHeaders;
17701 type GPUFeatureStatus = Electron.GPUFeatureStatus;
17702 type HIDDevice = Electron.HIDDevice;
17703 type InputEvent = Electron.InputEvent;
17704 type IOCounters = Electron.IOCounters;
17705 type IpcMainEvent = Electron.IpcMainEvent;
17706 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
17707 type IpcRendererEvent = Electron.IpcRendererEvent;
17708 type JumpListCategory = Electron.JumpListCategory;
17709 type JumpListItem = Electron.JumpListItem;
17710 type KeyboardEvent = Electron.KeyboardEvent;
17711 type KeyboardInputEvent = Electron.KeyboardInputEvent;
17712 type MemoryInfo = Electron.MemoryInfo;
17713 type MemoryUsageDetails = Electron.MemoryUsageDetails;
17714 type MimeTypedBuffer = Electron.MimeTypedBuffer;
17715 type MouseInputEvent = Electron.MouseInputEvent;
17716 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
17717 type NotificationAction = Electron.NotificationAction;
17718 type NotificationResponse = Electron.NotificationResponse;
17719 type PaymentDiscount = Electron.PaymentDiscount;
17720 type Point = Electron.Point;
17721 type PostBody = Electron.PostBody;
17722 type PrinterInfo = Electron.PrinterInfo;
17723 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
17724 type ProcessMetric = Electron.ProcessMetric;
17725 type Product = Electron.Product;
17726 type ProductDiscount = Electron.ProductDiscount;
17727 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
17728 type ProtocolRequest = Electron.ProtocolRequest;
17729 type ProtocolResponse = Electron.ProtocolResponse;
17730 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
17731 type Rectangle = Electron.Rectangle;
17732 type Referrer = Electron.Referrer;
17733 type ScrubberItem = Electron.ScrubberItem;
17734 type SegmentedControlSegment = Electron.SegmentedControlSegment;
17735 type SerialPort = Electron.SerialPort;
17736 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
17737 type SharedWorkerInfo = Electron.SharedWorkerInfo;
17738 type SharingItem = Electron.SharingItem;
17739 type ShortcutDetails = Electron.ShortcutDetails;
17740 type Size = Electron.Size;
17741 type Task = Electron.Task;
17742 type ThumbarButton = Electron.ThumbarButton;
17743 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
17744 type TraceConfig = Electron.TraceConfig;
17745 type Transaction = Electron.Transaction;
17746 type UploadData = Electron.UploadData;
17747 type UploadFile = Electron.UploadFile;
17748 type UploadRawData = Electron.UploadRawData;
17749 type UserDefaultTypes = Electron.UserDefaultTypes;
17750 type WebRequestFilter = Electron.WebRequestFilter;
17751 type WebSource = Electron.WebSource;
17754 namespace CrossProcessExports {
17756 type App = Electron.App;
17757 const autoUpdater: AutoUpdater;
17758 type AutoUpdater = Electron.AutoUpdater;
17759 class BrowserView extends Electron.BrowserView {}
17760 class BrowserWindow extends Electron.BrowserWindow {}
17761 type ClientRequest = Electron.ClientRequest;
17762 const clipboard: Clipboard;
17763 type Clipboard = Electron.Clipboard;
17764 type CommandLine = Electron.CommandLine;
17765 const contentTracing: ContentTracing;
17766 type ContentTracing = Electron.ContentTracing;
17767 const contextBridge: ContextBridge;
17768 type ContextBridge = Electron.ContextBridge;
17769 type Cookies = Electron.Cookies;
17770 const crashReporter: CrashReporter;
17771 type CrashReporter = Electron.CrashReporter;
17772 type Debugger = Electron.Debugger;
17773 const desktopCapturer: DesktopCapturer;
17774 type DesktopCapturer = Electron.DesktopCapturer;
17775 const dialog: Dialog;
17776 type Dialog = Electron.Dialog;
17777 type Dock = Electron.Dock;
17778 type DownloadItem = Electron.DownloadItem;
17779 const globalShortcut: GlobalShortcut;
17780 type GlobalShortcut = Electron.GlobalShortcut;
17781 const inAppPurchase: InAppPurchase;
17782 type InAppPurchase = Electron.InAppPurchase;
17783 type IncomingMessage = Electron.IncomingMessage;
17784 const ipcMain: IpcMain;
17785 type IpcMain = Electron.IpcMain;
17786 const ipcRenderer: IpcRenderer;
17787 type IpcRenderer = Electron.IpcRenderer;
17788 class Menu extends Electron.Menu {}
17789 class MenuItem extends Electron.MenuItem {}
17790 class MessageChannelMain extends Electron.MessageChannelMain {}
17791 type MessagePortMain = Electron.MessagePortMain;
17792 const nativeImage: typeof NativeImage;
17793 type NativeImage = Electron.NativeImage;
17794 const nativeTheme: NativeTheme;
17795 type NativeTheme = Electron.NativeTheme;
17797 type Net = Electron.Net;
17798 const netLog: NetLog;
17799 type NetLog = Electron.NetLog;
17800 class Notification extends Electron.Notification {}
17801 const powerMonitor: PowerMonitor;
17802 type PowerMonitor = Electron.PowerMonitor;
17803 const powerSaveBlocker: PowerSaveBlocker;
17804 type PowerSaveBlocker = Electron.PowerSaveBlocker;
17805 const protocol: Protocol;
17806 type Protocol = Electron.Protocol;
17807 const pushNotifications: PushNotifications;
17808 type PushNotifications = Electron.PushNotifications;
17809 const safeStorage: SafeStorage;
17810 type SafeStorage = Electron.SafeStorage;
17811 const screen: Screen;
17812 type Screen = Electron.Screen;
17813 type ServiceWorkers = Electron.ServiceWorkers;
17814 const session: typeof Session;
17815 type Session = Electron.Session;
17816 class ShareMenu extends Electron.ShareMenu {}
17817 const shell: Shell;
17818 type Shell = Electron.Shell;
17819 const systemPreferences: SystemPreferences;
17820 type SystemPreferences = Electron.SystemPreferences;
17821 class TouchBar extends Electron.TouchBar {}
17822 type TouchBarButton = Electron.TouchBarButton;
17823 type TouchBarColorPicker = Electron.TouchBarColorPicker;
17824 type TouchBarGroup = Electron.TouchBarGroup;
17825 type TouchBarLabel = Electron.TouchBarLabel;
17826 type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
17827 type TouchBarPopover = Electron.TouchBarPopover;
17828 type TouchBarScrubber = Electron.TouchBarScrubber;
17829 type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
17830 type TouchBarSlider = Electron.TouchBarSlider;
17831 type TouchBarSpacer = Electron.TouchBarSpacer;
17832 class Tray extends Electron.Tray {}
17833 const utilityProcess: typeof UtilityProcess;
17834 type UtilityProcess = Electron.UtilityProcess;
17835 const webContents: typeof WebContents;
17836 type WebContents = Electron.WebContents;
17837 const webFrame: WebFrame;
17838 type WebFrame = Electron.WebFrame;
17839 const webFrameMain: typeof WebFrameMain;
17840 type WebFrameMain = Electron.WebFrameMain;
17841 type WebRequest = Electron.WebRequest;
17842 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
17843 type AddRepresentationOptions = Electron.AddRepresentationOptions;
17844 type AnimationSettings = Electron.AnimationSettings;
17845 type AppDetailsOptions = Electron.AppDetailsOptions;
17846 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
17847 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
17848 type AuthInfo = Electron.AuthInfo;
17849 type AutoResizeOptions = Electron.AutoResizeOptions;
17850 type BeforeSendResponse = Electron.BeforeSendResponse;
17851 type BitmapOptions = Electron.BitmapOptions;
17852 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
17853 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
17854 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
17855 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
17856 type CallbackResponse = Electron.CallbackResponse;
17857 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
17858 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
17859 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
17860 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
17861 type Config = Electron.Config;
17862 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
17863 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
17864 type ContextMenuEvent = Electron.ContextMenuEvent;
17865 type ContextMenuParams = Electron.ContextMenuParams;
17866 type ContinueActivityDetails = Electron.ContinueActivityDetails;
17867 type CookiesGetFilter = Electron.CookiesGetFilter;
17868 type CookiesSetDetails = Electron.CookiesSetDetails;
17869 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
17870 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
17871 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
17872 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
17873 type Data = Electron.Data;
17874 type Details = Electron.Details;
17875 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
17876 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
17877 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
17878 type DidFailLoadEvent = Electron.DidFailLoadEvent;
17879 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
17880 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
17881 type DidNavigateEvent = Electron.DidNavigateEvent;
17882 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
17883 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
17884 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
17885 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
17886 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
17887 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
17888 type FeedURLOptions = Electron.FeedURLOptions;
17889 type FileIconOptions = Electron.FileIconOptions;
17890 type FindInPageOptions = Electron.FindInPageOptions;
17891 type FocusOptions = Electron.FocusOptions;
17892 type ForkOptions = Electron.ForkOptions;
17893 type FoundInPageEvent = Electron.FoundInPageEvent;
17894 type FrameCreatedDetails = Electron.FrameCreatedDetails;
17895 type FromPartitionOptions = Electron.FromPartitionOptions;
17896 type HandlerDetails = Electron.HandlerDetails;
17897 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
17898 type HeapStatistics = Electron.HeapStatistics;
17899 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
17900 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
17901 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
17902 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
17903 type ImportCertificateOptions = Electron.ImportCertificateOptions;
17904 type Info = Electron.Info;
17905 type Input = Electron.Input;
17906 type InsertCSSOptions = Electron.InsertCSSOptions;
17907 type IpcMessageEvent = Electron.IpcMessageEvent;
17908 type Item = Electron.Item;
17909 type JumpListSettings = Electron.JumpListSettings;
17910 type LoadCommitEvent = Electron.LoadCommitEvent;
17911 type LoadExtensionOptions = Electron.LoadExtensionOptions;
17912 type LoadFileOptions = Electron.LoadFileOptions;
17913 type LoadURLOptions = Electron.LoadURLOptions;
17914 type LoginItemSettings = Electron.LoginItemSettings;
17915 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
17916 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
17917 type MessageBoxOptions = Electron.MessageBoxOptions;
17918 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
17919 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
17920 type MessageDetails = Electron.MessageDetails;
17921 type MessageEvent = Electron.MessageEvent;
17922 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
17923 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
17924 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
17925 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
17926 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
17927 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
17928 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
17929 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
17930 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
17931 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
17932 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
17933 type OpenDialogOptions = Electron.OpenDialogOptions;
17934 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
17935 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
17936 type OpenExternalOptions = Electron.OpenExternalOptions;
17937 type Options = Electron.Options;
17938 type Opts = Electron.Opts;
17939 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
17940 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
17941 type Parameters = Electron.Parameters;
17942 type Payment = Electron.Payment;
17943 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
17944 type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
17945 type PluginCrashedEvent = Electron.PluginCrashedEvent;
17946 type PopupOptions = Electron.PopupOptions;
17947 type PreconnectOptions = Electron.PreconnectOptions;
17948 type PrintToPDFOptions = Electron.PrintToPDFOptions;
17949 type Privileges = Electron.Privileges;
17950 type ProgressBarOptions = Electron.ProgressBarOptions;
17951 type Provider = Electron.Provider;
17952 type ReadBookmark = Electron.ReadBookmark;
17953 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
17954 type RelaunchOptions = Electron.RelaunchOptions;
17955 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
17956 type Request = Electron.Request;
17957 type ResizeOptions = Electron.ResizeOptions;
17958 type ResourceUsage = Electron.ResourceUsage;
17959 type Response = Electron.Response;
17960 type Result = Electron.Result;
17961 type SaveDialogOptions = Electron.SaveDialogOptions;
17962 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
17963 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
17964 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
17965 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
17966 type Settings = Electron.Settings;
17967 type SourcesOptions = Electron.SourcesOptions;
17968 type SSLConfigConfig = Electron.SSLConfigConfig;
17969 type StartLoggingOptions = Electron.StartLoggingOptions;
17970 type Streams = Electron.Streams;
17971 type SystemMemoryInfo = Electron.SystemMemoryInfo;
17972 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
17973 type TitleOptions = Electron.TitleOptions;
17974 type ToBitmapOptions = Electron.ToBitmapOptions;
17975 type ToDataURLOptions = Electron.ToDataURLOptions;
17976 type ToPNGOptions = Electron.ToPNGOptions;
17977 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
17978 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
17979 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
17980 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
17981 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
17982 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
17983 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
17984 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
17985 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
17986 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
17987 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
17988 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
17989 type UploadProgress = Electron.UploadProgress;
17990 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
17991 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
17992 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
17993 type WillNavigateEvent = Electron.WillNavigateEvent;
17994 type WillResizeDetails = Electron.WillResizeDetails;
17995 type EditFlags = Electron.EditFlags;
17996 type Env = Electron.Env;
17997 type FoundInPageResult = Electron.FoundInPageResult;
17998 type LaunchItems = Electron.LaunchItems;
17999 type Margins = Electron.Margins;
18000 type MediaFlags = Electron.MediaFlags;
18001 type PageRanges = Electron.PageRanges;
18002 type Params = Electron.Params;
18003 type TitleBarOverlay = Electron.TitleBarOverlay;
18004 type Video = Electron.Video;
18005 type WebPreferences = Electron.WebPreferences;
18006 type DefaultFontFamily = Electron.DefaultFontFamily;
18007 type BluetoothDevice = Electron.BluetoothDevice;
18008 type Certificate = Electron.Certificate;
18009 type CertificatePrincipal = Electron.CertificatePrincipal;
18010 type Cookie = Electron.Cookie;
18011 type CPUUsage = Electron.CPUUsage;
18012 type CrashReport = Electron.CrashReport;
18013 type CustomScheme = Electron.CustomScheme;
18014 type DesktopCapturerSource = Electron.DesktopCapturerSource;
18015 type Display = Electron.Display;
18016 type Event = Electron.Event;
18017 type Extension = Electron.Extension;
18018 type ExtensionInfo = Electron.ExtensionInfo;
18019 type FileFilter = Electron.FileFilter;
18020 type FilePathWithHeaders = Electron.FilePathWithHeaders;
18021 type GPUFeatureStatus = Electron.GPUFeatureStatus;
18022 type HIDDevice = Electron.HIDDevice;
18023 type InputEvent = Electron.InputEvent;
18024 type IOCounters = Electron.IOCounters;
18025 type IpcMainEvent = Electron.IpcMainEvent;
18026 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
18027 type IpcRendererEvent = Electron.IpcRendererEvent;
18028 type JumpListCategory = Electron.JumpListCategory;
18029 type JumpListItem = Electron.JumpListItem;
18030 type KeyboardEvent = Electron.KeyboardEvent;
18031 type KeyboardInputEvent = Electron.KeyboardInputEvent;
18032 type MemoryInfo = Electron.MemoryInfo;
18033 type MemoryUsageDetails = Electron.MemoryUsageDetails;
18034 type MimeTypedBuffer = Electron.MimeTypedBuffer;
18035 type MouseInputEvent = Electron.MouseInputEvent;
18036 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
18037 type NotificationAction = Electron.NotificationAction;
18038 type NotificationResponse = Electron.NotificationResponse;
18039 type PaymentDiscount = Electron.PaymentDiscount;
18040 type Point = Electron.Point;
18041 type PostBody = Electron.PostBody;
18042 type PrinterInfo = Electron.PrinterInfo;
18043 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
18044 type ProcessMetric = Electron.ProcessMetric;
18045 type Product = Electron.Product;
18046 type ProductDiscount = Electron.ProductDiscount;
18047 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
18048 type ProtocolRequest = Electron.ProtocolRequest;
18049 type ProtocolResponse = Electron.ProtocolResponse;
18050 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
18051 type Rectangle = Electron.Rectangle;
18052 type Referrer = Electron.Referrer;
18053 type ScrubberItem = Electron.ScrubberItem;
18054 type SegmentedControlSegment = Electron.SegmentedControlSegment;
18055 type SerialPort = Electron.SerialPort;
18056 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
18057 type SharedWorkerInfo = Electron.SharedWorkerInfo;
18058 type SharingItem = Electron.SharingItem;
18059 type ShortcutDetails = Electron.ShortcutDetails;
18060 type Size = Electron.Size;
18061 type Task = Electron.Task;
18062 type ThumbarButton = Electron.ThumbarButton;
18063 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
18064 type TraceConfig = Electron.TraceConfig;
18065 type Transaction = Electron.Transaction;
18066 type UploadData = Electron.UploadData;
18067 type UploadFile = Electron.UploadFile;
18068 type UploadRawData = Electron.UploadRawData;
18069 type UserDefaultTypes = Electron.UserDefaultTypes;
18070 type WebRequestFilter = Electron.WebRequestFilter;
18071 type WebSource = Electron.WebSource;
18075 const autoUpdater: AutoUpdater;
18076 const clipboard: Clipboard;
18077 const contentTracing: ContentTracing;
18078 const contextBridge: ContextBridge;
18079 const crashReporter: CrashReporter;
18080 const desktopCapturer: DesktopCapturer;
18081 const dialog: Dialog;
18082 const globalShortcut: GlobalShortcut;
18083 const inAppPurchase: InAppPurchase;
18084 const ipcMain: IpcMain;
18085 const ipcRenderer: IpcRenderer;
18086 const nativeImage: typeof NativeImage;
18087 const nativeTheme: NativeTheme;
18089 const netLog: NetLog;
18090 const parentPort: ParentPort;
18091 const powerMonitor: PowerMonitor;
18092 const powerSaveBlocker: PowerSaveBlocker;
18093 const protocol: Protocol;
18094 const pushNotifications: PushNotifications;
18095 const safeStorage: SafeStorage;
18096 const screen: Screen;
18097 const session: typeof Session;
18098 const shell: Shell;
18099 const systemPreferences: SystemPreferences;
18100 const utilityProcess: typeof UtilityProcess;
18101 const webContents: typeof WebContents;
18102 const webFrame: WebFrame;
18103 const webFrameMain: typeof WebFrameMain;
18107 declare module 'electron' {
18108 export = Electron.CrossProcessExports;
18111 declare module 'electron/main' {
18112 export = Electron.Main
18115 declare module 'electron/common' {
18116 export = Electron.Common
18119 declare module 'electron/renderer' {
18120 export = Electron.Renderer
18123 interface NodeRequireFunction {
18124 (moduleName: 'electron'): typeof Electron.CrossProcessExports;
18125 (moduleName: 'electron/main'): typeof Electron.Main;
18126 (moduleName: 'electron/common'): typeof Electron.Common;
18127 (moduleName: 'electron/renderer'): typeof Electron.Renderer;
18130 interface NodeRequire {
18131 (moduleName: 'electron'): typeof Electron.CrossProcessExports;
18132 (moduleName: 'electron/main'): typeof Electron.Main;
18133 (moduleName: 'electron/common'): typeof Electron.Common;
18134 (moduleName: 'electron/renderer'): typeof Electron.Renderer;
18139 * The real path to the file on the users filesystem
18144 declare module 'original-fs' {
18145 import * as fs from 'fs';
18149 interface Document {
18150 createElement(tagName: 'webview'): Electron.WebviewTag;
18153 declare namespace NodeJS {
18154 interface Process extends NodeJS.EventEmitter {
18156 // Docs: https://electronjs.org/docs/api/process
18159 * Emitted when Electron has loaded its internal initialization script and is
18160 * beginning to load the web page or the main script.
18162 on(event: 'loaded', listener: Function): this;
18163 once(event: 'loaded', listener: Function): this;
18164 addListener(event: 'loaded', listener: Function): this;
18165 removeListener(event: 'loaded', listener: Function): this;
18167 * Causes the main thread of the current process crash.
18171 * * `allocated` Integer - Size of all allocated objects in Kilobytes.
18172 * * `total` Integer - Total allocated space in Kilobytes.
18174 * Returns an object with Blink memory information. It can be useful for debugging
18175 * rendering / DOM related memory issues. Note that all values are reported in
18178 getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
18179 getCPUUsage(): Electron.CPUUsage;
18181 * The number of milliseconds since epoch, or `null` if the information is
18184 * Indicates the creation time of the application. The time is represented as
18185 * number of milliseconds since epoch. It returns null if it is unable to get the
18186 * process creation time.
18188 getCreationTime(): (number) | (null);
18190 * * `totalHeapSize` Integer
18191 * * `totalHeapSizeExecutable` Integer
18192 * * `totalPhysicalSize` Integer
18193 * * `totalAvailableSize` Integer
18194 * * `usedHeapSize` Integer
18195 * * `heapSizeLimit` Integer
18196 * * `mallocedMemory` Integer
18197 * * `peakMallocedMemory` Integer
18198 * * `doesZapGarbage` boolean
18200 * Returns an object with V8 heap statistics. Note that all statistics are reported
18203 getHeapStatistics(): Electron.HeapStatistics;
18204 getIOCounters(): Electron.IOCounters;
18206 * Resolves with a ProcessMemoryInfo
18208 * Returns an object giving memory usage statistics about the current process. Note
18209 * that all statistics are reported in Kilobytes. This api should be called after
18212 * Chromium does not provide `residentSet` value for macOS. This is because macOS
18213 * performs in-memory compression of pages that haven't been recently used. As a
18214 * result the resident set size value is not what one would expect. `private`
18215 * memory is more representative of the actual pre-compression memory usage of the
18216 * process on macOS.
18218 getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
18220 * * `total` Integer - The total amount of physical memory in Kilobytes available
18222 * * `free` Integer - The total amount of memory not being used by applications or
18224 * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
18225 * Kilobytes available to the system.
18226 * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
18227 * Kilobytes available to the system.
18229 * Returns an object giving memory usage statistics about the entire system. Note
18230 * that all statistics are reported in Kilobytes.
18232 getSystemMemoryInfo(): Electron.SystemMemoryInfo;
18234 * The version of the host operating system.
18238 * **Note:** It returns the actual operating system version instead of kernel
18239 * version on macOS unlike `os.release()`.
18241 getSystemVersion(): string;
18243 * Causes the main thread of the current process hang.
18247 * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
18248 * whichever is lower for the current process.
18250 * @platform darwin,linux
18252 setFdLimit(maxDescriptors: number): void;
18254 * Indicates whether the snapshot has been created successfully.
18256 * Takes a V8 heap snapshot and saves it to `filePath`.
18258 takeHeapSnapshot(filePath: string): boolean;
18260 * A `string` representing Chrome's version string.
18263 readonly chrome: string;
18265 * A `string` (optional) representing a globally unique ID of the current
18266 * JavaScript context. Each frame has its own JavaScript context. When
18267 * contextIsolation is enabled, the isolated world also has a separate JavaScript
18268 * context. This property is only available in the renderer process.
18271 readonly contextId?: string;
18273 * A `boolean` that indicates whether the current renderer context has
18274 * `contextIsolation` enabled. It is `undefined` in the main process.
18277 readonly contextIsolated: boolean;
18279 * A `boolean`. When app is started by being passed as parameter to the default
18280 * app, this property is `true` in the main process, otherwise it is `undefined`.
18283 readonly defaultApp: boolean;
18285 * A `string` representing Electron's version string.
18288 readonly electron: string;
18290 * A `boolean`, `true` when the current renderer context is the "main" renderer
18291 * frame. If you want the ID of the current frame you should use
18292 * `webFrame.routingId`.
18295 readonly isMainFrame: boolean;
18297 * A `boolean`. For Mac App Store build, this property is `true`, for other builds
18298 * it is `undefined`.
18301 readonly mas: boolean;
18303 * A `boolean` that controls ASAR support inside your application. Setting this to
18304 * `true` will disable the support for `asar` archives in Node's built-in modules.
18308 * A `boolean` that controls whether or not deprecation warnings are printed to
18309 * `stderr`. Setting this to `true` will silence deprecation warnings. This
18310 * property is used instead of the `--no-deprecation` command line flag.
18312 noDeprecation: boolean;
18314 * A `Electron.ParentPort` property if this is a `UtilityProcess` (or `null`
18315 * otherwise) allowing communication with the parent process.
18317 parentPort: Electron.ParentPort;
18319 * A `string` representing the path to the resources directory.
18322 readonly resourcesPath: string;
18324 * A `boolean`. When the renderer process is sandboxed, this property is `true`,
18325 * otherwise it is `undefined`.
18328 readonly sandboxed: boolean;
18330 * A `boolean` that controls whether or not deprecation warnings will be thrown as
18331 * exceptions. Setting this to `true` will throw errors for deprecations. This
18332 * property is used instead of the `--throw-deprecation` command line flag.
18334 throwDeprecation: boolean;
18336 * A `boolean` that controls whether or not deprecations printed to `stderr`
18337 * include their stack trace. Setting this to `true` will print stack traces for
18338 * deprecations. This property is instead of the `--trace-deprecation` command line
18341 traceDeprecation: boolean;
18343 * A `boolean` that controls whether or not process warnings printed to `stderr`
18344 * include their stack trace. Setting this to `true` will print stack traces for
18345 * process warnings (including deprecations). This property is instead of the
18346 * `--trace-warnings` command line flag.
18348 traceProcessWarnings: boolean;
18350 * A `string` representing the current process's type, can be:
18352 * * `browser` - The main process
18353 * * `renderer` - A renderer process
18354 * * `worker` - In a web worker
18355 * * `utility` - In a node process launched as a service
18358 readonly type: ('browser' | 'renderer' | 'worker' | 'utility');
18360 * A `boolean`. If the app is running as a Windows Store app (appx), this property
18361 * is `true`, for otherwise it is `undefined`.
18364 readonly windowsStore: boolean;
18366 interface ProcessVersions {
18367 readonly electron: string;
18368 readonly chrome: string;