1 // Type definitions for Electron 28.1.0
2 // Project: http://electronjs.org/
3 // Definitions by: The Electron Team <https://github.com/electron/electron>
4 // Definitions: https://github.com/electron/typescript-definitions
6 /// <reference types="node" />
9 type GlobalResponse = Response;
10 type GlobalRequest = Request;
12 declare namespace Electron {
13 const NodeEventEmitter: typeof import('events').EventEmitter;
15 type Accelerator = string;
16 type Event<Params extends object = {}> = {
17 preventDefault: () => void;
18 readonly defaultPrevented: boolean;
21 interface App extends NodeJS.EventEmitter {
23 // Docs: https://electronjs.org/docs/api/app
26 * Emitted when Chrome's accessibility support changes. This event fires when
27 * assistive technologies, such as screen readers, are enabled or disabled. See
28 * https://www.chromium.org/developers/design-documents/accessibility for more
31 * @platform darwin,win32
33 on(event: 'accessibility-support-changed', listener: (event: Event,
35 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
37 accessibilitySupportEnabled: boolean) => void): this;
38 off(event: 'accessibility-support-changed', listener: (event: Event,
40 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
42 accessibilitySupportEnabled: boolean) => void): this;
43 once(event: 'accessibility-support-changed', listener: (event: Event,
45 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
47 accessibilitySupportEnabled: boolean) => void): this;
48 addListener(event: 'accessibility-support-changed', listener: (event: Event,
50 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
52 accessibilitySupportEnabled: boolean) => void): this;
53 removeListener(event: 'accessibility-support-changed', listener: (event: Event,
55 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
57 accessibilitySupportEnabled: boolean) => void): this;
59 * Emitted when the application is activated. Various actions can trigger this
60 * event, such as launching the application for the first time, attempting to
61 * re-launch the application when it's already running, or clicking on the
62 * application's dock or taskbar icon.
66 on(event: 'activate', listener: (event: Event,
67 hasVisibleWindows: boolean) => void): this;
68 off(event: 'activate', listener: (event: Event,
69 hasVisibleWindows: boolean) => void): this;
70 once(event: 'activate', listener: (event: Event,
71 hasVisibleWindows: boolean) => void): this;
72 addListener(event: 'activate', listener: (event: Event,
73 hasVisibleWindows: boolean) => void): this;
74 removeListener(event: 'activate', listener: (event: Event,
75 hasVisibleWindows: boolean) => void): this;
77 * Emitted during Handoff after an activity from this device was successfully
78 * resumed on another one.
82 on(event: 'activity-was-continued', listener: (event: Event,
84 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
88 * Contains app-specific state stored by the activity.
90 userInfo: unknown) => void): this;
91 off(event: 'activity-was-continued', listener: (event: Event,
93 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
97 * Contains app-specific state stored by the activity.
99 userInfo: unknown) => void): this;
100 once(event: 'activity-was-continued', listener: (event: Event,
102 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
106 * Contains app-specific state stored by the activity.
108 userInfo: unknown) => void): this;
109 addListener(event: 'activity-was-continued', listener: (event: Event,
111 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
115 * Contains app-specific state stored by the activity.
117 userInfo: unknown) => void): this;
118 removeListener(event: 'activity-was-continued', listener: (event: Event,
120 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
124 * Contains app-specific state stored by the activity.
126 userInfo: unknown) => void): this;
128 * Emitted before the application starts closing its windows. Calling
129 * `event.preventDefault()` will prevent the default behavior, which is terminating
132 * **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
133 * then `before-quit` is emitted _after_ emitting `close` event on all windows and
136 * **Note:** On Windows, this event will not be emitted if the app is closed due to
137 * a shutdown/restart of the system or a user logout.
139 on(event: 'before-quit', listener: (event: Event) => void): this;
140 off(event: 'before-quit', listener: (event: Event) => void): this;
141 once(event: 'before-quit', listener: (event: Event) => void): this;
142 addListener(event: 'before-quit', listener: (event: Event) => void): this;
143 removeListener(event: 'before-quit', listener: (event: Event) => void): this;
145 * Emitted when a browserWindow gets blurred.
147 on(event: 'browser-window-blur', listener: (event: Event,
148 window: BrowserWindow) => void): this;
149 off(event: 'browser-window-blur', listener: (event: Event,
150 window: BrowserWindow) => void): this;
151 once(event: 'browser-window-blur', listener: (event: Event,
152 window: BrowserWindow) => void): this;
153 addListener(event: 'browser-window-blur', listener: (event: Event,
154 window: BrowserWindow) => void): this;
155 removeListener(event: 'browser-window-blur', listener: (event: Event,
156 window: BrowserWindow) => void): this;
158 * Emitted when a new browserWindow is created.
160 on(event: 'browser-window-created', listener: (event: Event,
161 window: BrowserWindow) => void): this;
162 off(event: 'browser-window-created', listener: (event: Event,
163 window: BrowserWindow) => void): this;
164 once(event: 'browser-window-created', listener: (event: Event,
165 window: BrowserWindow) => void): this;
166 addListener(event: 'browser-window-created', listener: (event: Event,
167 window: BrowserWindow) => void): this;
168 removeListener(event: 'browser-window-created', listener: (event: Event,
169 window: BrowserWindow) => void): this;
171 * Emitted when a browserWindow gets focused.
173 on(event: 'browser-window-focus', listener: (event: Event,
174 window: BrowserWindow) => void): this;
175 off(event: 'browser-window-focus', listener: (event: Event,
176 window: BrowserWindow) => void): this;
177 once(event: 'browser-window-focus', listener: (event: Event,
178 window: BrowserWindow) => void): this;
179 addListener(event: 'browser-window-focus', listener: (event: Event,
180 window: BrowserWindow) => void): this;
181 removeListener(event: 'browser-window-focus', listener: (event: Event,
182 window: BrowserWindow) => void): this;
184 * Emitted when failed to verify the `certificate` for `url`, to trust the
185 * certificate you should prevent the default behavior with
186 * `event.preventDefault()` and call `callback(true)`.
188 on(event: 'certificate-error', listener: (event: Event,
189 webContents: WebContents,
195 certificate: Certificate,
196 callback: (isTrusted: boolean) => void,
197 isMainFrame: boolean) => void): this;
198 off(event: 'certificate-error', listener: (event: Event,
199 webContents: WebContents,
205 certificate: Certificate,
206 callback: (isTrusted: boolean) => void,
207 isMainFrame: boolean) => void): this;
208 once(event: 'certificate-error', listener: (event: Event,
209 webContents: WebContents,
215 certificate: Certificate,
216 callback: (isTrusted: boolean) => void,
217 isMainFrame: boolean) => void): this;
218 addListener(event: 'certificate-error', listener: (event: Event,
219 webContents: WebContents,
225 certificate: Certificate,
226 callback: (isTrusted: boolean) => void,
227 isMainFrame: boolean) => void): this;
228 removeListener(event: 'certificate-error', listener: (event: Event,
229 webContents: WebContents,
235 certificate: Certificate,
236 callback: (isTrusted: boolean) => void,
237 isMainFrame: boolean) => void): this;
239 * Emitted when the child process unexpectedly disappears. This is normally because
240 * it was crashed or killed. It does not include renderer processes.
242 on(event: 'child-process-gone', listener: (event: Event,
243 details: Details) => void): this;
244 off(event: 'child-process-gone', listener: (event: Event,
245 details: Details) => void): this;
246 once(event: 'child-process-gone', listener: (event: Event,
247 details: Details) => void): this;
248 addListener(event: 'child-process-gone', listener: (event: Event,
249 details: Details) => void): this;
250 removeListener(event: 'child-process-gone', listener: (event: Event,
251 details: Details) => void): this;
253 * Emitted during Handoff when an activity from a different device wants to be
254 * resumed. You should call `event.preventDefault()` if you want to handle this
257 * A user activity can be continued only in an app that has the same developer Team
258 * ID as the activity's source app and that supports the activity's type. Supported
259 * activity types are specified in the app's `Info.plist` under the
260 * `NSUserActivityTypes` key.
264 on(event: 'continue-activity', listener: (event: Event,
266 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
270 * Contains app-specific state stored by the activity on another device.
273 details: ContinueActivityDetails) => void): this;
274 off(event: 'continue-activity', listener: (event: Event,
276 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
280 * Contains app-specific state stored by the activity on another device.
283 details: ContinueActivityDetails) => void): this;
284 once(event: 'continue-activity', listener: (event: Event,
286 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
290 * Contains app-specific state stored by the activity on another device.
293 details: ContinueActivityDetails) => void): this;
294 addListener(event: 'continue-activity', listener: (event: Event,
296 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
300 * Contains app-specific state stored by the activity on another device.
303 details: ContinueActivityDetails) => void): this;
304 removeListener(event: 'continue-activity', listener: (event: Event,
306 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
310 * Contains app-specific state stored by the activity on another device.
313 details: ContinueActivityDetails) => void): this;
315 * Emitted during Handoff when an activity from a different device fails to be
320 on(event: 'continue-activity-error', listener: (event: Event,
322 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
326 * A string with the error's localized description.
328 error: string) => void): this;
329 off(event: 'continue-activity-error', listener: (event: Event,
331 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
335 * A string with the error's localized description.
337 error: string) => void): this;
338 once(event: 'continue-activity-error', listener: (event: Event,
340 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
344 * A string with the error's localized description.
346 error: string) => void): this;
347 addListener(event: 'continue-activity-error', listener: (event: Event,
349 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
353 * A string with the error's localized description.
355 error: string) => void): this;
356 removeListener(event: 'continue-activity-error', listener: (event: Event,
358 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
362 * A string with the error's localized description.
364 error: string) => void): this;
366 * Emitted when the application becomes active. This differs from the `activate`
367 * event in that `did-become-active` is emitted every time the app becomes active,
368 * not only when Dock icon is clicked or application is re-launched. It is also
369 * emitted when a user switches to the app via the macOS App Switcher.
373 on(event: 'did-become-active', listener: (event: Event) => void): this;
374 off(event: 'did-become-active', listener: (event: Event) => void): this;
375 once(event: 'did-become-active', listener: (event: Event) => void): this;
376 addListener(event: 'did-become-active', listener: (event: Event) => void): this;
377 removeListener(event: 'did-become-active', listener: (event: Event) => void): this;
379 * Emitted when the app is no longer active and doesn’t have focus. This can be
380 * triggered, for example, by clicking on another application or by using the macOS
381 * App Switcher to switch to another application.
385 on(event: 'did-resign-active', listener: (event: Event) => void): this;
386 off(event: 'did-resign-active', listener: (event: Event) => void): this;
387 once(event: 'did-resign-active', listener: (event: Event) => void): this;
388 addListener(event: 'did-resign-active', listener: (event: Event) => void): this;
389 removeListener(event: 'did-resign-active', listener: (event: Event) => void): this;
391 * Emitted whenever there is a GPU info update.
393 on(event: 'gpu-info-update', listener: Function): this;
394 off(event: 'gpu-info-update', listener: Function): this;
395 once(event: 'gpu-info-update', listener: Function): this;
396 addListener(event: 'gpu-info-update', listener: Function): this;
397 removeListener(event: 'gpu-info-update', listener: Function): this;
399 * Emitted when the GPU process crashes or is killed.
401 * **Deprecated:** This event is superceded by the `child-process-gone` event which
402 * contains more information about why the child process disappeared. It isn't
403 * always because it crashed. The `killed` boolean can be replaced by checking
404 * `reason === 'killed'` when you switch to that event.
408 on(event: 'gpu-process-crashed', listener: (event: Event,
409 killed: boolean) => void): this;
410 off(event: 'gpu-process-crashed', listener: (event: Event,
411 killed: boolean) => void): this;
412 once(event: 'gpu-process-crashed', listener: (event: Event,
413 killed: boolean) => void): this;
414 addListener(event: 'gpu-process-crashed', listener: (event: Event,
415 killed: boolean) => void): this;
416 removeListener(event: 'gpu-process-crashed', listener: (event: Event,
417 killed: boolean) => void): this;
419 * Emitted when `webContents` wants to do basic auth.
421 * The default behavior is to cancel all authentications. To override this you
422 * should prevent the default behavior with `event.preventDefault()` and call
423 * `callback(username, password)` with the credentials.
425 * If `callback` is called without a username or password, the authentication
426 * request will be cancelled and the authentication error will be returned to the
429 on(event: 'login', listener: (event: Event,
430 webContents: WebContents,
431 authenticationResponseDetails: AuthenticationResponseDetails,
433 callback: (username?: string, password?: string) => void) => void): this;
434 off(event: 'login', listener: (event: Event,
435 webContents: WebContents,
436 authenticationResponseDetails: AuthenticationResponseDetails,
438 callback: (username?: string, password?: string) => void) => void): this;
439 once(event: 'login', listener: (event: Event,
440 webContents: WebContents,
441 authenticationResponseDetails: AuthenticationResponseDetails,
443 callback: (username?: string, password?: string) => void) => void): this;
444 addListener(event: 'login', listener: (event: Event,
445 webContents: WebContents,
446 authenticationResponseDetails: AuthenticationResponseDetails,
448 callback: (username?: string, password?: string) => void) => void): this;
449 removeListener(event: 'login', listener: (event: Event,
450 webContents: WebContents,
451 authenticationResponseDetails: AuthenticationResponseDetails,
453 callback: (username?: string, password?: string) => void) => void): this;
455 * Emitted when the user clicks the native macOS new tab button. The new tab button
456 * is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
460 on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
461 off(event: 'new-window-for-tab', listener: (event: Event) => void): this;
462 once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
463 addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
464 removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
466 * Emitted when the user wants to open a file with the application. The `open-file`
467 * event is usually emitted when the application is already open and the OS wants
468 * to reuse the application to open the file. `open-file` is also emitted when a
469 * file is dropped onto the dock and the application is not yet running. Make sure
470 * to listen for the `open-file` event very early in your application startup to
471 * handle this case (even before the `ready` event is emitted).
473 * You should call `event.preventDefault()` if you want to handle this event.
475 * On Windows, you have to parse `process.argv` (in the main process) to get the
480 on(event: 'open-file', listener: (event: Event,
481 path: string) => void): this;
482 off(event: 'open-file', listener: (event: Event,
483 path: string) => void): this;
484 once(event: 'open-file', listener: (event: Event,
485 path: string) => void): this;
486 addListener(event: 'open-file', listener: (event: Event,
487 path: string) => void): this;
488 removeListener(event: 'open-file', listener: (event: Event,
489 path: string) => void): this;
491 * Emitted when the user wants to open a URL with the application. Your
492 * application's `Info.plist` file must define the URL scheme within the
493 * `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
495 * As with the `open-file` event, be sure to register a listener for the `open-url`
496 * event early in your application startup to detect if the application is being
497 * opened to handle a URL. If you register the listener in response to a `ready`
498 * event, you'll miss URLs that trigger the launch of your application.
502 on(event: 'open-url', listener: (event: Event,
503 url: string) => void): this;
504 off(event: 'open-url', listener: (event: Event,
505 url: string) => void): this;
506 once(event: 'open-url', listener: (event: Event,
507 url: string) => void): this;
508 addListener(event: 'open-url', listener: (event: Event,
509 url: string) => void): this;
510 removeListener(event: 'open-url', listener: (event: Event,
511 url: string) => void): this;
513 * Emitted when the application is quitting.
515 * **Note:** On Windows, this event will not be emitted if the app is closed due to
516 * a shutdown/restart of the system or a user logout.
518 on(event: 'quit', listener: (event: Event,
519 exitCode: number) => void): this;
520 off(event: 'quit', listener: (event: Event,
521 exitCode: number) => void): this;
522 once(event: 'quit', listener: (event: Event,
523 exitCode: number) => void): this;
524 addListener(event: 'quit', listener: (event: Event,
525 exitCode: number) => void): this;
526 removeListener(event: 'quit', listener: (event: Event,
527 exitCode: number) => void): this;
529 * Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
530 * holds the `userInfo` of the `NSUserNotification` or information from
531 * `UNNotificationResponse` that was used to open the application, if it was
532 * launched from Notification Center. You can also call `app.isReady()` to check if
533 * this event has already fired and `app.whenReady()` to get a Promise that is
534 * fulfilled when Electron is initialized.
536 on(event: 'ready', listener: (event: Event,
540 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
541 off(event: 'ready', listener: (event: Event,
545 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
546 once(event: 'ready', listener: (event: Event,
550 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
551 addListener(event: 'ready', listener: (event: Event,
555 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
556 removeListener(event: 'ready', listener: (event: Event,
560 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
562 * Emitted when the renderer process unexpectedly disappears. This is normally
563 * because it was crashed or killed.
565 on(event: 'render-process-gone', listener: (event: Event,
566 webContents: WebContents,
567 details: RenderProcessGoneDetails) => void): this;
568 off(event: 'render-process-gone', listener: (event: Event,
569 webContents: WebContents,
570 details: RenderProcessGoneDetails) => void): this;
571 once(event: 'render-process-gone', listener: (event: Event,
572 webContents: WebContents,
573 details: RenderProcessGoneDetails) => void): this;
574 addListener(event: 'render-process-gone', listener: (event: Event,
575 webContents: WebContents,
576 details: RenderProcessGoneDetails) => void): this;
577 removeListener(event: 'render-process-gone', listener: (event: Event,
578 webContents: WebContents,
579 details: RenderProcessGoneDetails) => void): this;
581 * Emitted when the renderer process of `webContents` crashes or is killed.
583 * **Deprecated:** This event is superceded by the `render-process-gone` event
584 * which contains more information about why the render process disappeared. It
585 * isn't always because it crashed. The `killed` boolean can be replaced by
586 * checking `reason === 'killed'` when you switch to that event.
590 on(event: 'renderer-process-crashed', listener: (event: Event,
591 webContents: WebContents,
592 killed: boolean) => void): this;
593 off(event: 'renderer-process-crashed', listener: (event: Event,
594 webContents: WebContents,
595 killed: boolean) => void): this;
596 once(event: 'renderer-process-crashed', listener: (event: Event,
597 webContents: WebContents,
598 killed: boolean) => void): this;
599 addListener(event: 'renderer-process-crashed', listener: (event: Event,
600 webContents: WebContents,
601 killed: boolean) => void): this;
602 removeListener(event: 'renderer-process-crashed', listener: (event: Event,
603 webContents: WebContents,
604 killed: boolean) => void): this;
606 * This event will be emitted inside the primary instance of your application when
607 * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
609 * `argv` is an Array of the second instance's command line arguments, and
610 * `workingDirectory` is its current working directory. Usually applications
611 * respond to this by making their primary window focused and non-minimized.
613 * **Note:** `argv` will not be exactly the same list of arguments as those passed
614 * to the second instance. The order might change and additional arguments might be
615 * appended. If you need to maintain the exact same arguments, it's advised to use
616 * `additionalData` instead.
618 * **Note:** If the second instance is started by a different user than the first,
619 * the `argv` array will not include the arguments.
621 * This event is guaranteed to be emitted after the `ready` event of `app` gets
624 * **Note:** Extra command line arguments might be added by Chromium, such as
625 * `--original-process-start-time`.
627 on(event: 'second-instance', listener: (event: Event,
629 * An array of the second instance's command line arguments
633 * The second instance's working directory
635 workingDirectory: string,
637 * A JSON object of additional data passed from the second instance
639 additionalData: unknown) => void): this;
640 off(event: 'second-instance', listener: (event: Event,
642 * An array of the second instance's command line arguments
646 * The second instance's working directory
648 workingDirectory: string,
650 * A JSON object of additional data passed from the second instance
652 additionalData: unknown) => void): this;
653 once(event: 'second-instance', listener: (event: Event,
655 * An array of the second instance's command line arguments
659 * The second instance's working directory
661 workingDirectory: string,
663 * A JSON object of additional data passed from the second instance
665 additionalData: unknown) => void): this;
666 addListener(event: 'second-instance', listener: (event: Event,
668 * An array of the second instance's command line arguments
672 * The second instance's working directory
674 workingDirectory: string,
676 * A JSON object of additional data passed from the second instance
678 additionalData: unknown) => void): this;
679 removeListener(event: 'second-instance', listener: (event: Event,
681 * An array of the second instance's command line arguments
685 * The second instance's working directory
687 workingDirectory: string,
689 * A JSON object of additional data passed from the second instance
691 additionalData: unknown) => void): this;
693 * Emitted when a client certificate is requested.
695 * The `url` corresponds to the navigation entry requesting the client certificate
696 * and `callback` can be called with an entry filtered from the list. Using
697 * `event.preventDefault()` prevents the application from using the first
698 * certificate from the store.
700 on(event: 'select-client-certificate', listener: (event: Event,
701 webContents: WebContents,
703 certificateList: Certificate[],
704 callback: (certificate?: Certificate) => void) => void): this;
705 off(event: 'select-client-certificate', listener: (event: Event,
706 webContents: WebContents,
708 certificateList: Certificate[],
709 callback: (certificate?: Certificate) => void) => void): this;
710 once(event: 'select-client-certificate', listener: (event: Event,
711 webContents: WebContents,
713 certificateList: Certificate[],
714 callback: (certificate?: Certificate) => void) => void): this;
715 addListener(event: 'select-client-certificate', listener: (event: Event,
716 webContents: WebContents,
718 certificateList: Certificate[],
719 callback: (certificate?: Certificate) => void) => void): this;
720 removeListener(event: 'select-client-certificate', listener: (event: Event,
721 webContents: WebContents,
723 certificateList: Certificate[],
724 callback: (certificate?: Certificate) => void) => void): this;
726 * Emitted when Electron has created a new `session`.
728 on(event: 'session-created', listener: (session: Session) => void): this;
729 off(event: 'session-created', listener: (session: Session) => void): this;
730 once(event: 'session-created', listener: (session: Session) => void): this;
731 addListener(event: 'session-created', listener: (session: Session) => void): this;
732 removeListener(event: 'session-created', listener: (session: Session) => void): this;
734 * Emitted when Handoff is about to be resumed on another device. If you need to
735 * update the state to be transferred, you should call `event.preventDefault()`
736 * immediately, construct a new `userInfo` dictionary and call
737 * `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
738 * fail and `continue-activity-error` will be called.
742 on(event: 'update-activity-state', listener: (event: Event,
744 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
748 * Contains app-specific state stored by the activity.
750 userInfo: unknown) => void): this;
751 off(event: 'update-activity-state', listener: (event: Event,
753 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
757 * Contains app-specific state stored by the activity.
759 userInfo: unknown) => void): this;
760 once(event: 'update-activity-state', listener: (event: Event,
762 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
766 * Contains app-specific state stored by the activity.
768 userInfo: unknown) => void): this;
769 addListener(event: 'update-activity-state', listener: (event: Event,
771 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
775 * Contains app-specific state stored by the activity.
777 userInfo: unknown) => void): this;
778 removeListener(event: 'update-activity-state', listener: (event: Event,
780 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
784 * Contains app-specific state stored by the activity.
786 userInfo: unknown) => void): this;
788 * Emitted when a new webContents is created.
790 on(event: 'web-contents-created', listener: (event: Event,
791 webContents: WebContents) => void): this;
792 off(event: 'web-contents-created', listener: (event: Event,
793 webContents: WebContents) => void): this;
794 once(event: 'web-contents-created', listener: (event: Event,
795 webContents: WebContents) => void): this;
796 addListener(event: 'web-contents-created', listener: (event: Event,
797 webContents: WebContents) => void): this;
798 removeListener(event: 'web-contents-created', listener: (event: Event,
799 webContents: WebContents) => void): this;
801 * Emitted during Handoff before an activity from a different device wants to be
802 * resumed. You should call `event.preventDefault()` if you want to handle this
807 on(event: 'will-continue-activity', listener: (event: Event,
809 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
811 type: string) => void): this;
812 off(event: 'will-continue-activity', listener: (event: Event,
814 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
816 type: string) => void): this;
817 once(event: 'will-continue-activity', listener: (event: Event,
819 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
821 type: string) => void): this;
822 addListener(event: 'will-continue-activity', listener: (event: Event,
824 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
826 type: string) => void): this;
827 removeListener(event: 'will-continue-activity', listener: (event: Event,
829 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
831 type: string) => void): this;
833 * Emitted when the application has finished basic startup. On Windows and Linux,
834 * the `will-finish-launching` event is the same as the `ready` event; on macOS,
835 * this event represents the `applicationWillFinishLaunching` notification of
838 * In most cases, you should do everything in the `ready` event handler.
840 on(event: 'will-finish-launching', listener: Function): this;
841 off(event: 'will-finish-launching', listener: Function): this;
842 once(event: 'will-finish-launching', listener: Function): this;
843 addListener(event: 'will-finish-launching', listener: Function): this;
844 removeListener(event: 'will-finish-launching', listener: Function): this;
846 * Emitted when all windows have been closed and the application will quit. Calling
847 * `event.preventDefault()` will prevent the default behavior, which is terminating
850 * See the description of the `window-all-closed` event for the differences between
851 * the `will-quit` and `window-all-closed` events.
853 * **Note:** On Windows, this event will not be emitted if the app is closed due to
854 * a shutdown/restart of the system or a user logout.
856 on(event: 'will-quit', listener: (event: Event) => void): this;
857 off(event: 'will-quit', listener: (event: Event) => void): this;
858 once(event: 'will-quit', listener: (event: Event) => void): this;
859 addListener(event: 'will-quit', listener: (event: Event) => void): this;
860 removeListener(event: 'will-quit', listener: (event: Event) => void): this;
862 * Emitted when all windows have been closed.
864 * If you do not subscribe to this event and all windows are closed, the default
865 * behavior is to quit the app; however, if you subscribe, you control whether the
866 * app quits or not. If the user pressed `Cmd + Q`, or the developer called
867 * `app.quit()`, Electron will first try to close all the windows and then emit the
868 * `will-quit` event, and in this case the `window-all-closed` event would not be
871 on(event: 'window-all-closed', listener: Function): this;
872 off(event: 'window-all-closed', listener: Function): this;
873 once(event: 'window-all-closed', listener: Function): this;
874 addListener(event: 'window-all-closed', listener: Function): this;
875 removeListener(event: 'window-all-closed', listener: Function): this;
877 * Adds `path` to the recent documents list.
879 * This list is managed by the OS. On Windows, you can visit the list from the task
880 * bar, and on macOS, you can visit it from dock menu.
882 * @platform darwin,win32
884 addRecentDocument(path: string): void;
886 * Clears the recent documents list.
888 * @platform darwin,win32
890 clearRecentDocuments(): void;
892 * Configures host resolution (DNS and DNS-over-HTTPS). By default, the following
893 * resolvers will be used, in order:
895 * * DNS-over-HTTPS, if the DNS provider supports it, then
896 * * the built-in resolver (enabled on macOS only by default), then
897 * * the system's resolver (e.g. `getaddrinfo`).
899 * This can be configured to either restrict usage of non-encrypted DNS
900 * (`secureDnsMode: "secure"`), or disable DNS-over-HTTPS (`secureDnsMode: "off"`).
901 * It is also possible to enable or disable the built-in resolver.
903 * To disable insecure DNS, you can specify a `secureDnsMode` of `"secure"`. If you
904 * do so, you should make sure to provide a list of DNS-over-HTTPS servers to use,
905 * in case the user's DNS configuration does not include a provider that supports
908 * This API must be called after the `ready` event is emitted.
910 configureHostResolver(options: ConfigureHostResolverOptions): void;
912 * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
913 * basis if the GPU processes crashes too frequently. This function disables that
916 * This method can only be called before app is ready.
918 disableDomainBlockingFor3DAPIs(): void;
920 * Disables hardware acceleration for current app.
922 * This method can only be called before app is ready.
924 disableHardwareAcceleration(): void;
926 * Enables full sandbox mode on the app. This means that all renderers will be
927 * launched sandboxed, regardless of the value of the `sandbox` flag in
930 * This method can only be called before app is ready.
932 enableSandbox(): void;
934 * Exits immediately with `exitCode`. `exitCode` defaults to 0.
936 * All windows will be closed immediately without asking the user, and the
937 * `before-quit` and `will-quit` events will not be emitted.
939 exit(exitCode?: number): void;
941 * On Linux, focuses on the first visible window. On macOS, makes the application
942 * the active app. On Windows, focuses on the application's first window.
944 * You should seek to use the `steal` option as sparingly as possible.
946 focus(options?: FocusOptions): void;
948 * Resolve with an object containing the following:
950 * * `icon` NativeImage - the display icon of the app handling the protocol.
951 * * `path` string - installation path of the app handling the protocol.
952 * * `name` string - display name of the app handling the protocol.
954 * This method returns a promise that contains the application name, icon and path
955 * of the default handler for the protocol (aka URI scheme) of a URL.
957 * @platform darwin,win32
959 getApplicationInfoForProtocol(url: string): Promise<Electron.ApplicationInfoForProtocolReturnValue>;
961 * Name of the application handling the protocol, or an empty string if there is no
962 * handler. For instance, if Electron is the default handler of the URL, this could
963 * be `Electron` on Windows and Mac. However, don't rely on the precise format
964 * which is not guaranteed to remain unchanged. Expect a different format on Linux,
965 * possibly with a `.desktop` suffix.
967 * This method returns the application name of the default handler for the protocol
968 * (aka URI scheme) of a URL.
970 getApplicationNameForProtocol(url: string): string;
972 * Array of `ProcessMetric` objects that correspond to memory and CPU usage
973 * statistics of all the processes associated with the app.
975 getAppMetrics(): ProcessMetric[];
977 * The current application directory.
979 getAppPath(): string;
981 * The current value displayed in the counter badge.
983 * @platform linux,darwin
985 getBadgeCount(): number;
987 * The type of the currently running activity.
991 getCurrentActivityType(): string;
993 * fulfilled with the app's icon, which is a NativeImage.
995 * Fetches a path's associated icon.
997 * On _Windows_, there a 2 kinds of icons:
999 * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
1000 * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
1002 * On _Linux_ and _macOS_, icons depend on the application associated with file
1005 getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
1007 * The Graphics Feature Status from `chrome://gpu/`.
1009 * **Note:** This information is only usable after the `gpu-info-update` event is
1012 getGPUFeatureStatus(): GPUFeatureStatus;
1014 * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
1015 * containing all the GPU Information as in chromium's GPUInfo object. This
1016 * includes the version and driver information that's shown on `chrome://gpu` page.
1018 * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
1019 * fewer attributes than when requested with `complete`. Here's an example of basic
1022 * Using `basic` should be preferred if only basic information like `vendorId` or
1023 * `deviceId` is needed.
1025 getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
1027 * * `minItems` Integer - The minimum number of items that will be shown in the
1028 * Jump List (for a more detailed description of this value see the MSDN docs).
1029 * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
1030 * correspond to items that the user has explicitly removed from custom categories
1031 * in the Jump List. These items must not be re-added to the Jump List in the
1032 * **next** call to `app.setJumpList()`, Windows will not display any custom
1033 * category that contains any of the removed items.
1037 getJumpListSettings(): JumpListSettings;
1039 * The current application locale, fetched using Chromium's `l10n_util` library.
1040 * Possible return values are documented here.
1042 * To set the locale, you'll want to use a command line switch at app startup,
1043 * which may be found here.
1045 * **Note:** When distributing your packaged app, you have to also ship the
1048 * **Note:** This API must be called after the `ready` event is emitted.
1050 * **Note:** To see example return values of this API compared to other locale and
1051 * language APIs, see `app.getPreferredSystemLanguages()`.
1053 getLocale(): string;
1055 * User operating system's locale two-letter ISO 3166 country code. The value is
1056 * taken from native OS APIs.
1058 * **Note:** When unable to detect locale country code, it returns empty string.
1060 getLocaleCountryCode(): string;
1062 * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
1063 * you need to pass the same arguments here for `openAtLogin` to be set correctly.
1066 * * `openAtLogin` boolean - `true` if the app is set to open at login.
1067 * * `openAsHidden` boolean _macOS_ - `true` if the app is set to open as hidden at
1068 * login. This setting is not available on MAS builds.
1069 * * `wasOpenedAtLogin` boolean _macOS_ - `true` if the app was opened at login
1070 * automatically. This setting is not available on MAS builds.
1071 * * `wasOpenedAsHidden` boolean _macOS_ - `true` if the app was opened as a hidden
1072 * login item. This indicates that the app should not open any windows at startup.
1073 * This setting is not available on MAS builds.
1074 * * `restoreState` boolean _macOS_ - `true` if the app was opened as a login item
1075 * that should restore the state from the previous session. This indicates that the
1076 * app should restore the windows that were open the last time the app was closed.
1077 * This setting is not available on MAS builds.
1078 * * `executableWillLaunchAtLogin` boolean _Windows_ - `true` if app is set to open
1079 * at login and its run key is not deactivated. This differs from `openAtLogin` as
1080 * it ignores the `args` option, this property will be true if the given executable
1081 * would be launched at login with **any** arguments.
1082 * * `launchItems` Object[] _Windows_
1083 * * `name` string _Windows_ - name value of a registry entry.
1084 * * `path` string _Windows_ - The executable to an app that corresponds to a
1086 * * `args` string[] _Windows_ - the command-line arguments to pass to the
1088 * * `scope` string _Windows_ - one of `user` or `machine`. Indicates whether the
1089 * registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
1090 * * `enabled` boolean _Windows_ - `true` if the app registry key is startup
1091 * approved and therefore shows as `enabled` in Task Manager and Windows settings.
1093 * @platform darwin,win32
1095 getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
1097 * The current application's name, which is the name in the application's
1098 * `package.json` file.
1100 * Usually the `name` field of `package.json` is a short lowercase name, according
1101 * to the npm modules spec. You should usually also specify a `productName` field,
1102 * which is your application's full capitalized name, and which will be preferred
1103 * over `name` by Electron.
1107 * A path to a special directory or file associated with `name`. On failure, an
1108 * `Error` is thrown.
1110 * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
1111 * called first, a default log directory will be created equivalent to calling
1112 * `app.setAppLogsPath()` without a `path` parameter.
1114 getPath(name: 'home' | 'appData' | 'userData' | 'sessionData' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'crashDumps'): string;
1116 * The user's preferred system languages from most preferred to least preferred,
1117 * including the country codes if applicable. A user can modify and add to this
1118 * list on Windows or macOS through the Language and Region settings.
1120 * The API uses `GlobalizationPreferences` (with a fallback to
1121 * `GetSystemPreferredUILanguages`) on Windows, `\[NSLocale preferredLanguages\]`
1122 * on macOS, and `g_get_language_names` on Linux.
1124 * This API can be used for purposes such as deciding what language to present the
1127 * Here are some examples of return values of the various language and locale APIs
1128 * with different configurations:
1130 * On Windows, given application locale is German, the regional format is Finnish
1131 * (Finland), and the preferred system languages from most to least preferred are
1132 * French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish
1135 * On macOS, given the application locale is German, the region is Finland, and the
1136 * preferred system languages from most to least preferred are French (Canada),
1137 * English (US), Simplified Chinese, and Spanish (Latin America):
1139 * Both the available languages and regions and the possible return values differ
1140 * between the two operating systems.
1142 * As can be seen with the example above, on Windows, it is possible that a
1143 * preferred system language has no country code, and that one of the preferred
1144 * system languages corresponds with the language used for the regional format. On
1145 * macOS, the region serves more as a default country code: the user doesn't need
1146 * to have Finnish as a preferred language to use Finland as the region,and the
1147 * country code `FI` is used as the country code for preferred system languages
1148 * that do not have associated countries in the language name.
1150 getPreferredSystemLanguages(): string[];
1152 * The current system locale. On Windows and Linux, it is fetched using Chromium's
1153 * `i18n` library. On macOS, `[NSLocale currentLocale]` is used instead. To get the
1154 * user's current system language, which is not always the same as the locale, it
1155 * is better to use `app.getPreferredSystemLanguages()`.
1157 * Different operating systems also use the regional data differently:
1159 * * Windows 11 uses the regional format for numbers, dates, and times.
1160 * * macOS Monterey uses the region for formatting numbers, dates, times, and for
1161 * selecting the currency symbol to use.
1163 * Therefore, this API can be used for purposes such as choosing a format for
1164 * rendering dates and times in a calendar app, especially when the developer wants
1165 * the format to be consistent with the OS.
1167 * **Note:** This API must be called after the `ready` event is emitted.
1169 * **Note:** To see example return values of this API compared to other locale and
1170 * language APIs, see `app.getPreferredSystemLanguages()`.
1172 getSystemLocale(): string;
1174 * The version of the loaded application. If no version is found in the
1175 * application's `package.json` file, the version of the current bundle or
1176 * executable is returned.
1178 getVersion(): string;
1180 * This method returns whether or not this instance of your app is currently
1181 * holding the single instance lock. You can request the lock with
1182 * `app.requestSingleInstanceLock()` and release with
1183 * `app.releaseSingleInstanceLock()`
1185 hasSingleInstanceLock(): boolean;
1187 * Hides all application windows without minimizing them.
1193 * Imports the certificate in pkcs12 format into the platform certificate store.
1194 * `callback` is called with the `result` of import operation, a value of `0`
1195 * indicates success while any other value indicates failure according to Chromium
1200 importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
1202 * Invalidates the current Handoff user activity.
1206 invalidateCurrentActivity(): void;
1208 * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
1209 * will return `true` if the use of assistive technologies, such as screen readers,
1210 * has been detected. See
1211 * https://www.chromium.org/developers/design-documents/accessibility for more
1214 * @platform darwin,win32
1216 isAccessibilitySupportEnabled(): boolean;
1218 * Whether the current executable is the default handler for a protocol (aka URI
1221 * **Note:** On macOS, you can use this method to check if the app has been
1222 * registered as the default protocol handler for a protocol. You can also verify
1223 * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
1224 * macOS machine. Please refer to Apple's documentation for details.
1226 * The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
1229 isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1231 * whether or not the current OS version allows for native emoji pickers.
1233 isEmojiPanelSupported(): boolean;
1235 * `true` if the application—including all of its windows—is hidden (e.g. with
1236 * `Command-H`), `false` otherwise.
1240 isHidden(): boolean;
1242 * Whether the application is currently running from the systems Application
1243 * folder. Use in combination with `app.moveToApplicationsFolder()`
1247 isInApplicationsFolder(): boolean;
1249 * `true` if Electron has finished initializing, `false` otherwise. See also
1250 * `app.whenReady()`.
1254 * whether `Secure Keyboard Entry` is enabled.
1256 * By default this API will return `false`.
1260 isSecureKeyboardEntryEnabled(): boolean;
1262 * Whether the current desktop environment is Unity launcher.
1266 isUnityRunning(): boolean;
1268 * Whether the move was successful. Please note that if the move is successful,
1269 * your application will quit and relaunch.
1271 * No confirmation dialog will be presented by default. If you wish to allow the
1272 * user to confirm the operation, you may do so using the `dialog` API.
1274 * **NOTE:** This method throws errors if anything other than the user causes the
1275 * move to fail. For instance if the user cancels the authorization dialog, this
1276 * method returns false. If we fail to perform the copy, then this method will
1277 * throw an error. The message in the error should be informative and tell you
1278 * exactly what went wrong.
1280 * By default, if an app of the same name as the one being moved exists in the
1281 * Applications directory and is _not_ running, the existing app will be trashed
1282 * and the active app moved into its place. If it _is_ running, the preexisting
1283 * running app will assume focus and the previously active app will quit itself.
1284 * This behavior can be changed by providing the optional conflict handler, where
1285 * the boolean returned by the handler determines whether or not the move conflict
1286 * is resolved with default behavior. i.e. returning `false` will ensure no
1287 * further action is taken, returning `true` will result in the default behavior
1288 * and the method continuing.
1292 * Would mean that if an app already exists in the user directory, if the user
1293 * chooses to 'Continue Move' then the function would continue with its default
1294 * behavior and the existing app will be trashed and the active app moved into its
1299 moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
1301 * Try to close all windows. The `before-quit` event will be emitted first. If all
1302 * windows are successfully closed, the `will-quit` event will be emitted and by
1303 * default the application will terminate.
1305 * This method guarantees that all `beforeunload` and `unload` event handlers are
1306 * correctly executed. It is possible that a window cancels the quitting by
1307 * returning `false` in the `beforeunload` event handler.
1311 * Relaunches the app when current instance exits.
1313 * By default, the new instance will use the same working directory and command
1314 * line arguments with current instance. When `args` is specified, the `args` will
1315 * be passed as command line arguments instead. When `execPath` is specified, the
1316 * `execPath` will be executed for relaunch instead of current app.
1318 * Note that this method does not quit the app when executed, you have to call
1319 * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
1321 * When `app.relaunch` is called for multiple times, multiple instances will be
1322 * started after current instance exited.
1324 * An example of restarting current instance immediately and adding a new command
1325 * line argument to the new instance:
1327 relaunch(options?: RelaunchOptions): void;
1329 * Releases all locks that were created by `requestSingleInstanceLock`. This will
1330 * allow multiple instances of the application to once again run side by side.
1332 releaseSingleInstanceLock(): void;
1334 * Whether the call succeeded.
1336 * This method checks if the current executable as the default handler for a
1337 * protocol (aka URI scheme). If so, it will remove the app as the default handler.
1339 * @platform darwin,win32
1341 removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1343 * The return value of this method indicates whether or not this instance of your
1344 * application successfully obtained the lock. If it failed to obtain the lock,
1345 * you can assume that another instance of your application is already running with
1346 * the lock and exit immediately.
1348 * I.e. This method returns `true` if your process is the primary instance of your
1349 * application and your app should continue loading. It returns `false` if your
1350 * process should immediately quit as it has sent its parameters to another
1351 * instance that has already acquired the lock.
1353 * On macOS, the system enforces single instance automatically when users try to
1354 * open a second instance of your app in Finder, and the `open-file` and `open-url`
1355 * events will be emitted for that. However when users start your app in command
1356 * line, the system's single instance mechanism will be bypassed, and you have to
1357 * use this method to ensure single instance.
1359 * An example of activating the window of primary instance when a second instance
1362 requestSingleInstanceLock(additionalData?: Record<any, any>): boolean;
1364 * Marks the current Handoff user activity as inactive without invalidating it.
1368 resignCurrentActivity(): void;
1370 * Set the about panel options. This will override the values defined in the app's
1371 * `.plist` file on macOS. See the Apple docs for more details. On Linux, values
1372 * must be set in order to be shown; there are no defaults.
1374 * If you do not set `credits` but still wish to surface them in your app, AppKit
1375 * will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in
1376 * that order, in the bundle returned by the NSBundle class method main. The first
1377 * file found is used, and if none is found, the info area is left blank. See Apple
1378 * documentation for more information.
1380 setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
1382 * Manually enables Chrome's accessibility support, allowing to expose
1383 * accessibility switch to users in application settings. See Chromium's
1384 * accessibility docs for more details. Disabled by default.
1386 * This API must be called after the `ready` event is emitted.
1388 * **Note:** Rendering accessibility tree can significantly affect the performance
1389 * of your app. It should not be enabled by default.
1391 * @platform darwin,win32
1393 setAccessibilitySupportEnabled(enabled: boolean): void;
1395 * Sets the activation policy for a given app.
1397 * Activation policy types:
1399 * * 'regular' - The application is an ordinary app that appears in the Dock and
1400 * may have a user interface.
1401 * * 'accessory' - The application doesn’t appear in the Dock and doesn’t have a
1402 * menu bar, but it may be activated programmatically or by clicking on one of its
1404 * * 'prohibited' - The application doesn’t appear in the Dock and may not create
1405 * windows or be activated.
1409 setActivationPolicy(policy: 'regular' | 'accessory' | 'prohibited'): void;
1411 * Sets or creates a directory your app's logs which can then be manipulated with
1412 * `app.getPath()` or `app.setPath(pathName, newPath)`.
1414 * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
1415 * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
1416 * `userData` directory on _Linux_ and _Windows_.
1418 setAppLogsPath(path?: string): void;
1420 * Changes the Application User Model ID to `id`.
1424 setAppUserModelId(id: string): void;
1426 * Whether the call succeeded.
1428 * Sets the current executable as the default handler for a protocol (aka URI
1429 * scheme). It allows you to integrate your app deeper into the operating system.
1430 * Once registered, all links with `your-protocol://` will be opened with the
1431 * current executable. The whole link, including protocol, will be passed to your
1432 * application as a parameter.
1434 * **Note:** On macOS, you can only register protocols that have been added to your
1435 * app's `info.plist`, which cannot be modified at runtime. However, you can change
1436 * the file during build time via Electron Forge, Electron Packager, or by editing
1437 * `info.plist` with a text editor. Please refer to Apple's documentation for
1440 * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
1441 * will return `true` for all calls but the registry key it sets won't be
1442 * accessible by other applications. In order to register your Windows Store
1443 * application as a default protocol handler you must declare the protocol in your
1446 * The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme`
1449 setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1451 * Whether the call succeeded.
1453 * Sets the counter badge for current app. Setting the count to `0` will hide the
1456 * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
1458 * **Note:** Unity launcher requires a `.desktop` file to work. For more
1459 * information, please read the Unity integration documentation.
1461 * **Note:** On macOS, you need to ensure that your application has the permission
1462 * to display notifications for this method to work.
1464 * @platform linux,darwin
1466 setBadgeCount(count?: number): boolean;
1468 * Sets or removes a custom Jump List for the application, and returns one of the
1469 * following strings:
1471 * * `ok` - Nothing went wrong.
1472 * * `error` - One or more errors occurred, enable runtime logging to figure out
1474 * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
1475 * category in the Jump List. Separators are only allowed in the standard `Tasks`
1477 * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
1478 * Jump List for a file type the app isn't registered to handle.
1479 * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
1480 * Jump List due to user privacy or group policy settings.
1482 * If `categories` is `null` the previously set custom Jump List (if any) will be
1483 * replaced by the standard Jump List for the app (managed by Windows).
1485 * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
1486 * property set then its `type` is assumed to be `tasks`. If the `name` property is
1487 * set but the `type` property is omitted then the `type` is assumed to be
1490 * **Note:** Users can remove items from custom categories, and Windows will not
1491 * allow a removed item to be added back into a custom category until **after** the
1492 * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
1493 * removed item to a custom category earlier than that will result in the entire
1494 * custom category being omitted from the Jump List. The list of removed items can
1495 * be obtained using `app.getJumpListSettings()`.
1497 * **Note:** The maximum length of a Jump List item's `description` property is 260
1498 * characters. Beyond this limit, the item will not be added to the Jump List, nor
1499 * will it be displayed.
1501 * Here's a very simple example of creating a custom Jump List:
1505 setJumpList(categories: (JumpListCategory[]) | (null)): ('ok' | 'error' | 'invalidSeparatorError' | 'fileTypeRegistrationError' | 'customCategoryAccessDeniedError');
1507 * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
1508 * want to set the launch path to Update.exe, and pass arguments that specify your
1509 * application name. For example:
1511 * @platform darwin,win32
1513 setLoginItemSettings(settings: Settings): void;
1515 * Overrides the current application's name.
1517 * **Note:** This function overrides the name used internally by Electron; it does
1518 * not affect the name that the OS uses.
1520 setName(name: string): void;
1522 * Overrides the `path` to a special directory or file associated with `name`. If
1523 * the path specifies a directory that does not exist, an `Error` is thrown. In
1524 * that case, the directory should be created with `fs.mkdirSync` or similar.
1526 * You can only override paths of a `name` defined in `app.getPath`.
1528 * By default, web pages' cookies and caches will be stored under the `sessionData`
1529 * directory. If you want to change this location, you have to override the
1530 * `sessionData` path before the `ready` event of the `app` module is emitted.
1532 setPath(name: string, path: string): void;
1534 * Set the `Secure Keyboard Entry` is enabled in your application.
1536 * By using this API, important information such as password and other sensitive
1537 * information can be prevented from being intercepted by other processes.
1539 * See Apple's documentation for more details.
1541 * **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it
1542 * when it is no longer needed.
1546 setSecureKeyboardEntryEnabled(enabled: boolean): void;
1548 * Creates an `NSUserActivity` and sets it as the current activity. The activity is
1549 * eligible for Handoff to another device afterward.
1553 setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
1555 * Adds `tasks` to the Tasks category of the Jump List on Windows.
1557 * `tasks` is an array of `Task` objects.
1559 * Whether the call succeeded.
1561 * **Note:** If you'd like to customize the Jump List even more use
1562 * `app.setJumpList(categories)` instead.
1566 setUserTasks(tasks: Task[]): boolean;
1568 * Shows application windows after they were hidden. Does not automatically focus
1575 * Show the app's about panel options. These options can be overridden with
1576 * `app.setAboutPanelOptions(options)`. This function runs asynchronously.
1578 showAboutPanel(): void;
1580 * Show the platform's native emoji picker.
1582 * @platform darwin,win32
1584 showEmojiPanel(): void;
1586 * This function **must** be called once you have finished accessing the security
1587 * scoped file. If you do not remember to stop accessing the bookmark, kernel
1588 * resources will be leaked and your app will lose its ability to reach outside the
1589 * sandbox completely, until your app is restarted.
1591 * Start accessing a security scoped resource. With this method Electron
1592 * applications that are packaged for the Mac App Store may reach outside their
1593 * sandbox to access files chosen by the user. See Apple's documentation for a
1594 * description of how this system works.
1598 startAccessingSecurityScopedResource(bookmarkData: string): Function;
1600 * Updates the current activity if its type matches `type`, merging the entries
1601 * from `userInfo` into its current `userInfo` dictionary.
1605 updateCurrentActivity(type: string, userInfo: any): void;
1607 * fulfilled when Electron is initialized. May be used as a convenient alternative
1608 * to checking `app.isReady()` and subscribing to the `ready` event if the app is
1611 whenReady(): Promise<void>;
1613 * A `boolean` property that's `true` if Chrome's accessibility support is enabled,
1614 * `false` otherwise. This property will be `true` if the use of assistive
1615 * technologies, such as screen readers, has been detected. Setting this property
1616 * to `true` manually enables Chrome's accessibility support, allowing developers
1617 * to expose accessibility switch to users in application settings.
1619 * See Chromium's accessibility docs for more details. Disabled by default.
1621 * This API must be called after the `ready` event is emitted.
1623 * **Note:** Rendering accessibility tree can significantly affect the performance
1624 * of your app. It should not be enabled by default.
1626 * @platform darwin,win32
1628 accessibilitySupportEnabled: boolean;
1630 * A `Menu | null` property that returns `Menu` if one has been set and `null`
1631 * otherwise. Users can pass a Menu to set this property.
1633 applicationMenu: (Menu) | (null);
1635 * An `Integer` property that returns the badge count for current app. Setting the
1636 * count to `0` will hide the badge.
1638 * On macOS, setting this with any nonzero integer shows on the dock icon. On
1639 * Linux, this property only works for Unity launcher.
1641 * **Note:** Unity launcher requires a `.desktop` file to work. For more
1642 * information, please read the Unity integration documentation.
1644 * **Note:** On macOS, you need to ensure that your application has the permission
1645 * to display notifications for this property to take effect.
1647 * @platform linux,darwin
1651 * A `CommandLine` object that allows you to read and manipulate the command line
1652 * arguments that Chromium uses.
1655 readonly commandLine: CommandLine;
1657 * A `Dock` `| undefined` object that allows you to perform actions on your app
1658 * icon in the user's dock on macOS.
1662 readonly dock: Dock;
1664 * A `boolean` property that returns `true` if the app is packaged, `false`
1665 * otherwise. For many apps, this property can be used to distinguish development
1666 * and production environments.
1669 readonly isPackaged: boolean;
1671 * A `string` property that indicates the current application's name, which is the
1672 * name in the application's `package.json` file.
1674 * Usually the `name` field of `package.json` is a short lowercase name, according
1675 * to the npm modules spec. You should usually also specify a `productName` field,
1676 * which is your application's full capitalized name, and which will be preferred
1677 * over `name` by Electron.
1681 * A `boolean` which when `true` indicates that the app is currently running under
1682 * an ARM64 translator (like the macOS Rosetta Translator Environment or Windows
1685 * You can use this property to prompt users to download the arm64 version of your
1686 * application when they are mistakenly running the x64 version under Rosetta or
1689 * @platform darwin,win32
1691 readonly runningUnderARM64Translation: boolean;
1693 * A `string` which is the user agent string Electron will use as a global
1696 * This is the user agent that will be used when no user agent is set at the
1697 * `webContents` or `session` level. It is useful for ensuring that your entire
1698 * app has the same user agent. Set to a custom value as early as possible in your
1699 * app's initialization to ensure that your overridden value is used.
1701 userAgentFallback: string;
1704 interface AutoUpdater extends NodeJS.EventEmitter {
1706 // Docs: https://electronjs.org/docs/api/auto-updater
1709 * This event is emitted after a user calls `quitAndInstall()`.
1711 * When this API is called, the `before-quit` event is not emitted before all
1712 * windows are closed. As a result you should listen to this event if you wish to
1713 * perform actions before the windows are closed while a process is quitting, as
1714 * well as listening to `before-quit`.
1716 on(event: 'before-quit-for-update', listener: Function): this;
1717 off(event: 'before-quit-for-update', listener: Function): this;
1718 once(event: 'before-quit-for-update', listener: Function): this;
1719 addListener(event: 'before-quit-for-update', listener: Function): this;
1720 removeListener(event: 'before-quit-for-update', listener: Function): this;
1722 * Emitted when checking if an update has started.
1724 on(event: 'checking-for-update', listener: Function): this;
1725 off(event: 'checking-for-update', listener: Function): this;
1726 once(event: 'checking-for-update', listener: Function): this;
1727 addListener(event: 'checking-for-update', listener: Function): this;
1728 removeListener(event: 'checking-for-update', listener: Function): this;
1730 * Emitted when there is an error while updating.
1732 on(event: 'error', listener: (error: Error) => void): this;
1733 off(event: 'error', listener: (error: Error) => void): this;
1734 once(event: 'error', listener: (error: Error) => void): this;
1735 addListener(event: 'error', listener: (error: Error) => void): this;
1736 removeListener(event: 'error', listener: (error: Error) => void): this;
1738 * Emitted when there is an available update. The update is downloaded
1741 on(event: 'update-available', listener: Function): this;
1742 off(event: 'update-available', listener: Function): this;
1743 once(event: 'update-available', listener: Function): this;
1744 addListener(event: 'update-available', listener: Function): this;
1745 removeListener(event: 'update-available', listener: Function): this;
1747 * Emitted when an update has been downloaded.
1749 * On Windows only `releaseName` is available.
1751 * **Note:** It is not strictly necessary to handle this event. A successfully
1752 * downloaded update will still be applied the next time the application starts.
1754 on(event: 'update-downloaded', listener: (event: Event,
1755 releaseNotes: string,
1756 releaseName: string,
1758 updateURL: string) => void): this;
1759 off(event: 'update-downloaded', listener: (event: Event,
1760 releaseNotes: string,
1761 releaseName: string,
1763 updateURL: string) => void): this;
1764 once(event: 'update-downloaded', listener: (event: Event,
1765 releaseNotes: string,
1766 releaseName: string,
1768 updateURL: string) => void): this;
1769 addListener(event: 'update-downloaded', listener: (event: Event,
1770 releaseNotes: string,
1771 releaseName: string,
1773 updateURL: string) => void): this;
1774 removeListener(event: 'update-downloaded', listener: (event: Event,
1775 releaseNotes: string,
1776 releaseName: string,
1778 updateURL: string) => void): this;
1780 * Emitted when there is no available update.
1782 on(event: 'update-not-available', listener: Function): this;
1783 off(event: 'update-not-available', listener: Function): this;
1784 once(event: 'update-not-available', listener: Function): this;
1785 addListener(event: 'update-not-available', listener: Function): this;
1786 removeListener(event: 'update-not-available', listener: Function): this;
1788 * Asks the server whether there is an update. You must call `setFeedURL` before
1791 * **Note:** If an update is available it will be downloaded automatically. Calling
1792 * `autoUpdater.checkForUpdates()` twice will download the update two times.
1794 checkForUpdates(): void;
1796 * The current update feed URL.
1798 getFeedURL(): string;
1800 * Restarts the app and installs the update after it has been downloaded. It should
1801 * only be called after `update-downloaded` has been emitted.
1803 * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
1804 * windows first, and automatically call `app.quit()` after all windows have been
1807 * **Note:** It is not strictly necessary to call this function to apply an update,
1808 * as a successfully downloaded update will always be applied the next time the
1809 * application starts.
1811 quitAndInstall(): void;
1813 * Sets the `url` and initialize the auto updater.
1815 setFeedURL(options: FeedURLOptions): void;
1818 interface BluetoothDevice {
1820 // Docs: https://electronjs.org/docs/api/structures/bluetooth-device
1828 // Docs: https://electronjs.org/docs/api/browser-view
1833 constructor(options?: BrowserViewConstructorOptions);
1835 * The `bounds` of this BrowserView instance as `Object`.
1839 getBounds(): Rectangle;
1843 setAutoResize(options: AutoResizeOptions): void;
1845 * Examples of valid `color` values:
1850 * * #ffffff (RRGGBB)
1851 * * #ffffffff (AARRGGBB)
1853 * * rgb(([\d]+),\s*([\d]+),\s*([\d]+))
1854 * * e.g. rgb(255, 255, 255)
1856 * * rgba(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+))
1857 * * e.g. rgba(255, 255, 255, 1.0)
1859 * * hsl((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%)
1860 * * e.g. hsl(200, 20%, 50%)
1862 * * hsla((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+))
1863 * * e.g. hsla(200, 20%, 50%, 0.5)
1865 * * Options are listed in SkParseColor.cpp
1866 * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
1867 * * e.g. `blueviolet` or `red`
1869 * **Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBA` or
1874 setBackgroundColor(color: string): void;
1876 * Resizes and moves the view to the supplied bounds relative to the window.
1880 setBounds(bounds: Rectangle): void;
1882 * A `WebContents` object owned by this view.
1886 webContents: WebContents;
1889 class BrowserWindow extends NodeEventEmitter {
1891 // Docs: https://electronjs.org/docs/api/browser-window
1894 * Emitted when the window is set or unset to show always on top of other windows.
1896 on(event: 'always-on-top-changed', listener: (event: Event,
1897 isAlwaysOnTop: boolean) => void): this;
1898 off(event: 'always-on-top-changed', listener: (event: Event,
1899 isAlwaysOnTop: boolean) => void): this;
1900 once(event: 'always-on-top-changed', listener: (event: Event,
1901 isAlwaysOnTop: boolean) => void): this;
1902 addListener(event: 'always-on-top-changed', listener: (event: Event,
1903 isAlwaysOnTop: boolean) => void): this;
1904 removeListener(event: 'always-on-top-changed', listener: (event: Event,
1905 isAlwaysOnTop: boolean) => void): this;
1907 * Emitted when an App Command is invoked. These are typically related to keyboard
1908 * media keys or browser commands, as well as the "Back" button built into some
1911 * Commands are lowercased, underscores are replaced with hyphens, and the
1912 * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
1913 * emitted as `browser-backward`.
1915 * The following app commands are explicitly supported on Linux:
1917 * * `browser-backward`
1918 * * `browser-forward`
1920 * @platform win32,linux
1922 on(event: 'app-command', listener: (event: Event,
1923 command: string) => void): this;
1924 off(event: 'app-command', listener: (event: Event,
1925 command: string) => void): this;
1926 once(event: 'app-command', listener: (event: Event,
1927 command: string) => void): this;
1928 addListener(event: 'app-command', listener: (event: Event,
1929 command: string) => void): this;
1930 removeListener(event: 'app-command', listener: (event: Event,
1931 command: string) => void): this;
1933 * Emitted when the window loses focus.
1935 on(event: 'blur', listener: Function): this;
1936 off(event: 'blur', listener: Function): this;
1937 once(event: 'blur', listener: Function): this;
1938 addListener(event: 'blur', listener: Function): this;
1939 removeListener(event: 'blur', listener: Function): this;
1941 * Emitted when the window is going to be closed. It's emitted before the
1942 * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
1943 * will cancel the close.
1945 * Usually you would want to use the `beforeunload` handler to decide whether the
1946 * window should be closed, which will also be called when the window is reloaded.
1947 * In Electron, returning any value other than `undefined` would cancel the close.
1950 * _**Note**: There is a subtle difference between the behaviors of
1951 * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
1952 * handler)`. It is recommended to always set the `event.returnValue` explicitly,
1953 * instead of only returning a value, as the former works more consistently within
1956 on(event: 'close', listener: (event: Event) => void): this;
1957 off(event: 'close', listener: (event: Event) => void): this;
1958 once(event: 'close', listener: (event: Event) => void): this;
1959 addListener(event: 'close', listener: (event: Event) => void): this;
1960 removeListener(event: 'close', listener: (event: Event) => void): this;
1962 * Emitted when the window is closed. After you have received this event you should
1963 * remove the reference to the window and avoid using it any more.
1965 on(event: 'closed', listener: Function): this;
1966 off(event: 'closed', listener: Function): this;
1967 once(event: 'closed', listener: Function): this;
1968 addListener(event: 'closed', listener: Function): this;
1969 removeListener(event: 'closed', listener: Function): this;
1971 * Emitted when the window enters a full-screen state.
1973 on(event: 'enter-full-screen', listener: Function): this;
1974 off(event: 'enter-full-screen', listener: Function): this;
1975 once(event: 'enter-full-screen', listener: Function): this;
1976 addListener(event: 'enter-full-screen', listener: Function): this;
1977 removeListener(event: 'enter-full-screen', listener: Function): this;
1979 * Emitted when the window enters a full-screen state triggered by HTML API.
1981 on(event: 'enter-html-full-screen', listener: Function): this;
1982 off(event: 'enter-html-full-screen', listener: Function): this;
1983 once(event: 'enter-html-full-screen', listener: Function): this;
1984 addListener(event: 'enter-html-full-screen', listener: Function): this;
1985 removeListener(event: 'enter-html-full-screen', listener: Function): this;
1987 * Emitted when the window gains focus.
1989 on(event: 'focus', listener: Function): this;
1990 off(event: 'focus', listener: Function): this;
1991 once(event: 'focus', listener: Function): this;
1992 addListener(event: 'focus', listener: Function): this;
1993 removeListener(event: 'focus', listener: Function): this;
1995 * Emitted when the window is hidden.
1997 on(event: 'hide', listener: Function): this;
1998 off(event: 'hide', listener: Function): this;
1999 once(event: 'hide', listener: Function): this;
2000 addListener(event: 'hide', listener: Function): this;
2001 removeListener(event: 'hide', listener: Function): this;
2003 * Emitted when the window leaves a full-screen state.
2005 on(event: 'leave-full-screen', listener: Function): this;
2006 off(event: 'leave-full-screen', listener: Function): this;
2007 once(event: 'leave-full-screen', listener: Function): this;
2008 addListener(event: 'leave-full-screen', listener: Function): this;
2009 removeListener(event: 'leave-full-screen', listener: Function): this;
2011 * Emitted when the window leaves a full-screen state triggered by HTML API.
2013 on(event: 'leave-html-full-screen', listener: Function): this;
2014 off(event: 'leave-html-full-screen', listener: Function): this;
2015 once(event: 'leave-html-full-screen', listener: Function): this;
2016 addListener(event: 'leave-html-full-screen', listener: Function): this;
2017 removeListener(event: 'leave-html-full-screen', listener: Function): this;
2019 * Emitted when window is maximized.
2021 on(event: 'maximize', listener: Function): this;
2022 off(event: 'maximize', listener: Function): this;
2023 once(event: 'maximize', listener: Function): this;
2024 addListener(event: 'maximize', listener: Function): this;
2025 removeListener(event: 'maximize', listener: Function): this;
2027 * Emitted when the window is minimized.
2029 on(event: 'minimize', listener: Function): this;
2030 off(event: 'minimize', listener: Function): this;
2031 once(event: 'minimize', listener: Function): this;
2032 addListener(event: 'minimize', listener: Function): this;
2033 removeListener(event: 'minimize', listener: Function): this;
2035 * Emitted when the window is being moved to a new position.
2037 on(event: 'move', listener: Function): this;
2038 off(event: 'move', listener: Function): this;
2039 once(event: 'move', listener: Function): this;
2040 addListener(event: 'move', listener: Function): this;
2041 removeListener(event: 'move', listener: Function): this;
2043 * Emitted once when the window is moved to a new position.
2045 * **Note**: On macOS this event is an alias of `move`.
2047 * @platform darwin,win32
2049 on(event: 'moved', listener: Function): this;
2050 off(event: 'moved', listener: Function): this;
2051 once(event: 'moved', listener: Function): this;
2052 addListener(event: 'moved', listener: Function): this;
2053 removeListener(event: 'moved', listener: Function): this;
2055 * Emitted when the native new tab button is clicked.
2059 on(event: 'new-window-for-tab', listener: Function): this;
2060 off(event: 'new-window-for-tab', listener: Function): this;
2061 once(event: 'new-window-for-tab', listener: Function): this;
2062 addListener(event: 'new-window-for-tab', listener: Function): this;
2063 removeListener(event: 'new-window-for-tab', listener: Function): this;
2065 * Emitted when the document changed its title, calling `event.preventDefault()`
2066 * will prevent the native window's title from changing. `explicitSet` is false
2067 * when title is synthesized from file URL.
2069 on(event: 'page-title-updated', listener: (event: Event,
2071 explicitSet: boolean) => void): this;
2072 off(event: 'page-title-updated', listener: (event: Event,
2074 explicitSet: boolean) => void): this;
2075 once(event: 'page-title-updated', listener: (event: Event,
2077 explicitSet: boolean) => void): this;
2078 addListener(event: 'page-title-updated', listener: (event: Event,
2080 explicitSet: boolean) => void): this;
2081 removeListener(event: 'page-title-updated', listener: (event: Event,
2083 explicitSet: boolean) => void): this;
2085 * Emitted when the web page has been rendered (while not being shown) and window
2086 * can be displayed without a visual flash.
2088 * Please note that using this event implies that the renderer will be considered
2089 * "visible" and paint even though `show` is false. This event will never fire if
2090 * you use `paintWhenInitiallyHidden: false`
2092 on(event: 'ready-to-show', listener: Function): this;
2093 off(event: 'ready-to-show', listener: Function): this;
2094 once(event: 'ready-to-show', listener: Function): this;
2095 addListener(event: 'ready-to-show', listener: Function): this;
2096 removeListener(event: 'ready-to-show', listener: Function): this;
2098 * Emitted after the window has been resized.
2100 on(event: 'resize', listener: Function): this;
2101 off(event: 'resize', listener: Function): this;
2102 once(event: 'resize', listener: Function): this;
2103 addListener(event: 'resize', listener: Function): this;
2104 removeListener(event: 'resize', listener: Function): this;
2106 * Emitted once when the window has finished being resized.
2108 * This is usually emitted when the window has been resized manually. On macOS,
2109 * resizing the window with `setBounds`/`setSize` and setting the `animate`
2110 * parameter to `true` will also emit this event once resizing has finished.
2112 * @platform darwin,win32
2114 on(event: 'resized', listener: Function): this;
2115 off(event: 'resized', listener: Function): this;
2116 once(event: 'resized', listener: Function): this;
2117 addListener(event: 'resized', listener: Function): this;
2118 removeListener(event: 'resized', listener: Function): this;
2120 * Emitted when the unresponsive web page becomes responsive again.
2122 on(event: 'responsive', listener: Function): this;
2123 off(event: 'responsive', listener: Function): this;
2124 once(event: 'responsive', listener: Function): this;
2125 addListener(event: 'responsive', listener: Function): this;
2126 removeListener(event: 'responsive', listener: Function): this;
2128 * Emitted when the window is restored from a minimized state.
2130 on(event: 'restore', listener: Function): this;
2131 off(event: 'restore', listener: Function): this;
2132 once(event: 'restore', listener: Function): this;
2133 addListener(event: 'restore', listener: Function): this;
2134 removeListener(event: 'restore', listener: Function): this;
2136 * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
2137 * is ended. The `rotation` value on each emission is the angle in degrees rotated
2138 * since the last emission. The last emitted event upon a rotation gesture will
2139 * always be of value `0`. Counter-clockwise rotation values are positive, while
2140 * clockwise ones are negative.
2144 on(event: 'rotate-gesture', listener: (event: Event,
2145 rotation: number) => void): this;
2146 off(event: 'rotate-gesture', listener: (event: Event,
2147 rotation: number) => void): this;
2148 once(event: 'rotate-gesture', listener: (event: Event,
2149 rotation: number) => void): this;
2150 addListener(event: 'rotate-gesture', listener: (event: Event,
2151 rotation: number) => void): this;
2152 removeListener(event: 'rotate-gesture', listener: (event: Event,
2153 rotation: number) => void): this;
2155 * Emitted when window session is going to end due to force shutdown or machine
2156 * restart or session log off.
2160 on(event: 'session-end', listener: Function): this;
2161 off(event: 'session-end', listener: Function): this;
2162 once(event: 'session-end', listener: Function): this;
2163 addListener(event: 'session-end', listener: Function): this;
2164 removeListener(event: 'session-end', listener: Function): this;
2166 * Emitted when the window opens a sheet.
2170 on(event: 'sheet-begin', listener: Function): this;
2171 off(event: 'sheet-begin', listener: Function): this;
2172 once(event: 'sheet-begin', listener: Function): this;
2173 addListener(event: 'sheet-begin', listener: Function): this;
2174 removeListener(event: 'sheet-begin', listener: Function): this;
2176 * Emitted when the window has closed a sheet.
2180 on(event: 'sheet-end', listener: Function): this;
2181 off(event: 'sheet-end', listener: Function): this;
2182 once(event: 'sheet-end', listener: Function): this;
2183 addListener(event: 'sheet-end', listener: Function): this;
2184 removeListener(event: 'sheet-end', listener: Function): this;
2186 * Emitted when the window is shown.
2188 on(event: 'show', listener: Function): this;
2189 off(event: 'show', listener: Function): this;
2190 once(event: 'show', listener: Function): this;
2191 addListener(event: 'show', listener: Function): this;
2192 removeListener(event: 'show', listener: Function): this;
2194 * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
2197 * The method underlying this event is built to handle older macOS-style trackpad
2198 * swiping, where the content on the screen doesn't move with the swipe. Most macOS
2199 * trackpads are not configured to allow this kind of swiping anymore, so in order
2200 * for it to emit properly the 'Swipe between pages' preference in `System
2201 * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
2206 on(event: 'swipe', listener: (event: Event,
2207 direction: string) => void): this;
2208 off(event: 'swipe', listener: (event: Event,
2209 direction: string) => void): this;
2210 once(event: 'swipe', listener: (event: Event,
2211 direction: string) => void): this;
2212 addListener(event: 'swipe', listener: (event: Event,
2213 direction: string) => void): this;
2214 removeListener(event: 'swipe', listener: (event: Event,
2215 direction: string) => void): this;
2217 * Emitted when the system context menu is triggered on the window, this is
2218 * normally only triggered when the user right clicks on the non-client area of
2219 * your window. This is the window titlebar or any area you have declared as
2220 * `-webkit-app-region: drag` in a frameless window.
2222 * Calling `event.preventDefault()` will prevent the menu from being displayed.
2226 on(event: 'system-context-menu', listener: (event: Event,
2228 * The screen coordinates the context menu was triggered at
2230 point: Point) => void): this;
2231 off(event: 'system-context-menu', listener: (event: Event,
2233 * The screen coordinates the context menu was triggered at
2235 point: Point) => void): this;
2236 once(event: 'system-context-menu', listener: (event: Event,
2238 * The screen coordinates the context menu was triggered at
2240 point: Point) => void): this;
2241 addListener(event: 'system-context-menu', listener: (event: Event,
2243 * The screen coordinates the context menu was triggered at
2245 point: Point) => void): this;
2246 removeListener(event: 'system-context-menu', listener: (event: Event,
2248 * The screen coordinates the context menu was triggered at
2250 point: Point) => void): this;
2252 * Emitted when the window exits from a maximized state.
2254 on(event: 'unmaximize', listener: Function): this;
2255 off(event: 'unmaximize', listener: Function): this;
2256 once(event: 'unmaximize', listener: Function): this;
2257 addListener(event: 'unmaximize', listener: Function): this;
2258 removeListener(event: 'unmaximize', listener: Function): this;
2260 * Emitted when the web page becomes unresponsive.
2262 on(event: 'unresponsive', listener: Function): this;
2263 off(event: 'unresponsive', listener: Function): this;
2264 once(event: 'unresponsive', listener: Function): this;
2265 addListener(event: 'unresponsive', listener: Function): this;
2266 removeListener(event: 'unresponsive', listener: Function): this;
2268 * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
2269 * will prevent the window from being moved.
2271 * Note that this is only emitted when the window is being moved manually. Moving
2272 * the window with `setPosition`/`setBounds`/`center` will not emit this event.
2274 * @platform darwin,win32
2276 on(event: 'will-move', listener: (event: Event,
2278 * Location the window is being moved to.
2280 newBounds: Rectangle) => void): this;
2281 off(event: 'will-move', listener: (event: Event,
2283 * Location the window is being moved to.
2285 newBounds: Rectangle) => void): this;
2286 once(event: 'will-move', listener: (event: Event,
2288 * Location the window is being moved to.
2290 newBounds: Rectangle) => void): this;
2291 addListener(event: 'will-move', listener: (event: Event,
2293 * Location the window is being moved to.
2295 newBounds: Rectangle) => void): this;
2296 removeListener(event: 'will-move', listener: (event: Event,
2298 * Location the window is being moved to.
2300 newBounds: Rectangle) => void): this;
2302 * Emitted before the window is resized. Calling `event.preventDefault()` will
2303 * prevent the window from being resized.
2305 * Note that this is only emitted when the window is being resized manually.
2306 * Resizing the window with `setBounds`/`setSize` will not emit this event.
2308 * The possible values and behaviors of the `edge` option are platform dependent.
2309 * Possible values are:
2311 * * On Windows, possible values are `bottom`, `top`, `left`, `right`, `top-left`,
2312 * `top-right`, `bottom-left`, `bottom-right`.
2313 * * On macOS, possible values are `bottom` and `right`.
2314 * * The value `bottom` is used to denote vertical resizing.
2315 * * The value `right` is used to denote horizontal resizing.
2317 * @platform darwin,win32
2319 on(event: 'will-resize', listener: (event: Event,
2321 * Size the window is being resized to.
2323 newBounds: Rectangle,
2324 details: WillResizeDetails) => void): this;
2325 off(event: 'will-resize', listener: (event: Event,
2327 * Size the window is being resized to.
2329 newBounds: Rectangle,
2330 details: WillResizeDetails) => void): this;
2331 once(event: 'will-resize', listener: (event: Event,
2333 * Size the window is being resized to.
2335 newBounds: Rectangle,
2336 details: WillResizeDetails) => void): this;
2337 addListener(event: 'will-resize', listener: (event: Event,
2339 * Size the window is being resized to.
2341 newBounds: Rectangle,
2342 details: WillResizeDetails) => void): this;
2343 removeListener(event: 'will-resize', listener: (event: Event,
2345 * Size the window is being resized to.
2347 newBounds: Rectangle,
2348 details: WillResizeDetails) => void): this;
2352 constructor(options?: BrowserWindowConstructorOptions);
2354 * The window that owns the given `browserView`. If the given view is not attached
2355 * to any window, returns `null`.
2357 static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
2359 * The window with the given `id`.
2361 static fromId(id: number): (BrowserWindow) | (null);
2363 * The window that owns the given `webContents` or `null` if the contents are not
2364 * owned by a window.
2366 static fromWebContents(webContents: WebContents): (BrowserWindow) | (null);
2368 * An array of all opened browser windows.
2370 static getAllWindows(): BrowserWindow[];
2372 * The window that is focused in this application, otherwise returns `null`.
2374 static getFocusedWindow(): (BrowserWindow) | (null);
2376 * Replacement API for setBrowserView supporting work with multi browser views.
2380 addBrowserView(browserView: BrowserView): void;
2382 * Adds a window as a tab on this window, after the tab for the window instance.
2386 addTabbedWindow(browserWindow: BrowserWindow): void;
2388 * Removes focus from the window.
2391 blurWebView(): void;
2393 * Resolves with a NativeImage
2395 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
2396 * whole visible page. If the page is not visible, `rect` may be empty. The page is
2397 * considered visible when its browser window is hidden and the capturer count is
2398 * non-zero. If you would like the page to stay hidden, you should ensure that
2399 * `stayHidden` is set to true.
2401 capturePage(rect?: Rectangle, opts?: Opts): Promise<Electron.NativeImage>;
2403 * Moves window to the center of the screen.
2407 * Try to close the window. This has the same effect as a user manually clicking
2408 * the close button of the window. The web page may cancel the close though. See
2413 * Closes the currently open Quick Look panel.
2417 closeFilePreview(): void;
2419 * Force closing the window, the `unload` and `beforeunload` event won't be emitted
2420 * for the web page, and `close` event will also not be emitted for this window,
2421 * but it guarantees the `closed` event will be emitted.
2425 * Starts or stops flashing the window to attract user's attention.
2427 flashFrame(flag: boolean): void;
2429 * Focuses on the window.
2432 focusOnWebView(): void;
2434 * Gets the background color of the window in Hex (`#RRGGBB`) format.
2436 * See Setting `backgroundColor`.
2438 * **Note:** The alpha value is _not_ returned alongside the red, green, and blue
2441 getBackgroundColor(): string;
2443 * The `bounds` of the window as `Object`.
2445 * **Note:** On macOS, the y-coordinate value returned will be at minimum the Tray
2446 * height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height:
2447 * 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x:
2448 * 25, y: 38, width: 800, height: 600 }`.
2450 getBounds(): Rectangle;
2452 * The `BrowserView` attached to `win`. Returns `null` if one is not attached.
2453 * Throws an error if multiple `BrowserView`s are attached.
2457 getBrowserView(): (BrowserView) | (null);
2459 * a sorted by z-index array of all BrowserViews that have been attached with
2460 * `addBrowserView` or `setBrowserView`. The top-most BrowserView is the last
2461 * element of the array.
2463 * **Note:** The BrowserView API is currently experimental and may change or be
2464 * removed in future Electron releases.
2468 getBrowserViews(): BrowserView[];
2470 * All child windows.
2472 getChildWindows(): BrowserWindow[];
2474 * The `bounds` of the window's client area as `Object`.
2476 getContentBounds(): Rectangle;
2478 * Contains the window's client area's width and height.
2480 getContentSize(): number[];
2482 * Contains the window's maximum width and height.
2484 getMaximumSize(): number[];
2486 * Window id in the format of DesktopCapturerSource's id. For example
2489 * More precisely the format is `window:id:other_id` where `id` is `HWND` on
2490 * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
2491 * Linux. `other_id` is used to identify web contents (tabs) so within the same top
2494 getMediaSourceId(): string;
2496 * Contains the window's minimum width and height.
2498 getMinimumSize(): number[];
2500 * The platform-specific handle of the window.
2502 * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
2503 * `Window` (`unsigned long`) on Linux.
2505 getNativeWindowHandle(): Buffer;
2507 * Contains the window bounds of the normal state
2509 * **Note:** whatever the current state of the window : maximized, minimized or in
2510 * fullscreen, this function always returns the position and size of the window in
2511 * normal state. In normal state, getBounds and getNormalBounds returns the same
2514 getNormalBounds(): Rectangle;
2516 * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
2519 getOpacity(): number;
2521 * The parent window or `null` if there is no parent.
2523 getParentWindow(): (BrowserWindow) | (null);
2525 * Contains the window's current position.
2527 getPosition(): number[];
2529 * The pathname of the file the window represents.
2533 getRepresentedFilename(): string;
2535 * Contains the window's width and height.
2537 getSize(): number[];
2539 * The title of the native window.
2541 * **Note:** The title of the web page can be different from the title of the
2546 * The custom position for the traffic light buttons in frameless window, `null`
2547 * will be returned when there is no custom position.
2551 getWindowButtonPosition(): (Point) | (null);
2553 * Whether the window has a shadow.
2555 hasShadow(): boolean;
2561 * Hooks a windows message. The `callback` is called when the message is received
2566 hookWindowMessage(message: number, callback: (wParam: Buffer, lParam: Buffer) => void): void;
2568 * Invalidates the window shadow so that it is recomputed based on the current
2571 * `BrowserWindows` that are transparent can sometimes leave behind visual
2572 * artifacts on macOS. This method can be used to clear these artifacts when, for
2573 * example, performing an animation.
2577 invalidateShadow(): void;
2579 * Whether the window is always on top of other windows.
2581 isAlwaysOnTop(): boolean;
2583 * Whether the window can be manually closed by user.
2585 * On Linux always returns `true`.
2587 * @platform darwin,win32
2589 isClosable(): boolean;
2591 * Whether the window is destroyed.
2593 isDestroyed(): boolean;
2595 * Whether the window's document has been edited.
2599 isDocumentEdited(): boolean;
2601 * whether the window is enabled.
2603 isEnabled(): boolean;
2605 * Whether the window can be focused.
2607 * @platform darwin,win32
2609 isFocusable(): boolean;
2611 * Whether the window is focused.
2613 isFocused(): boolean;
2615 * Whether the window is in fullscreen mode.
2617 isFullScreen(): boolean;
2619 * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
2622 isFullScreenable(): boolean;
2624 * Whether the window will be hidden when the user toggles into mission control.
2628 isHiddenInMissionControl(): boolean;
2630 * Whether the window is in kiosk mode.
2634 * Whether the window can be manually maximized by user.
2636 * On Linux always returns `true`.
2638 * @platform darwin,win32
2640 isMaximizable(): boolean;
2642 * Whether the window is maximized.
2644 isMaximized(): boolean;
2646 * Whether menu bar automatically hides itself.
2648 * @platform win32,linux
2650 isMenuBarAutoHide(): boolean;
2652 * Whether the menu bar is visible.
2654 * @platform win32,linux
2656 isMenuBarVisible(): boolean;
2658 * Whether the window can be manually minimized by the user.
2660 * On Linux always returns `true`.
2662 * @platform darwin,win32
2664 isMinimizable(): boolean;
2666 * Whether the window is minimized.
2668 isMinimized(): boolean;
2670 * Whether current window is a modal window.
2674 * Whether the window can be moved by user.
2676 * On Linux always returns `true`.
2678 * @platform darwin,win32
2680 isMovable(): boolean;
2682 * Whether the window is in normal state (not maximized, not minimized, not in
2685 isNormal(): boolean;
2687 * Whether the window can be manually resized by the user.
2689 isResizable(): boolean;
2691 * Whether the window is in simple (pre-Lion) fullscreen mode.
2695 isSimpleFullScreen(): boolean;
2697 * Whether the window is in Windows 10 tablet mode.
2699 * Since Windows 10 users can use their PC as tablet, under this mode apps can
2700 * choose to optimize their UI for tablets, such as enlarging the titlebar and
2701 * hiding titlebar buttons.
2703 * This API returns whether the window is in tablet mode, and the `resize` event
2704 * can be be used to listen to changes to tablet mode.
2708 isTabletMode(): boolean;
2710 * Whether the window is visible to the user in the foreground of the app.
2712 isVisible(): boolean;
2714 * Whether the window is visible on all workspaces.
2716 * **Note:** This API always returns false on Windows.
2718 * @platform darwin,linux
2720 isVisibleOnAllWorkspaces(): boolean;
2722 * `true` or `false` depending on whether the message is hooked.
2726 isWindowMessageHooked(message: number): boolean;
2728 * the promise will resolve when the page has finished loading (see
2729 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
2731 * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
2732 * relative to the root of your application. See the `webContents` docs for more
2735 loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
2737 * the promise will resolve when the page has finished loading (see
2738 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
2740 * Same as `webContents.loadURL(url[, options])`.
2742 * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
2743 * file using the `file://` protocol.
2745 * To ensure that file URLs are properly formatted, it is recommended to use Node's
2746 * `url.format` method:
2748 * You can load a URL using a `POST` request with URL-encoded data by doing the
2751 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
2753 * Maximizes the window. This will also show (but not focus) the window if it isn't
2754 * being displayed already.
2758 * Merges all windows into one window with multiple tabs when native tabs are
2759 * enabled and there is more than one open window.
2763 mergeAllWindows(): void;
2765 * Minimizes the window. On some platforms the minimized window will be shown in
2770 * Moves window above the source window in the sense of z-order. If the
2771 * `mediaSourceId` is not of type window or if the window does not exist then this
2772 * method throws an error.
2774 moveAbove(mediaSourceId: string): void;
2776 * Moves the current tab into a new window if native tabs are enabled and there is
2777 * more than one tab in the current window.
2781 moveTabToNewWindow(): void;
2783 * Moves window to top(z-order) regardless of focus
2787 * Uses Quick Look to preview a file at a given path.
2791 previewFile(path: string, displayName?: string): void;
2793 * Same as `webContents.reload`.
2799 removeBrowserView(browserView: BrowserView): void;
2801 * Remove the window's menu bar.
2803 * @platform linux,win32
2807 * Restores the window from minimized state to its previous state.
2811 * Selects the next tab when native tabs are enabled and there are other tabs in
2816 selectNextTab(): void;
2818 * Selects the previous tab when native tabs are enabled and there are other tabs
2823 selectPreviousTab(): void;
2825 * Sets whether the window should show always on top of other windows. After
2826 * setting this, the window is still a normal window, not a toolbox window which
2827 * can not be focused on.
2829 setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
2831 * Sets the properties for the window's taskbar button.
2833 * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
2834 * together. If one of those properties is not set, then neither will be used.
2838 setAppDetails(options: AppDetailsOptions): void;
2840 * This will make a window maintain an aspect ratio. The extra size allows a
2841 * developer to have space, specified in pixels, not included within the aspect
2842 * ratio calculations. This API already takes into account the difference between a
2843 * window's size and its content size.
2845 * Consider a normal window with an HD video player and associated controls.
2846 * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
2847 * on the right edge and 50 pixels of controls below the player. In order to
2848 * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
2849 * the player itself we would call this function with arguments of 16/9 and {
2850 * width: 40, height: 50 }. The second argument doesn't care where the extra width
2851 * and height are within the content view--only that they exist. Sum any extra
2852 * width and height areas you have within the overall content view.
2854 * The aspect ratio is not respected when window is resized programmatically with
2855 * APIs like `win.setSize`.
2857 * To reset an aspect ratio, pass 0 as the `aspectRatio` value:
2858 * `win.setAspectRatio(0)`.
2860 setAspectRatio(aspectRatio: number, extraSize?: Size): void;
2862 * Controls whether to hide cursor when typing.
2866 setAutoHideCursor(autoHide: boolean): void;
2868 * Sets whether the window menu bar should hide itself automatically. Once set the
2869 * menu bar will only show when users press the single `Alt` key.
2871 * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
2872 * hide it immediately.
2874 * @platform win32,linux
2876 setAutoHideMenuBar(hide: boolean): void;
2878 * Examples of valid `backgroundColor` values:
2881 * * #fff (shorthand RGB)
2882 * * #ffff (shorthand ARGB)
2884 * * #ffffffff (ARGB)
2886 * * rgb(([\d]+),\s*([\d]+),\s*([\d]+))
2887 * * e.g. rgb(255, 255, 255)
2889 * * rgba(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+))
2890 * * e.g. rgba(255, 255, 255, 1.0)
2892 * * hsl((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%)
2893 * * e.g. hsl(200, 20%, 50%)
2895 * * hsla((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+))
2896 * * e.g. hsla(200, 20%, 50%, 0.5)
2898 * * Options are listed in SkParseColor.cpp
2899 * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
2900 * * e.g. `blueviolet` or `red`
2902 * Sets the background color of the window. See Setting `backgroundColor`.
2904 setBackgroundColor(backgroundColor: string): void;
2906 * This method sets the browser window's system-drawn background material,
2907 * including behind the non-client area.
2909 * See the Windows documentation for more details.
2911 * **Note:** This method is only supported on Windows 11 22H2 and up.
2915 setBackgroundMaterial(material: 'auto' | 'none' | 'mica' | 'acrylic' | 'tabbed'): void;
2917 * Resizes and moves the window to the supplied bounds. Any properties that are not
2918 * supplied will default to their current values.
2920 * **Note:** On macOS, the y-coordinate value cannot be smaller than the Tray
2921 * height. The tray height has changed over time and depends on the operating
2922 * system, but is between 20-40px. Passing a value lower than the tray height will
2923 * result in a window that is flush to the tray.
2925 setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
2929 setBrowserView(browserView: (BrowserView) | (null)): void;
2931 * Sets whether the window can be manually closed by user. On Linux does nothing.
2933 * @platform darwin,win32
2935 setClosable(closable: boolean): void;
2937 * Resizes and moves the window's client area (e.g. the web page) to the supplied
2940 setContentBounds(bounds: Rectangle, animate?: boolean): void;
2942 * Prevents the window contents from being captured by other apps.
2944 * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
2945 * it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`. For Windows 10
2946 * version 2004 and up the window will be removed from capture entirely, older
2947 * Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
2949 * @platform darwin,win32
2951 setContentProtection(enable: boolean): void;
2953 * Resizes the window's client area (e.g. the web page) to `width` and `height`.
2955 setContentSize(width: number, height: number, animate?: boolean): void;
2957 * Specifies whether the window’s document has been edited, and the icon in title
2958 * bar will become gray when set to `true`.
2962 setDocumentEdited(edited: boolean): void;
2964 * Disable or enable the window.
2966 setEnabled(enable: boolean): void;
2968 * Changes whether the window can be focused.
2970 * On macOS it does not remove the focus from the window.
2972 * @platform darwin,win32
2974 setFocusable(focusable: boolean): void;
2976 * Sets whether the window should be in fullscreen mode.
2978 * **Note:** On macOS, fullscreen transitions take place asynchronously. If further
2979 * actions depend on the fullscreen state, use the 'enter-full-screen' or
2980 * 'leave-full-screen' events.
2982 setFullScreen(flag: boolean): void;
2984 * Sets whether the maximize/zoom window button toggles fullscreen mode or
2985 * maximizes the window.
2987 setFullScreenable(fullscreenable: boolean): void;
2989 * Sets whether the window should have a shadow.
2991 setHasShadow(hasShadow: boolean): void;
2993 * Sets whether the window will be hidden when the user toggles into mission
2998 setHiddenInMissionControl(hidden: boolean): void;
3000 * Changes window icon.
3002 * @platform win32,linux
3004 setIcon(icon: (NativeImage) | (string)): void;
3006 * Makes the window ignore all mouse events.
3008 * All mouse events happened in this window will be passed to the window below this
3009 * window, but if this window has focus, it will still receive keyboard events.
3011 setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
3013 * Enters or leaves kiosk mode.
3015 setKiosk(flag: boolean): void;
3017 * Sets whether the window can be manually maximized by user. On Linux does
3020 * @platform darwin,win32
3022 setMaximizable(maximizable: boolean): void;
3024 * Sets the maximum size of window to `width` and `height`.
3026 setMaximumSize(width: number, height: number): void;
3028 * Sets the `menu` as the window's menu bar.
3030 * @platform linux,win32
3032 setMenu(menu: (Menu) | (null)): void;
3034 * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
3035 * can still bring up the menu bar by pressing the single `Alt` key.
3037 * @platform win32,linux
3039 setMenuBarVisibility(visible: boolean): void;
3041 * Sets whether the window can be manually minimized by user. On Linux does
3044 * @platform darwin,win32
3046 setMinimizable(minimizable: boolean): void;
3048 * Sets the minimum size of window to `width` and `height`.
3050 setMinimumSize(width: number, height: number): void;
3052 * Sets whether the window can be moved by user. On Linux does nothing.
3054 * @platform darwin,win32
3056 setMovable(movable: boolean): void;
3058 * Sets the opacity of the window. On Linux, does nothing. Out of bound number
3059 * values are clamped to the [0, 1] range.
3061 * @platform win32,darwin
3063 setOpacity(opacity: number): void;
3065 * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
3066 * convey some sort of application status or to passively notify the user.
3070 setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
3072 * Sets `parent` as current window's parent window, passing `null` will turn
3073 * current window into a top-level window.
3075 setParentWindow(parent: (BrowserWindow) | (null)): void;
3077 * Moves window to `x` and `y`.
3079 setPosition(x: number, y: number, animate?: boolean): void;
3081 * Sets progress value in progress bar. Valid range is [0, 1.0].
3083 * Remove progress bar when progress < 0; Change to indeterminate mode when
3086 * On Linux platform, only supports Unity desktop environment, you need to specify
3087 * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
3088 * it will assume `{app.name}.desktop`.
3090 * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
3091 * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
3092 * mode set (but with a value within the valid range), `normal` will be assumed.
3094 setProgressBar(progress: number, options?: ProgressBarOptions): void;
3096 * Sets the pathname of the file the window represents, and the icon of the file
3097 * will show in window's title bar.
3101 setRepresentedFilename(filename: string): void;
3103 * Sets whether the window can be manually resized by the user.
3105 setResizable(resizable: boolean): void;
3107 * Setting a window shape determines the area within the window where the system
3108 * permits drawing and user interaction. Outside of the given region, no pixels
3109 * will be drawn and no mouse events will be registered. Mouse events outside of
3110 * the region will not be received by that window, but will fall through to
3111 * whatever is behind the window.
3114 * @platform win32,linux
3116 setShape(rects: Rectangle[]): void;
3118 * Changes the attachment point for sheets on macOS. By default, sheets are
3119 * attached just below the window frame, but you may want to display them beneath a
3120 * HTML-rendered toolbar. For example:
3124 setSheetOffset(offsetY: number, offsetX?: number): void;
3126 * Enters or leaves simple fullscreen mode.
3128 * Simple fullscreen mode emulates the native fullscreen behavior found in versions
3129 * of macOS prior to Lion (10.7).
3133 setSimpleFullScreen(flag: boolean): void;
3135 * Resizes the window to `width` and `height`. If `width` or `height` are below any
3136 * set minimum size constraints the window will snap to its minimum size.
3138 setSize(width: number, height: number, animate?: boolean): void;
3140 * Makes the window not show in the taskbar.
3142 * @platform darwin,win32
3144 setSkipTaskbar(skip: boolean): void;
3146 * Whether the buttons were added successfully
3148 * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
3149 * of a window in a taskbar button layout. Returns a `boolean` object indicates
3150 * whether the thumbnail has been added successfully.
3152 * The number of buttons in thumbnail toolbar should be no greater than 7 due to
3153 * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
3154 * removed due to the platform's limitation. But you can call the API with an empty
3155 * array to clean the buttons.
3157 * The `buttons` is an array of `Button` objects:
3160 * * `icon` NativeImage - The icon showing in thumbnail toolbar.
3161 * * `click` Function
3162 * * `tooltip` string (optional) - The text of the button's tooltip.
3163 * * `flags` string[] (optional) - Control specific states and behaviors of the
3164 * button. By default, it is `['enabled']`.
3166 * The `flags` is an array that can include following `string`s:
3168 * * `enabled` - The button is active and available to the user.
3169 * * `disabled` - The button is disabled. It is present, but has a visual state
3170 * indicating it will not respond to user action.
3171 * * `dismissonclick` - When the button is clicked, the thumbnail window closes
3173 * * `nobackground` - Do not draw a button border, use only the image.
3174 * * `hidden` - The button is not shown to the user.
3175 * * `noninteractive` - The button is enabled but not interactive; no pressed
3176 * button state is drawn. This value is intended for instances where the button is
3177 * used in a notification.
3181 setThumbarButtons(buttons: ThumbarButton[]): boolean;
3183 * Sets the region of the window to show as the thumbnail image displayed when
3184 * hovering over the window in the taskbar. You can reset the thumbnail to be the
3185 * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
3190 setThumbnailClip(region: Rectangle): void;
3192 * Sets the toolTip that is displayed when hovering over the window thumbnail in
3197 setThumbnailToolTip(toolTip: string): void;
3199 * Changes the title of native window to `title`.
3201 setTitle(title: string): void;
3203 * On a Window with Window Controls Overlay already enabled, this method updates
3204 * the style of the title bar overlay.
3208 setTitleBarOverlay(options: TitleBarOverlayOptions): void;
3210 * Raises `browserView` above other `BrowserView`s attached to `win`. Throws an
3211 * error if `browserView` is not attached to `win`.
3215 setTopBrowserView(browserView: BrowserView): void;
3217 * Sets the touchBar layout for the current window. Specifying `null` or
3218 * `undefined` clears the touch bar. This method only has an effect if the machine
3221 * **Note:** The TouchBar API is currently experimental and may change or be
3222 * removed in future Electron releases.
3226 setTouchBar(touchBar: (TouchBar) | (null)): void;
3228 * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
3229 * will remove the vibrancy effect on the window.
3233 setVibrancy(type: (('titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page')) | (null)): void;
3235 * Sets whether the window should be visible on all workspaces.
3237 * **Note:** This API does nothing on Windows.
3239 * @platform darwin,linux
3241 setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
3243 * Set a custom position for the traffic light buttons in frameless window. Passing
3244 * `null` will reset the position to default.
3248 setWindowButtonPosition(position: (Point) | (null)): void;
3250 * Sets whether the window traffic light buttons should be visible.
3254 setWindowButtonVisibility(visible: boolean): void;
3256 * Shows and gives focus to the window.
3260 * Shows or hides the tab overview when native tabs are enabled.
3264 showAllTabs(): void;
3266 * Same as `webContents.showDefinitionForSelection()`.
3270 showDefinitionForSelection(): void;
3272 * Shows the window but doesn't focus on it.
3274 showInactive(): void;
3276 * Toggles the visibility of the tab bar if native tabs are enabled and there is
3277 * only one tab in the current window.
3281 toggleTabBar(): void;
3283 * Unhooks all of the window messages.
3287 unhookAllWindowMessages(): void;
3289 * Unhook the window message.
3293 unhookWindowMessage(message: number): void;
3295 * Unmaximizes the window.
3299 * A `string` property that defines an alternative title provided only to
3300 * accessibility tools such as screen readers. This string is not directly visible
3303 accessibleTitle: string;
3305 * A `boolean` property that determines whether the window menu bar should hide
3306 * itself automatically. Once set, the menu bar will only show when users press the
3309 * If the menu bar is already visible, setting this property to `true` won't hide
3312 autoHideMenuBar: boolean;
3314 * A `boolean` property that determines whether the window can be manually closed
3317 * On Linux the setter is a no-op, although the getter returns `true`.
3319 * @platform darwin,win32
3323 * A `boolean` property that specifies whether the window’s document has been
3326 * The icon in title bar will become gray when set to `true`.
3330 documentEdited: boolean;
3332 * A `boolean` property that determines whether the window is excluded from the
3333 * application’s Windows menu. `false` by default.
3337 excludedFromShownWindowsMenu: boolean;
3339 * A `boolean` property that determines whether the window is focusable.
3341 * @platform win32,darwin
3345 * A `boolean` property that determines whether the window is in fullscreen mode.
3347 fullScreen: boolean;
3349 * A `boolean` property that determines whether the maximize/zoom window button
3350 * toggles fullscreen mode or maximizes the window.
3352 fullScreenable: boolean;
3354 * A `Integer` property representing the unique ID of the window. Each ID is unique
3355 * among all `BrowserWindow` instances of the entire Electron application.
3358 readonly id: number;
3360 * A `boolean` property that determines whether the window is in kiosk mode.
3364 * A `boolean` property that determines whether the window can be manually
3365 * maximized by user.
3367 * On Linux the setter is a no-op, although the getter returns `true`.
3369 * @platform darwin,win32
3371 maximizable: boolean;
3373 * A `boolean` property that determines whether the menu bar should be visible.
3375 * **Note:** If the menu bar is auto-hide, users can still bring up the menu bar by
3376 * pressing the single `Alt` key.
3378 * @platform win32,linux
3380 menuBarVisible: boolean;
3382 * A `boolean` property that determines whether the window can be manually
3383 * minimized by user.
3385 * On Linux the setter is a no-op, although the getter returns `true`.
3387 * @platform darwin,win32
3389 minimizable: boolean;
3391 * A `boolean` property that determines Whether the window can be moved by user.
3393 * On Linux the setter is a no-op, although the getter returns `true`.
3395 * @platform darwin,win32
3399 * A `string` property that determines the pathname of the file the window
3400 * represents, and the icon of the file will show in window's title bar.
3404 representedFilename: string;
3406 * A `boolean` property that determines whether the window can be manually resized
3411 * A `boolean` property that determines whether the window has a shadow.
3415 * A `boolean` property that determines whether the window is in simple (pre-Lion)
3418 simpleFullScreen: boolean;
3420 * A `string` (optional) property that is equal to the `tabbingIdentifier` passed
3421 * to the `BrowserWindow` constructor or `undefined` if none was set.
3425 readonly tabbingIdentifier?: string;
3427 * A `string` property that determines the title of the native window.
3429 * **Note:** The title of the web page can be different from the title of the
3434 * A `boolean` property that determines whether the window is visible on all
3437 * **Note:** Always returns false on Windows.
3439 * @platform darwin,linux
3441 visibleOnAllWorkspaces: boolean;
3443 * A `WebContents` object this window owns. All web page related events and
3444 * operations will be done via it.
3446 * See the `webContents` documentation for its methods and events.
3449 readonly webContents: WebContents;
3452 interface BrowserWindowConstructorOptions {
3454 // Docs: https://electronjs.org/docs/api/structures/browser-window-options
3457 * Whether clicking an inactive window will also click through to the web contents.
3458 * Default is `false` on macOS. This option is not configurable on other platforms.
3462 acceptFirstMouse?: boolean;
3464 * Whether the window should always stay on top of other windows. Default is
3467 alwaysOnTop?: boolean;
3469 * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
3471 autoHideMenuBar?: boolean;
3473 * The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color
3474 * format. Alpha in #AARRGGBB format is supported if `transparent` is set to
3475 * `true`. Default is `#FFF` (white). See win.setBackgroundColor for more
3478 backgroundColor?: string;
3480 * Set the window's system-drawn background material, including behind the
3481 * non-client area. Can be `auto`, `none`, `mica`, `acrylic` or `tabbed`. See
3482 * win.setBackgroundMaterial for more information.
3486 backgroundMaterial?: ('auto' | 'none' | 'mica' | 'acrylic' | 'tabbed');
3488 * Show window in the center of the screen. Default is `false`.
3492 * Whether window is closable. This is not implemented on Linux. Default is `true`.
3494 * @platform darwin,win32
3498 * Forces using dark theme for the window, only works on some GTK+3 desktop
3499 * environments. Default is `false`.
3501 darkTheme?: boolean;
3503 * Whether to hide cursor when typing. Default is `false`.
3505 disableAutoHideCursor?: boolean;
3507 * Enable the window to be resized larger than screen. Only relevant for macOS, as
3508 * other OSes allow larger-than-screen windows by default. Default is `false`.
3512 enableLargerThanScreen?: boolean;
3514 * Whether the window can be focused. Default is `true`. On Windows setting
3515 * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
3516 * `focusable: false` makes the window stop interacting with wm, so the window will
3517 * always stay on top in all workspaces.
3519 focusable?: boolean;
3521 * Specify `false` to create a frameless window. Default is `true`.
3525 * Whether the window should show in fullscreen. When explicitly set to `false` the
3526 * fullscreen button will be hidden or disabled on macOS. Default is `false`.
3528 fullscreen?: boolean;
3530 * Whether the window can be put into fullscreen mode. On macOS, also whether the
3531 * maximize/zoom button should toggle full screen mode or maximize window. Default
3534 fullscreenable?: boolean;
3536 * Whether window should have a shadow. Default is `true`.
3538 hasShadow?: boolean;
3540 * Window's height in pixels. Default is `600`.
3544 * Whether window should be hidden when the user toggles into mission control.
3548 hiddenInMissionControl?: boolean;
3550 * The window icon. On Windows it is recommended to use `ICO` icons to get best
3551 * visual effects, you can also leave it undefined so the executable's icon will be
3554 icon?: (NativeImage) | (string);
3556 * Whether the window is in kiosk mode. Default is `false`.
3560 * Window's maximum height. Default is no limit.
3564 * Whether window is maximizable. This is not implemented on Linux. Default is
3567 * @platform darwin,win32
3569 maximizable?: boolean;
3571 * Window's maximum width. Default is no limit.
3575 * Window's minimum height. Default is `0`.
3579 * Whether window is minimizable. This is not implemented on Linux. Default is
3582 * @platform darwin,win32
3584 minimizable?: boolean;
3586 * Window's minimum width. Default is `0`.
3590 * Whether this is a modal window. This only works when the window is a child
3591 * window. Default is `false`.
3595 * Whether window is movable. This is not implemented on Linux. Default is `true`.
3597 * @platform darwin,win32
3601 * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
3602 * (fully opaque). This is only implemented on Windows and macOS.
3604 * @platform darwin,win32
3608 * Whether the renderer should be active when `show` is `false` and it has just
3609 * been created. In order for `document.visibilityState` to work correctly on
3610 * first load with `show: false` you should set this to `false`. Setting this to
3611 * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
3613 paintWhenInitiallyHidden?: boolean;
3615 * Specify parent window. Default is `null`.
3617 parent?: BrowserWindow;
3619 * Whether window is resizable. Default is `true`.
3621 resizable?: boolean;
3623 * Whether frameless window should have rounded corners on macOS. Default is
3624 * `true`. Setting this property to `false` will prevent the window from being
3629 roundedCorners?: boolean;
3631 * Whether window should be shown when created. Default is `true`.
3635 * Use pre-Lion fullscreen on macOS. Default is `false`.
3639 simpleFullscreen?: boolean;
3641 * Whether to show the window in taskbar. Default is `false`.
3643 * @platform darwin,win32
3645 skipTaskbar?: boolean;
3647 * Tab group name, allows opening the window as a native tab. Windows with the same
3648 * tabbing identifier will be grouped together. This also adds a native new tab
3649 * button to your window's tab bar and allows your `app` and window to receive the
3650 * `new-window-for-tab` event.
3654 tabbingIdentifier?: string;
3656 * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
3657 * window frame. Setting it to `false` will remove window shadow and window
3658 * animations. Default is `true`.
3660 thickFrame?: boolean;
3662 * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
3663 * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
3667 * When using a frameless window in conjunction with
3668 * `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so
3669 * that the standard window controls ("traffic lights" on macOS) are visible, this
3670 * property enables the Window Controls Overlay JavaScript APIs and CSS Environment
3671 * Variables. Specifying `true` will result in an overlay with default system
3672 * colors. Default is `false`.
3674 titleBarOverlay?: (TitleBarOverlay) | (boolean);
3676 * The style of window title bar. Default is `default`. Possible values are:
3678 * @platform darwin,win32
3680 titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
3682 * Set a custom position for the traffic light buttons in frameless windows.
3686 trafficLightPosition?: Point;
3688 * Makes the window transparent. Default is `false`. On Windows, does not work
3689 * unless the window is frameless.
3691 transparent?: boolean;
3693 * The type of window, default is normal window. See more about this below.
3697 * The `width` and `height` would be used as web page's size, which means the
3698 * actual window's size will include window frame's size and be slightly larger.
3699 * Default is `false`.
3701 useContentSize?: boolean;
3703 * Add a type of vibrancy effect to the window, only on macOS. Can be
3704 * `appearance-based`, `titlebar`, `selection`, `menu`, `popover`, `sidebar`,
3705 * `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`,
3706 * `under-window`, or `under-page`.
3710 vibrancy?: ('appearance-based' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page');
3712 * Specify how the material appearance should reflect window activity state on
3713 * macOS. Must be used with the `vibrancy` property. Possible values are:
3717 visualEffectState?: ('followWindow' | 'active' | 'inactive');
3719 * Settings of web page's features.
3721 webPreferences?: WebPreferences;
3723 * Window's width in pixels. Default is `800`.
3727 * (**required** if y is used) Window's left offset from screen. Default is to
3728 * center the window.
3732 * (**required** if x is used) Window's top offset from screen. Default is to
3733 * center the window.
3737 * Controls the behavior on macOS when option-clicking the green stoplight button
3738 * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
3739 * will grow to the preferred width of the web page when zoomed, `false` will cause
3740 * it to zoom to the width of the screen. This will also affect the behavior when
3741 * calling `maximize()` directly. Default is `false`.
3745 zoomToPageWidth?: boolean;
3748 interface Certificate {
3750 // Docs: https://electronjs.org/docs/api/structures/certificate
3757 * Fingerprint of the certificate
3759 fingerprint: string;
3763 issuer: CertificatePrincipal;
3765 * Issuer certificate (if not self-signed)
3767 issuerCert: Certificate;
3769 * Issuer's Common Name
3773 * Hex value represented string
3775 serialNumber: string;
3779 subject: CertificatePrincipal;
3781 * Subject's Common Name
3783 subjectName: string;
3785 * End date of the certificate being valid in seconds
3787 validExpiry: number;
3789 * Start date of the certificate being valid in seconds
3794 interface CertificatePrincipal {
3796 // Docs: https://electronjs.org/docs/api/structures/certificate-principal
3803 * Country or region.
3811 * Organization names.
3813 organizations: string[];
3815 * Organization Unit names.
3817 organizationUnits: string[];
3819 * State or province.
3824 class ClientRequest extends NodeEventEmitter {
3826 // Docs: https://electronjs.org/docs/api/client-request
3829 * Emitted when the `request` is aborted. The `abort` event will not be fired if
3830 * the `request` is already closed.
3832 on(event: 'abort', listener: Function): this;
3833 off(event: 'abort', listener: Function): this;
3834 once(event: 'abort', listener: Function): this;
3835 addListener(event: 'abort', listener: Function): this;
3836 removeListener(event: 'abort', listener: Function): this;
3838 * Emitted as the last event in the HTTP request-response transaction. The `close`
3839 * event indicates that no more events will be emitted on either the `request` or
3840 * `response` objects.
3842 on(event: 'close', listener: Function): this;
3843 off(event: 'close', listener: Function): this;
3844 once(event: 'close', listener: Function): this;
3845 addListener(event: 'close', listener: Function): this;
3846 removeListener(event: 'close', listener: Function): this;
3848 * Emitted when the `net` module fails to issue a network request. Typically when
3849 * the `request` object emits an `error` event, a `close` event will subsequently
3850 * follow and no response object will be provided.
3852 on(event: 'error', listener: (
3854 * an error object providing some information about the failure.
3856 error: Error) => void): this;
3857 off(event: 'error', listener: (
3859 * an error object providing some information about the failure.
3861 error: Error) => void): this;
3862 once(event: 'error', listener: (
3864 * an error object providing some information about the failure.
3866 error: Error) => void): this;
3867 addListener(event: 'error', listener: (
3869 * an error object providing some information about the failure.
3871 error: Error) => void): this;
3872 removeListener(event: 'error', listener: (
3874 * an error object providing some information about the failure.
3876 error: Error) => void): this;
3878 * Emitted just after the last chunk of the `request`'s data has been written into
3879 * the `request` object.
3881 on(event: 'finish', listener: Function): this;
3882 off(event: 'finish', listener: Function): this;
3883 once(event: 'finish', listener: Function): this;
3884 addListener(event: 'finish', listener: Function): this;
3885 removeListener(event: 'finish', listener: Function): this;
3887 * Emitted when an authenticating proxy is asking for user credentials.
3889 * The `callback` function is expected to be called back with user credentials:
3891 * * `username` string
3892 * * `password` string
3894 * Providing empty credentials will cancel the request and report an authentication
3895 * error on the response object:
3897 on(event: 'login', listener: (authInfo: AuthInfo,
3898 callback: (username?: string, password?: string) => void) => void): this;
3899 off(event: 'login', listener: (authInfo: AuthInfo,
3900 callback: (username?: string, password?: string) => void) => void): this;
3901 once(event: 'login', listener: (authInfo: AuthInfo,
3902 callback: (username?: string, password?: string) => void) => void): this;
3903 addListener(event: 'login', listener: (authInfo: AuthInfo,
3904 callback: (username?: string, password?: string) => void) => void): this;
3905 removeListener(event: 'login', listener: (authInfo: AuthInfo,
3906 callback: (username?: string, password?: string) => void) => void): this;
3908 * Emitted when the server returns a redirect response (e.g. 301 Moved
3909 * Permanently). Calling `request.followRedirect` will continue with the
3910 * redirection. If this event is handled, `request.followRedirect` must be called
3911 * **synchronously**, otherwise the request will be cancelled.
3913 on(event: 'redirect', listener: (statusCode: number,
3915 redirectUrl: string,
3916 responseHeaders: Record<string, string[]>) => void): this;
3917 off(event: 'redirect', listener: (statusCode: number,
3919 redirectUrl: string,
3920 responseHeaders: Record<string, string[]>) => void): this;
3921 once(event: 'redirect', listener: (statusCode: number,
3923 redirectUrl: string,
3924 responseHeaders: Record<string, string[]>) => void): this;
3925 addListener(event: 'redirect', listener: (statusCode: number,
3927 redirectUrl: string,
3928 responseHeaders: Record<string, string[]>) => void): this;
3929 removeListener(event: 'redirect', listener: (statusCode: number,
3931 redirectUrl: string,
3932 responseHeaders: Record<string, string[]>) => void): this;
3933 on(event: 'response', listener: (
3935 * An object representing the HTTP response message.
3937 response: IncomingMessage) => void): this;
3938 off(event: 'response', listener: (
3940 * An object representing the HTTP response message.
3942 response: IncomingMessage) => void): this;
3943 once(event: 'response', listener: (
3945 * An object representing the HTTP response message.
3947 response: IncomingMessage) => void): this;
3948 addListener(event: 'response', listener: (
3950 * An object representing the HTTP response message.
3952 response: IncomingMessage) => void): this;
3953 removeListener(event: 'response', listener: (
3955 * An object representing the HTTP response message.
3957 response: IncomingMessage) => void): this;
3961 constructor(options: (ClientRequestConstructorOptions) | (string));
3963 * Cancels an ongoing HTTP transaction. If the request has already emitted the
3964 * `close` event, the abort operation will have no effect. Otherwise an ongoing
3965 * event will emit `abort` and `close` events. Additionally, if there is an ongoing
3966 * response object,it will emit the `aborted` event.
3970 * Sends the last chunk of the request data. Subsequent write or end operations
3971 * will not be allowed. The `finish` event is emitted just after the end operation.
3973 end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): this;
3975 * Continues any pending redirection. Can only be called during a `'redirect'`
3978 followRedirect(): void;
3980 * The value of a previously set extra header name.
3982 getHeader(name: string): string;
3984 * * `active` boolean - Whether the request is currently active. If this is false
3985 * no other properties will be set
3986 * * `started` boolean - Whether the upload has started. If this is false both
3987 * `current` and `total` will be set to 0.
3988 * * `current` Integer - The number of bytes that have been uploaded so far
3989 * * `total` Integer - The number of bytes that will be uploaded this request
3991 * You can use this method in conjunction with `POST` requests to get the progress
3992 * of a file upload or other data transfer.
3994 getUploadProgress(): UploadProgress;
3996 * Removes a previously set extra header name. This method can be called only
3997 * before first write. Trying to call it after the first write will throw an error.
3999 removeHeader(name: string): void;
4001 * Adds an extra HTTP header. The header name will be issued as-is without
4002 * lowercasing. It can be called only before first write. Calling this method after
4003 * the first write will throw an error. If the passed value is not a `string`, its
4004 * `toString()` method will be called to obtain the final value.
4006 * Certain headers are restricted from being set by apps. These headers are listed
4007 * below. More information on restricted headers can be found in Chromium's header
4010 * * `Content-Length`
4012 * * `Trailer` or `Te`
4016 * * `Transfer-Encoding`
4018 * Additionally, setting the `Connection` header to the value `upgrade` is also
4021 setHeader(name: string, value: string): void;
4023 * `callback` is essentially a dummy function introduced in the purpose of keeping
4024 * similarity with the Node.js API. It is called asynchronously in the next tick
4025 * after `chunk` content have been delivered to the Chromium networking layer.
4026 * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
4027 * content have been flushed on the wire before `callback` is called.
4029 * Adds a chunk of data to the request body. The first write operation may cause
4030 * the request headers to be issued on the wire. After the first write operation,
4031 * it is not allowed to add or remove a custom header.
4033 write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
4035 * A `boolean` specifying whether the request will use HTTP chunked transfer
4036 * encoding or not. Defaults to false. The property is readable and writable,
4037 * however it can be set only before the first write operation as the HTTP headers
4038 * are not yet put on the wire. Trying to set the `chunkedEncoding` property after
4039 * the first write will throw an error.
4041 * Using chunked encoding is strongly recommended if you need to send a large
4042 * request body as data will be streamed in small chunks instead of being
4043 * internally buffered inside Electron process memory.
4045 chunkedEncoding: boolean;
4048 interface Clipboard {
4050 // Docs: https://electronjs.org/docs/api/clipboard
4053 * An array of supported formats for the clipboard `type`.
4055 availableFormats(type?: 'selection' | 'clipboard'): string[];
4057 * Clears the clipboard content.
4059 clear(type?: 'selection' | 'clipboard'): void;
4061 * Whether the clipboard supports the specified `format`.
4065 has(format: string, type?: 'selection' | 'clipboard'): boolean;
4067 * Reads `format` type from the clipboard.
4069 * `format` should contain valid ASCII characters and have `/` separator. `a/c`,
4070 * `a/bc` are valid formats while `/abc`, `abc/`, `a/`, `/a`, `a` are not valid.
4074 read(format: string): string;
4079 * Returns an Object containing `title` and `url` keys representing the bookmark in
4080 * the clipboard. The `title` and `url` values will be empty strings when the
4081 * bookmark is unavailable. The `title` value will always be empty on Windows.
4083 * @platform darwin,win32
4085 readBookmark(): ReadBookmark;
4087 * Reads `format` type from the clipboard.
4091 readBuffer(format: string): Buffer;
4093 * The text on the find pasteboard, which is the pasteboard that holds information
4094 * about the current state of the active application’s find panel.
4096 * This method uses synchronous IPC when called from the renderer process. The
4097 * cached value is reread from the find pasteboard whenever the application is
4102 readFindText(): string;
4104 * The content in the clipboard as markup.
4106 readHTML(type?: 'selection' | 'clipboard'): string;
4108 * The image content in the clipboard.
4110 readImage(type?: 'selection' | 'clipboard'): NativeImage;
4112 * The content in the clipboard as RTF.
4114 readRTF(type?: 'selection' | 'clipboard'): string;
4116 * The content in the clipboard as plain text.
4118 readText(type?: 'selection' | 'clipboard'): string;
4120 * Writes `data` to the clipboard.
4122 write(data: Data, type?: 'selection' | 'clipboard'): void;
4124 * Writes the `title` (macOS only) and `url` into the clipboard as a bookmark.
4126 * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
4127 * can use `clipboard.write` to write both a bookmark and fallback text to the
4130 * @platform darwin,win32
4132 writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
4134 * Writes the `buffer` into the clipboard as `format`.
4138 writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
4140 * Writes the `text` into the find pasteboard (the pasteboard that holds
4141 * information about the current state of the active application’s find panel) as
4142 * plain text. This method uses synchronous IPC when called from the renderer
4147 writeFindText(text: string): void;
4149 * Writes `markup` to the clipboard.
4151 writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
4153 * Writes `image` to the clipboard.
4155 writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
4157 * Writes the `text` into the clipboard in RTF.
4159 writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
4161 * Writes the `text` into the clipboard as plain text.
4163 writeText(text: string, type?: 'selection' | 'clipboard'): void;
4168 // Docs: https://electronjs.org/docs/api/command-line
4171 * Append an argument to Chromium's command line. The argument will be quoted
4172 * correctly. Switches will precede arguments regardless of appending order.
4174 * If you're appending an argument like `--switch=value`, consider using
4175 * `appendSwitch('switch', 'value')` instead.
4177 * **Note:** This will not affect `process.argv`. The intended usage of this
4178 * function is to control Chromium's behavior.
4180 appendArgument(value: string): void;
4182 * Append a switch (with optional `value`) to Chromium's command line.
4184 * **Note:** This will not affect `process.argv`. The intended usage of this
4185 * function is to control Chromium's behavior.
4187 appendSwitch(the_switch: string, value?: string): void;
4189 * The command-line switch value.
4191 * **Note:** When the switch is not present or has no value, it returns empty
4194 getSwitchValue(the_switch: string): string;
4196 * Whether the command-line switch is present.
4198 hasSwitch(the_switch: string): boolean;
4200 * Removes the specified switch from Chromium's command line.
4202 * **Note:** This will not affect `process.argv`. The intended usage of this
4203 * function is to control Chromium's behavior.
4205 removeSwitch(the_switch: string): void;
4208 interface ContentTracing {
4210 // Docs: https://electronjs.org/docs/api/content-tracing
4213 * resolves with an array of category groups once all child processes have
4214 * acknowledged the `getCategories` request
4216 * Get a set of category groups. The category groups can change as new code paths
4217 * are reached. See also the list of built-in tracing categories.
4219 * > **NOTE:** Electron adds a non-default tracing category called `"electron"`.
4220 * This category can be used to capture Electron-specific tracing events.
4222 getCategories(): Promise<string[]>;
4224 * Resolves with an object containing the `value` and `percentage` of trace buffer
4228 * * `percentage` number
4230 * Get the maximum usage across processes of trace buffer as a percentage of the
4233 getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
4235 * resolved once all child processes have acknowledged the `startRecording`
4238 * Start recording on all processes.
4240 * Recording begins immediately locally and asynchronously on child processes as
4241 * soon as they receive the EnableRecording request.
4243 * If a recording is already running, the promise will be immediately resolved, as
4244 * only one trace operation can be in progress at a time.
4246 startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
4248 * resolves with a path to a file that contains the traced data once all child
4249 * processes have acknowledged the `stopRecording` request
4251 * Stop recording on all processes.
4253 * Child processes typically cache trace data and only rarely flush and send trace
4254 * data back to the main process. This helps to minimize the runtime overhead of
4255 * tracing since sending trace data over IPC can be an expensive operation. So, to
4256 * end tracing, Chromium asynchronously asks all child processes to flush any
4257 * pending trace data.
4259 * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
4260 * or not provided, trace data will be written to a temporary file, and the path
4261 * will be returned in the promise.
4263 stopRecording(resultFilePath?: string): Promise<string>;
4266 interface ContextBridge {
4268 // Docs: https://electronjs.org/docs/api/context-bridge
4270 exposeInIsolatedWorld(worldId: number, apiKey: string, api: any): void;
4271 exposeInMainWorld(apiKey: string, api: any): void;
4276 // Docs: https://electronjs.org/docs/api/structures/cookie
4279 * The domain of the cookie; this will be normalized with a preceding dot so that
4280 * it's also valid for subdomains.
4284 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
4285 * Not provided for session cookies.
4287 expirationDate?: number;
4289 * Whether the cookie is a host-only cookie; this will only be `true` if no domain
4294 * Whether the cookie is marked as HTTP only.
4298 * The name of the cookie.
4302 * The path of the cookie.
4306 * The Same Site policy applied to this cookie. Can be `unspecified`,
4307 * `no_restriction`, `lax` or `strict`.
4309 sameSite: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
4311 * Whether the cookie is marked as secure.
4315 * Whether the cookie is a session cookie or a persistent cookie with an expiration
4320 * The value of the cookie.
4325 class Cookies extends NodeEventEmitter {
4327 // Docs: https://electronjs.org/docs/api/cookies
4330 * Emitted when a cookie is changed because it was added, edited, removed, or
4333 on(event: 'changed', listener: (event: Event,
4335 * The cookie that was changed.
4339 * The cause of the change with one of the following values:
4341 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
4343 * `true` if the cookie was removed, `false` otherwise.
4345 removed: boolean) => void): this;
4346 off(event: 'changed', listener: (event: Event,
4348 * The cookie that was changed.
4352 * The cause of the change with one of the following values:
4354 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
4356 * `true` if the cookie was removed, `false` otherwise.
4358 removed: boolean) => void): this;
4359 once(event: 'changed', listener: (event: Event,
4361 * The cookie that was changed.
4365 * The cause of the change with one of the following values:
4367 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
4369 * `true` if the cookie was removed, `false` otherwise.
4371 removed: boolean) => void): this;
4372 addListener(event: 'changed', listener: (event: Event,
4374 * The cookie that was changed.
4378 * The cause of the change with one of the following values:
4380 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
4382 * `true` if the cookie was removed, `false` otherwise.
4384 removed: boolean) => void): this;
4385 removeListener(event: 'changed', listener: (event: Event,
4387 * The cookie that was changed.
4391 * The cause of the change with one of the following values:
4393 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
4395 * `true` if the cookie was removed, `false` otherwise.
4397 removed: boolean) => void): this;
4399 * A promise which resolves when the cookie store has been flushed
4401 * Writes any unwritten cookies data to disk
4403 * Cookies written by any method will not be written to disk immediately, but will
4404 * be written every 30 seconds or 512 operations
4406 * Calling this method can cause the cookie to be written to disk immediately.
4408 flushStore(): Promise<void>;
4410 * A promise which resolves an array of cookie objects.
4412 * Sends a request to get all cookies matching `filter`, and resolves a promise
4413 * with the response.
4415 get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
4417 * A promise which resolves when the cookie has been removed
4419 * Removes the cookies matching `url` and `name`
4421 remove(url: string, name: string): Promise<void>;
4423 * A promise which resolves when the cookie has been set
4425 * Sets a cookie with `details`.
4427 set(details: CookiesSetDetails): Promise<void>;
4430 interface CPUUsage {
4432 // Docs: https://electronjs.org/docs/api/structures/cpu-usage
4435 * The number of average idle CPU wakeups per second since the last call to
4436 * getCPUUsage. First call returns 0. Will always return 0 on Windows.
4438 idleWakeupsPerSecond: number;
4440 * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
4442 percentCPUUsage: number;
4445 interface CrashReport {
4447 // Docs: https://electronjs.org/docs/api/structures/crash-report
4453 interface CrashReporter {
4455 // Docs: https://electronjs.org/docs/api/crash-reporter
4458 * Set an extra parameter to be sent with the crash report. The values specified
4459 * here will be sent in addition to any values set via the `extra` option when
4460 * `start` was called.
4462 * Parameters added in this fashion (or via the `extra` parameter to
4463 * `crashReporter.start`) are specific to the calling process. Adding extra
4464 * parameters in the main process will not cause those parameters to be sent along
4465 * with crashes from renderer or other child processes. Similarly, adding extra
4466 * parameters in a renderer process will not result in those parameters being sent
4467 * with crashes that occur in other renderer processes or in the main process.
4469 * **Note:** Parameters have limits on the length of the keys and values. Key names
4470 * must be no longer than 39 bytes, and values must be no longer than 20320 bytes.
4471 * Keys with names longer than the maximum will be silently ignored. Key values
4472 * longer than the maximum length will be truncated.
4474 addExtraParameter(key: string, value: string): void;
4476 * The date and ID of the last crash report. Only crash reports that have been
4477 * uploaded will be returned; even if a crash report is present on disk it will not
4478 * be returned until it is uploaded. In the case that there are no uploaded
4479 * reports, `null` is returned.
4481 * **Note:** This method is only available in the main process.
4483 getLastCrashReport(): CrashReport;
4485 * The current 'extra' parameters of the crash reporter.
4487 getParameters(): Record<string, string>;
4489 * Returns all uploaded crash reports. Each report contains the date and uploaded
4492 * **Note:** This method is only available in the main process.
4494 getUploadedReports(): CrashReport[];
4496 * Whether reports should be submitted to the server. Set through the `start`
4497 * method or `setUploadToServer`.
4499 * **Note:** This method is only available in the main process.
4501 getUploadToServer(): boolean;
4503 * Remove an extra parameter from the current set of parameters. Future crashes
4504 * will not include this parameter.
4506 removeExtraParameter(key: string): void;
4508 * This would normally be controlled by user preferences. This has no effect if
4509 * called before `start` is called.
4511 * **Note:** This method is only available in the main process.
4513 setUploadToServer(uploadToServer: boolean): void;
4515 * This method must be called before using any other `crashReporter` APIs. Once
4516 * initialized this way, the crashpad handler collects crashes from all
4517 * subsequently created processes. The crash reporter cannot be disabled once
4520 * This method should be called as early as possible in app startup, preferably
4521 * before `app.on('ready')`. If the crash reporter is not initialized at the time a
4522 * renderer process is created, then that renderer process will not be monitored by
4523 * the crash reporter.
4525 * **Note:** You can test out the crash reporter by generating a crash using
4526 * `process.crash()`.
4528 * **Note:** If you need to send additional/updated `extra` parameters after your
4529 * first call `start` you can call `addExtraParameter`.
4531 * **Note:** Parameters passed in `extra`, `globalExtra` or set with
4532 * `addExtraParameter` have limits on the length of the keys and values. Key names
4533 * must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys
4534 * with names longer than the maximum will be silently ignored. Key values longer
4535 * than the maximum length will be truncated.
4537 * **Note:** This method is only available in the main process.
4539 start(options: CrashReporterStartOptions): void;
4542 interface CustomScheme {
4544 // Docs: https://electronjs.org/docs/api/structures/custom-scheme
4546 privileges?: Privileges;
4548 * Custom schemes to be registered with options.
4553 class Debugger extends NodeEventEmitter {
4555 // Docs: https://electronjs.org/docs/api/debugger
4558 * Emitted when the debugging session is terminated. This happens either when
4559 * `webContents` is closed or devtools is invoked for the attached `webContents`.
4561 on(event: 'detach', listener: (event: Event,
4563 * Reason for detaching debugger.
4565 reason: string) => void): this;
4566 off(event: 'detach', listener: (event: Event,
4568 * Reason for detaching debugger.
4570 reason: string) => void): this;
4571 once(event: 'detach', listener: (event: Event,
4573 * Reason for detaching debugger.
4575 reason: string) => void): this;
4576 addListener(event: 'detach', listener: (event: Event,
4578 * Reason for detaching debugger.
4580 reason: string) => void): this;
4581 removeListener(event: 'detach', listener: (event: Event,
4583 * Reason for detaching debugger.
4585 reason: string) => void): this;
4587 * Emitted whenever the debugging target issues an instrumentation event.
4589 on(event: 'message', listener: (event: Event,
4595 * Event parameters defined by the 'parameters' attribute in the remote debugging
4600 * Unique identifier of attached debugging session, will match the value sent from
4601 * `debugger.sendCommand`.
4603 sessionId: string) => void): this;
4604 off(event: 'message', listener: (event: Event,
4610 * Event parameters defined by the 'parameters' attribute in the remote debugging
4615 * Unique identifier of attached debugging session, will match the value sent from
4616 * `debugger.sendCommand`.
4618 sessionId: string) => void): this;
4619 once(event: 'message', listener: (event: Event,
4625 * Event parameters defined by the 'parameters' attribute in the remote debugging
4630 * Unique identifier of attached debugging session, will match the value sent from
4631 * `debugger.sendCommand`.
4633 sessionId: string) => void): this;
4634 addListener(event: 'message', listener: (event: Event,
4640 * Event parameters defined by the 'parameters' attribute in the remote debugging
4645 * Unique identifier of attached debugging session, will match the value sent from
4646 * `debugger.sendCommand`.
4648 sessionId: string) => void): this;
4649 removeListener(event: 'message', listener: (event: Event,
4655 * Event parameters defined by the 'parameters' attribute in the remote debugging
4660 * Unique identifier of attached debugging session, will match the value sent from
4661 * `debugger.sendCommand`.
4663 sessionId: string) => void): this;
4665 * Attaches the debugger to the `webContents`.
4667 attach(protocolVersion?: string): void;
4669 * Detaches the debugger from the `webContents`.
4673 * Whether a debugger is attached to the `webContents`.
4675 isAttached(): boolean;
4677 * A promise that resolves with the response defined by the 'returns' attribute of
4678 * the command description in the remote debugging protocol or is rejected
4679 * indicating the failure of the command.
4681 * Send given command to the debugging target.
4683 sendCommand(method: string, commandParams?: any, sessionId?: string): Promise<any>;
4686 interface DesktopCapturer {
4688 // Docs: https://electronjs.org/docs/api/desktop-capturer
4691 * Resolves with an array of `DesktopCapturerSource` objects, each
4692 * `DesktopCapturerSource` represents a screen or an individual window that can be
4695 * **Note** Capturing the screen contents requires user consent on macOS 10.15
4696 * Catalina or higher, which can detected by
4697 * `systemPreferences.getMediaAccessStatus`.
4699 getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
4702 interface DesktopCapturerSource {
4704 // Docs: https://electronjs.org/docs/api/structures/desktop-capturer-source
4707 * An icon image of the application that owns the window or null if the source has
4708 * a type screen. The size of the icon is not known in advance and depends on what
4709 * the application provides.
4711 appIcon: NativeImage;
4713 * A unique identifier that will correspond to the `id` of the matching Display
4714 * returned by the Screen API. On some platforms, this is equivalent to the `XX`
4715 * portion of the `id` field above and on others it will differ. It will be an
4716 * empty string if not available.
4720 * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
4721 * constraint when calling `navigator.getUserMedia`. The format of the identifier
4722 * will be `window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle. YY is 1 for
4723 * the current process, and 0 for all others. ZZ is a sequential number that
4724 * represents the screen, and it does not equal to the index in the source's name.
4728 * A screen source will be named either `Entire Screen` or `Screen <index>`, while
4729 * the name of a window source will match the window title.
4733 * A thumbnail image. **Note:** There is no guarantee that the size of the
4734 * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
4735 * to `desktopCapturer.getSources`. The actual size depends on the scale of the
4738 thumbnail: NativeImage;
4743 // Docs: https://electronjs.org/docs/api/dialog
4746 * resolves when the certificate trust dialog is shown.
4748 * On macOS, this displays a modal dialog that shows a message and certificate
4749 * information, and gives the user the option of trusting/importing the
4750 * certificate. If you provide a `browserWindow` argument the dialog will be
4751 * attached to the parent window, making it modal.
4753 * On Windows the options are more limited, due to the Win32 APIs used:
4755 * * The `message` argument is not used, as the OS provides its own confirmation
4757 * * The `browserWindow` argument is ignored since it is not possible to make this
4758 * confirmation dialog modal.
4760 * @platform darwin,win32
4762 showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
4764 * resolves when the certificate trust dialog is shown.
4766 * On macOS, this displays a modal dialog that shows a message and certificate
4767 * information, and gives the user the option of trusting/importing the
4768 * certificate. If you provide a `browserWindow` argument the dialog will be
4769 * attached to the parent window, making it modal.
4771 * On Windows the options are more limited, due to the Win32 APIs used:
4773 * * The `message` argument is not used, as the OS provides its own confirmation
4775 * * The `browserWindow` argument is ignored since it is not possible to make this
4776 * confirmation dialog modal.
4778 * @platform darwin,win32
4780 showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
4782 * Displays a modal dialog that shows an error message.
4784 * This API can be called safely before the `ready` event the `app` module emits,
4785 * it is usually used to report errors in early stage of startup. If called before
4786 * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
4787 * dialog will appear.
4789 showErrorBox(title: string, content: string): void;
4791 * resolves with a promise containing the following properties:
4793 * * `response` number - The index of the clicked button.
4794 * * `checkboxChecked` boolean - The checked state of the checkbox if
4795 * `checkboxLabel` was set. Otherwise `false`.
4797 * Shows a message box.
4799 * The `browserWindow` argument allows the dialog to attach itself to a parent
4800 * window, making it modal.
4802 showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
4804 * resolves with a promise containing the following properties:
4806 * * `response` number - The index of the clicked button.
4807 * * `checkboxChecked` boolean - The checked state of the checkbox if
4808 * `checkboxLabel` was set. Otherwise `false`.
4810 * Shows a message box.
4812 * The `browserWindow` argument allows the dialog to attach itself to a parent
4813 * window, making it modal.
4815 showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
4817 * the index of the clicked button.
4819 * Shows a message box, it will block the process until the message box is closed.
4820 * It returns the index of the clicked button.
4822 * The `browserWindow` argument allows the dialog to attach itself to a parent
4823 * window, making it modal. If `browserWindow` is not shown dialog will not be
4824 * attached to it. In such case it will be displayed as an independent window.
4826 showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
4828 * the index of the clicked button.
4830 * Shows a message box, it will block the process until the message box is closed.
4831 * It returns the index of the clicked button.
4833 * The `browserWindow` argument allows the dialog to attach itself to a parent
4834 * window, making it modal. If `browserWindow` is not shown dialog will not be
4835 * attached to it. In such case it will be displayed as an independent window.
4837 showMessageBoxSync(options: MessageBoxSyncOptions): number;
4839 * Resolve with an object containing the following:
4841 * * `canceled` boolean - whether or not the dialog was canceled.
4842 * * `filePaths` string[] - An array of file paths chosen by the user. If the
4843 * dialog is cancelled this will be an empty array.
4844 * * `bookmarks` string[] (optional) _macOS_ _mas_ - An array matching the
4845 * `filePaths` array of base64 encoded strings which contains security scoped
4846 * bookmark data. `securityScopedBookmarks` must be enabled for this to be
4847 * populated. (For return values, see table here.)
4849 * The `browserWindow` argument allows the dialog to attach itself to a parent
4850 * window, making it modal.
4852 * The `filters` specifies an array of file types that can be displayed or selected
4853 * when you want to limit the user to a specific type. For example:
4855 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4856 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4857 * `'*'` wildcard (no other wildcard is supported).
4859 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4860 * and a directory selector, so if you set `properties` to `['openFile',
4861 * 'openDirectory']` on these platforms, a directory selector will be shown.
4863 showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
4865 * Resolve with an object containing the following:
4867 * * `canceled` boolean - whether or not the dialog was canceled.
4868 * * `filePaths` string[] - An array of file paths chosen by the user. If the
4869 * dialog is cancelled this will be an empty array.
4870 * * `bookmarks` string[] (optional) _macOS_ _mas_ - An array matching the
4871 * `filePaths` array of base64 encoded strings which contains security scoped
4872 * bookmark data. `securityScopedBookmarks` must be enabled for this to be
4873 * populated. (For return values, see table here.)
4875 * The `browserWindow` argument allows the dialog to attach itself to a parent
4876 * window, making it modal.
4878 * The `filters` specifies an array of file types that can be displayed or selected
4879 * when you want to limit the user to a specific type. For example:
4881 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4882 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4883 * `'*'` wildcard (no other wildcard is supported).
4885 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4886 * and a directory selector, so if you set `properties` to `['openFile',
4887 * 'openDirectory']` on these platforms, a directory selector will be shown.
4889 showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
4891 * the file paths chosen by the user; if the dialog is cancelled it returns
4894 * The `browserWindow` argument allows the dialog to attach itself to a parent
4895 * window, making it modal.
4897 * The `filters` specifies an array of file types that can be displayed or selected
4898 * when you want to limit the user to a specific type. For example:
4900 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4901 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4902 * `'*'` wildcard (no other wildcard is supported).
4904 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4905 * and a directory selector, so if you set `properties` to `['openFile',
4906 * 'openDirectory']` on these platforms, a directory selector will be shown.
4908 showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
4910 * the file paths chosen by the user; if the dialog is cancelled it returns
4913 * The `browserWindow` argument allows the dialog to attach itself to a parent
4914 * window, making it modal.
4916 * The `filters` specifies an array of file types that can be displayed or selected
4917 * when you want to limit the user to a specific type. For example:
4919 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4920 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4921 * `'*'` wildcard (no other wildcard is supported).
4923 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4924 * and a directory selector, so if you set `properties` to `['openFile',
4925 * 'openDirectory']` on these platforms, a directory selector will be shown.
4927 showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
4929 * Resolve with an object containing the following:
4931 * * `canceled` boolean - whether or not the dialog was canceled.
4932 * * `filePath` string (optional) - If the dialog is canceled, this will be
4934 * * `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which
4935 * contains the security scoped bookmark data for the saved file.
4936 * `securityScopedBookmarks` must be enabled for this to be present. (For return
4937 * values, see table here.)
4939 * The `browserWindow` argument allows the dialog to attach itself to a parent
4940 * window, making it modal.
4942 * The `filters` specifies an array of file types that can be displayed, see
4943 * `dialog.showOpenDialog` for an example.
4945 * **Note:** On macOS, using the asynchronous version is recommended to avoid
4946 * issues when expanding and collapsing the dialog.
4948 showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
4950 * Resolve with an object containing the following:
4952 * * `canceled` boolean - whether or not the dialog was canceled.
4953 * * `filePath` string (optional) - If the dialog is canceled, this will be
4955 * * `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which
4956 * contains the security scoped bookmark data for the saved file.
4957 * `securityScopedBookmarks` must be enabled for this to be present. (For return
4958 * values, see table here.)
4960 * The `browserWindow` argument allows the dialog to attach itself to a parent
4961 * window, making it modal.
4963 * The `filters` specifies an array of file types that can be displayed, see
4964 * `dialog.showOpenDialog` for an example.
4966 * **Note:** On macOS, using the asynchronous version is recommended to avoid
4967 * issues when expanding and collapsing the dialog.
4969 showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
4971 * the path of the file chosen by the user; if the dialog is cancelled it returns
4974 * The `browserWindow` argument allows the dialog to attach itself to a parent
4975 * window, making it modal.
4977 * The `filters` specifies an array of file types that can be displayed, see
4978 * `dialog.showOpenDialog` for an example.
4980 showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined);
4982 * the path of the file chosen by the user; if the dialog is cancelled it returns
4985 * The `browserWindow` argument allows the dialog to attach itself to a parent
4986 * window, making it modal.
4988 * The `filters` specifies an array of file types that can be displayed, see
4989 * `dialog.showOpenDialog` for an example.
4991 showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined);
4996 // Docs: https://electronjs.org/docs/api/structures/display
4999 * Can be `available`, `unavailable`, `unknown`.
5001 accelerometerSupport: ('available' | 'unavailable' | 'unknown');
5003 * the bounds of the display in DIP points.
5007 * The number of bits per pixel.
5011 * represent a color space (three-dimensional object which contains all realizable
5012 * color combinations) for the purpose of color conversions.
5016 * The number of bits per color component.
5018 depthPerComponent: number;
5020 * `true`` if the display is detected by the system.
5024 * The display refresh rate.
5026 displayFrequency: number;
5028 * Unique identifier associated with the display. A value of of -1 means the
5029 * display is invalid or the correct `id` is not yet known, and a value of -10
5030 * means the display is a virtual display assigned to a unified desktop.
5034 * `true` for an internal display and `false` for an external display.
5038 * User-friendly label, determined by the platform.
5042 * Maximum cursor size in native pixels.
5044 maximumCursorSize: Size;
5046 * Whether or not the display is a monochrome display.
5048 monochrome: boolean;
5050 * Returns the display's origin in pixel coordinates. Only available on windowing
5051 * systems like X11 that position displays in pixel coordinates.
5053 nativeOrigin: Point;
5055 * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
5059 * Output device's pixel scale factor.
5061 scaleFactor: number;
5064 * Can be `available`, `unavailable`, `unknown`.
5066 touchSupport: ('available' | 'unavailable' | 'unknown');
5068 * the work area of the display in DIP points.
5070 workArea: Rectangle;
5072 * The size of the work area.
5079 // Docs: https://electronjs.org/docs/api/dock
5082 * an ID representing the request.
5084 * When `critical` is passed, the dock icon will bounce until either the
5085 * application becomes active or the request is canceled.
5087 * When `informational` is passed, the dock icon will bounce for one second.
5088 * However, the request remains active until either the application becomes active
5089 * or the request is canceled.
5091 * **Note:** This method can only be used while the app is not focused; when the
5092 * app is focused it will return -1.
5096 bounce(type?: 'critical' | 'informational'): number;
5098 * Cancel the bounce of `id`.
5102 cancelBounce(id: number): void;
5104 * Bounces the Downloads stack if the filePath is inside the Downloads folder.
5108 downloadFinished(filePath: string): void;
5110 * The badge string of the dock.
5116 * The application's dock menu.
5120 getMenu(): (Menu) | (null);
5122 * Hides the dock icon.
5128 * Whether the dock icon is visible.
5132 isVisible(): boolean;
5134 * Sets the string to be displayed in the dock’s badging area.
5138 setBadge(text: string): void;
5140 * Sets the `image` associated with this dock icon.
5144 setIcon(image: (NativeImage) | (string)): void;
5146 * Sets the application's dock menu.
5150 setMenu(menu: Menu): void;
5152 * Resolves when the dock icon is shown.
5156 show(): Promise<void>;
5159 class DownloadItem extends NodeEventEmitter {
5161 // Docs: https://electronjs.org/docs/api/download-item
5164 * Emitted when the download is in a terminal state. This includes a completed
5165 * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
5166 * download that can't be resumed.
5168 * The `state` can be one of following:
5170 * * `completed` - The download completed successfully.
5171 * * `cancelled` - The download has been cancelled.
5172 * * `interrupted` - The download has interrupted and can not resume.
5174 on(event: 'done', listener: (event: Event,
5176 * Can be `completed`, `cancelled` or `interrupted`.
5178 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
5179 off(event: 'done', listener: (event: Event,
5181 * Can be `completed`, `cancelled` or `interrupted`.
5183 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
5184 once(event: 'done', listener: (event: Event,
5186 * Can be `completed`, `cancelled` or `interrupted`.
5188 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
5189 addListener(event: 'done', listener: (event: Event,
5191 * Can be `completed`, `cancelled` or `interrupted`.
5193 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
5194 removeListener(event: 'done', listener: (event: Event,
5196 * Can be `completed`, `cancelled` or `interrupted`.
5198 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
5200 * Emitted when the download has been updated and is not done.
5202 * The `state` can be one of following:
5204 * * `progressing` - The download is in-progress.
5205 * * `interrupted` - The download has interrupted and can be resumed.
5207 on(event: 'updated', listener: (event: Event,
5209 * Can be `progressing` or `interrupted`.
5211 state: ('progressing' | 'interrupted')) => void): this;
5212 off(event: 'updated', listener: (event: Event,
5214 * Can be `progressing` or `interrupted`.
5216 state: ('progressing' | 'interrupted')) => void): this;
5217 once(event: 'updated', listener: (event: Event,
5219 * Can be `progressing` or `interrupted`.
5221 state: ('progressing' | 'interrupted')) => void): this;
5222 addListener(event: 'updated', listener: (event: Event,
5224 * Can be `progressing` or `interrupted`.
5226 state: ('progressing' | 'interrupted')) => void): this;
5227 removeListener(event: 'updated', listener: (event: Event,
5229 * Can be `progressing` or `interrupted`.
5231 state: ('progressing' | 'interrupted')) => void): this;
5233 * Cancels the download operation.
5237 * Whether the download can resume.
5239 canResume(): boolean;
5241 * The Content-Disposition field from the response header.
5243 getContentDisposition(): string;
5245 * ETag header value.
5249 * The file name of the download item.
5251 * **Note:** The file name is not always the same as the actual one saved in local
5252 * disk. If user changes the file name in a prompted download saving dialog, the
5253 * actual name of saved file will be different.
5255 getFilename(): string;
5257 * Last-Modified header value.
5259 getLastModifiedTime(): string;
5261 * The files mime type.
5263 getMimeType(): string;
5265 * The received bytes of the download item.
5267 getReceivedBytes(): number;
5269 * Returns the object previously set by
5270 * `downloadItem.setSaveDialogOptions(options)`.
5272 getSaveDialogOptions(): SaveDialogOptions;
5274 * The save path of the download item. This will be either the path set via
5275 * `downloadItem.setSavePath(path)` or the path selected from the shown save
5278 getSavePath(): string;
5280 * Number of seconds since the UNIX epoch when the download was started.
5282 getStartTime(): number;
5284 * The current state. Can be `progressing`, `completed`, `cancelled` or
5287 * **Note:** The following methods are useful specifically to resume a `cancelled`
5288 * item when session is restarted.
5290 getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
5292 * The total size in bytes of the download item.
5294 * If the size is unknown, it returns 0.
5296 getTotalBytes(): number;
5298 * The origin URL where the item is downloaded from.
5302 * The complete URL chain of the item including any redirects.
5304 getURLChain(): string[];
5306 * Whether the download has user gesture.
5308 hasUserGesture(): boolean;
5310 * Whether the download is paused.
5312 isPaused(): boolean;
5314 * Pauses the download.
5318 * Resumes the download that has been paused.
5320 * **Note:** To enable resumable downloads the server you are downloading from must
5321 * support range requests and provide both `Last-Modified` and `ETag` header
5322 * values. Otherwise `resume()` will dismiss previously received bytes and restart
5323 * the download from the beginning.
5327 * This API allows the user to set custom options for the save dialog that opens
5328 * for the download item by default. The API is only available in session's
5329 * `will-download` callback function.
5331 setSaveDialogOptions(options: SaveDialogOptions): void;
5333 * The API is only available in session's `will-download` callback function. If
5334 * `path` doesn't exist, Electron will try to make the directory recursively. If
5335 * user doesn't set the save path via the API, Electron will use the original
5336 * routine to determine the save path; this usually prompts a save dialog.
5338 setSavePath(path: string): void;
5340 * A `string` property that determines the save file path of the download item.
5342 * The property is only available in session's `will-download` callback function.
5343 * If user doesn't set the save path via the property, Electron will use the
5344 * original routine to determine the save path; this usually prompts a save dialog.
5349 interface Extension {
5351 // Docs: https://electronjs.org/docs/api/structures/extension
5355 * Copy of the extension's manifest data.
5360 * The extension's file path.
5364 * The extension's `chrome-extension://` URL.
5370 interface ExtensionInfo {
5372 // Docs: https://electronjs.org/docs/api/structures/extension-info
5378 interface FileFilter {
5380 // Docs: https://electronjs.org/docs/api/structures/file-filter
5382 extensions: string[];
5386 interface FilePathWithHeaders {
5388 // Docs: https://electronjs.org/docs/api/structures/file-path-with-headers
5391 * Additional headers to be sent.
5393 headers?: Record<string, string>;
5395 * The path to the file to send.
5400 interface GlobalShortcut {
5402 // Docs: https://electronjs.org/docs/api/global-shortcut
5405 * Whether this application has registered `accelerator`.
5407 * When the accelerator is already taken by other applications, this call will
5408 * still return `false`. This behavior is intended by operating systems, since they
5409 * don't want applications to fight for global shortcuts.
5411 isRegistered(accelerator: Accelerator): boolean;
5413 * Whether or not the shortcut was registered successfully.
5415 * Registers a global shortcut of `accelerator`. The `callback` is called when the
5416 * registered shortcut is pressed by the user.
5418 * When the accelerator is already taken by other applications, this call will
5419 * silently fail. This behavior is intended by operating systems, since they don't
5420 * want applications to fight for global shortcuts.
5422 * The following accelerators will not be registered successfully on macOS 10.14
5423 * Mojave unless the app has been authorized as a trusted accessibility client:
5425 * * "Media Play/Pause"
5426 * * "Media Next Track"
5427 * * "Media Previous Track"
5430 register(accelerator: Accelerator, callback: () => void): boolean;
5432 * Registers a global shortcut of all `accelerator` items in `accelerators`. The
5433 * `callback` is called when any of the registered shortcuts are pressed by the
5436 * When a given accelerator is already taken by other applications, this call will
5437 * silently fail. This behavior is intended by operating systems, since they don't
5438 * want applications to fight for global shortcuts.
5440 * The following accelerators will not be registered successfully on macOS 10.14
5441 * Mojave unless the app has been authorized as a trusted accessibility client:
5443 * * "Media Play/Pause"
5444 * * "Media Next Track"
5445 * * "Media Previous Track"
5448 registerAll(accelerators: Accelerator[], callback: () => void): void;
5450 * Unregisters the global shortcut of `accelerator`.
5452 unregister(accelerator: Accelerator): void;
5454 * Unregisters all of the global shortcuts.
5456 unregisterAll(): void;
5459 interface GPUFeatureStatus {
5461 // Docs: https://electronjs.org/docs/api/structures/gpu-feature-status
5466 '2d_canvas': string;
5474 flash_stage3d: string;
5476 * Flash Stage3D Baseline profile.
5478 flash_stage3d_baseline: string;
5482 gpu_compositing: string;
5484 * Multiple Raster Threads.
5486 multiple_raster_threads: string;
5488 * Native GpuMemoryBuffers.
5490 native_gpu_memory_buffers: string;
5494 rasterization: string;
5498 video_decode: string;
5502 video_encode: string;
5517 interface HIDDevice {
5519 // Docs: https://electronjs.org/docs/api/structures/hid-device
5522 * Unique identifier for the device.
5526 * Unique identifier for the HID interface. A device may have multiple HID
5531 * Name of the device.
5535 * The USB product ID.
5539 * The USB device serial number.
5541 serialNumber?: string;
5543 * The USB vendor ID.
5548 interface InAppPurchase extends NodeJS.EventEmitter {
5550 // Docs: https://electronjs.org/docs/api/in-app-purchase
5552 on(event: 'transactions-updated', listener: Function): this;
5553 off(event: 'transactions-updated', listener: Function): this;
5554 once(event: 'transactions-updated', listener: Function): this;
5555 addListener(event: 'transactions-updated', listener: Function): this;
5556 removeListener(event: 'transactions-updated', listener: Function): this;
5558 * whether a user can make a payment.
5560 canMakePayments(): boolean;
5562 * Completes all pending transactions.
5564 finishAllTransactions(): void;
5566 * Completes the pending transactions corresponding to the date.
5568 finishTransactionByDate(date: string): void;
5570 * Resolves with an array of `Product` objects.
5572 * Retrieves the product descriptions.
5574 getProducts(productIDs: string[]): Promise<Electron.Product[]>;
5576 * the path to the receipt.
5578 getReceiptURL(): string;
5580 * Returns `true` if the product is valid and added to the payment queue.
5582 * You should listen for the `transactions-updated` event as soon as possible and
5583 * certainly before you call `purchaseProduct`.
5585 purchaseProduct(productID: string, opts?: (number) | (PurchaseProductOpts)): Promise<boolean>;
5587 * Restores finished transactions. This method can be called either to install
5588 * purchases on additional devices, or to restore purchases for an application that
5589 * the user deleted and reinstalled.
5591 * The payment queue delivers a new transaction for each previously completed
5592 * transaction that can be restored. Each transaction includes a copy of the
5593 * original transaction.
5595 restoreCompletedTransactions(): void;
5598 class IncomingMessage extends NodeEventEmitter {
5600 // Docs: https://electronjs.org/docs/api/incoming-message
5603 * Emitted when a request has been canceled during an ongoing HTTP transaction.
5605 on(event: 'aborted', listener: Function): this;
5606 off(event: 'aborted', listener: Function): this;
5607 once(event: 'aborted', listener: Function): this;
5608 addListener(event: 'aborted', listener: Function): this;
5609 removeListener(event: 'aborted', listener: Function): this;
5611 * The `data` event is the usual method of transferring response data into
5614 on(event: 'data', listener: (
5616 * A chunk of response body's data.
5618 chunk: Buffer) => void): this;
5619 off(event: 'data', listener: (
5621 * A chunk of response body's data.
5623 chunk: Buffer) => void): this;
5624 once(event: 'data', listener: (
5626 * A chunk of response body's data.
5628 chunk: Buffer) => void): this;
5629 addListener(event: 'data', listener: (
5631 * A chunk of response body's data.
5633 chunk: Buffer) => void): this;
5634 removeListener(event: 'data', listener: (
5636 * A chunk of response body's data.
5638 chunk: Buffer) => void): this;
5640 * Indicates that response body has ended. Must be placed before 'data' event.
5642 on(event: 'end', listener: Function): this;
5643 off(event: 'end', listener: Function): this;
5644 once(event: 'end', listener: Function): this;
5645 addListener(event: 'end', listener: Function): this;
5646 removeListener(event: 'end', listener: Function): this;
5650 * `error` Error - Typically holds an error string identifying failure root cause.
5652 * Emitted when an error was encountered while streaming response data events. For
5653 * instance, if the server closes the underlying while the response is still
5654 * streaming, an `error` event will be emitted on the response object and a `close`
5655 * event will subsequently follow on the request object.
5657 on(event: 'error', listener: Function): this;
5658 off(event: 'error', listener: Function): this;
5659 once(event: 'error', listener: Function): this;
5660 addListener(event: 'error', listener: Function): this;
5661 removeListener(event: 'error', listener: Function): this;
5663 * A `Record<string, string | string[]>` representing the HTTP response headers.
5664 * The `headers` object is formatted as follows:
5666 * * All header names are lowercased.
5667 * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,
5668 * `etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,
5669 * `last-modified`, `location`, `max-forwards`, `proxy-authorization`, `referer`,
5670 * `retry-after`, `server`, or `user-agent` are discarded.
5671 * * `set-cookie` is always an array. Duplicates are added to the array.
5672 * * For duplicate `cookie` headers, the values are joined together with '; '.
5673 * * For all other headers, the values are joined together with ', '.
5675 headers: Record<string, (string) | (string[])>;
5677 * A `string` indicating the HTTP protocol version number. Typical values are '1.0'
5678 * or '1.1'. Additionally `httpVersionMajor` and `httpVersionMinor` are two
5679 * Integer-valued readable properties that return respectively the HTTP major and
5680 * minor version numbers.
5682 httpVersion: string;
5684 * An `Integer` indicating the HTTP protocol major version number.
5686 httpVersionMajor: number;
5688 * An `Integer` indicating the HTTP protocol minor version number.
5690 httpVersionMinor: number;
5692 * A `string[]` containing the raw HTTP response headers exactly as they were
5693 * received. The keys and values are in the same list. It is not a list of tuples.
5694 * So, the even-numbered offsets are key values, and the odd-numbered offsets are
5695 * the associated values. Header names are not lowercased, and duplicates are not
5698 rawHeaders: string[];
5700 * An `Integer` indicating the HTTP response status code.
5704 * A `string` representing the HTTP status message.
5706 statusMessage: string;
5709 interface InputEvent {
5711 // Docs: https://electronjs.org/docs/api/structures/input-event
5714 * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
5715 * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
5716 * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
5718 modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
5720 * Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`,
5721 * `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`,
5722 * `char`, `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`,
5723 * `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`,
5724 * `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`,
5725 * `gestureTap`, `gestureTapCancel`, `gestureShortPress`, `gestureLongPress`,
5726 * `gestureLongTap`, `gestureTwoFingerTap`, `gestureTapUnconfirmed`,
5727 * `gestureDoubleTap`, `touchStart`, `touchMove`, `touchEnd`, `touchCancel`,
5728 * `touchScrollStarted`, `pointerDown`, `pointerUp`, `pointerMove`,
5729 * `pointerRawUpdate`, `pointerCancel` or `pointerCausedUaAction`.
5731 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');
5734 interface IOCounters {
5736 // Docs: https://electronjs.org/docs/api/structures/io-counters
5739 * Then number of I/O other operations.
5741 otherOperationCount: number;
5743 * Then number of I/O other transfers.
5745 otherTransferCount: number;
5747 * The number of I/O read operations.
5749 readOperationCount: number;
5751 * The number of I/O read transfers.
5753 readTransferCount: number;
5755 * The number of I/O write operations.
5757 writeOperationCount: number;
5759 * The number of I/O write transfers.
5761 writeTransferCount: number;
5764 interface IpcMain extends NodeJS.EventEmitter {
5766 // Docs: https://electronjs.org/docs/api/ipc-main
5769 * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
5770 * renderer calls `ipcRenderer.invoke(channel, ...args)`.
5772 * If `listener` returns a Promise, the eventual result of the promise will be
5773 * returned as a reply to the remote caller. Otherwise, the return value of the
5774 * listener will be used as the value of the reply.
5776 * The `event` that is passed as the first argument to the handler is the same as
5777 * that passed to a regular event listener. It includes information about which
5778 * WebContents is the source of the invoke request.
5780 * Errors thrown through `handle` in the main process are not transparent as they
5781 * are serialized and only the `message` property from the original error is
5782 * provided to the renderer process. Please refer to #24427 for details.
5784 handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<any>) | (any)): void;
5786 * Handles a single `invoke`able IPC message, then removes the listener. See
5787 * `ipcMain.handle(channel, listener)`.
5789 handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<any>) | (any)): void;
5791 * Listens to `channel`, when a new message arrives `listener` would be called with
5792 * `listener(event, args...)`.
5794 on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
5796 * Adds a one time `listener` function for the event. This `listener` is invoked
5797 * only the next time a message is sent to `channel`, after which it is removed.
5799 once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
5801 * Removes listeners of the specified `channel`.
5803 removeAllListeners(channel?: string): this;
5805 * Removes any handler for `channel`, if present.
5807 removeHandler(channel: string): void;
5809 * Removes the specified `listener` from the listener array for the specified
5812 removeListener(channel: string, listener: (...args: any[]) => void): this;
5815 interface IpcMainEvent extends Event {
5817 // Docs: https://electronjs.org/docs/api/structures/ipc-main-event
5820 * The ID of the renderer frame that sent this message
5824 * A list of MessagePorts that were transferred with this message
5826 ports: MessagePortMain[];
5828 * The internal ID of the renderer process that sent this message
5832 * A function that will send an IPC message to the renderer frame that sent the
5833 * original message that you are currently handling. You should use this method to
5834 * "reply" to the sent message in order to guarantee the reply will go to the
5835 * correct process and frame.
5837 reply: (channel: string, ...args: any[]) => void;
5839 * Set this to the value to be returned in a synchronous message
5843 * Returns the `webContents` that sent the message
5845 sender: WebContents;
5847 * The frame that sent this message
5850 readonly senderFrame: WebFrameMain;
5853 interface IpcMainInvokeEvent extends Event {
5855 // Docs: https://electronjs.org/docs/api/structures/ipc-main-invoke-event
5858 * The ID of the renderer frame that sent this message
5862 * The internal ID of the renderer process that sent this message
5866 * Returns the `webContents` that sent the message
5868 sender: WebContents;
5870 * The frame that sent this message
5873 readonly senderFrame: WebFrameMain;
5876 interface IpcRenderer extends NodeJS.EventEmitter {
5878 // Docs: https://electronjs.org/docs/api/ipc-renderer
5881 * Alias for `ipcRenderer.on`.
5883 addListener(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
5885 * Resolves with the response from the main process.
5887 * Send a message to the main process via `channel` and expect a result
5888 * asynchronously. Arguments will be serialized with the Structured Clone
5889 * Algorithm, just like `window.postMessage`, so prototype chains will not be
5890 * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
5893 * The main process should listen for `channel` with `ipcMain.handle()`.
5897 * If you need to transfer a `MessagePort` to the main process, use
5898 * `ipcRenderer.postMessage`.
5900 * If you do not need a response to the message, consider using `ipcRenderer.send`.
5902 * > **Note** Sending non-standard JavaScript types such as DOM objects or special
5903 * Electron objects will throw an exception.
5905 * Since the main process does not have support for DOM objects such as
5906 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
5907 * Electron's IPC to the main process, as the main process would have no way to
5908 * decode them. Attempting to send such objects over IPC will result in an error.
5910 * > **Note** If the handler in the main process throws an error, the promise
5911 * returned by `invoke` will reject. However, the `Error` object in the renderer
5912 * process will not be the same as the one thrown in the main process.
5914 invoke(channel: string, ...args: any[]): Promise<any>;
5916 * Alias for `ipcRenderer.removeListener`.
5918 off(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
5920 * Listens to `channel`, when a new message arrives `listener` would be called with
5921 * `listener(event, args...)`.
5923 on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
5925 * Adds a one time `listener` function for the event. This `listener` is invoked
5926 * only the next time a message is sent to `channel`, after which it is removed.
5928 once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
5930 * Send a message to the main process, optionally transferring ownership of zero or
5931 * more `MessagePort` objects.
5933 * The transferred `MessagePort` objects will be available in the main process as
5934 * `MessagePortMain` objects by accessing the `ports` property of the emitted
5939 * For more information on using `MessagePort` and `MessageChannel`, see the MDN
5942 postMessage(channel: string, message: any, transfer?: MessagePort[]): void;
5944 * Removes all listeners, or those of the specified `channel`.
5946 removeAllListeners(channel: string): this;
5948 * Removes the specified `listener` from the listener array for the specified
5951 removeListener(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
5953 * Send an asynchronous message to the main process via `channel`, along with
5954 * arguments. Arguments will be serialized with the Structured Clone Algorithm,
5955 * just like `window.postMessage`, so prototype chains will not be included.
5956 * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
5959 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
5960 * Electron objects will throw an exception.
5962 * Since the main process does not have support for DOM objects such as
5963 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
5964 * Electron's IPC to the main process, as the main process would have no way to
5965 * decode them. Attempting to send such objects over IPC will result in an error.
5967 * The main process handles it by listening for `channel` with the `ipcMain`
5970 * If you need to transfer a `MessagePort` to the main process, use
5971 * `ipcRenderer.postMessage`.
5973 * If you want to receive a single response from the main process, like the result
5974 * of a method call, consider using `ipcRenderer.invoke`.
5976 send(channel: string, ...args: any[]): void;
5978 * The value sent back by the `ipcMain` handler.
5980 * Send a message to the main process via `channel` and expect a result
5981 * synchronously. Arguments will be serialized with the Structured Clone Algorithm,
5982 * just like `window.postMessage`, so prototype chains will not be included.
5983 * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
5986 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
5987 * Electron objects will throw an exception.
5989 * Since the main process does not have support for DOM objects such as
5990 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
5991 * Electron's IPC to the main process, as the main process would have no way to
5992 * decode them. Attempting to send such objects over IPC will result in an error.
5994 * The main process handles it by listening for `channel` with `ipcMain` module,
5995 * and replies by setting `event.returnValue`.
5997 * > :warning: **WARNING**: Sending a synchronous message will block the whole
5998 * renderer process until the reply is received, so use this method only as a last
5999 * resort. It's much better to use the asynchronous version, `invoke()`.
6001 sendSync(channel: string, ...args: any[]): any;
6003 * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
6004 * the host page instead of the main process.
6006 sendToHost(channel: string, ...args: any[]): void;
6009 interface IpcRendererEvent extends Event {
6011 // Docs: https://electronjs.org/docs/api/structures/ipc-renderer-event
6014 * A list of MessagePorts that were transferred with this message
6016 ports: MessagePort[];
6018 * The `IpcRenderer` instance that emitted the event originally
6020 sender: IpcRenderer;
6023 interface JumpListCategory {
6025 // Docs: https://electronjs.org/docs/api/structures/jump-list-category
6028 * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
6029 * should be omitted.
6031 items?: JumpListItem[];
6033 * Must be set if `type` is `custom`, otherwise it should be omitted.
6037 * One of the following:
6039 type?: ('tasks' | 'frequent' | 'recent' | 'custom');
6042 interface JumpListItem {
6044 // Docs: https://electronjs.org/docs/api/structures/jump-list-item
6047 * The command line arguments when `program` is executed. Should only be set if
6052 * Description of the task (displayed in a tooltip). Should only be set if `type`
6053 * is `task`. Maximum length 260 characters.
6055 description?: string;
6057 * The index of the icon in the resource file. If a resource file contains multiple
6058 * icons this value can be used to specify the zero-based index of the icon that
6059 * should be displayed for this task. If a resource file contains only one icon,
6060 * this property should be set to zero.
6064 * The absolute path to an icon to be displayed in a Jump List, which can be an
6065 * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
6066 * can usually specify `process.execPath` to show the program icon.
6070 * Path of the file to open, should only be set if `type` is `file`.
6074 * Path of the program to execute, usually you should specify `process.execPath`
6075 * which opens the current program. Should only be set if `type` is `task`.
6079 * The text to be displayed for the item in the Jump List. Should only be set if
6084 * One of the following:
6086 type?: ('task' | 'separator' | 'file');
6088 * The working directory. Default is empty.
6090 workingDirectory?: string;
6093 interface KeyboardEvent {
6095 // Docs: https://electronjs.org/docs/api/structures/keyboard-event
6098 * whether an Alt key was used in an accelerator to trigger the Event
6102 * whether the Control key was used in an accelerator to trigger the Event
6106 * whether a meta key was used in an accelerator to trigger the Event
6110 * whether a Shift key was used in an accelerator to trigger the Event
6114 * whether an accelerator was used to trigger the event as opposed to another user
6115 * gesture like mouse click
6117 triggeredByAccelerator?: boolean;
6120 interface KeyboardInputEvent extends InputEvent {
6122 // Docs: https://electronjs.org/docs/api/structures/keyboard-input-event
6125 * The character that will be sent as the keyboard event. Should only use the valid
6126 * key codes in Accelerator.
6130 * The type of the event, can be `rawKeyDown`, `keyDown`, `keyUp` or `char`.
6132 type: ('rawKeyDown' | 'keyDown' | 'keyUp' | 'char');
6135 interface MemoryInfo {
6137 // Docs: https://electronjs.org/docs/api/structures/memory-info
6140 * The maximum amount of memory that has ever been pinned to actual physical RAM.
6142 peakWorkingSetSize: number;
6144 * The amount of memory not shared by other processes, such as JS heap or HTML
6149 privateBytes?: number;
6151 * The amount of memory currently pinned to actual physical RAM.
6153 workingSetSize: number;
6156 interface MemoryUsageDetails {
6158 // Docs: https://electronjs.org/docs/api/structures/memory-usage-details
6165 class Menu extends NodeEventEmitter {
6167 // Docs: https://electronjs.org/docs/api/menu
6170 * Emitted when a popup is closed either manually or with `menu.closePopup()`.
6172 on(event: 'menu-will-close', listener: (event: Event) => void): this;
6173 off(event: 'menu-will-close', listener: (event: Event) => void): this;
6174 once(event: 'menu-will-close', listener: (event: Event) => void): this;
6175 addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
6176 removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
6178 * Emitted when `menu.popup()` is called.
6180 on(event: 'menu-will-show', listener: (event: Event) => void): this;
6181 off(event: 'menu-will-show', listener: (event: Event) => void): this;
6182 once(event: 'menu-will-show', listener: (event: Event) => void): this;
6183 addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
6184 removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
6190 * Generally, the `template` is an array of `options` for constructing a MenuItem.
6191 * The usage can be referenced above.
6193 * You can also attach other fields to the element of the `template` and they will
6194 * become properties of the constructed menu items.
6196 static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
6198 * The application menu, if set, or `null`, if not set.
6200 * **Note:** The returned `Menu` instance doesn't support dynamic addition or
6201 * removal of menu items. Instance properties can still be dynamically modified.
6203 static getApplicationMenu(): (Menu) | (null);
6205 * Sends the `action` to the first responder of application. This is used for
6206 * emulating default macOS menu behaviors. Usually you would use the `role`
6207 * property of a `MenuItem`.
6209 * See the macOS Cocoa Event Handling Guide for more information on macOS' native
6214 static sendActionToFirstResponder(action: string): void;
6216 * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
6217 * will be set as each window's top menu.
6219 * Also on Windows and Linux, you can use a `&` in the top-level item name to
6220 * indicate which letter should get a generated accelerator. For example, using
6221 * `&File` for the file menu would result in a generated `Alt-F` accelerator that
6222 * opens the associated menu. The indicated character in the button label then gets
6223 * an underline, and the `&` character is not displayed on the button label.
6225 * In order to escape the `&` character in an item name, add a proceeding `&`. For
6226 * example, `&&File` would result in `&File` displayed on the button label.
6228 * Passing `null` will suppress the default menu. On Windows and Linux, this has
6229 * the additional effect of removing the menu bar from the window.
6231 * **Note:** The default menu will be created automatically if the app does not set
6232 * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
6235 static setApplicationMenu(menu: (Menu) | (null)): void;
6237 * Appends the `menuItem` to the menu.
6239 append(menuItem: MenuItem): void;
6241 * Closes the context menu in the `browserWindow`.
6243 closePopup(browserWindow?: BrowserWindow): void;
6245 * the item with the specified `id`
6247 getMenuItemById(id: string): (MenuItem) | (null);
6249 * Inserts the `menuItem` to the `pos` position of the menu.
6251 insert(pos: number, menuItem: MenuItem): void;
6253 * Pops up this menu as a context menu in the `BrowserWindow`.
6255 popup(options?: PopupOptions): void;
6257 * A `MenuItem[]` array containing the menu's items.
6259 * Each `Menu` consists of multiple `MenuItem`s and each `MenuItem` can have a
6267 // Docs: https://electronjs.org/docs/api/menu-item
6272 constructor(options: MenuItemConstructorOptions);
6274 * An `Accelerator` (optional) indicating the item's accelerator, if set.
6276 accelerator?: Accelerator;
6278 * A `boolean` indicating whether the item is checked, this property can be
6279 * dynamically changed.
6281 * A `checkbox` menu item will toggle the `checked` property on and off when
6284 * A `radio` menu item will turn on its `checked` property when clicked, and will
6285 * turn off that property for all adjacent items in the same menu.
6287 * You can add a `click` function for additional behavior.
6291 * A `Function` that is fired when the MenuItem receives a click event. It can be
6292 * called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
6294 * * `event` KeyboardEvent
6295 * * `focusedWindow` BrowserWindow
6296 * * `focusedWebContents` WebContents
6300 * A `number` indicating an item's sequential unique id.
6304 * A `boolean` indicating whether the item is enabled, this property can be
6305 * dynamically changed.
6309 * A `NativeImage | string` (optional) indicating the item's icon, if set.
6311 icon?: (NativeImage) | (string);
6313 * A `string` indicating the item's unique id, this property can be dynamically
6318 * A `string` indicating the item's visible label.
6322 * A `Menu` that the item is a part of.
6326 * A `boolean` indicating if the accelerator should be registered with the system
6327 * or just displayed.
6329 * This property can be dynamically changed.
6331 registerAccelerator: boolean;
6333 * A `string` (optional) indicating the item's role, if set. Can be `undo`, `redo`,
6334 * `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`,
6335 * `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`,
6336 * `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`,
6337 * `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
6338 * `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,
6339 * `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`,
6340 * `selectPreviousTab`, `showAllTabs`, `mergeAllWindows`, `clearRecentDocuments`,
6341 * `moveTabToNewWindow` or `windowMenu`
6343 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' | 'showAllTabs' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
6345 * A `SharingItem` indicating the item to share when the `role` is `shareMenu`.
6347 * This property can be dynamically changed.
6351 sharingItem: SharingItem;
6353 * A `string` indicating the item's sublabel.
6357 * A `Menu` (optional) containing the menu item's submenu, if present.
6361 * A `string` indicating the item's hover text.
6367 * A `string` indicating the type of the item. Can be `normal`, `separator`,
6368 * `submenu`, `checkbox` or `radio`.
6370 type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
6372 * An `Accelerator | null` indicating the item's user-assigned accelerator for the
6375 * **Note:** This property is only initialized after the `MenuItem` has been added
6376 * to a `Menu`. Either via `Menu.buildFromTemplate` or via
6377 * `Menu.append()/insert()`. Accessing before initialization will just return
6382 readonly userAccelerator: (Accelerator) | (null);
6384 * A `boolean` indicating whether the item is visible, this property can be
6385 * dynamically changed.
6390 class MessageChannelMain extends NodeEventEmitter {
6392 // Docs: https://electronjs.org/docs/api/message-channel-main
6395 * A `MessagePortMain` property.
6397 port1: MessagePortMain;
6399 * A `MessagePortMain` property.
6401 port2: MessagePortMain;
6404 class MessagePortMain extends NodeEventEmitter {
6406 // Docs: https://electronjs.org/docs/api/message-port-main
6409 * Emitted when the remote end of a MessagePortMain object becomes disconnected.
6411 on(event: 'close', listener: Function): this;
6412 off(event: 'close', listener: Function): this;
6413 once(event: 'close', listener: Function): this;
6414 addListener(event: 'close', listener: Function): this;
6415 removeListener(event: 'close', listener: Function): this;
6417 * Emitted when a MessagePortMain object receives a message.
6419 on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
6420 off(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
6421 once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
6422 addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
6423 removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
6425 * Disconnects the port, so it is no longer active.
6429 * Sends a message from the port, and optionally, transfers ownership of objects to
6430 * other browsing contexts.
6432 postMessage(message: any, transfer?: MessagePortMain[]): void;
6434 * Starts the sending of messages queued on the port. Messages will be queued until
6435 * this method is called.
6440 interface MimeTypedBuffer {
6442 // Docs: https://electronjs.org/docs/api/structures/mime-typed-buffer
6445 * Charset of the buffer.
6449 * The actual Buffer content.
6453 * MIME type of the buffer.
6458 interface MouseInputEvent extends InputEvent {
6460 // Docs: https://electronjs.org/docs/api/structures/mouse-input-event
6463 * The button pressed, can be `left`, `middle`, `right`.
6465 button?: ('left' | 'middle' | 'right');
6466 clickCount?: number;
6472 * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
6473 * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
6475 type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
6480 interface MouseWheelInputEvent extends MouseInputEvent {
6482 // Docs: https://electronjs.org/docs/api/structures/mouse-wheel-input-event
6484 accelerationRatioX?: number;
6485 accelerationRatioY?: number;
6486 canScroll?: boolean;
6489 hasPreciseScrollingDeltas?: boolean;
6491 * The type of the event, can be `mouseWheel`.
6493 type: ('mouseWheel');
6494 wheelTicksX?: number;
6495 wheelTicksY?: number;
6500 // Docs: https://electronjs.org/docs/api/native-image
6503 * Creates an empty `NativeImage` instance.
6505 static createEmpty(): NativeImage;
6507 * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
6508 * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
6510 static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
6512 * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
6515 static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
6517 * Creates a new `NativeImage` instance from `dataURL`.
6519 static createFromDataURL(dataURL: string): NativeImage;
6521 * Creates a new `NativeImage` instance from the NSImage that maps to the given
6522 * image name. See `System Icons` for a list of possible values.
6524 * The `hslShift` is applied to the image with the following rules:
6526 * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
6527 * and 360 on the hue color wheel (red).
6528 * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
6529 * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
6530 * saturate the image.
6531 * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
6532 * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
6533 * leave unchanged. 1 = full lightness (make all pixels white).
6535 * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
6536 * 0]` will make the image completely black.
6538 * In some cases, the `NSImageName` doesn't match its string representation; one
6539 * example of this is `NSFolderImageName`, whose string representation would
6540 * actually be `NSFolder`. Therefore, you'll need to determine the correct string
6541 * representation for your image before passing it in. This can be done with the
6544 * `echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME);
6545 * }' | clang -otest -x objective-c -framework Cocoa - && ./test`
6547 * where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
6551 static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
6553 * Creates a new `NativeImage` instance from a file located at `path`. This method
6554 * returns an empty image if the `path` does not exist, cannot be read, or is not a
6557 static createFromPath(path: string): NativeImage;
6559 * fulfilled with the file's thumbnail preview image, which is a NativeImage.
6561 * Note: The Windows implementation will ignore `size.height` and scale the height
6562 * according to `size.width`.
6564 * @platform darwin,win32
6566 static createThumbnailFromPath(path: string, size: Size): Promise<Electron.NativeImage>;
6568 * Add an image representation for a specific scale factor. This can be used to
6569 * explicitly add different scale factor representations to an image. This can be
6570 * called on empty images.
6572 addRepresentation(options: AddRepresentationOptions): void;
6574 * The cropped image.
6576 crop(rect: Rectangle): NativeImage;
6578 * The image's aspect ratio.
6580 * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
6581 * the image representation most closely matching the passed value.
6583 getAspectRatio(scaleFactor?: number): number;
6585 * A Buffer that contains the image's raw bitmap pixel data.
6587 * The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does
6588 * not copy the bitmap data, so you have to use the returned Buffer immediately in
6589 * current event loop tick; otherwise the data might be changed or destroyed.
6591 getBitmap(options?: BitmapOptions): Buffer;
6593 * A Buffer that stores C pointer to underlying native handle of the image. On
6594 * macOS, a pointer to `NSImage` instance would be returned.
6596 * Notice that the returned pointer is a weak pointer to the underlying native
6597 * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
6598 * instance is kept around.
6602 getNativeHandle(): Buffer;
6604 * An array of all scale factors corresponding to representations for a given
6607 getScaleFactors(): number[];
6609 * If `scaleFactor` is passed, this will return the size corresponding to the image
6610 * representation most closely matching the passed value.
6612 getSize(scaleFactor?: number): Size;
6614 * Whether the image is empty.
6618 * Whether the image is a template image.
6620 isTemplateImage(): boolean;
6622 * The resized image.
6624 * If only the `height` or the `width` are specified then the current aspect ratio
6625 * will be preserved in the resized image.
6627 resize(options: ResizeOptions): NativeImage;
6629 * Marks the image as a template image.
6631 setTemplateImage(option: boolean): void;
6633 * A Buffer that contains a copy of the image's raw bitmap pixel data.
6635 toBitmap(options?: ToBitmapOptions): Buffer;
6637 * The data URL of the image.
6639 toDataURL(options?: ToDataURLOptions): string;
6641 * A Buffer that contains the image's `JPEG` encoded data.
6643 toJPEG(quality: number): Buffer;
6645 * A Buffer that contains the image's `PNG` encoded data.
6647 toPNG(options?: ToPNGOptions): Buffer;
6649 * A `boolean` property that determines whether the image is considered a template
6652 * Please note that this property only has an effect on macOS.
6656 isMacTemplateImage: boolean;
6659 interface NativeTheme extends NodeJS.EventEmitter {
6661 // Docs: https://electronjs.org/docs/api/native-theme
6664 * Emitted when something in the underlying NativeTheme has changed. This normally
6665 * means that either the value of `shouldUseDarkColors`,
6666 * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
6667 * will have to check them to determine which one has changed.
6669 on(event: 'updated', listener: Function): this;
6670 off(event: 'updated', listener: Function): this;
6671 once(event: 'updated', listener: Function): this;
6672 addListener(event: 'updated', listener: Function): this;
6673 removeListener(event: 'updated', listener: Function): this;
6675 * A `boolean` indicating whether Chromium is in forced colors mode, controlled by
6676 * system accessibility settings. Currently, Windows high contrast is the only
6677 * system setting that triggers forced colors mode.
6681 readonly inForcedColorsMode: boolean;
6683 * A `boolean` for if the OS / Chromium currently has a dark mode enabled or is
6684 * being instructed to show a dark-style UI. If you want to modify this value you
6685 * should use `themeSource` below.
6688 readonly shouldUseDarkColors: boolean;
6690 * A `boolean` for if the OS / Chromium currently has high-contrast mode enabled or
6691 * is being instructed to show a high-contrast UI.
6693 * @platform darwin,win32
6695 readonly shouldUseHighContrastColors: boolean;
6697 * A `boolean` for if the OS / Chromium currently has an inverted color scheme or
6698 * is being instructed to use an inverted color scheme.
6700 * @platform darwin,win32
6702 readonly shouldUseInvertedColorScheme: boolean;
6704 * A `string` property that can be `system`, `light` or `dark`. It is used to
6705 * override and supersede the value that Chromium has chosen to use internally.
6707 * Setting this property to `system` will remove the override and everything will
6708 * be reset to the OS default. By default `themeSource` is `system`.
6710 * Settings this property to `dark` will have the following effects:
6712 * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
6713 * * Any UI Electron renders on Linux and Windows including context menus,
6714 * devtools, etc. will use the dark UI.
6715 * * Any UI the OS renders on macOS including menus, window frames, etc. will use
6717 * * The `prefers-color-scheme` CSS query will match `dark` mode.
6718 * * The `updated` event will be emitted
6720 * Settings this property to `light` will have the following effects:
6722 * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
6723 * * Any UI Electron renders on Linux and Windows including context menus,
6724 * devtools, etc. will use the light UI.
6725 * * Any UI the OS renders on macOS including menus, window frames, etc. will use
6727 * * The `prefers-color-scheme` CSS query will match `light` mode.
6728 * * The `updated` event will be emitted
6730 * The usage of this property should align with a classic "dark mode" state machine
6731 * in your application where the user has three options.
6733 * * `Follow OS` --> `themeSource = 'system'`
6734 * * `Dark Mode` --> `themeSource = 'dark'`
6735 * * `Light Mode` --> `themeSource = 'light'`
6737 * Your application should then always use `shouldUseDarkColors` to determine what
6740 themeSource: ('system' | 'light' | 'dark');
6745 // Docs: https://electronjs.org/docs/api/net
6750 * Sends a request, similarly to how `fetch()` works in the renderer, using
6751 * Chrome's network stack. This differs from Node's `fetch()`, which uses Node.js's
6756 * This method will issue requests from the default session. To send a `fetch`
6757 * request from another session, use ses.fetch().
6759 * See the MDN documentation for `fetch()` for more details.
6763 * * `net.fetch()` does not support the `data:` or `blob:` schemes.
6764 * * The value of the `integrity` option is ignored.
6765 * * The `.type` and `.url` values of the returned `Response` object are incorrect.
6767 * By default, requests made with `net.fetch` can be made to custom protocols as
6768 * well as `file:`, and will trigger webRequest handlers if present. When the
6769 * non-standard `bypassCustomProtocolHandlers` option is set in RequestInit, custom
6770 * protocol handlers will not be called for this request. This allows forwarding an
6771 * intercepted request to the built-in handler. webRequest handlers will still be
6772 * triggered when bypassing custom protocols.
6774 fetch(input: (string) | (GlobalRequest), init?: RequestInit & { bypassCustomProtocolHandlers?: boolean }): Promise<GlobalResponse>;
6776 * Whether there is currently internet connection.
6778 * A return value of `false` is a pretty strong indicator that the user won't be
6779 * able to connect to remote sites. However, a return value of `true` is
6780 * inconclusive; even if some link is up, it is uncertain whether a particular
6781 * connection attempt to a particular remote site will be successful.
6783 isOnline(): boolean;
6785 * Creates a `ClientRequest` instance using the provided `options` which are
6786 * directly forwarded to the `ClientRequest` constructor. The `net.request` method
6787 * would be used to issue both secure and insecure HTTP requests according to the
6788 * specified protocol scheme in the `options` object.
6790 request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
6792 * Resolves with the resolved IP addresses for the `host`.
6794 * This method will resolve hosts from the default session. To resolve a host from
6795 * another session, use ses.resolveHost().
6797 resolveHost(host: string, options?: ResolveHostOptions): Promise<Electron.ResolvedHost>;
6799 * A `boolean` property. Whether there is currently internet connection.
6801 * A return value of `false` is a pretty strong indicator that the user won't be
6802 * able to connect to remote sites. However, a return value of `true` is
6803 * inconclusive; even if some link is up, it is uncertain whether a particular
6804 * connection attempt to a particular remote site will be successful.
6807 readonly online: boolean;
6812 // Docs: https://electronjs.org/docs/api/net-log
6815 * resolves when the net log has begun recording.
6817 * Starts recording network events to `path`.
6819 startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
6821 * resolves when the net log has been flushed to disk.
6823 * Stops recording network events. If not called, net logging will automatically
6824 * end when app quits.
6826 stopLogging(): Promise<void>;
6828 * A `boolean` property that indicates whether network logs are currently being
6832 readonly currentlyLogging: boolean;
6835 class Notification extends NodeEventEmitter {
6837 // Docs: https://electronjs.org/docs/api/notification
6842 on(event: 'action', listener: (event: Event,
6844 * The index of the action that was activated.
6846 index: number) => void): this;
6847 off(event: 'action', listener: (event: Event,
6849 * The index of the action that was activated.
6851 index: number) => void): this;
6852 once(event: 'action', listener: (event: Event,
6854 * The index of the action that was activated.
6856 index: number) => void): this;
6857 addListener(event: 'action', listener: (event: Event,
6859 * The index of the action that was activated.
6861 index: number) => void): this;
6862 removeListener(event: 'action', listener: (event: Event,
6864 * The index of the action that was activated.
6866 index: number) => void): this;
6868 * Emitted when the notification is clicked by the user.
6870 on(event: 'click', listener: (event: Event) => void): this;
6871 off(event: 'click', listener: (event: Event) => void): this;
6872 once(event: 'click', listener: (event: Event) => void): this;
6873 addListener(event: 'click', listener: (event: Event) => void): this;
6874 removeListener(event: 'click', listener: (event: Event) => void): this;
6876 * Emitted when the notification is closed by manual intervention from the user.
6878 * This event is not guaranteed to be emitted in all cases where the notification
6881 * On Windows, the `close` event can be emitted in one of three ways: programmatic
6882 * dismissal with `notification.close()`, by the user closing the notification, or
6883 * via system timeout. If a notification is in the Action Center after the initial
6884 * `close` event is emitted, a call to `notification.close()` will remove the
6885 * notification from the action center but the `close` event will not be emitted
6888 on(event: 'close', listener: (event: Event) => void): this;
6889 off(event: 'close', listener: (event: Event) => void): this;
6890 once(event: 'close', listener: (event: Event) => void): this;
6891 addListener(event: 'close', listener: (event: Event) => void): this;
6892 removeListener(event: 'close', listener: (event: Event) => void): this;
6894 * Emitted when an error is encountered while creating and showing the native
6899 on(event: 'failed', listener: (event: Event,
6901 * The error encountered during execution of the `show()` method.
6903 error: string) => void): this;
6904 off(event: 'failed', listener: (event: Event,
6906 * The error encountered during execution of the `show()` method.
6908 error: string) => void): this;
6909 once(event: 'failed', listener: (event: Event,
6911 * The error encountered during execution of the `show()` method.
6913 error: string) => void): this;
6914 addListener(event: 'failed', listener: (event: Event,
6916 * The error encountered during execution of the `show()` method.
6918 error: string) => void): this;
6919 removeListener(event: 'failed', listener: (event: Event,
6921 * The error encountered during execution of the `show()` method.
6923 error: string) => void): this;
6925 * Emitted when the user clicks the "Reply" button on a notification with
6930 on(event: 'reply', listener: (event: Event,
6932 * The string the user entered into the inline reply field.
6934 reply: string) => void): this;
6935 off(event: 'reply', listener: (event: Event,
6937 * The string the user entered into the inline reply field.
6939 reply: string) => void): this;
6940 once(event: 'reply', listener: (event: Event,
6942 * The string the user entered into the inline reply field.
6944 reply: string) => void): this;
6945 addListener(event: 'reply', listener: (event: Event,
6947 * The string the user entered into the inline reply field.
6949 reply: string) => void): this;
6950 removeListener(event: 'reply', listener: (event: Event,
6952 * The string the user entered into the inline reply field.
6954 reply: string) => void): this;
6956 * Emitted when the notification is shown to the user. Note that this event can be
6957 * fired multiple times as a notification can be shown multiple times through the
6960 on(event: 'show', listener: (event: Event) => void): this;
6961 off(event: 'show', listener: (event: Event) => void): this;
6962 once(event: 'show', listener: (event: Event) => void): this;
6963 addListener(event: 'show', listener: (event: Event) => void): this;
6964 removeListener(event: 'show', listener: (event: Event) => void): this;
6968 constructor(options?: NotificationConstructorOptions);
6970 * Whether or not desktop notifications are supported on the current system
6972 static isSupported(): boolean;
6974 * Dismisses the notification.
6976 * On Windows, calling `notification.close()` while the notification is visible on
6977 * screen will dismiss the notification and remove it from the Action Center. If
6978 * `notification.close()` is called after the notification is no longer visible on
6979 * screen, calling `notification.close()` will try remove it from the Action
6984 * Immediately shows the notification to the user. Unlike the web notification API,
6985 * instantiating a `new Notification()` does not immediately show it to the user.
6986 * Instead, you need to call this method before the OS will display it.
6988 * If the notification has been shown before, this method will dismiss the
6989 * previously shown notification and create a new one with identical properties.
6993 * A `NotificationAction[]` property representing the actions of the notification.
6995 actions: NotificationAction[];
6997 * A `string` property representing the body of the notification.
7001 * A `string` property representing the close button text of the notification.
7003 closeButtonText: string;
7005 * A `boolean` property representing whether the notification has a reply action.
7009 * A `string` property representing the reply placeholder of the notification.
7011 replyPlaceholder: string;
7013 * A `boolean` property representing whether the notification is silent.
7017 * A `string` property representing the sound of the notification.
7021 * A `string` property representing the subtitle of the notification.
7025 * A `string` property representing the type of timeout duration for the
7026 * notification. Can be 'default' or 'never'.
7028 * If `timeoutType` is set to 'never', the notification never expires. It stays
7029 * open until closed by the calling API or the user.
7031 * @platform linux,win32
7033 timeoutType: ('default' | 'never');
7035 * A `string` property representing the title of the notification.
7039 * A `string` property representing the custom Toast XML of the notification.
7045 * A `string` property representing the urgency level of the notification. Can be
7046 * 'normal', 'critical', or 'low'.
7048 * Default is 'low' - see NotifyUrgency for more information.
7052 urgency: ('normal' | 'critical' | 'low');
7055 interface NotificationAction {
7057 // Docs: https://electronjs.org/docs/api/structures/notification-action
7060 * The label for the given action.
7064 * The type of action, can be `button`.
7069 interface NotificationResponse {
7071 // Docs: https://electronjs.org/docs/api/structures/notification-response
7074 * The identifier string of the action that the user selected.
7076 actionIdentifier: string;
7078 * The delivery date of the notification.
7082 * The unique identifier for this notification request.
7086 * A dictionary of custom information associated with the notification.
7088 userInfo: Record<string, any>;
7090 * The text entered or chosen by the user.
7095 interface ParentPort extends NodeJS.EventEmitter {
7097 // Docs: https://electronjs.org/docs/api/parent-port
7100 * Emitted when the process receives a message. Messages received on this port will
7101 * be queued up until a handler is registered for this event.
7103 on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
7104 off(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
7105 once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
7106 addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
7107 removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
7109 * Sends a message from the process to its parent.
7111 postMessage(message: any): void;
7114 interface PaymentDiscount {
7116 // Docs: https://electronjs.org/docs/api/structures/payment-discount
7119 * A string used to uniquely identify a discount offer for a product.
7123 * A string that identifies the key used to generate the signature.
7125 keyIdentifier: string;
7127 * A universally unique ID (UUID) value that you define.
7131 * A UTF-8 string representing the properties of a specific discount offer,
7132 * cryptographically signed.
7136 * The date and time of the signature's creation in milliseconds, formatted in Unix
7144 // Docs: https://electronjs.org/docs/api/structures/point
7150 interface PostBody {
7152 // Docs: https://electronjs.org/docs/api/structures/post-body
7155 * The boundary used to separate multiple parts of the message. Only valid when
7156 * `contentType` is `multipart/form-data`.
7160 * The `content-type` header used for the data. One of
7161 * `application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to the
7162 * `enctype` attribute of the submitted HTML form.
7164 contentType: string;
7166 * The post data to be sent to the new window.
7168 data: Array<(UploadRawData) | (UploadFile)>;
7171 interface PowerMonitor extends NodeJS.EventEmitter {
7173 // Docs: https://electronjs.org/docs/api/power-monitor
7176 * Emitted when the system is about to lock the screen.
7178 * @platform darwin,win32
7180 on(event: 'lock-screen', listener: Function): this;
7181 off(event: 'lock-screen', listener: Function): this;
7182 once(event: 'lock-screen', listener: Function): this;
7183 addListener(event: 'lock-screen', listener: Function): this;
7184 removeListener(event: 'lock-screen', listener: Function): this;
7186 * Emitted when the system changes to AC power.
7188 * @platform darwin,win32
7190 on(event: 'on-ac', listener: Function): this;
7191 off(event: 'on-ac', listener: Function): this;
7192 once(event: 'on-ac', listener: Function): this;
7193 addListener(event: 'on-ac', listener: Function): this;
7194 removeListener(event: 'on-ac', listener: Function): this;
7196 * Emitted when system changes to battery power.
7200 on(event: 'on-battery', listener: Function): this;
7201 off(event: 'on-battery', listener: Function): this;
7202 once(event: 'on-battery', listener: Function): this;
7203 addListener(event: 'on-battery', listener: Function): this;
7204 removeListener(event: 'on-battery', listener: Function): this;
7206 * Emitted when system is resuming.
7208 on(event: 'resume', listener: Function): this;
7209 off(event: 'resume', listener: Function): this;
7210 once(event: 'resume', listener: Function): this;
7211 addListener(event: 'resume', listener: Function): this;
7212 removeListener(event: 'resume', listener: Function): this;
7214 * Emitted when the system is about to reboot or shut down. If the event handler
7215 * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
7216 * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
7217 * should exit as soon as possible by calling something like `app.quit()`.
7219 * @platform linux,darwin
7221 on(event: 'shutdown', listener: Function): this;
7222 off(event: 'shutdown', listener: Function): this;
7223 once(event: 'shutdown', listener: Function): this;
7224 addListener(event: 'shutdown', listener: Function): this;
7225 removeListener(event: 'shutdown', listener: Function): this;
7227 * Notification of a change in the operating system's advertised speed limit for
7228 * CPUs, in percent. Values below 100 indicate that the system is impairing
7229 * processing power due to thermal management.
7231 * @platform darwin,win32
7233 on(event: 'speed-limit-change', listener: Function): this;
7234 off(event: 'speed-limit-change', listener: Function): this;
7235 once(event: 'speed-limit-change', listener: Function): this;
7236 addListener(event: 'speed-limit-change', listener: Function): this;
7237 removeListener(event: 'speed-limit-change', listener: Function): this;
7239 * Emitted when the system is suspending.
7241 on(event: 'suspend', listener: Function): this;
7242 off(event: 'suspend', listener: Function): this;
7243 once(event: 'suspend', listener: Function): this;
7244 addListener(event: 'suspend', listener: Function): this;
7245 removeListener(event: 'suspend', listener: Function): this;
7247 * Emitted when the thermal state of the system changes. Notification of a change
7248 * in the thermal status of the system, such as entering a critical temperature
7249 * range. Depending on the severity, the system might take steps to reduce said
7250 * temperature, for example, throttling the CPU or switching on the fans if
7253 * Apps may react to the new state by reducing expensive computing tasks (e.g.
7254 * video encoding), or notifying the user. The same state might be received
7258 * https://developer.apple.com/library/archive/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/RespondToThermalStateChanges.html
7262 on(event: 'thermal-state-change', listener: Function): this;
7263 off(event: 'thermal-state-change', listener: Function): this;
7264 once(event: 'thermal-state-change', listener: Function): this;
7265 addListener(event: 'thermal-state-change', listener: Function): this;
7266 removeListener(event: 'thermal-state-change', listener: Function): this;
7268 * Emitted as soon as the systems screen is unlocked.
7270 * @platform darwin,win32
7272 on(event: 'unlock-screen', listener: Function): this;
7273 off(event: 'unlock-screen', listener: Function): this;
7274 once(event: 'unlock-screen', listener: Function): this;
7275 addListener(event: 'unlock-screen', listener: Function): this;
7276 removeListener(event: 'unlock-screen', listener: Function): this;
7278 * Emitted when a login session is activated. See documentation for more
7283 on(event: 'user-did-become-active', listener: Function): this;
7284 off(event: 'user-did-become-active', listener: Function): this;
7285 once(event: 'user-did-become-active', listener: Function): this;
7286 addListener(event: 'user-did-become-active', listener: Function): this;
7287 removeListener(event: 'user-did-become-active', listener: Function): this;
7289 * Emitted when a login session is deactivated. See documentation for more
7294 on(event: 'user-did-resign-active', listener: Function): this;
7295 off(event: 'user-did-resign-active', listener: Function): this;
7296 once(event: 'user-did-resign-active', listener: Function): this;
7297 addListener(event: 'user-did-resign-active', listener: Function): this;
7298 removeListener(event: 'user-did-resign-active', listener: Function): this;
7300 * The system's current thermal state. Can be `unknown`, `nominal`, `fair`,
7301 * `serious`, or `critical`.
7305 getCurrentThermalState(): ('unknown' | 'nominal' | 'fair' | 'serious' | 'critical');
7307 * The system's current idle state. Can be `active`, `idle`, `locked` or `unknown`.
7309 * Calculate the system idle state. `idleThreshold` is the amount of time (in
7310 * seconds) before considered idle. `locked` is available on supported systems
7313 getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
7315 * Idle time in seconds
7317 * Calculate system idle time in seconds.
7319 getSystemIdleTime(): number;
7321 * Whether the system is on battery power.
7323 * To monitor for changes in this property, use the `on-battery` and `on-ac`
7326 isOnBatteryPower(): boolean;
7328 * A `boolean` property. True if the system is on battery power.
7330 * See `powerMonitor.isOnBatteryPower()`.
7332 onBatteryPower: boolean;
7335 interface PowerSaveBlocker {
7337 // Docs: https://electronjs.org/docs/api/power-save-blocker
7340 * Whether the corresponding `powerSaveBlocker` has started.
7342 isStarted(id: number): boolean;
7344 * The blocker ID that is assigned to this power blocker.
7346 * Starts preventing the system from entering lower-power mode. Returns an integer
7347 * identifying the power save blocker.
7349 * **Note:** `prevent-display-sleep` has higher precedence over
7350 * `prevent-app-suspension`. Only the highest precedence type takes effect. In
7351 * other words, `prevent-display-sleep` always takes precedence over
7352 * `prevent-app-suspension`.
7354 * For example, an API calling A requests for `prevent-app-suspension`, and another
7355 * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
7356 * used until B stops its request. After that, `prevent-app-suspension` is used.
7358 start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
7360 * Stops the specified power save blocker.
7362 * Whether the specified `powerSaveBlocker` has been stopped.
7364 stop(id: number): boolean;
7367 interface PrinterInfo {
7369 // Docs: https://electronjs.org/docs/api/structures/printer-info
7372 * a longer description of the printer's type.
7374 description: string;
7376 * the name of the printer as shown in Print Preview.
7378 displayName: string;
7380 * whether or not a given printer is set as the default printer on the OS.
7384 * the name of the printer as understood by the OS.
7388 * an object containing a variable number of platform-specific printer information.
7392 * the current status of the printer.
7397 interface ProcessMemoryInfo {
7399 // Docs: https://electronjs.org/docs/api/structures/process-memory-info
7402 * The amount of memory not shared by other processes, such as JS heap or HTML
7403 * content in Kilobytes.
7407 * The amount of memory currently pinned to actual physical RAM in Kilobytes.
7409 * @platform linux,win32
7411 residentSet: number;
7413 * The amount of memory shared between processes, typically memory consumed by the
7414 * Electron code itself in Kilobytes.
7419 interface ProcessMetric {
7421 // Docs: https://electronjs.org/docs/api/structures/process-metric
7424 * CPU usage of the process.
7428 * Creation time for this process. The time is represented as number of
7429 * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
7430 * is useful to use both the `pid` and the `creationTime` to uniquely identify a
7433 creationTime: number;
7435 * One of the following values:
7439 integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
7441 * Memory information for the process.
7445 * The name of the process. Examples for utility: `Audio Service`, `Content
7446 * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
7450 * Process id of the process.
7454 * Whether the process is sandboxed on OS level.
7456 * @platform darwin,win32
7458 sandboxed?: boolean;
7460 * The non-localized name of the process.
7462 serviceName?: string;
7464 * Process type. One of the following values:
7466 type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
7471 // Docs: https://electronjs.org/docs/api/structures/product
7474 * 3 character code presenting a product's currency based on the ISO 4217 standard.
7476 currencyCode: string;
7478 * An array of discount offers
7480 discounts: ProductDiscount[];
7482 * The total size of the content, in bytes.
7484 downloadContentLengths: number[];
7486 * A string that identifies the version of the content.
7488 downloadContentVersion: string;
7490 * The locale formatted price of the product.
7492 formattedPrice: string;
7494 * The object containing introductory price information for the product. available
7497 introductoryPrice?: ProductDiscount;
7499 * A boolean value that indicates whether the App Store has downloadable content
7500 * for this product. `true` if at least one file has been associated with the
7503 isDownloadable: boolean;
7505 * A description of the product.
7507 localizedDescription: string;
7509 * The name of the product.
7511 localizedTitle: string;
7513 * The cost of the product in the local currency.
7517 * The string that identifies the product to the Apple App Store.
7519 productIdentifier: string;
7521 * The identifier of the subscription group to which the subscription belongs.
7523 subscriptionGroupIdentifier: string;
7525 * The period details for products that are subscriptions.
7527 subscriptionPeriod?: ProductSubscriptionPeriod;
7530 interface ProductDiscount {
7532 // Docs: https://electronjs.org/docs/api/structures/product-discount
7535 * A string used to uniquely identify a discount offer for a product.
7539 * An integer that indicates the number of periods the product discount is
7542 numberOfPeriods: number;
7544 * The payment mode for this product discount. Can be `payAsYouGo`, `payUpFront`,
7547 paymentMode: ('payAsYouGo' | 'payUpFront' | 'freeTrial');
7549 * The discount price of the product in the local currency.
7553 * The locale used to format the discount price of the product.
7555 priceLocale: string;
7557 * An object that defines the period for the product discount.
7559 subscriptionPeriod?: ProductSubscriptionPeriod;
7561 * The type of discount offer.
7566 interface ProductSubscriptionPeriod {
7568 // Docs: https://electronjs.org/docs/api/structures/product-subscription-period
7571 * The number of units per subscription period.
7573 numberOfUnits: number;
7575 * The increment of time that a subscription period is specified in. Can be `day`,
7576 * `week`, `month`, `year`.
7578 unit: ('day' | 'week' | 'month' | 'year');
7581 interface Protocol {
7583 // Docs: https://electronjs.org/docs/api/protocol
7586 * Register a protocol handler for `scheme`. Requests made to URLs with this scheme
7587 * will delegate to this handler to determine what response should be sent.
7589 * Either a `Response` or a `Promise<Response>` can be returned.
7593 * See the MDN docs for `Request` and `Response` for more details.
7595 handle(scheme: string, handler: (request: GlobalRequest) => (GlobalResponse) | (Promise<GlobalResponse>)): void;
7597 * Whether the protocol was successfully intercepted
7599 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
7600 * which sends a `Buffer` as a response.
7604 interceptBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
7606 * Whether the protocol was successfully intercepted
7608 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
7609 * which sends a file as a response.
7613 interceptFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
7615 * Whether the protocol was successfully intercepted
7617 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
7618 * which sends a new HTTP request as a response.
7622 interceptHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
7624 * Whether the protocol was successfully intercepted
7626 * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
7631 interceptStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
7633 * Whether the protocol was successfully intercepted
7635 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
7636 * which sends a `string` as a response.
7640 interceptStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
7642 * Whether `scheme` is already handled.
7644 isProtocolHandled(scheme: string): boolean;
7646 * Whether `scheme` is already intercepted.
7650 isProtocolIntercepted(scheme: string): boolean;
7652 * Whether `scheme` is already registered.
7656 isProtocolRegistered(scheme: string): boolean;
7658 * Whether the protocol was successfully registered
7660 * Registers a protocol of `scheme` that will send a `Buffer` as a response.
7662 * The usage is the same with `registerFileProtocol`, except that the `callback`
7663 * should be called with either a `Buffer` object or an object that has the `data`
7670 registerBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
7672 * Whether the protocol was successfully registered
7674 * Registers a protocol of `scheme` that will send a file as the response. The
7675 * `handler` will be called with `request` and `callback` where `request` is an
7676 * incoming request for the `scheme`.
7678 * To handle the `request`, the `callback` should be called with either the file's
7679 * path or an object that has a `path` property, e.g. `callback(filePath)` or
7680 * `callback({ path: filePath })`. The `filePath` must be an absolute path.
7682 * By default the `scheme` is treated like `http:`, which is parsed differently
7683 * from protocols that follow the "generic URI syntax" like `file:`.
7687 registerFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
7689 * Whether the protocol was successfully registered
7691 * Registers a protocol of `scheme` that will send an HTTP request as a response.
7693 * The usage is the same with `registerFileProtocol`, except that the `callback`
7694 * should be called with an object that has the `url` property.
7698 registerHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
7700 * **Note:** This method can only be used before the `ready` event of the `app`
7701 * module gets emitted and can be called only once.
7703 * Registers the `scheme` as standard, secure, bypasses content security policy for
7704 * resources, allows registering ServiceWorker, supports fetch API, streaming
7705 * video/audio, and V8 code cache. Specify a privilege with the value of `true` to
7706 * enable the capability.
7708 * An example of registering a privileged scheme, that bypasses Content Security
7711 * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
7712 * `http` and `https` are standard schemes, while `file` is not.
7714 * Registering a scheme as standard allows relative and absolute resources to be
7715 * resolved correctly when served. Otherwise the scheme will behave like the `file`
7716 * protocol, but without the ability to resolve relative URLs.
7718 * For example when you load following page with custom protocol without
7719 * registering it as standard scheme, the image will not be loaded because
7720 * non-standard schemes can not recognize relative URLs:
7722 * Registering a scheme as standard will allow access to files through the
7723 * FileSystem API. Otherwise the renderer will throw a security error for the
7726 * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
7727 * cookies) are disabled for non standard schemes. So in general if you want to
7728 * register a custom protocol to replace the `http` protocol, you have to register
7729 * it as a standard scheme.
7731 * Protocols that use streams (http and stream protocols) should set `stream:
7732 * true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
7733 * their responses by default. The `stream` flag configures those elements to
7734 * correctly expect streaming responses.
7736 registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
7738 * Whether the protocol was successfully registered
7740 * Registers a protocol of `scheme` that will send a stream as a response.
7742 * The usage is the same with `registerFileProtocol`, except that the `callback`
7743 * should be called with either a `ReadableStream` object or an object that has the
7748 * It is possible to pass any object that implements the readable stream API (emits
7749 * `data`/`end`/`error` events). For example, here's how a file could be returned:
7753 registerStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
7755 * Whether the protocol was successfully registered
7757 * Registers a protocol of `scheme` that will send a `string` as a response.
7759 * The usage is the same with `registerFileProtocol`, except that the `callback`
7760 * should be called with either a `string` or an object that has the `data`
7765 registerStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
7767 * Removes a protocol handler registered with `protocol.handle`.
7769 unhandle(scheme: string): void;
7771 * Whether the protocol was successfully unintercepted
7773 * Remove the interceptor installed for `scheme` and restore its original handler.
7777 uninterceptProtocol(scheme: string): boolean;
7779 * Whether the protocol was successfully unregistered
7781 * Unregisters the custom protocol of `scheme`.
7785 unregisterProtocol(scheme: string): boolean;
7788 interface ProtocolRequest {
7790 // Docs: https://electronjs.org/docs/api/structures/protocol-request
7792 headers: Record<string, string>;
7795 uploadData?: UploadData[];
7799 interface ProtocolResponse {
7801 // Docs: https://electronjs.org/docs/api/structures/protocol-response
7804 * The charset of response body, default is `"utf-8"`.
7808 * The response body. When returning stream as response, this is a Node.js readable
7809 * stream representing the response body. When returning `Buffer` as response, this
7810 * is a `Buffer`. When returning `string` as response, this is a `string`. This is
7811 * ignored for other types of responses.
7813 data?: (Buffer) | (string) | (NodeJS.ReadableStream);
7815 * When assigned, the `request` will fail with the `error` number . For the
7816 * available error numbers you can use, please see the net error list.
7820 * An object containing the response headers. The keys must be string, and values
7821 * must be either string or Array of string.
7823 headers?: Record<string, (string) | (string[])>;
7825 * The HTTP `method`. This is only used for file and URL responses.
7829 * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
7830 * would implicitly set the `content-type` header in response, but if
7831 * `content-type` is already set in `headers`, the `mimeType` would be ignored.
7835 * Path to the file which would be sent as response body. This is only used for
7840 * The `referrer` URL. This is only used for file and URL responses.
7844 * The session used for requesting URL, by default the HTTP request will reuse the
7845 * current session. Setting `session` to `null` would use a random independent
7846 * session. This is only used for URL responses.
7850 * The HTTP response code, default is 200.
7852 statusCode?: number;
7854 * The data used as upload data. This is only used for URL responses when `method`
7857 uploadData?: ProtocolResponseUploadData;
7859 * Download the `url` and pipe the result as response body. This is only used for
7865 interface ProtocolResponseUploadData {
7867 // Docs: https://electronjs.org/docs/api/structures/protocol-response-upload-data
7870 * MIME type of the content.
7872 contentType: string;
7874 * Content to be sent.
7876 data: (string) | (Buffer);
7879 interface PushNotifications extends NodeJS.EventEmitter {
7881 // Docs: https://electronjs.org/docs/api/push-notifications
7884 * Emitted when the app receives a remote notification while running. See:
7885 * https://developer.apple.com/documentation/appkit/nsapplicationdelegate/1428430-application?language=objc
7889 on(event: 'received-apns-notification', listener: (event: Event,
7890 userInfo: Record<string, any>) => void): this;
7891 off(event: 'received-apns-notification', listener: (event: Event,
7892 userInfo: Record<string, any>) => void): this;
7893 once(event: 'received-apns-notification', listener: (event: Event,
7894 userInfo: Record<string, any>) => void): this;
7895 addListener(event: 'received-apns-notification', listener: (event: Event,
7896 userInfo: Record<string, any>) => void): this;
7897 removeListener(event: 'received-apns-notification', listener: (event: Event,
7898 userInfo: Record<string, any>) => void): this;
7900 * Registers the app with Apple Push Notification service (APNS) to receive Badge,
7901 * Sound, and Alert notifications. If registration is successful, the promise will
7902 * be resolved with the APNS device token. Otherwise, the promise will be rejected
7903 * with an error message. See:
7904 * https://developer.apple.com/documentation/appkit/nsapplication/1428476-registerforremotenotificationtyp?language=objc
7908 registerForAPNSNotifications(): Promise<string>;
7910 * Unregisters the app from notifications received from APNS. See:
7911 * https://developer.apple.com/documentation/appkit/nsapplication/1428747-unregisterforremotenotifications?language=objc
7915 unregisterForAPNSNotifications(): void;
7918 interface Rectangle {
7920 // Docs: https://electronjs.org/docs/api/structures/rectangle
7923 * The height of the rectangle (must be an integer).
7927 * The width of the rectangle (must be an integer).
7931 * The x coordinate of the origin of the rectangle (must be an integer).
7935 * The y coordinate of the origin of the rectangle (must be an integer).
7940 interface Referrer {
7942 // Docs: https://electronjs.org/docs/api/structures/referrer
7945 * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
7946 * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
7947 * See the Referrer-Policy spec for more details on the meaning of these values.
7949 policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
7951 * HTTP Referrer URL.
7956 interface RenderProcessGoneDetails {
7958 // Docs: https://electronjs.org/docs/api/structures/render-process-gone-details
7961 * The exit code of the process, unless `reason` is `launch-failed`, in which case
7962 * `exitCode` will be a platform-specific launch failure error code.
7966 * The reason the render process is gone. Possible values:
7968 reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
7971 interface ResolvedEndpoint {
7973 // Docs: https://electronjs.org/docs/api/structures/resolved-endpoint
7977 * One of the following:
7979 family: ('ipv4' | 'ipv6' | 'unspec');
7982 interface ResolvedHost {
7984 // Docs: https://electronjs.org/docs/api/structures/resolved-host
7987 * resolved DNS entries for the hostname
7989 endpoints: ResolvedEndpoint[];
7992 interface SafeStorage extends NodeJS.EventEmitter {
7994 // Docs: https://electronjs.org/docs/api/safe-storage
7997 * the decrypted string. Decrypts the encrypted buffer obtained with
7998 * `safeStorage.encryptString` back into a string.
8000 * This function will throw an error if decryption fails.
8002 decryptString(encrypted: Buffer): string;
8004 * An array of bytes representing the encrypted string.
8006 * This function will throw an error if encryption fails.
8008 encryptString(plainText: string): Buffer;
8010 * User friendly name of the password manager selected on Linux.
8012 * This function will return one of the following values:
8014 * * `basic_text` - When the desktop environment is not recognised or if the
8015 * following command line flag is provided `--password-store="basic"`.
8016 * * `gnome_libsecret` - When the desktop environment is `X-Cinnamon`, `Deepin`,
8017 * `GNOME`, `Pantheon`, `XFCE`, `UKUI`, `unity` or if the following command line
8018 * flag is provided `--password-store="gnome-libsecret"`.
8019 * * `kwallet` - When the desktop session is `kde4` or if the following command
8020 * line flag is provided `--password-store="kwallet"`.
8021 * * `kwallet5` - When the desktop session is `kde5` or if the following command
8022 * line flag is provided `--password-store="kwallet5"`.
8023 * * `kwallet6` - When the desktop session is `kde6`.
8024 * * `unknown` - When the function is called before app has emitted the `ready`
8029 getSelectedStorageBackend(): ('basic_text' | 'gnome_libsecret' | 'kwallet' | 'kwallet5' | 'kwallet6' | 'unknown');
8031 * Whether encryption is available.
8033 * On Linux, returns true if the app has emitted the `ready` event and the secret
8034 * key is available. On MacOS, returns true if Keychain is available. On Windows,
8035 * returns true once the app has emitted the `ready` event.
8037 isEncryptionAvailable(): boolean;
8039 * This function on Linux will force the module to use an in memory password for
8040 * creating symmetric key that is used for encrypt/decrypt functions when a valid
8041 * OS password manager cannot be determined for the current active desktop
8042 * environment. This function is a no-op on Windows and MacOS.
8044 setUsePlainTextEncryption(usePlainText: boolean): void;
8047 interface Screen extends NodeJS.EventEmitter {
8049 // Docs: https://electronjs.org/docs/api/screen
8052 * Emitted when `newDisplay` has been added.
8054 on(event: 'display-added', listener: (event: Event,
8055 newDisplay: Display) => void): this;
8056 off(event: 'display-added', listener: (event: Event,
8057 newDisplay: Display) => void): this;
8058 once(event: 'display-added', listener: (event: Event,
8059 newDisplay: Display) => void): this;
8060 addListener(event: 'display-added', listener: (event: Event,
8061 newDisplay: Display) => void): this;
8062 removeListener(event: 'display-added', listener: (event: Event,
8063 newDisplay: Display) => void): this;
8065 * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
8066 * an array of strings that describe the changes. Possible changes are `bounds`,
8067 * `workArea`, `scaleFactor` and `rotation`.
8069 on(event: 'display-metrics-changed', listener: (event: Event,
8071 changedMetrics: string[]) => void): this;
8072 off(event: 'display-metrics-changed', listener: (event: Event,
8074 changedMetrics: string[]) => void): this;
8075 once(event: 'display-metrics-changed', listener: (event: Event,
8077 changedMetrics: string[]) => void): this;
8078 addListener(event: 'display-metrics-changed', listener: (event: Event,
8080 changedMetrics: string[]) => void): this;
8081 removeListener(event: 'display-metrics-changed', listener: (event: Event,
8083 changedMetrics: string[]) => void): this;
8085 * Emitted when `oldDisplay` has been removed.
8087 on(event: 'display-removed', listener: (event: Event,
8088 oldDisplay: Display) => void): this;
8089 off(event: 'display-removed', listener: (event: Event,
8090 oldDisplay: Display) => void): this;
8091 once(event: 'display-removed', listener: (event: Event,
8092 oldDisplay: Display) => void): this;
8093 addListener(event: 'display-removed', listener: (event: Event,
8094 oldDisplay: Display) => void): this;
8095 removeListener(event: 'display-removed', listener: (event: Event,
8096 oldDisplay: Display) => void): this;
8098 * Converts a screen DIP point to a screen physical point. The DPI scale is
8099 * performed relative to the display containing the DIP point.
8103 dipToScreenPoint(point: Point): Point;
8105 * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
8106 * relative to the display nearest to `window`. If `window` is null, scaling will
8107 * be performed to the display nearest to `rect`.
8111 dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
8113 * An array of displays that are currently available.
8115 getAllDisplays(): Display[];
8117 * The current absolute position of the mouse pointer.
8119 * **Note:** The return value is a DIP point, not a screen physical point.
8121 getCursorScreenPoint(): Point;
8123 * The display that most closely intersects the provided bounds.
8125 getDisplayMatching(rect: Rectangle): Display;
8127 * The display nearest the specified point.
8129 getDisplayNearestPoint(point: Point): Display;
8131 * The primary display.
8133 getPrimaryDisplay(): Display;
8135 * Converts a screen physical point to a screen DIP point. The DPI scale is
8136 * performed relative to the display containing the physical point.
8140 screenToDipPoint(point: Point): Point;
8142 * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
8143 * relative to the display nearest to `window`. If `window` is null, scaling will
8144 * be performed to the display nearest to `rect`.
8148 screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
8151 interface ScrubberItem {
8153 // Docs: https://electronjs.org/docs/api/structures/scrubber-item
8156 * The image to appear in this item.
8160 * The text to appear in this item.
8165 interface SegmentedControlSegment {
8167 // Docs: https://electronjs.org/docs/api/structures/segmented-control-segment
8170 * Whether this segment is selectable. Default: true.
8174 * The image to appear in this segment.
8178 * The text to appear in this segment.
8183 interface SerialPort {
8185 // Docs: https://electronjs.org/docs/api/structures/serial-port
8188 * A stable identifier on Windows that can be used for device permissions.
8192 deviceInstanceId?: string;
8194 * A string suitable for display to the user for describing this device.
8196 displayName?: string;
8198 * Unique identifier for the port.
8206 * The USB product ID.
8210 * The USB device serial number.
8212 serialNumber?: string;
8214 * Represents a single serial port on macOS can be enumerated by multiple drivers.
8218 usbDriverName?: string;
8220 * The USB vendor ID.
8225 interface ServiceWorkerInfo {
8227 // Docs: https://electronjs.org/docs/api/structures/service-worker-info
8230 * The virtual ID of the process that this service worker is running in. This is
8231 * not an OS level PID. This aligns with the ID set used for
8232 * `webContents.getProcessId()`.
8234 renderProcessId: number;
8236 * The base URL that this service worker is active for.
8240 * The full URL to the script that this service worker runs
8245 class ServiceWorkers extends NodeEventEmitter {
8247 // Docs: https://electronjs.org/docs/api/service-workers
8250 * Emitted when a service worker logs something to the console.
8252 on(event: 'console-message', listener: (event: Event,
8254 * Information about the console message
8256 messageDetails: MessageDetails) => void): this;
8257 off(event: 'console-message', listener: (event: Event,
8259 * Information about the console message
8261 messageDetails: MessageDetails) => void): this;
8262 once(event: 'console-message', listener: (event: Event,
8264 * Information about the console message
8266 messageDetails: MessageDetails) => void): this;
8267 addListener(event: 'console-message', listener: (event: Event,
8269 * Information about the console message
8271 messageDetails: MessageDetails) => void): this;
8272 removeListener(event: 'console-message', listener: (event: Event,
8274 * Information about the console message
8276 messageDetails: MessageDetails) => void): this;
8278 * Emitted when a service worker has been registered. Can occur after a call to
8279 * `navigator.serviceWorker.register('/sw.js')` successfully resolves or when a
8280 * Chrome extension is loaded.
8282 on(event: 'registration-completed', listener: (event: Event,
8284 * Information about the registered service worker
8286 details: RegistrationCompletedDetails) => void): this;
8287 off(event: 'registration-completed', listener: (event: Event,
8289 * Information about the registered service worker
8291 details: RegistrationCompletedDetails) => void): this;
8292 once(event: 'registration-completed', listener: (event: Event,
8294 * Information about the registered service worker
8296 details: RegistrationCompletedDetails) => void): this;
8297 addListener(event: 'registration-completed', listener: (event: Event,
8299 * Information about the registered service worker
8301 details: RegistrationCompletedDetails) => void): this;
8302 removeListener(event: 'registration-completed', listener: (event: Event,
8304 * Information about the registered service worker
8306 details: RegistrationCompletedDetails) => void): this;
8308 * A ServiceWorkerInfo object where the keys are the service worker version ID and
8309 * the values are the information about that service worker.
8311 getAllRunning(): Record<number, ServiceWorkerInfo>;
8313 * Information about this service worker
8315 * If the service worker does not exist or is not running this method will throw an
8318 getFromVersionID(versionId: number): ServiceWorkerInfo;
8321 class Session extends NodeEventEmitter {
8323 // Docs: https://electronjs.org/docs/api/session
8326 * A session instance from `partition` string. When there is an existing `Session`
8327 * with the same `partition`, it will be returned; otherwise a new `Session`
8328 * instance will be created with `options`.
8330 * If `partition` starts with `persist:`, the page will use a persistent session
8331 * available to all pages in the app with the same `partition`. if there is no
8332 * `persist:` prefix, the page will use an in-memory session. If the `partition` is
8333 * empty then default session of the app will be returned.
8335 * To create a `Session` with `options`, you have to ensure the `Session` with the
8336 * `partition` has never been used before. There is no way to change the `options`
8337 * of an existing `Session` object.
8339 static fromPartition(partition: string, options?: FromPartitionOptions): Session;
8341 * A session instance from the absolute path as specified by the `path` string.
8342 * When there is an existing `Session` with the same absolute path, it will be
8343 * returned; otherwise a new `Session` instance will be created with `options`. The
8344 * call will throw an error if the path is not an absolute path. Additionally, an
8345 * error will be thrown if an empty string is provided.
8347 * To create a `Session` with `options`, you have to ensure the `Session` with the
8348 * `path` has never been used before. There is no way to change the `options` of an
8349 * existing `Session` object.
8351 static fromPath(path: string, options?: FromPathOptions): Session;
8353 * A `Session` object, the default session object of the app.
8355 static defaultSession: Session;
8357 * Emitted after an extension is loaded. This occurs whenever an extension is added
8358 * to the "enabled" set of extensions. This includes:
8360 * * Extensions being loaded from `Session.loadExtension`.
8361 * * Extensions being reloaded:
8363 * * if the extension requested it (`chrome.runtime.reload()`).
8365 on(event: 'extension-loaded', listener: (event: Event,
8366 extension: Extension) => void): this;
8367 off(event: 'extension-loaded', listener: (event: Event,
8368 extension: Extension) => void): this;
8369 once(event: 'extension-loaded', listener: (event: Event,
8370 extension: Extension) => void): this;
8371 addListener(event: 'extension-loaded', listener: (event: Event,
8372 extension: Extension) => void): this;
8373 removeListener(event: 'extension-loaded', listener: (event: Event,
8374 extension: Extension) => void): this;
8376 * Emitted after an extension is loaded and all necessary browser state is
8377 * initialized to support the start of the extension's background page.
8379 on(event: 'extension-ready', listener: (event: Event,
8380 extension: Extension) => void): this;
8381 off(event: 'extension-ready', listener: (event: Event,
8382 extension: Extension) => void): this;
8383 once(event: 'extension-ready', listener: (event: Event,
8384 extension: Extension) => void): this;
8385 addListener(event: 'extension-ready', listener: (event: Event,
8386 extension: Extension) => void): this;
8387 removeListener(event: 'extension-ready', listener: (event: Event,
8388 extension: Extension) => void): this;
8390 * Emitted after an extension is unloaded. This occurs when
8391 * `Session.removeExtension` is called.
8393 on(event: 'extension-unloaded', listener: (event: Event,
8394 extension: Extension) => void): this;
8395 off(event: 'extension-unloaded', listener: (event: Event,
8396 extension: Extension) => void): this;
8397 once(event: 'extension-unloaded', listener: (event: Event,
8398 extension: Extension) => void): this;
8399 addListener(event: 'extension-unloaded', listener: (event: Event,
8400 extension: Extension) => void): this;
8401 removeListener(event: 'extension-unloaded', listener: (event: Event,
8402 extension: Extension) => void): this;
8404 * Emitted after `navigator.hid.requestDevice` has been called and
8405 * `select-hid-device` has fired if a new device becomes available before the
8406 * callback from `select-hid-device` is called. This event is intended for use
8407 * when using a UI to ask users to pick a device so that the UI can be updated with
8408 * the newly added device.
8410 on(event: 'hid-device-added', listener: (event: Event,
8411 details: HidDeviceAddedDetails) => void): this;
8412 off(event: 'hid-device-added', listener: (event: Event,
8413 details: HidDeviceAddedDetails) => void): this;
8414 once(event: 'hid-device-added', listener: (event: Event,
8415 details: HidDeviceAddedDetails) => void): this;
8416 addListener(event: 'hid-device-added', listener: (event: Event,
8417 details: HidDeviceAddedDetails) => void): this;
8418 removeListener(event: 'hid-device-added', listener: (event: Event,
8419 details: HidDeviceAddedDetails) => void): this;
8421 * Emitted after `navigator.hid.requestDevice` has been called and
8422 * `select-hid-device` has fired if a device has been removed before the callback
8423 * from `select-hid-device` is called. This event is intended for use when using a
8424 * UI to ask users to pick a device so that the UI can be updated to remove the
8427 on(event: 'hid-device-removed', listener: (event: Event,
8428 details: HidDeviceRemovedDetails) => void): this;
8429 off(event: 'hid-device-removed', listener: (event: Event,
8430 details: HidDeviceRemovedDetails) => void): this;
8431 once(event: 'hid-device-removed', listener: (event: Event,
8432 details: HidDeviceRemovedDetails) => void): this;
8433 addListener(event: 'hid-device-removed', listener: (event: Event,
8434 details: HidDeviceRemovedDetails) => void): this;
8435 removeListener(event: 'hid-device-removed', listener: (event: Event,
8436 details: HidDeviceRemovedDetails) => void): this;
8438 * Emitted after `HIDDevice.forget()` has been called. This event can be used to
8439 * help maintain persistent storage of permissions when
8440 * `setDevicePermissionHandler` is used.
8442 on(event: 'hid-device-revoked', listener: (event: Event,
8443 details: HidDeviceRevokedDetails) => void): this;
8444 off(event: 'hid-device-revoked', listener: (event: Event,
8445 details: HidDeviceRevokedDetails) => void): this;
8446 once(event: 'hid-device-revoked', listener: (event: Event,
8447 details: HidDeviceRevokedDetails) => void): this;
8448 addListener(event: 'hid-device-revoked', listener: (event: Event,
8449 details: HidDeviceRevokedDetails) => void): this;
8450 removeListener(event: 'hid-device-revoked', listener: (event: Event,
8451 details: HidDeviceRevokedDetails) => void): this;
8453 * Emitted when a render process requests preconnection to a URL, generally due to
8456 on(event: 'preconnect', listener: (event: Event,
8458 * The URL being requested for preconnection by the renderer.
8460 preconnectUrl: string,
8462 * True if the renderer is requesting that the connection include credentials (see
8463 * the spec for more details.)
8465 allowCredentials: boolean) => void): this;
8466 off(event: 'preconnect', listener: (event: Event,
8468 * The URL being requested for preconnection by the renderer.
8470 preconnectUrl: string,
8472 * True if the renderer is requesting that the connection include credentials (see
8473 * the spec for more details.)
8475 allowCredentials: boolean) => void): this;
8476 once(event: 'preconnect', listener: (event: Event,
8478 * The URL being requested for preconnection by the renderer.
8480 preconnectUrl: string,
8482 * True if the renderer is requesting that the connection include credentials (see
8483 * the spec for more details.)
8485 allowCredentials: boolean) => void): this;
8486 addListener(event: 'preconnect', listener: (event: Event,
8488 * The URL being requested for preconnection by the renderer.
8490 preconnectUrl: string,
8492 * True if the renderer is requesting that the connection include credentials (see
8493 * the spec for more details.)
8495 allowCredentials: boolean) => void): this;
8496 removeListener(event: 'preconnect', listener: (event: Event,
8498 * The URL being requested for preconnection by the renderer.
8500 preconnectUrl: string,
8502 * True if the renderer is requesting that the connection include credentials (see
8503 * the spec for more details.)
8505 allowCredentials: boolean) => void): this;
8507 * Emitted when a HID device needs to be selected when a call to
8508 * `navigator.hid.requestDevice` is made. `callback` should be called with
8509 * `deviceId` to be selected; passing no arguments to `callback` will cancel the
8510 * request. Additionally, permissioning on `navigator.hid` can be further managed
8511 * by using `ses.setPermissionCheckHandler(handler)` and
8512 * `ses.setDevicePermissionHandler(handler)`.
8514 on(event: 'select-hid-device', listener: (event: Event,
8515 details: SelectHidDeviceDetails,
8516 callback: (deviceId?: (string) | (null)) => void) => void): this;
8517 off(event: 'select-hid-device', listener: (event: Event,
8518 details: SelectHidDeviceDetails,
8519 callback: (deviceId?: (string) | (null)) => void) => void): this;
8520 once(event: 'select-hid-device', listener: (event: Event,
8521 details: SelectHidDeviceDetails,
8522 callback: (deviceId?: (string) | (null)) => void) => void): this;
8523 addListener(event: 'select-hid-device', listener: (event: Event,
8524 details: SelectHidDeviceDetails,
8525 callback: (deviceId?: (string) | (null)) => void) => void): this;
8526 removeListener(event: 'select-hid-device', listener: (event: Event,
8527 details: SelectHidDeviceDetails,
8528 callback: (deviceId?: (string) | (null)) => void) => void): this;
8530 * Emitted when a serial port needs to be selected when a call to
8531 * `navigator.serial.requestPort` is made. `callback` should be called with
8532 * `portId` to be selected, passing an empty string to `callback` will cancel the
8533 * request. Additionally, permissioning on `navigator.serial` can be managed by
8534 * using ses.setPermissionCheckHandler(handler) with the `serial` permission.
8536 on(event: 'select-serial-port', listener: (event: Event,
8537 portList: SerialPort[],
8538 webContents: WebContents,
8539 callback: (portId: string) => void) => void): this;
8540 off(event: 'select-serial-port', listener: (event: Event,
8541 portList: SerialPort[],
8542 webContents: WebContents,
8543 callback: (portId: string) => void) => void): this;
8544 once(event: 'select-serial-port', listener: (event: Event,
8545 portList: SerialPort[],
8546 webContents: WebContents,
8547 callback: (portId: string) => void) => void): this;
8548 addListener(event: 'select-serial-port', listener: (event: Event,
8549 portList: SerialPort[],
8550 webContents: WebContents,
8551 callback: (portId: string) => void) => void): this;
8552 removeListener(event: 'select-serial-port', listener: (event: Event,
8553 portList: SerialPort[],
8554 webContents: WebContents,
8555 callback: (portId: string) => void) => void): this;
8557 * Emitted when a USB device needs to be selected when a call to
8558 * `navigator.usb.requestDevice` is made. `callback` should be called with
8559 * `deviceId` to be selected; passing no arguments to `callback` will cancel the
8560 * request. Additionally, permissioning on `navigator.usb` can be further managed
8561 * by using `ses.setPermissionCheckHandler(handler)` and
8562 * `ses.setDevicePermissionHandler(handler)`.
8564 on(event: 'select-usb-device', listener: (event: Event,
8565 details: SelectUsbDeviceDetails,
8566 callback: (deviceId?: string) => void) => void): this;
8567 off(event: 'select-usb-device', listener: (event: Event,
8568 details: SelectUsbDeviceDetails,
8569 callback: (deviceId?: string) => void) => void): this;
8570 once(event: 'select-usb-device', listener: (event: Event,
8571 details: SelectUsbDeviceDetails,
8572 callback: (deviceId?: string) => void) => void): this;
8573 addListener(event: 'select-usb-device', listener: (event: Event,
8574 details: SelectUsbDeviceDetails,
8575 callback: (deviceId?: string) => void) => void): this;
8576 removeListener(event: 'select-usb-device', listener: (event: Event,
8577 details: SelectUsbDeviceDetails,
8578 callback: (deviceId?: string) => void) => void): this;
8580 * Emitted after `navigator.serial.requestPort` has been called and
8581 * `select-serial-port` has fired if a new serial port becomes available before the
8582 * callback from `select-serial-port` is called. This event is intended for use
8583 * when using a UI to ask users to pick a port so that the UI can be updated with
8584 * the newly added port.
8586 on(event: 'serial-port-added', listener: (event: Event,
8588 webContents: WebContents) => void): this;
8589 off(event: 'serial-port-added', listener: (event: Event,
8591 webContents: WebContents) => void): this;
8592 once(event: 'serial-port-added', listener: (event: Event,
8594 webContents: WebContents) => void): this;
8595 addListener(event: 'serial-port-added', listener: (event: Event,
8597 webContents: WebContents) => void): this;
8598 removeListener(event: 'serial-port-added', listener: (event: Event,
8600 webContents: WebContents) => void): this;
8602 * Emitted after `navigator.serial.requestPort` has been called and
8603 * `select-serial-port` has fired if a serial port has been removed before the
8604 * callback from `select-serial-port` is called. This event is intended for use
8605 * when using a UI to ask users to pick a port so that the UI can be updated to
8606 * remove the specified port.
8608 on(event: 'serial-port-removed', listener: (event: Event,
8610 webContents: WebContents) => void): this;
8611 off(event: 'serial-port-removed', listener: (event: Event,
8613 webContents: WebContents) => void): this;
8614 once(event: 'serial-port-removed', listener: (event: Event,
8616 webContents: WebContents) => void): this;
8617 addListener(event: 'serial-port-removed', listener: (event: Event,
8619 webContents: WebContents) => void): this;
8620 removeListener(event: 'serial-port-removed', listener: (event: Event,
8622 webContents: WebContents) => void): this;
8624 * Emitted after `SerialPort.forget()` has been called. This event can be used to
8625 * help maintain persistent storage of permissions when
8626 * `setDevicePermissionHandler` is used.
8628 on(event: 'serial-port-revoked', listener: (event: Event,
8629 details: SerialPortRevokedDetails) => void): this;
8630 off(event: 'serial-port-revoked', listener: (event: Event,
8631 details: SerialPortRevokedDetails) => void): this;
8632 once(event: 'serial-port-revoked', listener: (event: Event,
8633 details: SerialPortRevokedDetails) => void): this;
8634 addListener(event: 'serial-port-revoked', listener: (event: Event,
8635 details: SerialPortRevokedDetails) => void): this;
8636 removeListener(event: 'serial-port-revoked', listener: (event: Event,
8637 details: SerialPortRevokedDetails) => void): this;
8639 * Emitted when a hunspell dictionary file starts downloading
8641 on(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
8643 * The language code of the dictionary file
8645 languageCode: string) => void): this;
8646 off(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
8648 * The language code of the dictionary file
8650 languageCode: string) => void): this;
8651 once(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
8653 * The language code of the dictionary file
8655 languageCode: string) => void): this;
8656 addListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
8658 * The language code of the dictionary file
8660 languageCode: string) => void): this;
8661 removeListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
8663 * The language code of the dictionary file
8665 languageCode: string) => void): this;
8667 * Emitted when a hunspell dictionary file download fails. For details on the
8668 * failure you should collect a netlog and inspect the download request.
8670 on(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
8672 * The language code of the dictionary file
8674 languageCode: string) => void): this;
8675 off(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
8677 * The language code of the dictionary file
8679 languageCode: string) => void): this;
8680 once(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
8682 * The language code of the dictionary file
8684 languageCode: string) => void): this;
8685 addListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
8687 * The language code of the dictionary file
8689 languageCode: string) => void): this;
8690 removeListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
8692 * The language code of the dictionary file
8694 languageCode: string) => void): this;
8696 * Emitted when a hunspell dictionary file has been successfully downloaded
8698 on(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
8700 * The language code of the dictionary file
8702 languageCode: string) => void): this;
8703 off(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
8705 * The language code of the dictionary file
8707 languageCode: string) => void): this;
8708 once(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
8710 * The language code of the dictionary file
8712 languageCode: string) => void): this;
8713 addListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
8715 * The language code of the dictionary file
8717 languageCode: string) => void): this;
8718 removeListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
8720 * The language code of the dictionary file
8722 languageCode: string) => void): this;
8724 * Emitted when a hunspell dictionary file has been successfully initialized. This
8725 * occurs after the file has been downloaded.
8727 on(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
8729 * The language code of the dictionary file
8731 languageCode: string) => void): this;
8732 off(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
8734 * The language code of the dictionary file
8736 languageCode: string) => void): this;
8737 once(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
8739 * The language code of the dictionary file
8741 languageCode: string) => void): this;
8742 addListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
8744 * The language code of the dictionary file
8746 languageCode: string) => void): this;
8747 removeListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
8749 * The language code of the dictionary file
8751 languageCode: string) => void): this;
8753 * Emitted after `navigator.usb.requestDevice` has been called and
8754 * `select-usb-device` has fired if a new device becomes available before the
8755 * callback from `select-usb-device` is called. This event is intended for use
8756 * when using a UI to ask users to pick a device so that the UI can be updated with
8757 * the newly added device.
8759 on(event: 'usb-device-added', listener: (event: Event,
8761 webContents: WebContents) => void): this;
8762 off(event: 'usb-device-added', listener: (event: Event,
8764 webContents: WebContents) => void): this;
8765 once(event: 'usb-device-added', listener: (event: Event,
8767 webContents: WebContents) => void): this;
8768 addListener(event: 'usb-device-added', listener: (event: Event,
8770 webContents: WebContents) => void): this;
8771 removeListener(event: 'usb-device-added', listener: (event: Event,
8773 webContents: WebContents) => void): this;
8775 * Emitted after `navigator.usb.requestDevice` has been called and
8776 * `select-usb-device` has fired if a device has been removed before the callback
8777 * from `select-usb-device` is called. This event is intended for use when using a
8778 * UI to ask users to pick a device so that the UI can be updated to remove the
8781 on(event: 'usb-device-removed', listener: (event: Event,
8783 webContents: WebContents) => void): this;
8784 off(event: 'usb-device-removed', listener: (event: Event,
8786 webContents: WebContents) => void): this;
8787 once(event: 'usb-device-removed', listener: (event: Event,
8789 webContents: WebContents) => void): this;
8790 addListener(event: 'usb-device-removed', listener: (event: Event,
8792 webContents: WebContents) => void): this;
8793 removeListener(event: 'usb-device-removed', listener: (event: Event,
8795 webContents: WebContents) => void): this;
8797 * Emitted after `USBDevice.forget()` has been called. This event can be used to
8798 * help maintain persistent storage of permissions when
8799 * `setDevicePermissionHandler` is used.
8801 on(event: 'usb-device-revoked', listener: (event: Event,
8802 details: UsbDeviceRevokedDetails) => void): this;
8803 off(event: 'usb-device-revoked', listener: (event: Event,
8804 details: UsbDeviceRevokedDetails) => void): this;
8805 once(event: 'usb-device-revoked', listener: (event: Event,
8806 details: UsbDeviceRevokedDetails) => void): this;
8807 addListener(event: 'usb-device-revoked', listener: (event: Event,
8808 details: UsbDeviceRevokedDetails) => void): this;
8809 removeListener(event: 'usb-device-revoked', listener: (event: Event,
8810 details: UsbDeviceRevokedDetails) => void): this;
8812 * Emitted when Electron is about to download `item` in `webContents`.
8814 * Calling `event.preventDefault()` will cancel the download and `item` will not be
8815 * available from next tick of the process.
8817 on(event: 'will-download', listener: (event: Event,
8819 webContents: WebContents) => void): this;
8820 off(event: 'will-download', listener: (event: Event,
8822 webContents: WebContents) => void): this;
8823 once(event: 'will-download', listener: (event: Event,
8825 webContents: WebContents) => void): this;
8826 addListener(event: 'will-download', listener: (event: Event,
8828 webContents: WebContents) => void): this;
8829 removeListener(event: 'will-download', listener: (event: Event,
8831 webContents: WebContents) => void): this;
8833 * Whether the word was successfully written to the custom dictionary. This API
8834 * will not work on non-persistent (in-memory) sessions.
8836 * **Note:** On macOS and Windows 10 this word will be written to the OS custom
8837 * dictionary as well
8839 addWordToSpellCheckerDictionary(word: string): boolean;
8841 * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
8844 allowNTLMCredentialsForDomains(domains: string): void;
8846 * resolves when the session’s HTTP authentication cache has been cleared.
8848 clearAuthCache(): Promise<void>;
8850 * resolves when the cache clear operation is complete.
8852 * Clears the session’s HTTP cache.
8854 clearCache(): Promise<void>;
8856 * resolves when the code cache clear operation is complete.
8858 clearCodeCaches(options: ClearCodeCachesOptions): Promise<void>;
8860 * Resolves when the operation is complete.
8862 * Clears the host resolver cache.
8864 clearHostResolverCache(): Promise<void>;
8866 * resolves when the storage data has been cleared.
8868 clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
8870 * Resolves when all connections are closed.
8872 * **Note:** It will terminate / fail all requests currently in flight.
8874 closeAllConnections(): Promise<void>;
8876 * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
8877 * The API will generate a DownloadItem that can be accessed with the will-download
8878 * event. The DownloadItem will not have any `WebContents` associated with it and
8879 * the initial state will be `interrupted`. The download will start only when the
8880 * `resume` API is called on the DownloadItem.
8882 createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
8884 * Disables any network emulation already active for the `session`. Resets to the
8885 * original network configuration.
8887 disableNetworkEmulation(): void;
8889 * Initiates a download of the resource at `url`. The API will generate a
8890 * DownloadItem that can be accessed with the will-download event.
8892 * **Note:** This does not perform any security checks that relate to a page's
8893 * origin, unlike `webContents.downloadURL`.
8895 downloadURL(url: string, options?: DownloadURLOptions): void;
8897 * Emulates network with the given configuration for the `session`.
8899 enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
8903 * Sends a request, similarly to how `fetch()` works in the renderer, using
8904 * Chrome's network stack. This differs from Node's `fetch()`, which uses Node.js's
8909 * See also `net.fetch()`, a convenience method which issues requests from the
8912 * See the MDN documentation for `fetch()` for more details.
8916 * * `net.fetch()` does not support the `data:` or `blob:` schemes.
8917 * * The value of the `integrity` option is ignored.
8918 * * The `.type` and `.url` values of the returned `Response` object are incorrect.
8920 * By default, requests made with `net.fetch` can be made to custom protocols as
8921 * well as `file:`, and will trigger webRequest handlers if present. When the
8922 * non-standard `bypassCustomProtocolHandlers` option is set in RequestInit, custom
8923 * protocol handlers will not be called for this request. This allows forwarding an
8924 * intercepted request to the built-in handler. webRequest handlers will still be
8925 * triggered when bypassing custom protocols.
8927 fetch(input: (string) | (GlobalRequest), init?: RequestInit & { bypassCustomProtocolHandlers?: boolean }): Promise<GlobalResponse>;
8929 * Writes any unwritten DOMStorage data to disk.
8931 flushStorageData(): void;
8933 * Resolves when the all internal states of proxy service is reset and the latest
8934 * proxy configuration is reapplied if it's already available. The pac script will
8935 * be fetched from `pacScript` again if the proxy mode is `pac_script`.
8937 forceReloadProxyConfig(): Promise<void>;
8939 * A list of all loaded extensions.
8941 * **Note:** This API cannot be called before the `ready` event of the `app` module
8944 getAllExtensions(): Extension[];
8946 * resolves with blob data.
8948 getBlobData(identifier: string): Promise<Buffer>;
8950 * the session's current cache size, in bytes.
8952 getCacheSize(): Promise<number>;
8954 * The loaded extension with the given ID.
8956 * **Note:** This API cannot be called before the `ready` event of the `app` module
8959 getExtension(extensionId: string): (Extension) | (null);
8961 * an array of paths to preload scripts that have been registered.
8963 getPreloads(): string[];
8965 * An array of language codes the spellchecker is enabled for. If this list is
8966 * empty the spellchecker will fallback to using `en-US`. By default on launch if
8967 * this setting is an empty list Electron will try to populate this setting with
8968 * the current OS locale. This setting is persisted across restarts.
8970 * **Note:** On macOS the OS spellchecker is used and has its own list of
8971 * languages. On macOS, this API will return whichever languages have been
8972 * configured by the OS.
8974 getSpellCheckerLanguages(): string[];
8976 * The absolute file system path where data for this session is persisted on disk.
8977 * For in memory sessions this returns `null`.
8979 getStoragePath(): (string) | (null);
8981 * The user agent for this session.
8983 getUserAgent(): string;
8985 * Whether or not this session is a persistent one. The default `webContents`
8986 * session of a `BrowserWindow` is persistent. When creating a session from a
8987 * partition, session prefixed with `persist:` will be persistent, while others
8988 * will be temporary.
8990 isPersistent(): boolean;
8992 * Whether the builtin spell checker is enabled.
8994 isSpellCheckerEnabled(): boolean;
8996 * An array of all words in app's custom dictionary. Resolves when the full
8997 * dictionary is loaded from disk.
8999 listWordsInSpellCheckerDictionary(): Promise<string[]>;
9001 * resolves when the extension is loaded.
9003 * This method will raise an exception if the extension could not be loaded. If
9004 * there are warnings when installing the extension (e.g. if the extension requests
9005 * an API that Electron does not support) then they will be logged to the console.
9007 * Note that Electron does not support the full range of Chrome extensions APIs.
9008 * See Supported Extensions APIs for more details on what is supported.
9010 * Note that in previous versions of Electron, extensions that were loaded would be
9011 * remembered for future runs of the application. This is no longer the case:
9012 * `loadExtension` must be called on every boot of your app if you want the
9013 * extension to be loaded.
9015 * This API does not support loading packed (.crx) extensions.
9017 * **Note:** This API cannot be called before the `ready` event of the `app` module
9020 * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
9021 * supported and will throw an error.
9023 loadExtension(path: string, options?: LoadExtensionOptions): Promise<Electron.Extension>;
9025 * Preconnects the given number of sockets to an origin.
9027 preconnect(options: PreconnectOptions): void;
9029 * Unloads an extension.
9031 * **Note:** This API cannot be called before the `ready` event of the `app` module
9034 removeExtension(extensionId: string): void;
9036 * Whether the word was successfully removed from the custom dictionary. This API
9037 * will not work on non-persistent (in-memory) sessions.
9039 * **Note:** On macOS and Windows 10 this word will be removed from the OS custom
9040 * dictionary as well
9042 removeWordFromSpellCheckerDictionary(word: string): boolean;
9044 * Resolves with the resolved IP addresses for the `host`.
9046 resolveHost(host: string, options?: ResolveHostOptions): Promise<Electron.ResolvedHost>;
9048 * Resolves with the proxy information for `url`.
9050 resolveProxy(url: string): Promise<string>;
9052 * Sets a handler to respond to Bluetooth pairing requests. This handler allows
9053 * developers to handle devices that require additional validation before pairing.
9054 * When a handler is not defined, any pairing on Linux or Windows that requires
9055 * additional validation will be automatically cancelled. macOS does not require a
9056 * handler because macOS handles the pairing automatically. To clear the handler,
9057 * call `setBluetoothPairingHandler(null)`.
9059 * @platform win32,linux
9061 setBluetoothPairingHandler(handler: ((details: BluetoothPairingHandlerHandlerDetails, callback: (response: Response) => void) => void) | (null)): void;
9063 * Sets the certificate verify proc for `session`, the `proc` will be called with
9064 * `proc(request, callback)` whenever a server certificate verification is
9065 * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
9068 * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
9071 * > **NOTE:** The result of this procedure is cached by the network service.
9073 setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
9075 * Sets the directory to store the generated JS code cache for this session. The
9076 * directory is not required to be created by the user before this call, the
9077 * runtime will create if it does not exist otherwise will use the existing
9078 * directory. If directory cannot be created, then code cache will not be used and
9079 * all operations related to code cache will fail silently inside the runtime. By
9080 * default, the directory will be `Code Cache` under the respective user data
9083 * Note that by default code cache is only enabled for http(s) URLs, to enable code
9084 * cache for custom protocols, `codeCache: true` and `standard: true` must be
9085 * specified when registering the protocol.
9087 setCodeCachePath(path: string): void;
9089 * Sets the handler which can be used to respond to device permission checks for
9090 * the `session`. Returning `true` will allow the device to be permitted and
9091 * `false` will reject it. To clear the handler, call
9092 * `setDevicePermissionHandler(null)`. This handler can be used to provide default
9093 * permissioning to devices without first calling for permission to devices (eg via
9094 * `navigator.hid.requestDevice`). If this handler is not defined, the default
9095 * device permissions as granted through device selection (eg via
9096 * `navigator.hid.requestDevice`) will be used. Additionally, the default behavior
9097 * of Electron is to store granted device permission in memory. If longer term
9098 * storage is needed, a developer can store granted device permissions (eg when
9099 * handling the `select-hid-device` event) and then read from that storage with
9100 * `setDevicePermissionHandler`.
9102 setDevicePermissionHandler(handler: ((details: DevicePermissionHandlerHandlerDetails) => boolean) | (null)): void;
9104 * This handler will be called when web content requests access to display media
9105 * via the `navigator.mediaDevices.getDisplayMedia` API. Use the desktopCapturer
9106 * API to choose which stream(s) to grant access to.
9108 * Passing a WebFrameMain object as a video or audio stream will capture the video
9109 * or audio stream from that frame.
9111 * Passing `null` instead of a function resets the handler to its default state.
9113 setDisplayMediaRequestHandler(handler: ((request: DisplayMediaRequestHandlerHandlerRequest, callback: (streams: Streams) => void) => void) | (null)): void;
9115 * Sets download saving directory. By default, the download directory will be the
9116 * `Downloads` under the respective app folder.
9118 setDownloadPath(path: string): void;
9120 * Sets the handler which can be used to respond to permission checks for the
9121 * `session`. Returning `true` will allow the permission and `false` will reject
9122 * it. Please note that you must also implement `setPermissionRequestHandler` to
9123 * get complete permission handling. Most web APIs do a permission check and then
9124 * make a permission request if the check is denied. To clear the handler, call
9125 * `setPermissionCheckHandler(null)`.
9127 setPermissionCheckHandler(handler: ((webContents: (WebContents) | (null), permission: 'clipboard-read' | 'clipboard-sanitized-write' | 'geolocation' | 'fullscreen' | 'hid' | 'idle-detection' | 'media' | 'mediaKeySystem' | 'midi' | 'midiSysex' | 'notifications' | 'openExternal' | 'pointerLock' | 'serial' | 'usb', requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void;
9129 * Sets the handler which can be used to respond to permission requests for the
9130 * `session`. Calling `callback(true)` will allow the permission and
9131 * `callback(false)` will reject it. To clear the handler, call
9132 * `setPermissionRequestHandler(null)`. Please note that you must also implement
9133 * `setPermissionCheckHandler` to get complete permission handling. Most web APIs
9134 * do a permission check and then make a permission request if the check is denied.
9136 setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'clipboard-sanitized-write' | 'display-capture' | 'fullscreen' | 'geolocation' | 'idle-detection' | 'media' | 'mediaKeySystem' | 'midi' | 'midiSysex' | 'notifications' | 'pointerLock' | 'keyboardLock' | 'openExternal' | 'window-management' | 'unknown', callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void;
9138 * Adds scripts that will be executed on ALL web contents that are associated with
9139 * this session just before normal `preload` scripts run.
9141 setPreloads(preloads: string[]): void;
9143 * Resolves when the proxy setting process is complete.
9145 * Sets the proxy settings.
9147 * When `mode` is unspecified, `pacScript` and `proxyRules` are provided together,
9148 * the `proxyRules` option is ignored and `pacScript` configuration is applied.
9150 * You may need `ses.closeAllConnections` to close currently in flight connections
9151 * to prevent pooled sockets using previous proxy from being reused by future
9154 * The `proxyRules` has to follow the rules below:
9158 * * `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
9159 * HTTP proxy `foopy2:80` for `ftp://` URLs.
9160 * * `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
9161 * * `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
9162 * over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
9163 * * `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
9164 * * `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
9165 * over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
9166 * * `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
9167 * proxy if `foopy` is unavailable.
9168 * * `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
9169 * `socks4://foopy2` for all other URLs.
9171 * The `proxyBypassRules` is a comma separated list of rules described below:
9173 * * `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
9175 * Match all hostnames that match the pattern HOSTNAME_PATTERN.
9177 * Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
9178 * "https://x.*.y.com:99"
9179 * * `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
9181 * Match a particular domain suffix.
9183 * Examples: ".google.com", ".com", "http://.google.com"
9184 * * `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
9186 * Match URLs which are IP address literals.
9188 * Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
9189 * * `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
9191 * Match any URL that is to an IP literal that falls between the given range. IP
9192 * range is specified using CIDR notation.
9194 * Examples: "192.168.1.1/16", "fefe:13::abc/33".
9197 * Match local addresses. The meaning of `<local>` is whether the host matches one
9198 * of: "127.0.0.1", "::1", "localhost".
9200 setProxy(config: Config): Promise<void>;
9202 * By default Electron will download hunspell dictionaries from the Chromium CDN.
9203 * If you want to override this behavior you can use this API to point the
9204 * dictionary downloader at your own hosted version of the hunspell dictionaries.
9205 * We publish a `hunspell_dictionaries.zip` file with each release which contains
9206 * the files you need to host here.
9208 * The file server must be **case insensitive**. If you cannot do this, you must
9209 * upload each file twice: once with the case it has in the ZIP file and once with
9210 * the filename as all lowercase.
9212 * If the files present in `hunspell_dictionaries.zip` are available at
9213 * `https://example.com/dictionaries/language-code.bdic` then you should call this
9215 * `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`.
9216 * Please note the trailing slash. The URL to the dictionaries is formed as
9217 * `${url}${filename}`.
9219 * **Note:** On macOS the OS spellchecker is used and therefore we do not download
9220 * any dictionary files. This API is a no-op on macOS.
9222 setSpellCheckerDictionaryDownloadURL(url: string): void;
9224 * Sets whether to enable the builtin spell checker.
9226 setSpellCheckerEnabled(enable: boolean): void;
9228 * The built in spellchecker does not automatically detect what language a user is
9229 * typing in. In order for the spell checker to correctly check their words you
9230 * must call this API with an array of language codes. You can get the list of
9231 * supported language codes with the `ses.availableSpellCheckerLanguages` property.
9233 * **Note:** On macOS the OS spellchecker is used and will detect your language
9234 * automatically. This API is a no-op on macOS.
9236 setSpellCheckerLanguages(languages: string[]): void;
9238 * Sets the SSL configuration for the session. All subsequent network requests will
9239 * use the new configuration. Existing network connections (such as WebSocket
9240 * connections) will not be terminated, but old sockets in the pool will not be
9241 * reused for new connections.
9243 setSSLConfig(config: SSLConfigConfig): void;
9245 * Sets the handler which can be used to override which USB classes are protected.
9246 * The return value for the handler is a string array of USB classes which should
9247 * be considered protected (eg not available in the renderer). Valid values for
9258 * Returning an empty string array from the handler will allow all USB classes;
9259 * returning the passed in array will maintain the default list of protected USB
9260 * classes (this is also the default behavior if a handler is not defined). To
9261 * clear the handler, call `setUSBProtectedClassesHandler(null)`.
9263 setUSBProtectedClassesHandler(handler: ((details: USBProtectedClassesHandlerHandlerDetails) => string[]) | (null)): void;
9265 * Overrides the `userAgent` and `acceptLanguages` for this session.
9267 * The `acceptLanguages` must a comma separated ordered list of language codes, for
9268 * example `"en-US,fr,de,ko,zh-CN,ja"`.
9270 * This doesn't affect existing `WebContents`, and each `WebContents` can use
9271 * `webContents.setUserAgent` to override the session-wide user agent.
9273 setUserAgent(userAgent: string, acceptLanguages?: string): void;
9275 * A `string[]` array which consists of all the known available spell checker
9276 * languages. Providing a language code to the `setSpellCheckerLanguages` API that
9277 * isn't in this array will result in an error.
9280 readonly availableSpellCheckerLanguages: string[];
9282 * A `Cookies` object for this session.
9285 readonly cookies: Cookies;
9287 * A `NetLog` object for this session.
9290 readonly netLog: NetLog;
9292 * A `Protocol` object for this session.
9295 readonly protocol: Protocol;
9297 * A `ServiceWorkers` object for this session.
9300 readonly serviceWorkers: ServiceWorkers;
9302 * A `boolean` indicating whether builtin spell checker is enabled.
9304 spellCheckerEnabled: boolean;
9306 * A `string | null` indicating the absolute file system path where data for this
9307 * session is persisted on disk. For in memory sessions this returns `null`.
9310 readonly storagePath: (string) | (null);
9312 * A `WebRequest` object for this session.
9315 readonly webRequest: WebRequest;
9318 interface SharedWorkerInfo {
9320 // Docs: https://electronjs.org/docs/api/structures/shared-worker-info
9323 * The unique id of the shared worker.
9327 * The url of the shared worker.
9332 class ShareMenu extends NodeEventEmitter {
9334 // Docs: https://electronjs.org/docs/api/share-menu
9339 constructor(sharingItem: SharingItem);
9341 * Closes the context menu in the `browserWindow`.
9343 closePopup(browserWindow?: BrowserWindow): void;
9345 * Pops up this menu as a context menu in the `BrowserWindow`.
9347 popup(options?: PopupOptions): void;
9350 interface SharingItem {
9352 // Docs: https://electronjs.org/docs/api/structures/sharing-item
9355 * An array of files to share.
9357 filePaths?: string[];
9359 * An array of text to share.
9363 * An array of URLs to share.
9370 // Docs: https://electronjs.org/docs/api/shell
9373 * Play the beep sound.
9377 * Open the given external protocol URL in the desktop's default manner. (For
9378 * example, mailto: URLs in the user's default mail agent).
9380 openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
9382 * Resolves with a string containing the error message corresponding to the failure
9383 * if a failure occurred, otherwise "".
9385 * Open the given file in the desktop's default manner.
9387 openPath(path: string): Promise<string>;
9389 * Resolves the shortcut link at `shortcutPath`.
9391 * An exception will be thrown when any error happens.
9395 readShortcutLink(shortcutPath: string): ShortcutDetails;
9397 * Show the given file in a file manager. If possible, select the file.
9399 showItemInFolder(fullPath: string): void;
9401 * Resolves when the operation has been completed. Rejects if there was an error
9402 * while deleting the requested item.
9404 * This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin
9405 * on Windows, and a desktop-environment-specific location on Linux).
9407 trashItem(path: string): Promise<void>;
9409 * Whether the shortcut was created successfully.
9411 * Creates or updates a shortcut link at `shortcutPath`.
9415 writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
9417 * Whether the shortcut was created successfully.
9419 * Creates or updates a shortcut link at `shortcutPath`.
9423 writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
9426 interface ShortcutDetails {
9428 // Docs: https://electronjs.org/docs/api/structures/shortcut-details
9431 * The Application User Model ID. Default is empty.
9433 appUserModelId?: string;
9435 * The arguments to be applied to `target` when launching from this shortcut.
9440 * The working directory. Default is empty.
9444 * The description of the shortcut. Default is empty.
9446 description?: string;
9448 * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
9449 * together. Default is empty, which uses the target's icon.
9453 * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
9457 * The target to launch from this shortcut.
9461 * The Application Toast Activator CLSID. Needed for participating in Action
9464 toastActivatorClsid?: string;
9469 // Docs: https://electronjs.org/docs/api/structures/size
9475 interface SystemPreferences extends NodeJS.EventEmitter {
9477 // Docs: https://electronjs.org/docs/api/system-preferences
9482 on(event: 'accent-color-changed', listener: (event: Event,
9484 * The new RGBA color the user assigned to be their system accent color.
9486 newColor: string) => void): this;
9487 off(event: 'accent-color-changed', listener: (event: Event,
9489 * The new RGBA color the user assigned to be their system accent color.
9491 newColor: string) => void): this;
9492 once(event: 'accent-color-changed', listener: (event: Event,
9494 * The new RGBA color the user assigned to be their system accent color.
9496 newColor: string) => void): this;
9497 addListener(event: 'accent-color-changed', listener: (event: Event,
9499 * The new RGBA color the user assigned to be their system accent color.
9501 newColor: string) => void): this;
9502 removeListener(event: 'accent-color-changed', listener: (event: Event,
9504 * The new RGBA color the user assigned to be their system accent color.
9506 newColor: string) => void): this;
9510 on(event: 'color-changed', listener: (event: Event) => void): this;
9511 off(event: 'color-changed', listener: (event: Event) => void): this;
9512 once(event: 'color-changed', listener: (event: Event) => void): this;
9513 addListener(event: 'color-changed', listener: (event: Event) => void): this;
9514 removeListener(event: 'color-changed', listener: (event: Event) => void): this;
9516 * A promise that resolves with `true` if consent was granted and `false` if it was
9517 * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
9518 * access request was denied and later is changed through the System Preferences
9519 * pane, a restart of the app will be required for the new permissions to take
9520 * effect. If access has already been requested and denied, it _must_ be changed
9521 * through the preference pane; an alert will not pop up and the promise will
9522 * resolve with the existing access status.
9524 * **Important:** In order to properly leverage this API, you must set the
9525 * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
9526 * app's `Info.plist` file. The values for these keys will be used to populate the
9527 * permission dialogs so that the user will be properly informed as to the purpose
9528 * of the permission request. See Electron Application Distribution for more
9529 * information about how to set these in the context of Electron.
9531 * This user consent was not required until macOS 10.14 Mojave, so this method will
9532 * always return `true` if your system is running 10.13 High Sierra.
9536 askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
9538 * whether or not this device has the ability to use Touch ID.
9542 canPromptTouchID(): boolean;
9544 * The users current system wide accent color preference in RGBA hexadecimal form.
9546 * This API is only available on macOS 10.14 Mojave or newer.
9548 * @platform win32,darwin
9550 getAccentColor(): string;
9552 * * `shouldRenderRichAnimation` boolean - Returns true if rich animations should
9553 * be rendered. Looks at session type (e.g. remote desktop) and accessibility
9554 * settings to give guidance for heavy animations.
9555 * * `scrollAnimationsEnabledBySystem` boolean - Determines on a per-platform basis
9556 * whether scroll animations (e.g. produced by home/end key) should be enabled.
9557 * * `prefersReducedMotion` boolean - Determines whether the user desires reduced
9558 * motion based on platform APIs.
9560 * Returns an object with system animation settings.
9562 getAnimationSettings(): AnimationSettings;
9564 * The system color setting in RGBA hexadecimal form (`#RRGGBBAA`). See the Windows
9565 * docs and the macOS docs for more details.
9567 * The following colors are only available on macOS 10.14: `find-highlight`,
9568 * `selected-content-background`, `separator`,
9569 * `unemphasized-selected-content-background`,
9570 * `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
9572 * @platform win32,darwin
9574 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' | '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;
9576 * Can be `dark`, `light` or `unknown`.
9578 * Gets the macOS appearance setting that is currently applied to your application,
9579 * maps to NSApplication.effectiveAppearance
9583 getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
9585 * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
9587 * This user consent was not required on macOS 10.13 High Sierra so this method
9588 * will always return `granted`. macOS 10.14 Mojave or higher requires consent for
9589 * `microphone` and `camera` access. macOS 10.15 Catalina or higher requires
9590 * consent for `screen` access.
9592 * Windows 10 has a global setting controlling `microphone` and `camera` access for
9593 * all win32 applications. It will always return `granted` for `screen` and for all
9594 * media types on older versions of Windows.
9596 * @platform win32,darwin
9598 getMediaAccessStatus(mediaType: 'microphone' | 'camera' | 'screen'): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
9600 * The standard system color formatted as `#RRGGBBAA`.
9602 * Returns one of several standard system colors that automatically adapt to
9603 * vibrancy and changes in accessibility settings like 'Increase contrast' and
9604 * 'Reduce transparency'. See Apple Documentation for more details.
9608 getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
9610 * The value of `key` in `NSUserDefaults`.
9612 * Some popular `key` and `type`s are:
9614 * * `AppleInterfaceStyle`: `string`
9615 * * `AppleAquaColorVariant`: `integer`
9616 * * `AppleHighlightColor`: `string`
9617 * * `AppleShowScrollBars`: `string`
9618 * * `NSNavRecentPlaces`: `array`
9619 * * `NSPreferredWebServices`: `dictionary`
9620 * * `NSUserDictionaryReplacementItems`: `array`
9624 getUserDefault<Type extends keyof UserDefaultTypes>(key: string, type: Type): UserDefaultTypes[Type];
9626 * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
9628 * An example of using it to determine if you should create a transparent window or
9629 * not (transparent windows won't work correctly when DWM composition is disabled):
9633 isAeroGlassEnabled(): boolean;
9635 * Whether the Swipe between pages setting is on.
9639 isSwipeTrackingFromScrollEventsEnabled(): boolean;
9641 * `true` if the current process is a trusted accessibility client and `false` if
9646 isTrustedAccessibilityClient(prompt: boolean): boolean;
9648 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
9649 * contains the user information dictionary sent along with the notification.
9653 postLocalNotification(event: string, userInfo: Record<string, any>): void;
9655 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
9656 * contains the user information dictionary sent along with the notification.
9660 postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
9662 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
9663 * contains the user information dictionary sent along with the notification.
9667 postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
9669 * resolves if the user has successfully authenticated with Touch ID.
9671 * This API itself will not protect your user data; rather, it is a mechanism to
9672 * allow you to do so. Native apps will need to set Access Control Constants like
9673 * `kSecAccessControlUserPresence` on their keychain entry so that reading it would
9674 * auto-prompt for Touch ID biometric consent. This could be done with
9675 * `node-keytar`, such that one would store an encryption key with `node-keytar`
9676 * and only fetch it if `promptTouchID()` resolves.
9680 promptTouchID(reason: string): Promise<void>;
9682 * Add the specified defaults to your application's `NSUserDefaults`.
9686 registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
9688 * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
9689 * or global value of a `key` previously set with `setUserDefault`.
9693 removeUserDefault(key: string): void;
9695 * Set the value of `key` in `NSUserDefaults`.
9697 * Note that `type` should match actual type of `value`. An exception is thrown if
9700 * Some popular `key` and `type`s are:
9702 * * `ApplePressAndHoldEnabled`: `boolean`
9706 setUserDefault<Type extends keyof UserDefaultTypes>(key: string, type: Type, value: UserDefaultTypes[Type]): void;
9708 * The ID of this subscription
9710 * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
9711 * defaults. This is necessary for events such as
9712 * `NSUserDefaultsDidChangeNotification`.
9714 * If `event` is null, the `NSNotificationCenter` doesn’t use it as criteria for
9715 * delivery to the observer. See docs for more information.
9719 subscribeLocalNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
9721 * The ID of this subscription
9723 * Subscribes to native notifications of macOS, `callback` will be called with
9724 * `callback(event, userInfo)` when the corresponding `event` happens. The
9725 * `userInfo` is an Object that contains the user information dictionary sent along
9726 * with the notification. The `object` is the sender of the notification, and only
9727 * supports `NSString` values for now.
9729 * The `id` of the subscriber is returned, which can be used to unsubscribe the
9732 * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
9733 * values of `event` are:
9735 * * `AppleInterfaceThemeChangedNotification`
9736 * * `AppleAquaColorVariantChanged`
9737 * * `AppleColorPreferencesChangedNotification`
9738 * * `AppleShowScrollBarsSettingChanged`
9740 * If `event` is null, the `NSDistributedNotificationCenter` doesn’t use it as
9741 * criteria for delivery to the observer. See docs for more information.
9745 subscribeNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
9747 * The ID of this subscription
9749 * Same as `subscribeNotification`, but uses
9750 * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
9751 * such as `NSWorkspaceDidActivateApplicationNotification`.
9753 * If `event` is null, the `NSWorkspaceNotificationCenter` doesn’t use it as
9754 * criteria for delivery to the observer. See docs for more information.
9758 subscribeWorkspaceNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
9760 * Same as `unsubscribeNotification`, but removes the subscriber from
9761 * `NSNotificationCenter`.
9765 unsubscribeLocalNotification(id: number): void;
9767 * Removes the subscriber with `id`.
9771 unsubscribeNotification(id: number): void;
9773 * Same as `unsubscribeNotification`, but removes the subscriber from
9774 * `NSWorkspace.sharedWorkspace.notificationCenter`.
9778 unsubscribeWorkspaceNotification(id: number): void;
9780 * A `boolean` property which determines whether the app avoids using
9781 * semitransparent backgrounds. This maps to
9782 * NSWorkspace.accessibilityDisplayShouldReduceTransparency
9786 accessibilityDisplayShouldReduceTransparency(): boolean;
9788 * A `string` property that can be `dark`, `light` or `unknown`.
9790 * Returns the macOS appearance setting that is currently applied to your
9791 * application, maps to NSApplication.effectiveAppearance
9795 readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
9800 // Docs: https://electronjs.org/docs/api/structures/task
9803 * The command line arguments when `program` is executed.
9807 * Description of this task.
9809 description: string;
9811 * The icon index in the icon file. If an icon file consists of two or more icons,
9812 * set this value to identify the icon. If an icon file consists of one icon, this
9817 * The absolute path to an icon to be displayed in a JumpList, which can be an
9818 * arbitrary resource file that contains an icon. You can usually specify
9819 * `process.execPath` to show the icon of the program.
9823 * Path of the program to execute, usually you should specify `process.execPath`
9824 * which opens the current program.
9828 * The string to be displayed in a JumpList.
9832 * The working directory. Default is empty.
9834 workingDirectory?: string;
9837 interface ThumbarButton {
9839 // Docs: https://electronjs.org/docs/api/structures/thumbar-button
9843 * Control specific states and behaviors of the button. By default, it is
9848 * The icon showing in thumbnail toolbar.
9852 * The text of the button's tooltip.
9859 // Docs: https://electronjs.org/docs/api/touch-bar
9864 constructor(options: TouchBarConstructorOptions);
9866 * A `TouchBarItem` that will replace the "esc" button on the touch bar when set.
9867 * Setting to `null` restores the default "esc" button. Changing this value
9868 * immediately updates the escape item in the touch bar.
9870 escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
9872 * A `typeof TouchBarButton` reference to the `TouchBarButton` class.
9874 static TouchBarButton: typeof TouchBarButton;
9876 * A `typeof TouchBarColorPicker` reference to the `TouchBarColorPicker` class.
9878 static TouchBarColorPicker: typeof TouchBarColorPicker;
9880 * A `typeof TouchBarGroup` reference to the `TouchBarGroup` class.
9882 static TouchBarGroup: typeof TouchBarGroup;
9884 * A `typeof TouchBarLabel` reference to the `TouchBarLabel` class.
9886 static TouchBarLabel: typeof TouchBarLabel;
9888 * A `typeof TouchBarOtherItemsProxy` reference to the `TouchBarOtherItemsProxy`
9891 static TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
9893 * A `typeof TouchBarPopover` reference to the `TouchBarPopover` class.
9895 static TouchBarPopover: typeof TouchBarPopover;
9897 * A `typeof TouchBarScrubber` reference to the `TouchBarScrubber` class.
9899 static TouchBarScrubber: typeof TouchBarScrubber;
9901 * A `typeof TouchBarSegmentedControl` reference to the `TouchBarSegmentedControl`
9904 static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
9906 * A `typeof TouchBarSlider` reference to the `TouchBarSlider` class.
9908 static TouchBarSlider: typeof TouchBarSlider;
9910 * A `typeof TouchBarSpacer` reference to the `TouchBarSpacer` class.
9912 static TouchBarSpacer: typeof TouchBarSpacer;
9915 class TouchBarButton {
9917 // Docs: https://electronjs.org/docs/api/touch-bar-button
9922 constructor(options: TouchBarButtonConstructorOptions);
9924 * A `string` representing the description of the button to be read by a screen
9925 * reader. Will only be read by screen readers if no label is set.
9927 accessibilityLabel: string;
9929 * A `string` hex code representing the button's current background color. Changing
9930 * this value immediately updates the button in the touch bar.
9932 backgroundColor: string;
9934 * A `boolean` representing whether the button is in an enabled state.
9938 * A `NativeImage` representing the button's current icon. Changing this value
9939 * immediately updates the button in the touch bar.
9943 * A `string` - Can be `left`, `right` or `overlay`. Defaults to `overlay`.
9945 iconPosition: ('left' | 'right' | 'overlay');
9947 * A `string` representing the button's current text. Changing this value
9948 * immediately updates the button in the touch bar.
9953 class TouchBarColorPicker extends NodeEventEmitter {
9955 // Docs: https://electronjs.org/docs/api/touch-bar-color-picker
9958 * TouchBarColorPicker
9960 constructor(options: TouchBarColorPickerConstructorOptions);
9962 * A `string[]` array representing the color picker's available colors to select.
9963 * Changing this value immediately updates the color picker in the touch bar.
9965 availableColors: string[];
9967 * A `string` hex code representing the color picker's currently selected color.
9968 * Changing this value immediately updates the color picker in the touch bar.
9970 selectedColor: string;
9973 class TouchBarGroup extends NodeEventEmitter {
9975 // Docs: https://electronjs.org/docs/api/touch-bar-group
9980 constructor(options: TouchBarGroupConstructorOptions);
9983 class TouchBarLabel extends NodeEventEmitter {
9985 // Docs: https://electronjs.org/docs/api/touch-bar-label
9990 constructor(options: TouchBarLabelConstructorOptions);
9992 * A `string` representing the description of the label to be read by a screen
9995 accessibilityLabel: string;
9997 * A `string` representing the label's current text. Changing this value
9998 * immediately updates the label in the touch bar.
10002 * A `string` hex code representing the label's current text color. Changing this
10003 * value immediately updates the label in the touch bar.
10008 class TouchBarOtherItemsProxy extends NodeEventEmitter {
10010 // Docs: https://electronjs.org/docs/api/touch-bar-other-items-proxy
10013 * TouchBarOtherItemsProxy
10018 class TouchBarPopover extends NodeEventEmitter {
10020 // Docs: https://electronjs.org/docs/api/touch-bar-popover
10025 constructor(options: TouchBarPopoverConstructorOptions);
10027 * A `NativeImage` representing the popover's current button icon. Changing this
10028 * value immediately updates the popover in the touch bar.
10032 * A `string` representing the popover's current button text. Changing this value
10033 * immediately updates the popover in the touch bar.
10038 class TouchBarScrubber extends NodeEventEmitter {
10040 // Docs: https://electronjs.org/docs/api/touch-bar-scrubber
10045 constructor(options: TouchBarScrubberConstructorOptions);
10047 * A `boolean` representing whether this scrubber is continuous or not. Updating
10048 * this value immediately updates the control in the touch bar.
10050 continuous: boolean;
10052 * A `ScrubberItem[]` array representing the items in this scrubber. Updating this
10053 * value immediately updates the control in the touch bar. Updating deep properties
10054 * inside this array **does not update the touch bar**.
10056 items: ScrubberItem[];
10058 * A `string` representing the mode of this scrubber. Updating this value
10059 * immediately updates the control in the touch bar. Possible values:
10061 * * `fixed` - Maps to `NSScrubberModeFixed`.
10062 * * `free` - Maps to `NSScrubberModeFree`.
10064 mode: ('fixed' | 'free');
10066 * A `string` representing the style that selected items in the scrubber should
10067 * have. This style is overlayed on top of the scrubber item instead of being
10068 * placed behind it. Updating this value immediately updates the control in the
10069 * touch bar. Possible values:
10071 * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
10072 * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
10073 * * `none` - Removes all styles.
10075 overlayStyle: ('background' | 'outline' | 'none');
10077 * A `string` representing the style that selected items in the scrubber should
10078 * have. Updating this value immediately updates the control in the touch bar.
10081 * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
10082 * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
10083 * * `none` - Removes all styles.
10085 selectedStyle: ('background' | 'outline' | 'none');
10087 * A `boolean` representing whether to show the left / right selection arrows in
10088 * this scrubber. Updating this value immediately updates the control in the touch
10091 showArrowButtons: boolean;
10094 class TouchBarSegmentedControl extends NodeEventEmitter {
10096 // Docs: https://electronjs.org/docs/api/touch-bar-segmented-control
10099 * TouchBarSegmentedControl
10101 constructor(options: TouchBarSegmentedControlConstructorOptions);
10103 * A `string` representing the current selection mode of the control. Can be
10104 * `single`, `multiple` or `buttons`.
10106 mode: ('single' | 'multiple' | 'buttons');
10108 * A `SegmentedControlSegment[]` array representing the segments in this control.
10109 * Updating this value immediately updates the control in the touch bar. Updating
10110 * deep properties inside this array **does not update the touch bar**.
10112 segments: SegmentedControlSegment[];
10114 * A `string` representing the controls current segment style. Updating this value
10115 * immediately updates the control in the touch bar.
10117 segmentStyle: string;
10119 * An `Integer` representing the currently selected segment. Changing this value
10120 * immediately updates the control in the touch bar. User interaction with the
10121 * touch bar will update this value automatically.
10123 selectedIndex: number;
10126 class TouchBarSlider extends NodeEventEmitter {
10128 // Docs: https://electronjs.org/docs/api/touch-bar-slider
10133 constructor(options: TouchBarSliderConstructorOptions);
10135 * A `string` representing the slider's current text. Changing this value
10136 * immediately updates the slider in the touch bar.
10140 * A `number` representing the slider's current maximum value. Changing this value
10141 * immediately updates the slider in the touch bar.
10145 * A `number` representing the slider's current minimum value. Changing this value
10146 * immediately updates the slider in the touch bar.
10150 * A `number` representing the slider's current value. Changing this value
10151 * immediately updates the slider in the touch bar.
10156 class TouchBarSpacer extends NodeEventEmitter {
10158 // Docs: https://electronjs.org/docs/api/touch-bar-spacer
10163 constructor(options: TouchBarSpacerConstructorOptions);
10165 * A `string` representing the size of the spacer. Can be `small`, `large` or
10168 size: ('small' | 'large' | 'flexible');
10171 interface TraceCategoriesAndOptions {
10173 // Docs: https://electronjs.org/docs/api/structures/trace-categories-and-options
10176 * A filter to control what category groups should be traced. A filter can have an
10177 * optional '-' prefix to exclude category groups that contain a matching category.
10178 * Having both included and excluded category patterns in the same list is not
10179 * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
10180 * `-excluded_category1,-excluded_category2`.
10182 categoryFilter: string;
10184 * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
10185 * the following strings: `record-until-full`, `record-continuously`,
10186 * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
10187 * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
10188 * modes and hence mutually exclusive. If more than one trace recording modes
10189 * appear in the `traceOptions` string, the last one takes precedence. If none of
10190 * the trace recording modes are specified, recording mode is `record-until-full`.
10191 * The trace option will first be reset to the default option (`record_mode` set to
10192 * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
10193 * before options parsed from `traceOptions` are applied on it.
10195 traceOptions: string;
10198 interface TraceConfig {
10200 // Docs: https://electronjs.org/docs/api/structures/trace-config
10203 * if true, filter event data according to a specific list of events that have been
10204 * manually vetted to not include any PII. See the implementation in Chromium for
10207 enable_argument_filter?: boolean;
10209 * a list of tracing categories to exclude. Can include glob-like patterns using
10210 * `*` at the end of the category name. See tracing categories for the list of
10213 excluded_categories?: string[];
10215 * a list of histogram names to report with the trace.
10217 histogram_names?: string[];
10219 * a list of tracing categories to include. Can include glob-like patterns using
10220 * `*` at the end of the category name. See tracing categories for the list of
10223 included_categories?: string[];
10225 * a list of process IDs to include in the trace. If not specified, trace all
10228 included_process_ids?: number[];
10230 * if the `disabled-by-default-memory-infra` category is enabled, this contains
10231 * optional additional configuration for data collection. See the Chromium
10232 * memory-infra docs for more information.
10234 memory_dump_config?: Record<string, any>;
10236 * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
10237 * or `trace-to-console`. Defaults to `record-until-full`.
10239 recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
10241 * maximum size of the trace recording buffer in events.
10243 trace_buffer_size_in_events?: number;
10245 * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
10247 trace_buffer_size_in_kb?: number;
10250 interface Transaction {
10252 // Docs: https://electronjs.org/docs/api/structures/transaction
10255 * The error code if an error occurred while processing the transaction.
10259 * The error message if an error occurred while processing the transaction.
10261 errorMessage: string;
10263 * The identifier of the restored transaction by the App Store.
10265 originalTransactionIdentifier: string;
10268 * The date the transaction was added to the App Store’s payment queue.
10270 transactionDate: string;
10272 * A string that uniquely identifies a successful payment transaction.
10274 transactionIdentifier: string;
10276 * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
10279 transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
10282 class Tray extends NodeEventEmitter {
10284 // Docs: https://electronjs.org/docs/api/tray
10287 * Emitted when the tray balloon is clicked.
10291 on(event: 'balloon-click', listener: Function): this;
10292 off(event: 'balloon-click', listener: Function): this;
10293 once(event: 'balloon-click', listener: Function): this;
10294 addListener(event: 'balloon-click', listener: Function): this;
10295 removeListener(event: 'balloon-click', listener: Function): this;
10297 * Emitted when the tray balloon is closed because of timeout or user manually
10302 on(event: 'balloon-closed', listener: Function): this;
10303 off(event: 'balloon-closed', listener: Function): this;
10304 once(event: 'balloon-closed', listener: Function): this;
10305 addListener(event: 'balloon-closed', listener: Function): this;
10306 removeListener(event: 'balloon-closed', listener: Function): this;
10308 * Emitted when the tray balloon shows.
10312 on(event: 'balloon-show', listener: Function): this;
10313 off(event: 'balloon-show', listener: Function): this;
10314 once(event: 'balloon-show', listener: Function): this;
10315 addListener(event: 'balloon-show', listener: Function): this;
10316 removeListener(event: 'balloon-show', listener: Function): this;
10318 * Emitted when the tray icon is clicked.
10320 * Note that on Linux this event is emitted when the tray icon receives an
10321 * activation, which might not necessarily be left mouse click.
10323 on(event: 'click', listener: (event: KeyboardEvent,
10325 * The bounds of tray icon.
10329 * The position of the event.
10331 position: Point) => void): this;
10332 off(event: 'click', listener: (event: KeyboardEvent,
10334 * The bounds of tray icon.
10338 * The position of the event.
10340 position: Point) => void): this;
10341 once(event: 'click', listener: (event: KeyboardEvent,
10343 * The bounds of tray icon.
10347 * The position of the event.
10349 position: Point) => void): this;
10350 addListener(event: 'click', listener: (event: KeyboardEvent,
10352 * The bounds of tray icon.
10356 * The position of the event.
10358 position: Point) => void): this;
10359 removeListener(event: 'click', listener: (event: KeyboardEvent,
10361 * The bounds of tray icon.
10365 * The position of the event.
10367 position: Point) => void): this;
10369 * Emitted when the tray icon is double clicked.
10371 * @platform darwin,win32
10373 on(event: 'double-click', listener: (event: KeyboardEvent,
10375 * The bounds of tray icon.
10377 bounds: Rectangle) => void): this;
10378 off(event: 'double-click', listener: (event: KeyboardEvent,
10380 * The bounds of tray icon.
10382 bounds: Rectangle) => void): this;
10383 once(event: 'double-click', listener: (event: KeyboardEvent,
10385 * The bounds of tray icon.
10387 bounds: Rectangle) => void): this;
10388 addListener(event: 'double-click', listener: (event: KeyboardEvent,
10390 * The bounds of tray icon.
10392 bounds: Rectangle) => void): this;
10393 removeListener(event: 'double-click', listener: (event: KeyboardEvent,
10395 * The bounds of tray icon.
10397 bounds: Rectangle) => void): this;
10399 * Emitted when a drag operation ends on the tray or ends at another location.
10403 on(event: 'drag-end', listener: Function): this;
10404 off(event: 'drag-end', listener: Function): this;
10405 once(event: 'drag-end', listener: Function): this;
10406 addListener(event: 'drag-end', listener: Function): this;
10407 removeListener(event: 'drag-end', listener: Function): this;
10409 * Emitted when a drag operation enters the tray icon.
10413 on(event: 'drag-enter', listener: Function): this;
10414 off(event: 'drag-enter', listener: Function): this;
10415 once(event: 'drag-enter', listener: Function): this;
10416 addListener(event: 'drag-enter', listener: Function): this;
10417 removeListener(event: 'drag-enter', listener: Function): this;
10419 * Emitted when a drag operation exits the tray icon.
10423 on(event: 'drag-leave', listener: Function): this;
10424 off(event: 'drag-leave', listener: Function): this;
10425 once(event: 'drag-leave', listener: Function): this;
10426 addListener(event: 'drag-leave', listener: Function): this;
10427 removeListener(event: 'drag-leave', listener: Function): this;
10429 * Emitted when any dragged items are dropped on the tray icon.
10433 on(event: 'drop', listener: Function): this;
10434 off(event: 'drop', listener: Function): this;
10435 once(event: 'drop', listener: Function): this;
10436 addListener(event: 'drop', listener: Function): this;
10437 removeListener(event: 'drop', listener: Function): this;
10439 * Emitted when dragged files are dropped in the tray icon.
10443 on(event: 'drop-files', listener: (event: Event,
10445 * The paths of the dropped files.
10447 files: string[]) => void): this;
10448 off(event: 'drop-files', listener: (event: Event,
10450 * The paths of the dropped files.
10452 files: string[]) => void): this;
10453 once(event: 'drop-files', listener: (event: Event,
10455 * The paths of the dropped files.
10457 files: string[]) => void): this;
10458 addListener(event: 'drop-files', listener: (event: Event,
10460 * The paths of the dropped files.
10462 files: string[]) => void): this;
10463 removeListener(event: 'drop-files', listener: (event: Event,
10465 * The paths of the dropped files.
10467 files: string[]) => void): this;
10469 * Emitted when dragged text is dropped in the tray icon.
10473 on(event: 'drop-text', listener: (event: Event,
10475 * the dropped text string.
10477 text: string) => void): this;
10478 off(event: 'drop-text', listener: (event: Event,
10480 * the dropped text string.
10482 text: string) => void): this;
10483 once(event: 'drop-text', listener: (event: Event,
10485 * the dropped text string.
10487 text: string) => void): this;
10488 addListener(event: 'drop-text', listener: (event: Event,
10490 * the dropped text string.
10492 text: string) => void): this;
10493 removeListener(event: 'drop-text', listener: (event: Event,
10495 * the dropped text string.
10497 text: string) => void): this;
10499 * Emitted when the tray icon is middle clicked.
10503 on(event: 'middle-click', listener: (event: KeyboardEvent,
10505 * The bounds of tray icon.
10507 bounds: Rectangle) => void): this;
10508 off(event: 'middle-click', listener: (event: KeyboardEvent,
10510 * The bounds of tray icon.
10512 bounds: Rectangle) => void): this;
10513 once(event: 'middle-click', listener: (event: KeyboardEvent,
10515 * The bounds of tray icon.
10517 bounds: Rectangle) => void): this;
10518 addListener(event: 'middle-click', listener: (event: KeyboardEvent,
10520 * The bounds of tray icon.
10522 bounds: Rectangle) => void): this;
10523 removeListener(event: 'middle-click', listener: (event: KeyboardEvent,
10525 * The bounds of tray icon.
10527 bounds: Rectangle) => void): this;
10529 * Emitted when the mouse clicks the tray icon.
10533 on(event: 'mouse-down', listener: (event: KeyboardEvent,
10535 * The position of the event.
10537 position: Point) => void): this;
10538 off(event: 'mouse-down', listener: (event: KeyboardEvent,
10540 * The position of the event.
10542 position: Point) => void): this;
10543 once(event: 'mouse-down', listener: (event: KeyboardEvent,
10545 * The position of the event.
10547 position: Point) => void): this;
10548 addListener(event: 'mouse-down', listener: (event: KeyboardEvent,
10550 * The position of the event.
10552 position: Point) => void): this;
10553 removeListener(event: 'mouse-down', listener: (event: KeyboardEvent,
10555 * The position of the event.
10557 position: Point) => void): this;
10559 * Emitted when the mouse enters the tray icon.
10561 * @platform darwin,win32
10563 on(event: 'mouse-enter', listener: (event: KeyboardEvent,
10565 * The position of the event.
10567 position: Point) => void): this;
10568 off(event: 'mouse-enter', listener: (event: KeyboardEvent,
10570 * The position of the event.
10572 position: Point) => void): this;
10573 once(event: 'mouse-enter', listener: (event: KeyboardEvent,
10575 * The position of the event.
10577 position: Point) => void): this;
10578 addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
10580 * The position of the event.
10582 position: Point) => void): this;
10583 removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
10585 * The position of the event.
10587 position: Point) => void): this;
10589 * Emitted when the mouse exits the tray icon.
10591 * @platform darwin,win32
10593 on(event: 'mouse-leave', listener: (event: KeyboardEvent,
10595 * The position of the event.
10597 position: Point) => void): this;
10598 off(event: 'mouse-leave', listener: (event: KeyboardEvent,
10600 * The position of the event.
10602 position: Point) => void): this;
10603 once(event: 'mouse-leave', listener: (event: KeyboardEvent,
10605 * The position of the event.
10607 position: Point) => void): this;
10608 addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
10610 * The position of the event.
10612 position: Point) => void): this;
10613 removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
10615 * The position of the event.
10617 position: Point) => void): this;
10619 * Emitted when the mouse moves in the tray icon.
10621 * @platform darwin,win32
10623 on(event: 'mouse-move', listener: (event: KeyboardEvent,
10625 * The position of the event.
10627 position: Point) => void): this;
10628 off(event: 'mouse-move', listener: (event: KeyboardEvent,
10630 * The position of the event.
10632 position: Point) => void): this;
10633 once(event: 'mouse-move', listener: (event: KeyboardEvent,
10635 * The position of the event.
10637 position: Point) => void): this;
10638 addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
10640 * The position of the event.
10642 position: Point) => void): this;
10643 removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
10645 * The position of the event.
10647 position: Point) => void): this;
10649 * Emitted when the mouse is released from clicking the tray icon.
10651 * Note: This will not be emitted if you have set a context menu for your Tray
10652 * using `tray.setContextMenu`, as a result of macOS-level constraints.
10656 on(event: 'mouse-up', listener: (event: KeyboardEvent,
10658 * The position of the event.
10660 position: Point) => void): this;
10661 off(event: 'mouse-up', listener: (event: KeyboardEvent,
10663 * The position of the event.
10665 position: Point) => void): this;
10666 once(event: 'mouse-up', listener: (event: KeyboardEvent,
10668 * The position of the event.
10670 position: Point) => void): this;
10671 addListener(event: 'mouse-up', listener: (event: KeyboardEvent,
10673 * The position of the event.
10675 position: Point) => void): this;
10676 removeListener(event: 'mouse-up', listener: (event: KeyboardEvent,
10678 * The position of the event.
10680 position: Point) => void): this;
10682 * Emitted when the tray icon is right clicked.
10684 * @platform darwin,win32
10686 on(event: 'right-click', listener: (event: KeyboardEvent,
10688 * The bounds of tray icon.
10690 bounds: Rectangle) => void): this;
10691 off(event: 'right-click', listener: (event: KeyboardEvent,
10693 * The bounds of tray icon.
10695 bounds: Rectangle) => void): this;
10696 once(event: 'right-click', listener: (event: KeyboardEvent,
10698 * The bounds of tray icon.
10700 bounds: Rectangle) => void): this;
10701 addListener(event: 'right-click', listener: (event: KeyboardEvent,
10703 * The bounds of tray icon.
10705 bounds: Rectangle) => void): this;
10706 removeListener(event: 'right-click', listener: (event: KeyboardEvent,
10708 * The bounds of tray icon.
10710 bounds: Rectangle) => void): this;
10714 constructor(image: (NativeImage) | (string), guid?: string);
10716 * Closes an open context menu, as set by `tray.setContextMenu()`.
10718 * @platform darwin,win32
10720 closeContextMenu(): void;
10722 * Destroys the tray icon immediately.
10726 * Displays a tray balloon.
10730 displayBalloon(options: DisplayBalloonOptions): void;
10732 * Returns focus to the taskbar notification area. Notification area icons should
10733 * use this message when they have completed their UI operation. For example, if
10734 * the icon displays a shortcut menu, but the user presses ESC to cancel it, use
10735 * `tray.focus()` to return focus to the notification area.
10741 * The `bounds` of this tray icon as `Object`.
10743 * @platform darwin,win32
10745 getBounds(): Rectangle;
10747 * Whether double click events will be ignored.
10751 getIgnoreDoubleClickEvents(): boolean;
10753 * the title displayed next to the tray icon in the status bar
10757 getTitle(): string;
10759 * Whether the tray icon is destroyed.
10761 isDestroyed(): boolean;
10763 * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
10764 * will be shown instead of the tray icon's context menu.
10766 * The `position` is only available on Windows, and it is (0, 0) by default.
10768 * @platform darwin,win32
10770 popUpContextMenu(menu?: Menu, position?: Point): void;
10772 * Removes a tray balloon.
10776 removeBalloon(): void;
10778 * Sets the context menu for this icon.
10780 setContextMenu(menu: (Menu) | (null)): void;
10782 * Sets the option to ignore double click events. Ignoring these events allows you
10783 * to detect every individual click of the tray icon.
10785 * This value is set to false by default.
10789 setIgnoreDoubleClickEvents(ignore: boolean): void;
10791 * Sets the `image` associated with this tray icon.
10793 setImage(image: (NativeImage) | (string)): void;
10795 * Sets the `image` associated with this tray icon when pressed on macOS.
10799 setPressedImage(image: (NativeImage) | (string)): void;
10801 * Sets the title displayed next to the tray icon in the status bar (Support ANSI
10806 setTitle(title: string, options?: TitleOptions): void;
10808 * Sets the hover text for this tray icon.
10810 setToolTip(toolTip: string): void;
10813 interface UploadData {
10815 // Docs: https://electronjs.org/docs/api/structures/upload-data
10818 * UUID of blob data. Use ses.getBlobData method to retrieve the data.
10822 * Content being sent.
10826 * Path of file being uploaded.
10831 interface UploadFile {
10833 // Docs: https://electronjs.org/docs/api/structures/upload-file
10836 * Path of file to be uploaded.
10840 * Number of bytes to read from `offset`. Defaults to `0`.
10844 * Last Modification time in number of seconds since the UNIX epoch. Defaults to
10847 modificationTime?: number;
10858 interface UploadRawData {
10860 // Docs: https://electronjs.org/docs/api/structures/upload-raw-data
10863 * Data to be uploaded.
10872 interface USBDevice {
10874 // Docs: https://electronjs.org/docs/api/structures/usb-device
10877 * The device class for the communication interface supported by the device
10879 deviceClass: number;
10881 * Unique identifier for the device.
10885 * The device protocol for the communication interface supported by the device
10887 deviceProtocol: number;
10889 * The device subclass for the communication interface supported by the device
10891 deviceSubclass: number;
10893 * The major version number of the device as defined by the device manufacturer.
10895 deviceVersionMajor: number;
10897 * The minor version number of the device as defined by the device manufacturer.
10899 deviceVersionMinor: number;
10901 * The subminor version number of the device as defined by the device manufacturer.
10903 deviceVersionSubminor: number;
10905 * The manufacturer name of the device.
10907 manufacturerName?: string;
10909 * The USB product ID.
10913 * Name of the device.
10915 productName?: string;
10917 * The USB device serial number.
10919 serialNumber?: string;
10921 * The USB protocol major version supported by the device
10923 usbVersionMajor: number;
10925 * The USB protocol minor version supported by the device
10927 usbVersionMinor: number;
10929 * The USB protocol subminor version supported by the device
10931 usbVersionSubminor: number;
10933 * The USB vendor ID.
10938 interface UserDefaultTypes {
10940 // Docs: https://electronjs.org/docs/api/structures/user-default-types
10942 array: Array<unknown>;
10944 dictionary: Record<string, unknown>;
10952 class UtilityProcess extends NodeEventEmitter {
10954 // Docs: https://electronjs.org/docs/api/utility-process
10956 static fork(modulePath: string, args?: string[], options?: ForkOptions): UtilityProcess;
10958 * Emitted after the child process ends.
10960 on(event: 'exit', listener: (
10962 * Contains the exit code for the process obtained from waitpid on posix, or
10963 * GetExitCodeProcess on windows.
10965 code: number) => void): this;
10966 off(event: 'exit', listener: (
10968 * Contains the exit code for the process obtained from waitpid on posix, or
10969 * GetExitCodeProcess on windows.
10971 code: number) => void): this;
10972 once(event: 'exit', listener: (
10974 * Contains the exit code for the process obtained from waitpid on posix, or
10975 * GetExitCodeProcess on windows.
10977 code: number) => void): this;
10978 addListener(event: 'exit', listener: (
10980 * Contains the exit code for the process obtained from waitpid on posix, or
10981 * GetExitCodeProcess on windows.
10983 code: number) => void): this;
10984 removeListener(event: 'exit', listener: (
10986 * Contains the exit code for the process obtained from waitpid on posix, or
10987 * GetExitCodeProcess on windows.
10989 code: number) => void): this;
10991 * Emitted when the child process sends a message using
10992 * `process.parentPort.postMessage()`.
10994 on(event: 'message', listener: (message: any) => void): this;
10995 off(event: 'message', listener: (message: any) => void): this;
10996 once(event: 'message', listener: (message: any) => void): this;
10997 addListener(event: 'message', listener: (message: any) => void): this;
10998 removeListener(event: 'message', listener: (message: any) => void): this;
11000 * Emitted once the child process has spawned successfully.
11002 on(event: 'spawn', listener: Function): this;
11003 off(event: 'spawn', listener: Function): this;
11004 once(event: 'spawn', listener: Function): this;
11005 addListener(event: 'spawn', listener: Function): this;
11006 removeListener(event: 'spawn', listener: Function): this;
11008 * Terminates the process gracefully. On POSIX, it uses SIGTERM but will ensure the
11009 * process is reaped on exit. This function returns true if the kill is successful,
11010 * and false otherwise.
11014 * Send a message to the child process, optionally transferring ownership of zero
11015 * or more `MessagePortMain` objects.
11019 postMessage(message: any, transfer?: MessagePortMain[]): void;
11021 * A `Integer | undefined` representing the process identifier (PID) of the child
11022 * process. If the child process fails to spawn due to errors, then the value is
11023 * `undefined`. When the child process exits, then the value is `undefined` after
11024 * the `exit` event is emitted.
11026 pid: (number) | (undefined);
11028 * A `NodeJS.ReadableStream | null` that represents the child process's stderr. If
11029 * the child was spawned with options.stdio[2] set to anything other than 'pipe',
11030 * then this will be `null`. When the child process exits, then the value is `null`
11031 * after the `exit` event is emitted.
11033 stderr: (NodeJS.ReadableStream) | (null);
11035 * A `NodeJS.ReadableStream | null` that represents the child process's stdout. If
11036 * the child was spawned with options.stdio[1] set to anything other than 'pipe',
11037 * then this will be `null`. When the child process exits, then the value is `null`
11038 * after the `exit` event is emitted.
11040 stdout: (NodeJS.ReadableStream) | (null);
11043 class WebContents extends NodeEventEmitter {
11045 // Docs: https://electronjs.org/docs/api/web-contents
11048 * A WebContents instance with the given TargetID, or `undefined` if there is no
11049 * WebContents associated with the given TargetID.
11051 * When communicating with the Chrome DevTools Protocol, it can be useful to lookup
11052 * a WebContents instance based on its assigned TargetID.
11054 static fromDevToolsTargetId(targetId: string): (WebContents) | (undefined);
11056 * A WebContents instance with the given WebFrameMain, or `undefined` if there is
11057 * no WebContents associated with the given WebFrameMain.
11059 static fromFrame(frame: WebFrameMain): (WebContents) | (undefined);
11061 * A WebContents instance with the given ID, or `undefined` if there is no
11062 * WebContents associated with the given ID.
11064 static fromId(id: number): (WebContents) | (undefined);
11066 * An array of all `WebContents` instances. This will contain web contents for all
11067 * windows, webviews, opened devtools, and devtools extension background pages.
11069 static getAllWebContents(): WebContents[];
11071 * The web contents that is focused in this application, otherwise returns `null`.
11073 static getFocusedWebContents(): (WebContents) | (null);
11075 * Emitted when media becomes audible or inaudible.
11077 on(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
11078 off(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
11079 once(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
11080 addListener(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
11081 removeListener(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
11083 * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
11084 * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
11087 * To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
11089 on(event: 'before-input-event', listener: (event: Event,
11091 * Input properties.
11093 input: Input) => void): this;
11094 off(event: 'before-input-event', listener: (event: Event,
11096 * Input properties.
11098 input: Input) => void): this;
11099 once(event: 'before-input-event', listener: (event: Event,
11101 * Input properties.
11103 input: Input) => void): this;
11104 addListener(event: 'before-input-event', listener: (event: Event,
11106 * Input properties.
11108 input: Input) => void): this;
11109 removeListener(event: 'before-input-event', listener: (event: Event,
11111 * Input properties.
11113 input: Input) => void): this;
11115 * Emitted when the `WebContents` loses focus.
11117 on(event: 'blur', listener: Function): this;
11118 off(event: 'blur', listener: Function): this;
11119 once(event: 'blur', listener: Function): this;
11120 addListener(event: 'blur', listener: Function): this;
11121 removeListener(event: 'blur', listener: Function): this;
11123 * Emitted when failed to verify the `certificate` for `url`.
11125 * The usage is the same with the `certificate-error` event of `app`.
11127 on(event: 'certificate-error', listener: (event: Event,
11133 certificate: Certificate,
11134 callback: (isTrusted: boolean) => void,
11135 isMainFrame: boolean) => void): this;
11136 off(event: 'certificate-error', listener: (event: Event,
11142 certificate: Certificate,
11143 callback: (isTrusted: boolean) => void,
11144 isMainFrame: boolean) => void): this;
11145 once(event: 'certificate-error', listener: (event: Event,
11151 certificate: Certificate,
11152 callback: (isTrusted: boolean) => void,
11153 isMainFrame: boolean) => void): this;
11154 addListener(event: 'certificate-error', listener: (event: Event,
11160 certificate: Certificate,
11161 callback: (isTrusted: boolean) => void,
11162 isMainFrame: boolean) => void): this;
11163 removeListener(event: 'certificate-error', listener: (event: Event,
11169 certificate: Certificate,
11170 callback: (isTrusted: boolean) => void,
11171 isMainFrame: boolean) => void): this;
11173 * Emitted when the associated window logs a console message.
11175 on(event: 'console-message', listener: (event: Event,
11177 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
11182 * The actual console message
11186 * The line number of the source that triggered this console message
11189 sourceId: string) => void): this;
11190 off(event: 'console-message', listener: (event: Event,
11192 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
11197 * The actual console message
11201 * The line number of the source that triggered this console message
11204 sourceId: string) => void): this;
11205 once(event: 'console-message', listener: (event: Event,
11207 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
11212 * The actual console message
11216 * The line number of the source that triggered this console message
11219 sourceId: string) => void): this;
11220 addListener(event: 'console-message', listener: (event: Event,
11222 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
11227 * The actual console message
11231 * The line number of the source that triggered this console message
11234 sourceId: string) => void): this;
11235 removeListener(event: 'console-message', listener: (event: Event,
11237 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
11242 * The actual console message
11246 * The line number of the source that triggered this console message
11249 sourceId: string) => void): this;
11251 * Emitted when the page calls `window.moveTo`, `window.resizeTo` or related APIs.
11253 * By default, this will move the window. To prevent that behavior, call
11254 * `event.preventDefault()`.
11256 on(event: 'content-bounds-updated', listener: (event: Event,
11258 * requested new content bounds
11260 bounds: Rectangle) => void): this;
11261 off(event: 'content-bounds-updated', listener: (event: Event,
11263 * requested new content bounds
11265 bounds: Rectangle) => void): this;
11266 once(event: 'content-bounds-updated', listener: (event: Event,
11268 * requested new content bounds
11270 bounds: Rectangle) => void): this;
11271 addListener(event: 'content-bounds-updated', listener: (event: Event,
11273 * requested new content bounds
11275 bounds: Rectangle) => void): this;
11276 removeListener(event: 'content-bounds-updated', listener: (event: Event,
11278 * requested new content bounds
11280 bounds: Rectangle) => void): this;
11282 * Emitted when there is a new context menu that needs to be handled.
11284 on(event: 'context-menu', listener: (event: Event,
11285 params: ContextMenuParams) => void): this;
11286 off(event: 'context-menu', listener: (event: Event,
11287 params: ContextMenuParams) => void): this;
11288 once(event: 'context-menu', listener: (event: Event,
11289 params: ContextMenuParams) => void): this;
11290 addListener(event: 'context-menu', listener: (event: Event,
11291 params: ContextMenuParams) => void): this;
11292 removeListener(event: 'context-menu', listener: (event: Event,
11293 params: ContextMenuParams) => void): this;
11295 * Emitted when the renderer process crashes or is killed.
11297 * **Deprecated:** This event is superceded by the `render-process-gone` event
11298 * which contains more information about why the render process disappeared. It
11299 * isn't always because it crashed. The `killed` boolean can be replaced by
11300 * checking `reason === 'killed'` when you switch to that event.
11304 on(event: 'crashed', listener: (event: Event,
11305 killed: boolean) => void): this;
11306 off(event: 'crashed', listener: (event: Event,
11307 killed: boolean) => void): this;
11308 once(event: 'crashed', listener: (event: Event,
11309 killed: boolean) => void): this;
11310 addListener(event: 'crashed', listener: (event: Event,
11311 killed: boolean) => void): this;
11312 removeListener(event: 'crashed', listener: (event: Event,
11313 killed: boolean) => void): this;
11315 * Emitted when the cursor's type changes. The `type` parameter can be `pointer`,
11316 * `crosshair`, `hand`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
11317 * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
11318 * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
11319 * `row-resize`, `m-panning`, `m-panning-vertical`, `m-panning-horizontal`,
11320 * `e-panning`, `n-panning`, `ne-panning`, `nw-panning`, `s-panning`, `se-panning`,
11321 * `sw-panning`, `w-panning`, `move`, `vertical-text`, `cell`, `context-menu`,
11322 * `alias`, `progress`, `nodrop`, `copy`, `none`, `not-allowed`, `zoom-in`,
11323 * `zoom-out`, `grab`, `grabbing`, `custom`, `null`, `drag-drop-none`,
11324 * `drag-drop-move`, `drag-drop-copy`, `drag-drop-link`, `ns-no-resize`,
11325 * `ew-no-resize`, `nesw-no-resize`, `nwse-no-resize`, or `default`.
11327 * If the `type` parameter is `custom`, the `image` parameter will hold the custom
11328 * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
11329 * additional information about the custom cursor.
11331 on(event: 'cursor-changed', listener: (event: Event,
11333 image: NativeImage,
11335 * scaling factor for the custom cursor.
11339 * the size of the `image`.
11343 * coordinates of the custom cursor's hotspot.
11345 hotspot: Point) => void): this;
11346 off(event: 'cursor-changed', listener: (event: Event,
11348 image: NativeImage,
11350 * scaling factor for the custom cursor.
11354 * the size of the `image`.
11358 * coordinates of the custom cursor's hotspot.
11360 hotspot: Point) => void): this;
11361 once(event: 'cursor-changed', listener: (event: Event,
11363 image: NativeImage,
11365 * scaling factor for the custom cursor.
11369 * the size of the `image`.
11373 * coordinates of the custom cursor's hotspot.
11375 hotspot: Point) => void): this;
11376 addListener(event: 'cursor-changed', listener: (event: Event,
11378 image: NativeImage,
11380 * scaling factor for the custom cursor.
11384 * the size of the `image`.
11388 * coordinates of the custom cursor's hotspot.
11390 hotspot: Point) => void): this;
11391 removeListener(event: 'cursor-changed', listener: (event: Event,
11393 image: NativeImage,
11395 * scaling factor for the custom cursor.
11399 * the size of the `image`.
11403 * coordinates of the custom cursor's hotspot.
11405 hotspot: Point) => void): this;
11407 * Emitted when `webContents` is destroyed.
11409 on(event: 'destroyed', listener: Function): this;
11410 off(event: 'destroyed', listener: Function): this;
11411 once(event: 'destroyed', listener: Function): this;
11412 addListener(event: 'destroyed', listener: Function): this;
11413 removeListener(event: 'destroyed', listener: Function): this;
11415 * Emitted when DevTools is closed.
11417 on(event: 'devtools-closed', listener: Function): this;
11418 off(event: 'devtools-closed', listener: Function): this;
11419 once(event: 'devtools-closed', listener: Function): this;
11420 addListener(event: 'devtools-closed', listener: Function): this;
11421 removeListener(event: 'devtools-closed', listener: Function): this;
11423 * Emitted when DevTools is focused / opened.
11425 on(event: 'devtools-focused', listener: Function): this;
11426 off(event: 'devtools-focused', listener: Function): this;
11427 once(event: 'devtools-focused', listener: Function): this;
11428 addListener(event: 'devtools-focused', listener: Function): this;
11429 removeListener(event: 'devtools-focused', listener: Function): this;
11431 * Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for
11432 * a link in its context menu.
11434 on(event: 'devtools-open-url', listener: (event: Event,
11436 * URL of the link that was clicked or selected.
11438 url: string) => void): this;
11439 off(event: 'devtools-open-url', listener: (event: Event,
11441 * URL of the link that was clicked or selected.
11443 url: string) => void): this;
11444 once(event: 'devtools-open-url', listener: (event: Event,
11446 * URL of the link that was clicked or selected.
11448 url: string) => void): this;
11449 addListener(event: 'devtools-open-url', listener: (event: Event,
11451 * URL of the link that was clicked or selected.
11453 url: string) => void): this;
11454 removeListener(event: 'devtools-open-url', listener: (event: Event,
11456 * URL of the link that was clicked or selected.
11458 url: string) => void): this;
11460 * Emitted when DevTools is opened.
11462 on(event: 'devtools-opened', listener: Function): this;
11463 off(event: 'devtools-opened', listener: Function): this;
11464 once(event: 'devtools-opened', listener: Function): this;
11465 addListener(event: 'devtools-opened', listener: Function): this;
11466 removeListener(event: 'devtools-opened', listener: Function): this;
11468 * Emitted when the devtools window instructs the webContents to reload
11470 on(event: 'devtools-reload-page', listener: Function): this;
11471 off(event: 'devtools-reload-page', listener: Function): this;
11472 once(event: 'devtools-reload-page', listener: Function): this;
11473 addListener(event: 'devtools-reload-page', listener: Function): this;
11474 removeListener(event: 'devtools-reload-page', listener: Function): this;
11476 * Emitted when a `<webview>` has been attached to this web contents.
11478 on(event: 'did-attach-webview', listener: (event: Event,
11480 * The guest web contents that is used by the `<webview>`.
11482 webContents: WebContents) => void): this;
11483 off(event: 'did-attach-webview', listener: (event: Event,
11485 * The guest web contents that is used by the `<webview>`.
11487 webContents: WebContents) => void): this;
11488 once(event: 'did-attach-webview', listener: (event: Event,
11490 * The guest web contents that is used by the `<webview>`.
11492 webContents: WebContents) => void): this;
11493 addListener(event: 'did-attach-webview', listener: (event: Event,
11495 * The guest web contents that is used by the `<webview>`.
11497 webContents: WebContents) => void): this;
11498 removeListener(event: 'did-attach-webview', listener: (event: Event,
11500 * The guest web contents that is used by the `<webview>`.
11502 webContents: WebContents) => void): this;
11504 * Emitted when a page's theme color changes. This is usually due to encountering a
11507 on(event: 'did-change-theme-color', listener: (event: Event,
11509 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
11511 color: (string) | (null)) => void): this;
11512 off(event: 'did-change-theme-color', listener: (event: Event,
11514 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
11516 color: (string) | (null)) => void): this;
11517 once(event: 'did-change-theme-color', listener: (event: Event,
11519 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
11521 color: (string) | (null)) => void): this;
11522 addListener(event: 'did-change-theme-color', listener: (event: Event,
11524 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
11526 color: (string) | (null)) => void): this;
11527 removeListener(event: 'did-change-theme-color', listener: (event: Event,
11529 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
11531 color: (string) | (null)) => void): this;
11533 * Emitted _after_ successful creation of a window via `window.open` in the
11534 * renderer. Not emitted if the creation of the window is canceled from
11535 * `webContents.setWindowOpenHandler`.
11537 * See `window.open()` for more details and how to use this in conjunction with
11538 * `webContents.setWindowOpenHandler`.
11540 on(event: 'did-create-window', listener: (window: BrowserWindow,
11541 details: DidCreateWindowDetails) => void): this;
11542 off(event: 'did-create-window', listener: (window: BrowserWindow,
11543 details: DidCreateWindowDetails) => void): this;
11544 once(event: 'did-create-window', listener: (window: BrowserWindow,
11545 details: DidCreateWindowDetails) => void): this;
11546 addListener(event: 'did-create-window', listener: (window: BrowserWindow,
11547 details: DidCreateWindowDetails) => void): this;
11548 removeListener(event: 'did-create-window', listener: (window: BrowserWindow,
11549 details: DidCreateWindowDetails) => void): this;
11551 * This event is like `did-finish-load` but emitted when the load failed. The full
11552 * list of error codes and their meaning is available here.
11554 on(event: 'did-fail-load', listener: (event: Event,
11556 errorDescription: string,
11557 validatedURL: string,
11558 isMainFrame: boolean,
11559 frameProcessId: number,
11560 frameRoutingId: number) => void): this;
11561 off(event: 'did-fail-load', listener: (event: Event,
11563 errorDescription: string,
11564 validatedURL: string,
11565 isMainFrame: boolean,
11566 frameProcessId: number,
11567 frameRoutingId: number) => void): this;
11568 once(event: 'did-fail-load', listener: (event: Event,
11570 errorDescription: string,
11571 validatedURL: string,
11572 isMainFrame: boolean,
11573 frameProcessId: number,
11574 frameRoutingId: number) => void): this;
11575 addListener(event: 'did-fail-load', listener: (event: Event,
11577 errorDescription: string,
11578 validatedURL: string,
11579 isMainFrame: boolean,
11580 frameProcessId: number,
11581 frameRoutingId: number) => void): this;
11582 removeListener(event: 'did-fail-load', listener: (event: Event,
11584 errorDescription: string,
11585 validatedURL: string,
11586 isMainFrame: boolean,
11587 frameProcessId: number,
11588 frameRoutingId: number) => void): this;
11590 * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
11591 * `window.stop()` was invoked).
11593 on(event: 'did-fail-provisional-load', listener: (event: Event,
11595 errorDescription: string,
11596 validatedURL: string,
11597 isMainFrame: boolean,
11598 frameProcessId: number,
11599 frameRoutingId: number) => void): this;
11600 off(event: 'did-fail-provisional-load', listener: (event: Event,
11602 errorDescription: string,
11603 validatedURL: string,
11604 isMainFrame: boolean,
11605 frameProcessId: number,
11606 frameRoutingId: number) => void): this;
11607 once(event: 'did-fail-provisional-load', listener: (event: Event,
11609 errorDescription: string,
11610 validatedURL: string,
11611 isMainFrame: boolean,
11612 frameProcessId: number,
11613 frameRoutingId: number) => void): this;
11614 addListener(event: 'did-fail-provisional-load', listener: (event: Event,
11616 errorDescription: string,
11617 validatedURL: string,
11618 isMainFrame: boolean,
11619 frameProcessId: number,
11620 frameRoutingId: number) => void): this;
11621 removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
11623 errorDescription: string,
11624 validatedURL: string,
11625 isMainFrame: boolean,
11626 frameProcessId: number,
11627 frameRoutingId: number) => void): this;
11629 * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
11630 * spinning, and the `onload` event was dispatched.
11632 on(event: 'did-finish-load', listener: Function): this;
11633 off(event: 'did-finish-load', listener: Function): this;
11634 once(event: 'did-finish-load', listener: Function): this;
11635 addListener(event: 'did-finish-load', listener: Function): this;
11636 removeListener(event: 'did-finish-load', listener: Function): this;
11638 * Emitted when a frame has done navigation.
11640 on(event: 'did-frame-finish-load', listener: (event: Event,
11641 isMainFrame: boolean,
11642 frameProcessId: number,
11643 frameRoutingId: number) => void): this;
11644 off(event: 'did-frame-finish-load', listener: (event: Event,
11645 isMainFrame: boolean,
11646 frameProcessId: number,
11647 frameRoutingId: number) => void): this;
11648 once(event: 'did-frame-finish-load', listener: (event: Event,
11649 isMainFrame: boolean,
11650 frameProcessId: number,
11651 frameRoutingId: number) => void): this;
11652 addListener(event: 'did-frame-finish-load', listener: (event: Event,
11653 isMainFrame: boolean,
11654 frameProcessId: number,
11655 frameRoutingId: number) => void): this;
11656 removeListener(event: 'did-frame-finish-load', listener: (event: Event,
11657 isMainFrame: boolean,
11658 frameProcessId: number,
11659 frameRoutingId: number) => void): this;
11661 * Emitted when any frame navigation is done.
11663 * This event is not emitted for in-page navigations, such as clicking anchor links
11664 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
11667 on(event: 'did-frame-navigate', listener: (event: Event,
11670 * -1 for non HTTP navigations
11672 httpResponseCode: number,
11674 * empty for non HTTP navigations,
11676 httpStatusText: string,
11677 isMainFrame: boolean,
11678 frameProcessId: number,
11679 frameRoutingId: number) => void): this;
11680 off(event: 'did-frame-navigate', listener: (event: Event,
11683 * -1 for non HTTP navigations
11685 httpResponseCode: number,
11687 * empty for non HTTP navigations,
11689 httpStatusText: string,
11690 isMainFrame: boolean,
11691 frameProcessId: number,
11692 frameRoutingId: number) => void): this;
11693 once(event: 'did-frame-navigate', listener: (event: Event,
11696 * -1 for non HTTP navigations
11698 httpResponseCode: number,
11700 * empty for non HTTP navigations,
11702 httpStatusText: string,
11703 isMainFrame: boolean,
11704 frameProcessId: number,
11705 frameRoutingId: number) => void): this;
11706 addListener(event: 'did-frame-navigate', listener: (event: Event,
11709 * -1 for non HTTP navigations
11711 httpResponseCode: number,
11713 * empty for non HTTP navigations,
11715 httpStatusText: string,
11716 isMainFrame: boolean,
11717 frameProcessId: number,
11718 frameRoutingId: number) => void): this;
11719 removeListener(event: 'did-frame-navigate', listener: (event: Event,
11722 * -1 for non HTTP navigations
11724 httpResponseCode: number,
11726 * empty for non HTTP navigations,
11728 httpStatusText: string,
11729 isMainFrame: boolean,
11730 frameProcessId: number,
11731 frameRoutingId: number) => void): this;
11733 * Emitted when a main frame navigation is done.
11735 * This event is not emitted for in-page navigations, such as clicking anchor links
11736 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
11739 on(event: 'did-navigate', listener: (event: Event,
11742 * -1 for non HTTP navigations
11744 httpResponseCode: number,
11746 * empty for non HTTP navigations
11748 httpStatusText: string) => void): this;
11749 off(event: 'did-navigate', listener: (event: Event,
11752 * -1 for non HTTP navigations
11754 httpResponseCode: number,
11756 * empty for non HTTP navigations
11758 httpStatusText: string) => void): this;
11759 once(event: 'did-navigate', listener: (event: Event,
11762 * -1 for non HTTP navigations
11764 httpResponseCode: number,
11766 * empty for non HTTP navigations
11768 httpStatusText: string) => void): this;
11769 addListener(event: 'did-navigate', listener: (event: Event,
11772 * -1 for non HTTP navigations
11774 httpResponseCode: number,
11776 * empty for non HTTP navigations
11778 httpStatusText: string) => void): this;
11779 removeListener(event: 'did-navigate', listener: (event: Event,
11782 * -1 for non HTTP navigations
11784 httpResponseCode: number,
11786 * empty for non HTTP navigations
11788 httpStatusText: string) => void): this;
11790 * Emitted when an in-page navigation happened in any frame.
11792 * When in-page navigation happens, the page URL changes but does not cause
11793 * navigation outside of the page. Examples of this occurring are when anchor links
11794 * are clicked or when the DOM `hashchange` event is triggered.
11796 on(event: 'did-navigate-in-page', listener: (event: Event,
11798 isMainFrame: boolean,
11799 frameProcessId: number,
11800 frameRoutingId: number) => void): this;
11801 off(event: 'did-navigate-in-page', listener: (event: Event,
11803 isMainFrame: boolean,
11804 frameProcessId: number,
11805 frameRoutingId: number) => void): this;
11806 once(event: 'did-navigate-in-page', listener: (event: Event,
11808 isMainFrame: boolean,
11809 frameProcessId: number,
11810 frameRoutingId: number) => void): this;
11811 addListener(event: 'did-navigate-in-page', listener: (event: Event,
11813 isMainFrame: boolean,
11814 frameProcessId: number,
11815 frameRoutingId: number) => void): this;
11816 removeListener(event: 'did-navigate-in-page', listener: (event: Event,
11818 isMainFrame: boolean,
11819 frameProcessId: number,
11820 frameRoutingId: number) => void): this;
11822 * Emitted after a server side redirect occurs during navigation. For example a
11825 * This event cannot be prevented, if you want to prevent redirects you should
11826 * checkout out the `will-redirect` event above.
11828 on(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
11836 isInPlace: boolean,
11840 isMainFrame: boolean,
11844 frameProcessId: number,
11848 frameRoutingId: number) => void): this;
11849 off(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
11857 isInPlace: boolean,
11861 isMainFrame: boolean,
11865 frameProcessId: number,
11869 frameRoutingId: number) => void): this;
11870 once(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
11878 isInPlace: boolean,
11882 isMainFrame: boolean,
11886 frameProcessId: number,
11890 frameRoutingId: number) => void): this;
11891 addListener(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
11899 isInPlace: boolean,
11903 isMainFrame: boolean,
11907 frameProcessId: number,
11911 frameRoutingId: number) => void): this;
11912 removeListener(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
11920 isInPlace: boolean,
11924 isMainFrame: boolean,
11928 frameProcessId: number,
11932 frameRoutingId: number) => void): this;
11934 * Corresponds to the points in time when the spinner of the tab started spinning.
11936 on(event: 'did-start-loading', listener: Function): this;
11937 off(event: 'did-start-loading', listener: Function): this;
11938 once(event: 'did-start-loading', listener: Function): this;
11939 addListener(event: 'did-start-loading', listener: Function): this;
11940 removeListener(event: 'did-start-loading', listener: Function): this;
11942 * Emitted when any frame (including main) starts navigating.
11944 on(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
11952 isInPlace: boolean,
11956 isMainFrame: boolean,
11960 frameProcessId: number,
11964 frameRoutingId: number) => void): this;
11965 off(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
11973 isInPlace: boolean,
11977 isMainFrame: boolean,
11981 frameProcessId: number,
11985 frameRoutingId: number) => void): this;
11986 once(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
11994 isInPlace: boolean,
11998 isMainFrame: boolean,
12002 frameProcessId: number,
12006 frameRoutingId: number) => void): this;
12007 addListener(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
12015 isInPlace: boolean,
12019 isMainFrame: boolean,
12023 frameProcessId: number,
12027 frameRoutingId: number) => void): this;
12028 removeListener(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
12036 isInPlace: boolean,
12040 isMainFrame: boolean,
12044 frameProcessId: number,
12048 frameRoutingId: number) => void): this;
12050 * Corresponds to the points in time when the spinner of the tab stopped spinning.
12052 on(event: 'did-stop-loading', listener: Function): this;
12053 off(event: 'did-stop-loading', listener: Function): this;
12054 once(event: 'did-stop-loading', listener: Function): this;
12055 addListener(event: 'did-stop-loading', listener: Function): this;
12056 removeListener(event: 'did-stop-loading', listener: Function): this;
12058 * Emitted when the document in the top-level frame is loaded.
12060 on(event: 'dom-ready', listener: Function): this;
12061 off(event: 'dom-ready', listener: Function): this;
12062 once(event: 'dom-ready', listener: Function): this;
12063 addListener(event: 'dom-ready', listener: Function): this;
12064 removeListener(event: 'dom-ready', listener: Function): this;
12066 * Emitted when the window enters a full-screen state triggered by HTML API.
12068 on(event: 'enter-html-full-screen', listener: Function): this;
12069 off(event: 'enter-html-full-screen', listener: Function): this;
12070 once(event: 'enter-html-full-screen', listener: Function): this;
12071 addListener(event: 'enter-html-full-screen', listener: Function): this;
12072 removeListener(event: 'enter-html-full-screen', listener: Function): this;
12074 * Emitted when the `WebContents` gains focus.
12076 * Note that on macOS, having focus means the `WebContents` is the first responder
12077 * of window, so switching focus between windows would not trigger the `focus` and
12078 * `blur` events of `WebContents`, as the first responder of each window is not
12081 * The `focus` and `blur` events of `WebContents` should only be used to detect
12082 * focus change between different `WebContents` and `BrowserView` in the same
12085 on(event: 'focus', listener: Function): this;
12086 off(event: 'focus', listener: Function): this;
12087 once(event: 'focus', listener: Function): this;
12088 addListener(event: 'focus', listener: Function): this;
12089 removeListener(event: 'focus', listener: Function): this;
12091 * Emitted when a result is available for `webContents.findInPage` request.
12093 on(event: 'found-in-page', listener: (event: Event,
12094 result: Result) => void): this;
12095 off(event: 'found-in-page', listener: (event: Event,
12096 result: Result) => void): this;
12097 once(event: 'found-in-page', listener: (event: Event,
12098 result: Result) => void): this;
12099 addListener(event: 'found-in-page', listener: (event: Event,
12100 result: Result) => void): this;
12101 removeListener(event: 'found-in-page', listener: (event: Event,
12102 result: Result) => void): this;
12104 * Emitted when the mainFrame, an `<iframe>`, or a nested `<iframe>` is loaded
12107 on(event: 'frame-created', listener: (event: Event,
12108 details: FrameCreatedDetails) => void): this;
12109 off(event: 'frame-created', listener: (event: Event,
12110 details: FrameCreatedDetails) => void): this;
12111 once(event: 'frame-created', listener: (event: Event,
12112 details: FrameCreatedDetails) => void): this;
12113 addListener(event: 'frame-created', listener: (event: Event,
12114 details: FrameCreatedDetails) => void): this;
12115 removeListener(event: 'frame-created', listener: (event: Event,
12116 details: FrameCreatedDetails) => void): this;
12118 * Emitted when an input event is sent to the WebContents. See InputEvent for
12121 on(event: 'input-event', listener: (event: Event,
12122 inputEvent: InputEvent) => void): this;
12123 off(event: 'input-event', listener: (event: Event,
12124 inputEvent: InputEvent) => void): this;
12125 once(event: 'input-event', listener: (event: Event,
12126 inputEvent: InputEvent) => void): this;
12127 addListener(event: 'input-event', listener: (event: Event,
12128 inputEvent: InputEvent) => void): this;
12129 removeListener(event: 'input-event', listener: (event: Event,
12130 inputEvent: InputEvent) => void): this;
12132 * Emitted when the renderer process sends an asynchronous message via
12133 * `ipcRenderer.send()`.
12135 * See also `webContents.ipc`, which provides an `IpcMain`-like interface for
12136 * responding to IPC messages specifically from this WebContents.
12138 on(event: 'ipc-message', listener: (event: IpcMainEvent,
12140 ...args: any[]) => void): this;
12141 off(event: 'ipc-message', listener: (event: IpcMainEvent,
12143 ...args: any[]) => void): this;
12144 once(event: 'ipc-message', listener: (event: IpcMainEvent,
12146 ...args: any[]) => void): this;
12147 addListener(event: 'ipc-message', listener: (event: IpcMainEvent,
12149 ...args: any[]) => void): this;
12150 removeListener(event: 'ipc-message', listener: (event: IpcMainEvent,
12152 ...args: any[]) => void): this;
12154 * Emitted when the renderer process sends a synchronous message via
12155 * `ipcRenderer.sendSync()`.
12157 * See also `webContents.ipc`, which provides an `IpcMain`-like interface for
12158 * responding to IPC messages specifically from this WebContents.
12160 on(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
12162 ...args: any[]) => void): this;
12163 off(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
12165 ...args: any[]) => void): this;
12166 once(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
12168 ...args: any[]) => void): this;
12169 addListener(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
12171 ...args: any[]) => void): this;
12172 removeListener(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
12174 ...args: any[]) => void): this;
12176 * Emitted when the window leaves a full-screen state triggered by HTML API.
12178 on(event: 'leave-html-full-screen', listener: Function): this;
12179 off(event: 'leave-html-full-screen', listener: Function): this;
12180 once(event: 'leave-html-full-screen', listener: Function): this;
12181 addListener(event: 'leave-html-full-screen', listener: Function): this;
12182 removeListener(event: 'leave-html-full-screen', listener: Function): this;
12184 * Emitted when `webContents` wants to do basic auth.
12186 * The usage is the same with the `login` event of `app`.
12188 on(event: 'login', listener: (event: Event,
12189 authenticationResponseDetails: AuthenticationResponseDetails,
12190 authInfo: AuthInfo,
12191 callback: (username?: string, password?: string) => void) => void): this;
12192 off(event: 'login', listener: (event: Event,
12193 authenticationResponseDetails: AuthenticationResponseDetails,
12194 authInfo: AuthInfo,
12195 callback: (username?: string, password?: string) => void) => void): this;
12196 once(event: 'login', listener: (event: Event,
12197 authenticationResponseDetails: AuthenticationResponseDetails,
12198 authInfo: AuthInfo,
12199 callback: (username?: string, password?: string) => void) => void): this;
12200 addListener(event: 'login', listener: (event: Event,
12201 authenticationResponseDetails: AuthenticationResponseDetails,
12202 authInfo: AuthInfo,
12203 callback: (username?: string, password?: string) => void) => void): this;
12204 removeListener(event: 'login', listener: (event: Event,
12205 authenticationResponseDetails: AuthenticationResponseDetails,
12206 authInfo: AuthInfo,
12207 callback: (username?: string, password?: string) => void) => void): this;
12209 * Emitted when media is paused or done playing.
12211 on(event: 'media-paused', listener: Function): this;
12212 off(event: 'media-paused', listener: Function): this;
12213 once(event: 'media-paused', listener: Function): this;
12214 addListener(event: 'media-paused', listener: Function): this;
12215 removeListener(event: 'media-paused', listener: Function): this;
12217 * Emitted when media starts playing.
12219 on(event: 'media-started-playing', listener: Function): this;
12220 off(event: 'media-started-playing', listener: Function): this;
12221 once(event: 'media-started-playing', listener: Function): this;
12222 addListener(event: 'media-started-playing', listener: Function): this;
12223 removeListener(event: 'media-started-playing', listener: Function): this;
12225 * Emitted when page receives favicon urls.
12227 on(event: 'page-favicon-updated', listener: (event: Event,
12231 favicons: string[]) => void): this;
12232 off(event: 'page-favicon-updated', listener: (event: Event,
12236 favicons: string[]) => void): this;
12237 once(event: 'page-favicon-updated', listener: (event: Event,
12241 favicons: string[]) => void): this;
12242 addListener(event: 'page-favicon-updated', listener: (event: Event,
12246 favicons: string[]) => void): this;
12247 removeListener(event: 'page-favicon-updated', listener: (event: Event,
12251 favicons: string[]) => void): this;
12253 * Fired when page title is set during navigation. `explicitSet` is false when
12254 * title is synthesized from file url.
12256 on(event: 'page-title-updated', listener: (event: Event,
12258 explicitSet: boolean) => void): this;
12259 off(event: 'page-title-updated', listener: (event: Event,
12261 explicitSet: boolean) => void): this;
12262 once(event: 'page-title-updated', listener: (event: Event,
12264 explicitSet: boolean) => void): this;
12265 addListener(event: 'page-title-updated', listener: (event: Event,
12267 explicitSet: boolean) => void): this;
12268 removeListener(event: 'page-title-updated', listener: (event: Event,
12270 explicitSet: boolean) => void): this;
12272 * Emitted when a new frame is generated. Only the dirty area is passed in the
12275 on(event: 'paint', listener: (event: Event,
12276 dirtyRect: Rectangle,
12278 * The image data of the whole frame.
12280 image: NativeImage) => void): this;
12281 off(event: 'paint', listener: (event: Event,
12282 dirtyRect: Rectangle,
12284 * The image data of the whole frame.
12286 image: NativeImage) => void): this;
12287 once(event: 'paint', listener: (event: Event,
12288 dirtyRect: Rectangle,
12290 * The image data of the whole frame.
12292 image: NativeImage) => void): this;
12293 addListener(event: 'paint', listener: (event: Event,
12294 dirtyRect: Rectangle,
12296 * The image data of the whole frame.
12298 image: NativeImage) => void): this;
12299 removeListener(event: 'paint', listener: (event: Event,
12300 dirtyRect: Rectangle,
12302 * The image data of the whole frame.
12304 image: NativeImage) => void): this;
12306 * Emitted when a plugin process has crashed.
12308 on(event: 'plugin-crashed', listener: (event: Event,
12310 version: string) => void): this;
12311 off(event: 'plugin-crashed', listener: (event: Event,
12313 version: string) => void): this;
12314 once(event: 'plugin-crashed', listener: (event: Event,
12316 version: string) => void): this;
12317 addListener(event: 'plugin-crashed', listener: (event: Event,
12319 version: string) => void): this;
12320 removeListener(event: 'plugin-crashed', listener: (event: Event,
12322 version: string) => void): this;
12324 * Emitted when the `WebContents` preferred size has changed.
12326 * This event will only be emitted when `enablePreferredSizeMode` is set to `true`
12327 * in `webPreferences`.
12329 on(event: 'preferred-size-changed', listener: (event: Event,
12331 * The minimum size needed to contain the layout of the document—without requiring
12334 preferredSize: Size) => void): this;
12335 off(event: 'preferred-size-changed', listener: (event: Event,
12337 * The minimum size needed to contain the layout of the document—without requiring
12340 preferredSize: Size) => void): this;
12341 once(event: 'preferred-size-changed', listener: (event: Event,
12343 * The minimum size needed to contain the layout of the document—without requiring
12346 preferredSize: Size) => void): this;
12347 addListener(event: 'preferred-size-changed', listener: (event: Event,
12349 * The minimum size needed to contain the layout of the document—without requiring
12352 preferredSize: Size) => void): this;
12353 removeListener(event: 'preferred-size-changed', listener: (event: Event,
12355 * The minimum size needed to contain the layout of the document—without requiring
12358 preferredSize: Size) => void): this;
12360 * Emitted when the preload script `preloadPath` throws an unhandled exception
12363 on(event: 'preload-error', listener: (event: Event,
12364 preloadPath: string,
12365 error: Error) => void): this;
12366 off(event: 'preload-error', listener: (event: Event,
12367 preloadPath: string,
12368 error: Error) => void): this;
12369 once(event: 'preload-error', listener: (event: Event,
12370 preloadPath: string,
12371 error: Error) => void): this;
12372 addListener(event: 'preload-error', listener: (event: Event,
12373 preloadPath: string,
12374 error: Error) => void): this;
12375 removeListener(event: 'preload-error', listener: (event: Event,
12376 preloadPath: string,
12377 error: Error) => void): this;
12379 * Emitted when the renderer process unexpectedly disappears. This is normally
12380 * because it was crashed or killed.
12382 on(event: 'render-process-gone', listener: (event: Event,
12383 details: RenderProcessGoneDetails) => void): this;
12384 off(event: 'render-process-gone', listener: (event: Event,
12385 details: RenderProcessGoneDetails) => void): this;
12386 once(event: 'render-process-gone', listener: (event: Event,
12387 details: RenderProcessGoneDetails) => void): this;
12388 addListener(event: 'render-process-gone', listener: (event: Event,
12389 details: RenderProcessGoneDetails) => void): this;
12390 removeListener(event: 'render-process-gone', listener: (event: Event,
12391 details: RenderProcessGoneDetails) => void): this;
12393 * Emitted when the unresponsive web page becomes responsive again.
12395 on(event: 'responsive', listener: Function): this;
12396 off(event: 'responsive', listener: Function): this;
12397 once(event: 'responsive', listener: Function): this;
12398 addListener(event: 'responsive', listener: Function): this;
12399 removeListener(event: 'responsive', listener: Function): this;
12401 * Emitted when a bluetooth device needs to be selected when a call to
12402 * `navigator.bluetooth.requestDevice` is made. `callback` should be called with
12403 * the `deviceId` of the device to be selected. Passing an empty string to
12404 * `callback` will cancel the request.
12406 * If an event listener is not added for this event, or if `event.preventDefault`
12407 * is not called when handling this event, the first available device will be
12408 * automatically selected.
12410 * Due to the nature of bluetooth, scanning for devices when
12411 * `navigator.bluetooth.requestDevice` is called may take time and will cause
12412 * `select-bluetooth-device` to fire multiple times until `callback` is called with
12413 * either a device id or an empty string to cancel the request.
12415 on(event: 'select-bluetooth-device', listener: (event: Event,
12416 devices: BluetoothDevice[],
12417 callback: (deviceId: string) => void) => void): this;
12418 off(event: 'select-bluetooth-device', listener: (event: Event,
12419 devices: BluetoothDevice[],
12420 callback: (deviceId: string) => void) => void): this;
12421 once(event: 'select-bluetooth-device', listener: (event: Event,
12422 devices: BluetoothDevice[],
12423 callback: (deviceId: string) => void) => void): this;
12424 addListener(event: 'select-bluetooth-device', listener: (event: Event,
12425 devices: BluetoothDevice[],
12426 callback: (deviceId: string) => void) => void): this;
12427 removeListener(event: 'select-bluetooth-device', listener: (event: Event,
12428 devices: BluetoothDevice[],
12429 callback: (deviceId: string) => void) => void): this;
12431 * Emitted when a client certificate is requested.
12433 * The usage is the same with the `select-client-certificate` event of `app`.
12435 on(event: 'select-client-certificate', listener: (event: Event,
12437 certificateList: Certificate[],
12438 callback: (certificate: Certificate) => void) => void): this;
12439 off(event: 'select-client-certificate', listener: (event: Event,
12441 certificateList: Certificate[],
12442 callback: (certificate: Certificate) => void) => void): this;
12443 once(event: 'select-client-certificate', listener: (event: Event,
12445 certificateList: Certificate[],
12446 callback: (certificate: Certificate) => void) => void): this;
12447 addListener(event: 'select-client-certificate', listener: (event: Event,
12449 certificateList: Certificate[],
12450 callback: (certificate: Certificate) => void) => void): this;
12451 removeListener(event: 'select-client-certificate', listener: (event: Event,
12453 certificateList: Certificate[],
12454 callback: (certificate: Certificate) => void) => void): this;
12456 * Emitted when the web page becomes unresponsive.
12458 on(event: 'unresponsive', listener: Function): this;
12459 off(event: 'unresponsive', listener: Function): this;
12460 once(event: 'unresponsive', listener: Function): this;
12461 addListener(event: 'unresponsive', listener: Function): this;
12462 removeListener(event: 'unresponsive', listener: Function): this;
12464 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
12466 on(event: 'update-target-url', listener: (event: Event,
12467 url: string) => void): this;
12468 off(event: 'update-target-url', listener: (event: Event,
12469 url: string) => void): this;
12470 once(event: 'update-target-url', listener: (event: Event,
12471 url: string) => void): this;
12472 addListener(event: 'update-target-url', listener: (event: Event,
12473 url: string) => void): this;
12474 removeListener(event: 'update-target-url', listener: (event: Event,
12475 url: string) => void): this;
12477 * Emitted when a `<webview>`'s web contents is being attached to this web
12478 * contents. Calling `event.preventDefault()` will destroy the guest page.
12480 * This event can be used to configure `webPreferences` for the `webContents` of a
12481 * `<webview>` before it's loaded, and provides the ability to set settings that
12482 * can't be set via `<webview>` attributes.
12484 on(event: 'will-attach-webview', listener: (event: Event,
12486 * The web preferences that will be used by the guest page. This object can be
12487 * modified to adjust the preferences for the guest page.
12489 webPreferences: WebPreferences,
12491 * The other `<webview>` parameters such as the `src` URL. This object can be
12492 * modified to adjust the parameters of the guest page.
12494 params: Record<string, string>) => void): this;
12495 off(event: 'will-attach-webview', listener: (event: Event,
12497 * The web preferences that will be used by the guest page. This object can be
12498 * modified to adjust the preferences for the guest page.
12500 webPreferences: WebPreferences,
12502 * The other `<webview>` parameters such as the `src` URL. This object can be
12503 * modified to adjust the parameters of the guest page.
12505 params: Record<string, string>) => void): this;
12506 once(event: 'will-attach-webview', listener: (event: Event,
12508 * The web preferences that will be used by the guest page. This object can be
12509 * modified to adjust the preferences for the guest page.
12511 webPreferences: WebPreferences,
12513 * The other `<webview>` parameters such as the `src` URL. This object can be
12514 * modified to adjust the parameters of the guest page.
12516 params: Record<string, string>) => void): this;
12517 addListener(event: 'will-attach-webview', listener: (event: Event,
12519 * The web preferences that will be used by the guest page. This object can be
12520 * modified to adjust the preferences for the guest page.
12522 webPreferences: WebPreferences,
12524 * The other `<webview>` parameters such as the `src` URL. This object can be
12525 * modified to adjust the parameters of the guest page.
12527 params: Record<string, string>) => void): this;
12528 removeListener(event: 'will-attach-webview', listener: (event: Event,
12530 * The web preferences that will be used by the guest page. This object can be
12531 * modified to adjust the preferences for the guest page.
12533 webPreferences: WebPreferences,
12535 * The other `<webview>` parameters such as the `src` URL. This object can be
12536 * modified to adjust the parameters of the guest page.
12538 params: Record<string, string>) => void): this;
12540 * Emitted when a user or the page wants to start navigation in any frame. It can
12541 * happen when the `window.location` object is changed or a user clicks a link in
12544 * Unlike `will-navigate`, `will-frame-navigate` is fired when the main frame or
12545 * any of its subframes attempts to navigate. When the navigation event comes from
12546 * the main frame, `isMainFrame` will be `true`.
12548 * This event will not emit when the navigation is started programmatically with
12549 * APIs like `webContents.loadURL` and `webContents.back`.
12551 * It is also not emitted for in-page navigations, such as clicking anchor links or
12552 * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
12555 * Calling `event.preventDefault()` will prevent the navigation.
12557 on(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
12558 off(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
12559 once(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
12560 addListener(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
12561 removeListener(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
12563 * Emitted when a user or the page wants to start navigation on the main frame. It
12564 * can happen when the `window.location` object is changed or a user clicks a link
12567 * This event will not emit when the navigation is started programmatically with
12568 * APIs like `webContents.loadURL` and `webContents.back`.
12570 * It is also not emitted for in-page navigations, such as clicking anchor links or
12571 * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
12574 * Calling `event.preventDefault()` will prevent the navigation.
12576 on(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
12584 isInPlace: boolean,
12588 isMainFrame: boolean,
12592 frameProcessId: number,
12596 frameRoutingId: number) => void): this;
12597 off(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
12605 isInPlace: boolean,
12609 isMainFrame: boolean,
12613 frameProcessId: number,
12617 frameRoutingId: number) => void): this;
12618 once(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
12626 isInPlace: boolean,
12630 isMainFrame: boolean,
12634 frameProcessId: number,
12638 frameRoutingId: number) => void): this;
12639 addListener(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
12647 isInPlace: boolean,
12651 isMainFrame: boolean,
12655 frameProcessId: number,
12659 frameRoutingId: number) => void): this;
12660 removeListener(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
12668 isInPlace: boolean,
12672 isMainFrame: boolean,
12676 frameProcessId: number,
12680 frameRoutingId: number) => void): this;
12682 * Emitted when a `beforeunload` event handler is attempting to cancel a page
12685 * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
12686 * and allow the page to be unloaded.
12688 * **Note:** This will be emitted for `BrowserViews` but will _not_ be respected -
12689 * this is because we have chosen not to tie the `BrowserView` lifecycle to its
12690 * owning BrowserWindow should one exist per the specification.
12692 on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
12693 off(event: 'will-prevent-unload', listener: (event: Event) => void): this;
12694 once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
12695 addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
12696 removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
12698 * Emitted when a server side redirect occurs during navigation. For example a 302
12701 * This event will be emitted after `did-start-navigation` and always before the
12702 * `did-redirect-navigation` event for the same navigation.
12704 * Calling `event.preventDefault()` will prevent the navigation (not just the
12707 on(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
12715 isInPlace: boolean,
12719 isMainFrame: boolean,
12723 frameProcessId: number,
12727 frameRoutingId: number) => void): this;
12728 off(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
12736 isInPlace: boolean,
12740 isMainFrame: boolean,
12744 frameProcessId: number,
12748 frameRoutingId: number) => void): this;
12749 once(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
12757 isInPlace: boolean,
12761 isMainFrame: boolean,
12765 frameProcessId: number,
12769 frameRoutingId: number) => void): this;
12770 addListener(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
12778 isInPlace: boolean,
12782 isMainFrame: boolean,
12786 frameProcessId: number,
12790 frameRoutingId: number) => void): this;
12791 removeListener(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
12799 isInPlace: boolean,
12803 isMainFrame: boolean,
12807 frameProcessId: number,
12811 frameRoutingId: number) => void): this;
12813 * Emitted when the user is requesting to change the zoom level using the mouse
12816 on(event: 'zoom-changed', listener: (event: Event,
12818 * Can be `in` or `out`.
12820 zoomDirection: ('in' | 'out')) => void): this;
12821 off(event: 'zoom-changed', listener: (event: Event,
12823 * Can be `in` or `out`.
12825 zoomDirection: ('in' | 'out')) => void): this;
12826 once(event: 'zoom-changed', listener: (event: Event,
12828 * Can be `in` or `out`.
12830 zoomDirection: ('in' | 'out')) => void): this;
12831 addListener(event: 'zoom-changed', listener: (event: Event,
12833 * Can be `in` or `out`.
12835 zoomDirection: ('in' | 'out')) => void): this;
12836 removeListener(event: 'zoom-changed', listener: (event: Event,
12838 * Can be `in` or `out`.
12840 zoomDirection: ('in' | 'out')) => void): this;
12842 * Adds the specified path to DevTools workspace. Must be used after DevTools
12845 addWorkSpace(path: string): void;
12847 * Adjusts the current text selection starting and ending points in the focused
12848 * frame by the given amounts. A negative amount moves the selection towards the
12849 * beginning of the document, and a positive amount moves the selection towards the
12850 * end of the document.
12854 * For a call of `win.webContents.adjustSelection({ start: 1, end: 5 })`
12858 * <img width="487" alt="Image Before Text Selection Adjustment"
12859 * src="../images/web-contents-text-selection-before.png"/>
12863 * <img width="487" alt="Image After Text Selection Adjustment"
12864 * src="../images/web-contents-text-selection-after.png"/>
12866 adjustSelection(options: AdjustSelectionOptions): void;
12868 * Begin subscribing for presentation events and captured frames, the `callback`
12869 * will be called with `callback(image, dirtyRect)` when there is a presentation
12872 * The `image` is an instance of NativeImage that stores the captured frame.
12874 * The `dirtyRect` is an object with `x, y, width, height` properties that
12875 * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
12876 * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
12878 beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
12880 * Begin subscribing for presentation events and captured frames, the `callback`
12881 * will be called with `callback(image, dirtyRect)` when there is a presentation
12884 * The `image` is an instance of NativeImage that stores the captured frame.
12886 * The `dirtyRect` is an object with `x, y, width, height` properties that
12887 * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
12888 * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
12890 beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
12892 * Whether the browser can go back to previous web page.
12894 canGoBack(): boolean;
12896 * Whether the browser can go forward to next web page.
12898 canGoForward(): boolean;
12900 * Whether the web page can go to `offset`.
12902 canGoToOffset(offset: number): boolean;
12904 * Resolves with a NativeImage
12906 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
12907 * whole visible page. The page is considered visible when its browser window is
12908 * hidden and the capturer count is non-zero. If you would like the page to stay
12909 * hidden, you should ensure that `stayHidden` is set to true.
12911 capturePage(rect?: Rectangle, opts?: Opts): Promise<Electron.NativeImage>;
12913 * Centers the current text selection in web page.
12915 centerSelection(): void;
12917 * Clears the navigation history.
12919 clearHistory(): void;
12921 * Closes the page, as if the web content had called `window.close()`.
12923 * If the page is successfully closed (i.e. the unload is not prevented by the
12924 * page, or `waitForBeforeUnload` is false or unspecified), the WebContents will be
12925 * destroyed and no longer usable. The `destroyed` event will be emitted.
12927 close(opts?: CloseOpts): void;
12929 * Closes the devtools.
12931 closeDevTools(): void;
12933 * Executes the editing command `copy` in web page.
12937 * Copy the image at the given position to the clipboard.
12939 copyImageAt(x: number, y: number): void;
12941 * Executes the editing command `cut` in web page.
12945 * Executes the editing command `delete` in web page.
12949 * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
12951 disableDeviceEmulation(): void;
12953 * Initiates a download of the resource at `url` without navigating. The
12954 * `will-download` event of `session` will be triggered.
12956 downloadURL(url: string, options?: DownloadURLOptions): void;
12958 * Enable device emulation with the given parameters.
12960 enableDeviceEmulation(parameters: Parameters): void;
12962 * End subscribing for frame presentation events.
12964 endFrameSubscription(): void;
12966 * A promise that resolves with the result of the executed code or is rejected if
12967 * the result of the code is a rejected promise.
12969 * Evaluates `code` in page.
12971 * In the browser window some HTML APIs like `requestFullScreen` can only be
12972 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
12975 * Code execution will be suspended until web page stop loading.
12977 executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
12979 * A promise that resolves with the result of the executed code or is rejected if
12980 * the result of the code is a rejected promise.
12982 * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
12984 executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
12986 * The request id used for the request.
12988 * Starts a request to find all matches for the `text` in the web page. The result
12989 * of the request can be obtained by subscribing to `found-in-page` event.
12991 findInPage(text: string, options?: FindInPageOptions): number;
12993 * Focuses the web page.
12997 * Forcefully terminates the renderer process that is currently hosting this
12998 * `webContents`. This will cause the `render-process-gone` event to be emitted
12999 * with the `reason=killed || reason=crashed`. Please note that some webContents
13000 * share renderer processes and therefore calling this method may also crash the
13001 * host process for other webContents as well.
13003 * Calling `reload()` immediately after calling this method will force the reload
13004 * to occur in a new process. This should be used when this process is unstable or
13005 * unusable, for instance in order to recover from the `unresponsive` event.
13007 forcefullyCrashRenderer(): void;
13009 * Information about all Shared Workers.
13011 getAllSharedWorkers(): SharedWorkerInfo[];
13013 * whether or not this WebContents will throttle animations and timers when the
13014 * page becomes backgrounded. This also affects the Page Visibility API.
13016 getBackgroundThrottling(): boolean;
13018 * the current title of the DevTools window. This will only be visible if DevTools
13019 * is opened in `undocked` or `detach` mode.
13021 getDevToolsTitle(): string;
13023 * If _offscreen rendering_ is enabled returns the current frame rate.
13025 getFrameRate(): number;
13027 * The identifier of a WebContents stream. This identifier can be used with
13028 * `navigator.mediaDevices.getUserMedia` using a `chromeMediaSource` of `tab`. The
13029 * identifier is restricted to the web contents that it is registered to and is
13030 * only valid for 10 seconds.
13032 getMediaSourceId(requestWebContents: WebContents): string;
13034 * The operating system `pid` of the associated renderer process.
13036 getOSProcessId(): number;
13038 * Get the system printer list.
13040 * Resolves with a `PrinterInfo[]`
13042 getPrintersAsync(): Promise<Electron.PrinterInfo[]>;
13044 * The Chromium internal `pid` of the associated renderer. Can be compared to the
13045 * `frameProcessId` passed by frame specific navigation events (e.g.
13046 * `did-frame-navigate`)
13048 getProcessId(): number;
13050 * The title of the current web page.
13052 getTitle(): string;
13054 * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
13055 * `remote`, `webview` or `offscreen`.
13057 getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
13059 * The URL of the current web page.
13063 * The user agent for this web page.
13065 getUserAgent(): string;
13067 * Returns the WebRTC IP Handling Policy.
13069 getWebRTCIPHandlingPolicy(): string;
13071 * * `min` Integer - The minimum UDP port number that WebRTC should use.
13072 * * `max` Integer - The maximum UDP port number that WebRTC should use.
13074 * By default this value is `{ min: 0, max: 0 }` , which would apply no restriction
13075 * on the udp port range.
13077 getWebRTCUDPPortRange(): WebRTCUDPPortRange;
13079 * the current zoom factor.
13081 getZoomFactor(): number;
13083 * the current zoom level.
13085 getZoomLevel(): number;
13087 * Makes the browser go back a web page.
13091 * Makes the browser go forward a web page.
13095 * Navigates browser to the specified absolute web page index.
13097 goToIndex(index: number): void;
13099 * Navigates to the specified offset from the "current entry".
13101 goToOffset(offset: number): void;
13103 * A promise that resolves with a key for the inserted CSS that can later be used
13104 * to remove the CSS via `contents.removeInsertedCSS(key)`.
13106 * Injects CSS into the current web page and returns a unique key for the inserted
13109 insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
13111 * Inserts `text` to the focused element.
13113 insertText(text: string): Promise<void>;
13115 * Starts inspecting element at position (`x`, `y`).
13117 inspectElement(x: number, y: number): void;
13119 * Opens the developer tools for the service worker context.
13121 inspectServiceWorker(): void;
13123 * Opens the developer tools for the shared worker context.
13125 inspectSharedWorker(): void;
13127 * Inspects the shared worker based on its ID.
13129 inspectSharedWorkerById(workerId: string): void;
13131 * Schedules a full repaint of the window this web contents is in.
13133 * If _offscreen rendering_ is enabled invalidates the frame and generates a new
13134 * one through the `'paint'` event.
13136 invalidate(): void;
13138 * Whether this page has been muted.
13140 isAudioMuted(): boolean;
13142 * Whether this page is being captured. It returns true when the capturer count is
13145 isBeingCaptured(): boolean;
13147 * Whether the renderer process has crashed.
13149 isCrashed(): boolean;
13151 * Whether audio is currently playing.
13153 isCurrentlyAudible(): boolean;
13155 * Whether the web page is destroyed.
13157 isDestroyed(): boolean;
13159 * Whether the devtools view is focused .
13161 isDevToolsFocused(): boolean;
13163 * Whether the devtools is opened.
13165 isDevToolsOpened(): boolean;
13167 * Whether the web page is focused.
13169 isFocused(): boolean;
13171 * Whether web page is still loading resources.
13173 isLoading(): boolean;
13175 * Whether the main frame (and not just iframes or frames within it) is still
13178 isLoadingMainFrame(): boolean;
13180 * Indicates whether _offscreen rendering_ is enabled.
13182 isOffscreen(): boolean;
13184 * If _offscreen rendering_ is enabled returns whether it is currently painting.
13186 isPainting(): boolean;
13188 * Whether the web page is waiting for a first-response from the main resource of
13191 isWaitingForResponse(): boolean;
13193 * the promise will resolve when the page has finished loading (see
13194 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
13196 * Loads the given file in the window, `filePath` should be a path to an HTML file
13197 * relative to the root of your application. For instance an app structure like
13200 * Would require code like this
13202 loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
13204 * the promise will resolve when the page has finished loading (see
13205 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
13206 * A noop rejection handler is already attached, which avoids unhandled rejection
13209 * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
13210 * the `http://` or `file://`. If the load should bypass http cache then use the
13211 * `pragma` header to achieve it.
13213 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
13215 * Opens the devtools.
13217 * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
13218 * explicitly passing an empty `mode` can force using last used dock state.
13220 * On Windows, if Windows Control Overlay is enabled, Devtools will be opened with
13221 * `mode: 'detach'`.
13223 openDevTools(options?: OpenDevToolsOptions): void;
13225 * Executes the editing command `paste` in web page.
13229 * Executes the editing command `pasteAndMatchStyle` in web page.
13231 pasteAndMatchStyle(): void;
13233 * Send a message to the renderer process, optionally transferring ownership of
13234 * zero or more `MessagePortMain` objects.
13236 * The transferred `MessagePortMain` objects will be available in the renderer
13237 * process by accessing the `ports` property of the emitted event. When they arrive
13238 * in the renderer, they will be native DOM `MessagePort` objects.
13242 postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
13244 * When a custom `pageSize` is passed, Chromium attempts to validate platform
13245 * specific minimum values for `width_microns` and `height_microns`. Width and
13246 * height must both be minimum 353 microns but may be higher on some operating
13249 * Prints window's web page. When `silent` is set to `true`, Electron will pick the
13250 * system's default printer if `deviceName` is empty and the default settings for
13253 * Use `page-break-before: always;` CSS style to force to print to a new page.
13257 print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void;
13259 * Resolves with the generated PDF data.
13261 * Prints the window's web page as PDF.
13263 * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
13265 * An example of `webContents.printToPDF`:
13267 * See Page.printToPdf for more information.
13269 printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
13271 * Executes the editing command `redo` in web page.
13275 * Reloads the current web page.
13279 * Reloads current page and ignores cache.
13281 reloadIgnoringCache(): void;
13283 * Resolves if the removal was successful.
13285 * Removes the inserted CSS from the current web page. The stylesheet is identified
13286 * by its key, which is returned from `contents.insertCSS(css)`.
13288 removeInsertedCSS(key: string): Promise<void>;
13290 * Removes the specified path from DevTools workspace.
13292 removeWorkSpace(path: string): void;
13294 * Executes the editing command `replace` in web page.
13296 replace(text: string): void;
13298 * Executes the editing command `replaceMisspelling` in web page.
13300 replaceMisspelling(text: string): void;
13302 * resolves if the page is saved.
13304 savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
13306 * Scrolls to the bottom of the current `webContents`.
13308 scrollToBottom(): void;
13310 * Scrolls to the top of the current `webContents`.
13312 scrollToTop(): void;
13314 * Executes the editing command `selectAll` in web page.
13318 * Send an asynchronous message to the renderer process via `channel`, along with
13319 * arguments. Arguments will be serialized with the Structured Clone Algorithm,
13320 * just like `postMessage`, so prototype chains will not be included. Sending
13321 * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
13325 * Sending non-standard JavaScript types such as DOM objects or special Electron
13326 * objects will throw an exception.
13330 * For additional reading, refer to Electron's IPC guide.
13332 send(channel: string, ...args: any[]): void;
13334 * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
13335 * contents needs to be focused for `sendInputEvent()` to work.
13337 sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
13339 * Send an asynchronous message to a specific frame in a renderer process via
13340 * `channel`, along with arguments. Arguments will be serialized with the
13341 * Structured Clone Algorithm, just like `postMessage`, so prototype chains will
13342 * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
13343 * will throw an exception.
13345 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
13346 * Electron objects will throw an exception.
13348 * The renderer process can handle the message by listening to `channel` with the
13349 * `ipcRenderer` module.
13351 * If you want to get the `frameId` of a given renderer context you should use the
13352 * `webFrame.routingId` value. E.g.
13354 * You can also read `frameId` from all incoming IPC messages in the main process.
13356 sendToFrame(frameId: (number) | ([number, number]), channel: string, ...args: any[]): void;
13358 * Mute the audio on the current web page.
13360 setAudioMuted(muted: boolean): void;
13362 * Controls whether or not this WebContents will throttle animations and timers
13363 * when the page becomes backgrounded. This also affects the Page Visibility API.
13365 setBackgroundThrottling(allowed: boolean): void;
13367 * Changes the title of the DevTools window to `title`. This will only be visible
13368 * if DevTools is opened in `undocked` or `detach` mode.
13370 setDevToolsTitle(title: string): void;
13372 * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
13374 * The `devToolsWebContents` must not have done any navigation, and it should not
13375 * be used for other purposes after the call.
13377 * By default Electron manages the devtools by creating an internal `WebContents`
13378 * with native view, which developers have very limited control of. With the
13379 * `setDevToolsWebContents` method, developers can use any `WebContents` to show
13380 * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
13383 * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
13384 * caller's responsibility to destroy `devToolsWebContents`.
13386 * An example of showing devtools in a `<webview>` tag:
13388 * An example of showing devtools in a `BrowserWindow`:
13390 setDevToolsWebContents(devToolsWebContents: WebContents): void;
13392 * If _offscreen rendering_ is enabled sets the frame rate to the specified number.
13393 * Only values between 1 and 240 are accepted.
13395 setFrameRate(fps: number): void;
13397 * Ignore application menu shortcuts while this web contents is focused.
13399 setIgnoreMenuShortcuts(ignore: boolean): void;
13401 * Sets the image animation policy for this webContents. The policy only affects
13402 * _new_ images, existing images that are currently being animated are unaffected.
13403 * This is a known limitation in Chromium, you can force image animation to be
13404 * recalculated with `img.src = img.src` which will result in no network traffic
13405 * but will update the animation policy.
13407 * This corresponds to the animationPolicy accessibility feature in Chromium.
13409 setImageAnimationPolicy(policy: 'animate' | 'animateOnce' | 'noAnimation'): void;
13411 * Overrides the user agent for this web page.
13413 setUserAgent(userAgent: string): void;
13415 * Sets the maximum and minimum pinch-to-zoom level.
13417 * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
13420 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
13422 * Setting the WebRTC IP handling policy allows you to control which IPs are
13423 * exposed via WebRTC. See BrowserLeaks for more details.
13425 setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
13427 * Setting the WebRTC UDP Port Range allows you to restrict the udp port range used
13428 * by WebRTC. By default the port range is unrestricted. **Note:** To reset to an
13429 * unrestricted port range this value should be set to `{ min: 0, max: 0 }`.
13431 setWebRTCUDPPortRange(udpPortRange: UdpPortRange): void;
13433 * Called before creating a window a new window is requested by the renderer, e.g.
13434 * by `window.open()`, a link with `target="_blank"`, shift+clicking on a link, or
13435 * submitting a form with `<form target="_blank">`. See `window.open()` for more
13436 * details and how to use this in conjunction with `did-create-window`.
13438 setWindowOpenHandler(handler: (details: HandlerDetails) => ({action: 'deny'}) | ({action: 'allow', outlivesOpener?: boolean, overrideBrowserWindowOptions?: BrowserWindowConstructorOptions})): void;
13440 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
13441 * divided by 100, so 300% = 3.0.
13443 * The factor must be greater than 0.0.
13445 setZoomFactor(factor: number): void;
13447 * Changes the zoom level to the specified level. The original size is 0 and each
13448 * increment above or below represents zooming 20% larger or smaller to default
13449 * limits of 300% and 50% of original size, respectively. The formula for this is
13450 * `scale := 1.2 ^ level`.
13452 * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
13453 * the zoom level for a specific domain propagates across all instances of windows
13454 * with the same domain. Differentiating the window URLs will make zoom work
13457 setZoomLevel(level: number): void;
13459 * Shows pop-up dictionary that searches the selected word on the page.
13463 showDefinitionForSelection(): void;
13465 * Sets the `item` as dragging item for current drag-drop operation, `file` is the
13466 * absolute path of the file to be dragged, and `icon` is the image showing under
13467 * the cursor when dragging.
13469 startDrag(item: Item): void;
13471 * If _offscreen rendering_ is enabled and not painting, start painting.
13473 startPainting(): void;
13475 * Stops any pending navigation.
13479 * Stops any `findInPage` request for the `webContents` with the provided `action`.
13481 stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
13483 * If _offscreen rendering_ is enabled and painting, stop painting.
13485 stopPainting(): void;
13487 * Indicates whether the snapshot has been created successfully.
13489 * Takes a V8 heap snapshot and saves it to `filePath`.
13491 takeHeapSnapshot(filePath: string): Promise<void>;
13493 * Toggles the developer tools.
13495 toggleDevTools(): void;
13497 * Executes the editing command `undo` in web page.
13501 * Executes the editing command `unselect` in web page.
13505 * A `boolean` property that determines whether this page is muted.
13507 audioMuted: boolean;
13509 * A `boolean` property that determines whether or not this WebContents will
13510 * throttle animations and timers when the page becomes backgrounded. This also
13511 * affects the Page Visibility API.
13513 backgroundThrottling: boolean;
13515 * A `Debugger` instance for this webContents.
13518 readonly debugger: Debugger;
13520 * A `WebContents | null` property that represents the of DevTools `WebContents`
13521 * associated with a given `WebContents`.
13523 * **Note:** Users should never store this object because it may become `null` when
13524 * the DevTools has been closed.
13527 readonly devToolsWebContents: (WebContents) | (null);
13529 * An `Integer` property that sets the frame rate of the web contents to the
13530 * specified number. Only values between 1 and 240 are accepted.
13532 * Only applicable if _offscreen rendering_ is enabled.
13536 * A `WebContents` instance that might own this `WebContents`.
13539 readonly hostWebContents: WebContents;
13541 * A `Integer` representing the unique ID of this WebContents. Each ID is unique
13542 * among all `WebContents` instances of the entire Electron application.
13545 readonly id: number;
13547 * An `IpcMain` scoped to just IPC messages sent from this WebContents.
13549 * IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
13550 * `ipcRenderer.postMessage` will be delivered in the following order:
13552 * * `contents.on('ipc-message')`
13553 * * `contents.mainFrame.on(channel)`
13554 * * `contents.ipc.on(channel)`
13555 * * `ipcMain.on(channel)`
13557 * Handlers registered with `invoke` will be checked in the following order. The
13558 * first one that is defined will be called, the rest will be ignored.
13560 * * `contents.mainFrame.handle(channel)`
13561 * * `contents.handle(channel)`
13562 * * `ipcMain.handle(channel)`
13564 * A handler or event listener registered on the WebContents will receive IPC
13565 * messages sent from any frame, including child frames. In most cases, only the
13566 * main frame can send IPC messages. However, if the `nodeIntegrationInSubFrames`
13567 * option is enabled, it is possible for child frames to send IPC messages also. In
13568 * that case, handlers should check the `senderFrame` property of the IPC event to
13569 * ensure that the message is coming from the expected frame. Alternatively,
13570 * register handlers on the appropriate frame directly using the `WebFrameMain.ipc`
13574 readonly ipc: IpcMain;
13576 * A `WebFrameMain` property that represents the top frame of the page's frame
13580 readonly mainFrame: WebFrameMain;
13582 * A `WebFrameMain` property that represents the frame that opened this
13583 * WebContents, either with open(), or by navigating a link with a target
13587 readonly opener: WebFrameMain;
13589 * A `Session` used by this webContents.
13592 readonly session: Session;
13594 * A `string` property that determines the user agent for this web page.
13598 * A `number` property that determines the zoom factor for this web contents.
13600 * The zoom factor is the zoom percent divided by 100, so 300% = 3.0.
13602 zoomFactor: number;
13604 * A `number` property that determines the zoom level for this web contents.
13606 * The original size is 0 and each increment above or below represents zooming 20%
13607 * larger or smaller to default limits of 300% and 50% of original size,
13608 * respectively. The formula for this is `scale := 1.2 ^ level`.
13613 interface WebFrame {
13615 // Docs: https://electronjs.org/docs/api/web-frame
13618 * Attempts to free memory that is no longer being used (like images from a
13619 * previous navigation).
13621 * Note that blindly calling this method probably makes Electron slower since it
13622 * will have to refill these emptied caches, you should only call it if an event in
13623 * your app has occurred that makes you think your page is actually using less
13624 * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
13625 * and intend to stay there).
13627 clearCache(): void;
13629 * A promise that resolves with the result of the executed code or is rejected if
13630 * execution throws or results in a rejected promise.
13632 * Evaluates `code` in page.
13634 * In the browser window some HTML APIs like `requestFullScreen` can only be
13635 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
13638 executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
13640 * A promise that resolves with the result of the executed code or is rejected if
13641 * execution could not start.
13643 * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
13645 * Note that when the execution of script fails, the returned promise will not
13646 * reject and the `result` would be `undefined`. This is because Chromium does not
13647 * dispatch errors of isolated worlds to foreign worlds.
13649 executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
13651 * A child of `webFrame` with the supplied `name`, `null` would be returned if
13652 * there's no such frame or if the frame is not in the current renderer process.
13654 findFrameByName(name: string): WebFrame;
13656 * that has the supplied `routingId`, `null` if not found.
13658 findFrameByRoutingId(routingId: number): WebFrame;
13660 * The frame element in `webFrame's` document selected by `selector`, `null` would
13661 * be returned if `selector` does not select a frame or if the frame is not in the
13662 * current renderer process.
13664 getFrameForSelector(selector: string): WebFrame;
13666 * * `images` MemoryUsageDetails
13667 * * `scripts` MemoryUsageDetails
13668 * * `cssStyleSheets` MemoryUsageDetails
13669 * * `xslStyleSheets` MemoryUsageDetails
13670 * * `fonts` MemoryUsageDetails
13671 * * `other` MemoryUsageDetails
13673 * Returns an object describing usage information of Blink's internal memory
13676 * This will generate:
13678 getResourceUsage(): ResourceUsage;
13680 * A list of suggested words for a given word. If the word is spelled correctly,
13681 * the result will be empty.
13683 getWordSuggestions(word: string): string[];
13685 * The current zoom factor.
13687 getZoomFactor(): number;
13689 * The current zoom level.
13691 getZoomLevel(): number;
13693 * A key for the inserted CSS that can later be used to remove the CSS via
13694 * `webFrame.removeInsertedCSS(key)`.
13696 * Injects CSS into the current web page and returns a unique key for the inserted
13699 insertCSS(css: string, options?: InsertCSSOptions): string;
13701 * Inserts `text` to the focused element.
13703 insertText(text: string): void;
13705 * True if the word is misspelled according to the built in spellchecker, false
13706 * otherwise. If no dictionary is loaded, always return false.
13708 isWordMisspelled(word: string): boolean;
13710 * Removes the inserted CSS from the current web page. The stylesheet is identified
13711 * by its key, which is returned from `webFrame.insertCSS(css)`.
13713 removeInsertedCSS(key: string): void;
13715 * Set the security origin, content security policy and name of the isolated world.
13716 * Note: If the `csp` is specified, then the `securityOrigin` also has to be
13719 setIsolatedWorldInfo(worldId: number, info: Info): void;
13721 * Sets a provider for spell checking in input fields and text areas.
13723 * If you want to use this method you must disable the builtin spellchecker when
13724 * you construct the window.
13726 * The `provider` must be an object that has a `spellCheck` method that accepts an
13727 * array of individual words for spellchecking. The `spellCheck` function runs
13728 * asynchronously and calls the `callback` function with an array of misspelt words
13731 * An example of using node-spellchecker as provider:
13733 setSpellCheckProvider(language: string, provider: Provider): void;
13735 * Sets the maximum and minimum pinch-to-zoom level.
13737 * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
13740 * > **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom
13741 * shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem
13742 * roles in the application Menu. To disable shortcuts, manually define the Menu
13743 * and omit zoom roles from the definition.
13745 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
13747 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
13748 * divided by 100, so 300% = 3.0.
13750 * The factor must be greater than 0.0.
13752 setZoomFactor(factor: number): void;
13754 * Changes the zoom level to the specified level. The original size is 0 and each
13755 * increment above or below represents zooming 20% larger or smaller to default
13756 * limits of 300% and 50% of original size, respectively.
13758 * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
13759 * the zoom level for a specific domain propagates across all instances of windows
13760 * with the same domain. Differentiating the window URLs will make zoom work
13763 setZoomLevel(level: number): void;
13765 * A `WebFrame | null` representing the first child frame of `webFrame`, the
13766 * property would be `null` if `webFrame` has no children or if first child is not
13767 * in the current renderer process.
13770 readonly firstChild: (WebFrame) | (null);
13772 * A `WebFrame | null` representing next sibling frame, the property would be
13773 * `null` if `webFrame` is the last frame in its parent or if the next sibling is
13774 * not in the current renderer process.
13777 readonly nextSibling: (WebFrame) | (null);
13779 * A `WebFrame | null` representing the frame which opened `webFrame`, the property
13780 * would be `null` if there's no opener or opener is not in the current renderer
13784 readonly opener: (WebFrame) | (null);
13786 * A `WebFrame | null` representing parent frame of `webFrame`, the property would
13787 * be `null` if `webFrame` is top or parent is not in the current renderer process.
13790 readonly parent: (WebFrame) | (null);
13792 * An `Integer` representing the unique frame id in the current renderer process.
13793 * Distinct WebFrame instances that refer to the same underlying frame will have
13794 * the same `routingId`.
13797 readonly routingId: number;
13799 * A `WebFrame | null` representing top frame in frame hierarchy to which
13800 * `webFrame` belongs, the property would be `null` if top frame is not in the
13801 * current renderer process.
13804 readonly top: (WebFrame) | (null);
13807 class WebFrameMain extends NodeEventEmitter {
13809 // Docs: https://electronjs.org/docs/api/web-frame-main
13812 * A frame with the given process and routing IDs, or `undefined` if there is no
13813 * WebFrameMain associated with the given IDs.
13815 static fromId(processId: number, routingId: number): (WebFrameMain) | (undefined);
13817 * Emitted when the document is loaded.
13819 on(event: 'dom-ready', listener: Function): this;
13820 off(event: 'dom-ready', listener: Function): this;
13821 once(event: 'dom-ready', listener: Function): this;
13822 addListener(event: 'dom-ready', listener: Function): this;
13823 removeListener(event: 'dom-ready', listener: Function): this;
13825 * A promise that resolves with the result of the executed code or is rejected if
13826 * execution throws or results in a rejected promise.
13828 * Evaluates `code` in page.
13830 * In the browser window some HTML APIs like `requestFullScreen` can only be
13831 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
13834 executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>;
13836 * Send a message to the renderer process, optionally transferring ownership of
13837 * zero or more `MessagePortMain` objects.
13839 * The transferred `MessagePortMain` objects will be available in the renderer
13840 * process by accessing the `ports` property of the emitted event. When they arrive
13841 * in the renderer, they will be native DOM `MessagePort` objects.
13845 postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
13847 * Whether the reload was initiated successfully. Only results in `false` when the
13848 * frame has no history.
13852 * Send an asynchronous message to the renderer process via `channel`, along with
13853 * arguments. Arguments will be serialized with the Structured Clone Algorithm,
13854 * just like `postMessage`, so prototype chains will not be included. Sending
13855 * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
13857 * The renderer process can handle the message by listening to `channel` with the
13858 * `ipcRenderer` module.
13860 send(channel: string, ...args: any[]): void;
13862 * A `WebFrameMain[]` collection containing the direct descendents of `frame`.
13865 readonly frames: WebFrameMain[];
13867 * A `WebFrameMain[]` collection containing every frame in the subtree of `frame`,
13868 * including itself. This can be useful when traversing through all frames.
13871 readonly framesInSubtree: WebFrameMain[];
13873 * An `Integer` representing the id of the frame's internal FrameTreeNode instance.
13874 * This id is browser-global and uniquely identifies a frame that hosts content.
13875 * The identifier is fixed at the creation of the frame and stays constant for the
13876 * lifetime of the frame. When the frame is removed, the id is not used again.
13879 readonly frameTreeNodeId: number;
13881 * An `IpcMain` instance scoped to the frame.
13883 * IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
13884 * `ipcRenderer.postMessage` will be delivered in the following order:
13886 * * `contents.on('ipc-message')`
13887 * * `contents.mainFrame.on(channel)`
13888 * * `contents.ipc.on(channel)`
13889 * * `ipcMain.on(channel)`
13891 * Handlers registered with `invoke` will be checked in the following order. The
13892 * first one that is defined will be called, the rest will be ignored.
13894 * * `contents.mainFrame.handle(channel)`
13895 * * `contents.handle(channel)`
13896 * * `ipcMain.handle(channel)`
13898 * In most cases, only the main frame of a WebContents can send or receive IPC
13899 * messages. However, if the `nodeIntegrationInSubFrames` option is enabled, it is
13900 * possible for child frames to send and receive IPC messages also. The
13901 * `WebContents.ipc` interface may be more convenient when
13902 * `nodeIntegrationInSubFrames` is not enabled.
13905 readonly ipc: IpcMain;
13907 * A `string` representing the frame name.
13910 readonly name: string;
13912 * A `string` representing the current origin of the frame, serialized according to
13913 * RFC 6454. This may be different from the URL. For instance, if the frame is a
13914 * child window opened to `about:blank`, then `frame.origin` will return the parent
13915 * frame's origin, while `frame.url` will return the empty string. Pages without a
13916 * scheme/host/port triple origin will have the serialized origin of `"null"` (that
13917 * is, the string containing the letters n, u, l, l).
13920 readonly origin: string;
13922 * An `Integer` representing the operating system `pid` of the process which owns
13926 readonly osProcessId: number;
13928 * A `WebFrameMain | null` representing parent frame of `frame`, the property would
13929 * be `null` if `frame` is the top frame in the frame hierarchy.
13932 readonly parent: (WebFrameMain) | (null);
13934 * An `Integer` representing the Chromium internal `pid` of the process which owns
13935 * this frame. This is not the same as the OS process ID; to read that use
13936 * `frame.osProcessId`.
13939 readonly processId: number;
13941 * An `Integer` representing the unique frame id in the current renderer process.
13942 * Distinct `WebFrameMain` instances that refer to the same underlying frame will
13943 * have the same `routingId`.
13946 readonly routingId: number;
13948 * A `WebFrameMain | null` representing top frame in the frame hierarchy to which
13952 readonly top: (WebFrameMain) | (null);
13954 * A `string` representing the current URL of the frame.
13957 readonly url: string;
13959 * A `string` representing the visibility state of the frame.
13961 * See also how the Page Visibility API is affected by other Electron APIs.
13964 readonly visibilityState: string;
13967 interface WebPreferences {
13969 // Docs: https://electronjs.org/docs/api/structures/web-preferences
13972 * An alternative title string provided only to accessibility tools such as screen
13973 * readers. This string is not directly visible to users.
13975 accessibleTitle?: string;
13977 * A list of strings that will be appended to `process.argv` in the renderer
13978 * process of this app. Useful for passing small bits of data down to renderer
13979 * process preload scripts.
13981 additionalArguments?: string[];
13983 * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
13986 allowRunningInsecureContent?: boolean;
13988 * Autoplay policy to apply to content in the window, can be
13989 * `no-user-gesture-required`, `user-gesture-required`,
13990 * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
13992 autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
13994 * Whether to throttle animations and timers when the page becomes background. This
13995 * also affects the Page Visibility API. When at least one webContents displayed in
13996 * a single browserWindow has disabled `backgroundThrottling` then frames will be
13997 * drawn and swapped for the whole window and other webContents displayed by it.
13998 * Defaults to `true`.
14000 backgroundThrottling?: boolean;
14002 * Whether to run Electron APIs and the specified `preload` script in a separate
14003 * JavaScript context. Defaults to `true`. The context that the `preload` script
14004 * runs in will only have access to its own dedicated `document` and `window`
14005 * globals, as well as its own set of JavaScript builtins (`Array`, `Object`,
14006 * `JSON`, etc.), which are all invisible to the loaded content. The Electron API
14007 * will only be available in the `preload` script and not the loaded page. This
14008 * option should be used when loading potentially untrusted remote content to
14009 * ensure the loaded content cannot tamper with the `preload` script and any
14010 * Electron APIs being used. This option uses the same technique used by Chrome
14011 * Content Scripts. You can access this context in the dev tools by selecting the
14012 * 'Electron Isolated Context' entry in the combo box at the top of the Console
14015 contextIsolation?: boolean;
14017 * Defaults to `ISO-8859-1`.
14019 defaultEncoding?: string;
14021 * Sets the default font for the font-family.
14023 defaultFontFamily?: DefaultFontFamily;
14025 * Defaults to `16`.
14027 defaultFontSize?: number;
14029 * Defaults to `13`.
14031 defaultMonospaceFontSize?: number;
14033 * Whether to enable DevTools. If it is set to `false`, can not use
14034 * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
14036 devTools?: boolean;
14038 * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
14039 * to disable. The full list of supported feature strings can be found in the
14040 * RuntimeEnabledFeatures.json5 file.
14042 disableBlinkFeatures?: string;
14044 * Whether to disable dialogs completely. Overrides `safeDialogs`. Default is
14047 disableDialogs?: boolean;
14049 * Whether to prevent the window from resizing when entering HTML Fullscreen.
14050 * Default is `false`.
14052 disableHtmlFullscreenWindowResize?: boolean;
14054 * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
14055 * to enable. The full list of supported feature strings can be found in the
14056 * RuntimeEnabledFeatures.json5 file.
14058 enableBlinkFeatures?: string;
14060 * Whether to enable preferred size mode. The preferred size is the minimum size
14061 * needed to contain the layout of the document—without requiring scrolling.
14062 * Enabling this will cause the `preferred-size-changed` event to be emitted on the
14063 * `WebContents` when the preferred size changes. Default is `false`.
14065 enablePreferredSizeMode?: boolean;
14067 * Whether to enable the WebSQL api. Default is `true`.
14069 enableWebSQL?: boolean;
14071 * Enables Chromium's experimental features. Default is `false`.
14073 experimentalFeatures?: boolean;
14075 * Specifies how to run image animations (E.g. GIFs). Can be `animate`,
14076 * `animateOnce` or `noAnimation`. Default is `animate`.
14078 imageAnimationPolicy?: ('animate' | 'animateOnce' | 'noAnimation');
14080 * Enables image support. Default is `true`.
14084 * Enables JavaScript support. Default is `true`.
14086 javascript?: boolean;
14090 minimumFontSize?: number;
14092 * Whether dragging and dropping a file or link onto the page causes a navigation.
14093 * Default is `false`.
14095 navigateOnDragDrop?: boolean;
14097 * Whether node integration is enabled. Default is `false`.
14099 nodeIntegration?: boolean;
14101 * Experimental option for enabling Node.js support in sub-frames such as iframes
14102 * and child windows. All your preloads will load for every iframe, you can use
14103 * `process.isMainFrame` to determine if you are in the main frame or not.
14105 nodeIntegrationInSubFrames?: boolean;
14107 * Whether node integration is enabled in web workers. Default is `false`. More
14108 * about this can be found in Multithreading.
14110 nodeIntegrationInWorker?: boolean;
14112 * Whether to enable offscreen rendering for the browser window. Defaults to
14113 * `false`. See the offscreen rendering tutorial for more details.
14115 offscreen?: boolean;
14117 * Sets the session used by the page according to the session's partition string.
14118 * If `partition` starts with `persist:`, the page will use a persistent session
14119 * available to all pages in the app with the same `partition`. If there is no
14120 * `persist:` prefix, the page will use an in-memory session. By assigning the same
14121 * `partition`, multiple pages can share the same session. Default is the default
14124 partition?: string;
14126 * Whether plugins should be enabled. Default is `false`.
14130 * Specifies a script that will be loaded before other scripts run in the page.
14131 * This script will always have access to node APIs no matter whether node
14132 * integration is turned on or off. The value should be the absolute file path to
14133 * the script. When node integration is turned off, the preload script can
14134 * reintroduce Node global symbols back to the global scope. See example here.
14138 * Whether to enable browser style consecutive dialog protection. Default is
14141 safeDialogs?: boolean;
14143 * The message to display when consecutive dialog protection is triggered. If not
14144 * defined the default message would be used, note that currently the default
14145 * message is in English and not localized.
14147 safeDialogsMessage?: string;
14149 * If set, this will sandbox the renderer associated with the window, making it
14150 * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
14151 * This is not the same as the `nodeIntegration` option and the APIs available to
14152 * the preload script are more limited. Read more about the option here.
14156 * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
14160 scrollBounce?: boolean;
14162 * Sets the session used by the page. Instead of passing the Session object
14163 * directly, you can also choose to use the `partition` option instead, which
14164 * accepts a partition string. When both `session` and `partition` are provided,
14165 * `session` will be preferred. Default is the default session.
14169 * Whether to enable the builtin spellchecker. Default is `true`.
14171 spellcheck?: boolean;
14173 * Make TextArea elements resizable. Default is `true`.
14175 textAreasAreResizable?: boolean;
14177 * Enforces the v8 code caching policy used by blink. Accepted values are
14179 v8CacheOptions?: ('none' | 'code' | 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile');
14181 * Enables WebGL support. Default is `true`.
14185 * When `false`, it will disable the same-origin policy (usually using testing
14186 * websites by people), and set `allowRunningInsecureContent` to `true` if this
14187 * options has not been set by user. Default is `true`.
14189 webSecurity?: boolean;
14191 * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
14192 * `preload` script configured for the `<webview>` will have node integration
14193 * enabled when it is executed so you should ensure remote/untrusted content is not
14194 * able to create a `<webview>` tag with a possibly malicious `preload` script. You
14195 * can use the `will-attach-webview` event on webContents to strip away the
14196 * `preload` script and to validate or alter the `<webview>`'s initial settings.
14198 webviewTag?: boolean;
14200 * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
14202 zoomFactor?: number;
14207 // Docs: https://electronjs.org/docs/api/web-request
14210 * The `listener` will be called with `listener(details)` when a server initiated
14211 * redirect is about to occur.
14213 onBeforeRedirect(filter: WebRequestFilter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
14215 * The `listener` will be called with `listener(details)` when a server initiated
14216 * redirect is about to occur.
14218 onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
14220 * The `listener` will be called with `listener(details, callback)` when a request
14221 * is about to occur.
14223 * The `uploadData` is an array of `UploadData` objects.
14225 * The `callback` has to be called with an `response` object.
14227 * Some examples of valid `urls`:
14229 onBeforeRequest(filter: WebRequestFilter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) => void) => void) | (null)): void;
14231 * The `listener` will be called with `listener(details, callback)` when a request
14232 * is about to occur.
14234 * The `uploadData` is an array of `UploadData` objects.
14236 * The `callback` has to be called with an `response` object.
14238 * Some examples of valid `urls`:
14240 onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) => void) => void) | (null)): void;
14242 * The `listener` will be called with `listener(details, callback)` before sending
14243 * an HTTP request, once the request headers are available. This may occur after a
14244 * TCP connection is made to the server, but before any http data is sent.
14246 * The `callback` has to be called with a `response` object.
14248 onBeforeSendHeaders(filter: WebRequestFilter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
14250 * The `listener` will be called with `listener(details, callback)` before sending
14251 * an HTTP request, once the request headers are available. This may occur after a
14252 * TCP connection is made to the server, but before any http data is sent.
14254 * The `callback` has to be called with a `response` object.
14256 onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
14258 * The `listener` will be called with `listener(details)` when a request is
14261 onCompleted(filter: WebRequestFilter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
14263 * The `listener` will be called with `listener(details)` when a request is
14266 onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
14268 * The `listener` will be called with `listener(details)` when an error occurs.
14270 onErrorOccurred(filter: WebRequestFilter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
14272 * The `listener` will be called with `listener(details)` when an error occurs.
14274 onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
14276 * The `listener` will be called with `listener(details, callback)` when HTTP
14277 * response headers of a request have been received.
14279 * The `callback` has to be called with a `response` object.
14281 onHeadersReceived(filter: WebRequestFilter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
14283 * The `listener` will be called with `listener(details, callback)` when HTTP
14284 * response headers of a request have been received.
14286 * The `callback` has to be called with a `response` object.
14288 onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
14290 * The `listener` will be called with `listener(details)` when first byte of the
14291 * response body is received. For HTTP requests, this means that the status line
14292 * and response headers are available.
14294 onResponseStarted(filter: WebRequestFilter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
14296 * The `listener` will be called with `listener(details)` when first byte of the
14297 * response body is received. For HTTP requests, this means that the status line
14298 * and response headers are available.
14300 onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
14302 * The `listener` will be called with `listener(details)` just before a request is
14303 * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
14304 * response are visible by the time this listener is fired.
14306 onSendHeaders(filter: WebRequestFilter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
14308 * The `listener` will be called with `listener(details)` just before a request is
14309 * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
14310 * response are visible by the time this listener is fired.
14312 onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
14315 interface WebRequestFilter {
14317 // Docs: https://electronjs.org/docs/api/structures/web-request-filter
14320 * Array of types that will be used to filter out the requests that do not match
14321 * the types. When not specified, all types will be matched. Can be `mainFrame`,
14322 * `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`,
14323 * `cspReport`, `media` or `webSocket`.
14325 types?: Array<'mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket'>;
14327 * Array of URL patterns that will be used to filter out the requests that do not
14328 * match the URL patterns.
14333 interface WebSource {
14335 // Docs: https://electronjs.org/docs/api/structures/web-source
14341 interface WebviewTag extends HTMLElement {
14343 // Docs: https://electronjs.org/docs/api/webview-tag
14346 * Fired when a load has committed. This includes navigation within the current
14347 * document as well as subframe document-level loads, but does not include
14348 * asynchronous resource loads.
14350 addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
14351 removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
14353 * Fired when the navigation is done, i.e. the spinner of the tab will stop
14354 * spinning, and the `onload` event is dispatched.
14356 addEventListener(event: 'did-finish-load', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14357 removeEventListener(event: 'did-finish-load', listener: (event: DOMEvent) => void): this;
14359 * This event is like `did-finish-load`, but fired when the load failed or was
14360 * cancelled, e.g. `window.stop()` is invoked.
14362 addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
14363 removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
14365 * Fired when a frame has done navigation.
14367 addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
14368 removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
14370 * Corresponds to the points in time when the spinner of the tab starts spinning.
14372 addEventListener(event: 'did-start-loading', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14373 removeEventListener(event: 'did-start-loading', listener: (event: DOMEvent) => void): this;
14375 * Corresponds to the points in time when the spinner of the tab stops spinning.
14377 addEventListener(event: 'did-stop-loading', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14378 removeEventListener(event: 'did-stop-loading', listener: (event: DOMEvent) => void): this;
14380 * Fired when attached to the embedder web contents.
14382 addEventListener(event: 'did-attach', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14383 removeEventListener(event: 'did-attach', listener: (event: DOMEvent) => void): this;
14385 * Fired when document in the given frame is loaded.
14387 addEventListener(event: 'dom-ready', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14388 removeEventListener(event: 'dom-ready', listener: (event: DOMEvent) => void): this;
14390 * Fired when page title is set during navigation. `explicitSet` is false when
14391 * title is synthesized from file url.
14393 addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
14394 removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
14396 * Fired when page receives favicon urls.
14398 addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
14399 removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
14401 * Fired when page enters fullscreen triggered by HTML API.
14403 addEventListener(event: 'enter-html-full-screen', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14404 removeEventListener(event: 'enter-html-full-screen', listener: (event: DOMEvent) => void): this;
14406 * Fired when page leaves fullscreen triggered by HTML API.
14408 addEventListener(event: 'leave-html-full-screen', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14409 removeEventListener(event: 'leave-html-full-screen', listener: (event: DOMEvent) => void): this;
14411 * Fired when the guest window logs a console message.
14413 * The following example code forwards all log messages to the embedder's console
14414 * without regard for log level or other properties.
14416 addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
14417 removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
14419 * Fired when a result is available for `webview.findInPage` request.
14421 addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
14422 removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
14424 * Emitted when a user or the page wants to start navigation. It can happen when
14425 * the `window.location` object is changed or a user clicks a link in the page.
14427 * This event will not emit when the navigation is started programmatically with
14428 * APIs like `<webview>.loadURL` and `<webview>.back`.
14430 * It is also not emitted during in-page navigation, such as clicking anchor links
14431 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
14434 * Calling `event.preventDefault()` does **NOT** have any effect.
14436 addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
14437 removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
14439 * Emitted when a user or the page wants to start navigation anywhere in the
14440 * `<webview>` or any frames embedded within. It can happen when the
14441 * `window.location` object is changed or a user clicks a link in the page.
14443 * This event will not emit when the navigation is started programmatically with
14444 * APIs like `<webview>.loadURL` and `<webview>.back`.
14446 * It is also not emitted during in-page navigation, such as clicking anchor links
14447 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
14450 * Calling `event.preventDefault()` does **NOT** have any effect.
14452 addEventListener(event: 'will-frame-navigate', listener: (event: WillFrameNavigateEvent) => void, useCapture?: boolean): this;
14453 removeEventListener(event: 'will-frame-navigate', listener: (event: WillFrameNavigateEvent) => void): this;
14455 * Emitted when any frame (including main) starts navigating. `isInPlace` will be
14456 * `true` for in-page navigations.
14458 addEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void, useCapture?: boolean): this;
14459 removeEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void): this;
14461 * Emitted after a server side redirect occurs during navigation. For example a 302
14464 addEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void, useCapture?: boolean): this;
14465 removeEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void): this;
14467 * Emitted when a navigation is done.
14469 * This event is not emitted for in-page navigations, such as clicking anchor links
14470 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
14473 addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
14474 removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
14476 * Emitted when any frame navigation is done.
14478 * This event is not emitted for in-page navigations, such as clicking anchor links
14479 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
14482 addEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void, useCapture?: boolean): this;
14483 removeEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void): this;
14485 * Emitted when an in-page navigation happened.
14487 * When in-page navigation happens, the page URL changes but does not cause
14488 * navigation outside of the page. Examples of this occurring are when anchor links
14489 * are clicked or when the DOM `hashchange` event is triggered.
14491 addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
14492 removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
14494 * Fired when the guest page attempts to close itself.
14496 * The following example code navigates the `webview` to `about:blank` when the
14497 * guest attempts to close itself.
14499 addEventListener(event: 'close', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14500 removeEventListener(event: 'close', listener: (event: DOMEvent) => void): this;
14502 * Fired when the guest page has sent an asynchronous message to embedder page.
14504 * With `sendToHost` method and `ipc-message` event you can communicate between
14505 * guest page and embedder page:
14507 addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
14508 removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
14510 * Fired when the renderer process crashes or is killed.
14512 * **Deprecated:** This event is superceded by the `render-process-gone` event
14513 * which contains more information about why the render process disappeared. It
14514 * isn't always because it crashed.
14518 addEventListener(event: 'crashed', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14519 removeEventListener(event: 'crashed', listener: (event: DOMEvent) => void): this;
14521 * Fired when the renderer process unexpectedly disappears. This is normally
14522 * because it was crashed or killed.
14524 addEventListener(event: 'render-process-gone', listener: (event: RenderProcessGoneEvent) => void, useCapture?: boolean): this;
14525 removeEventListener(event: 'render-process-gone', listener: (event: RenderProcessGoneEvent) => void): this;
14527 * Fired when a plugin process is crashed.
14529 addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
14530 removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
14532 * Fired when the WebContents is destroyed.
14534 addEventListener(event: 'destroyed', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14535 removeEventListener(event: 'destroyed', listener: (event: DOMEvent) => void): this;
14537 * Emitted when media starts playing.
14539 addEventListener(event: 'media-started-playing', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14540 removeEventListener(event: 'media-started-playing', listener: (event: DOMEvent) => void): this;
14542 * Emitted when media is paused or done playing.
14544 addEventListener(event: 'media-paused', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14545 removeEventListener(event: 'media-paused', listener: (event: DOMEvent) => void): this;
14547 * Emitted when a page's theme color changes. This is usually due to encountering a
14550 addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
14551 removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
14553 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
14555 addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
14556 removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
14558 * Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for
14559 * a link in its context menu.
14561 addEventListener(event: 'devtools-open-url', listener: (event: DevtoolsOpenUrlEvent) => void, useCapture?: boolean): this;
14562 removeEventListener(event: 'devtools-open-url', listener: (event: DevtoolsOpenUrlEvent) => void): this;
14564 * Emitted when DevTools is opened.
14566 addEventListener(event: 'devtools-opened', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14567 removeEventListener(event: 'devtools-opened', listener: (event: DOMEvent) => void): this;
14569 * Emitted when DevTools is closed.
14571 addEventListener(event: 'devtools-closed', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14572 removeEventListener(event: 'devtools-closed', listener: (event: DOMEvent) => void): this;
14574 * Emitted when DevTools is focused / opened.
14576 addEventListener(event: 'devtools-focused', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
14577 removeEventListener(event: 'devtools-focused', listener: (event: DOMEvent) => void): this;
14579 * Emitted when there is a new context menu that needs to be handled.
14581 addEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void, useCapture?: boolean): this;
14582 removeEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void): this;
14583 addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
14584 addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
14585 removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
14586 removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
14588 * Adjusts the current text selection starting and ending points in the focused
14589 * frame by the given amounts. A negative amount moves the selection towards the
14590 * beginning of the document, and a positive amount moves the selection towards the
14591 * end of the document.
14593 * See `webContents.adjustSelection` for examples.
14595 adjustSelection(options: AdjustSelectionOptions): void;
14597 * Whether the guest page can go back.
14599 canGoBack(): boolean;
14601 * Whether the guest page can go forward.
14603 canGoForward(): boolean;
14605 * Whether the guest page can go to `offset`.
14607 canGoToOffset(offset: number): boolean;
14609 * Resolves with a NativeImage
14611 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
14612 * whole visible page.
14614 capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
14616 * Centers the current text selection in page.
14618 centerSelection(): void;
14620 * Clears the navigation history.
14622 clearHistory(): void;
14624 * Closes the DevTools window of guest page.
14626 closeDevTools(): void;
14628 * Executes editing command `copy` in page.
14632 * Executes editing command `cut` in page.
14636 * Executes editing command `delete` in page.
14640 * Initiates a download of the resource at `url` without navigating.
14642 downloadURL(url: string, options?: DownloadURLOptions): void;
14644 * A promise that resolves with the result of the executed code or is rejected if
14645 * the result of the code is a rejected promise.
14647 * Evaluates `code` in page. If `userGesture` is set, it will create the user
14648 * gesture context in the page. HTML APIs like `requestFullScreen`, which require
14649 * user action, can take advantage of this option for automation.
14651 executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
14653 * The request id used for the request.
14655 * Starts a request to find all matches for the `text` in the web page. The result
14656 * of the request can be obtained by subscribing to `found-in-page` event.
14658 findInPage(text: string, options?: FindInPageOptions): number;
14660 * The title of guest page.
14662 getTitle(): string;
14664 * The URL of guest page.
14668 * The user agent for guest page.
14670 getUserAgent(): string;
14672 * The WebContents ID of this `webview`.
14674 getWebContentsId(): number;
14676 * the current zoom factor.
14678 getZoomFactor(): number;
14680 * the current zoom level.
14682 getZoomLevel(): number;
14684 * Makes the guest page go back.
14688 * Makes the guest page go forward.
14692 * Navigates to the specified absolute index.
14694 goToIndex(index: number): void;
14696 * Navigates to the specified offset from the "current entry".
14698 goToOffset(offset: number): void;
14700 * A promise that resolves with a key for the inserted CSS that can later be used
14701 * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
14703 * Injects CSS into the current web page and returns a unique key for the inserted
14706 insertCSS(css: string): Promise<string>;
14708 * Inserts `text` to the focused element.
14710 insertText(text: string): Promise<void>;
14712 * Starts inspecting element at position (`x`, `y`) of guest page.
14714 inspectElement(x: number, y: number): void;
14716 * Opens the DevTools for the service worker context present in the guest page.
14718 inspectServiceWorker(): void;
14720 * Opens the DevTools for the shared worker context present in the guest page.
14722 inspectSharedWorker(): void;
14724 * Whether guest page has been muted.
14726 isAudioMuted(): boolean;
14728 * Whether the renderer process has crashed.
14730 isCrashed(): boolean;
14732 * Whether audio is currently playing.
14734 isCurrentlyAudible(): boolean;
14736 * Whether DevTools window of guest page is focused.
14738 isDevToolsFocused(): boolean;
14740 * Whether guest page has a DevTools window attached.
14742 isDevToolsOpened(): boolean;
14744 * Whether guest page is still loading resources.
14746 isLoading(): boolean;
14748 * Whether the main frame (and not just iframes or frames within it) is still
14751 isLoadingMainFrame(): boolean;
14753 * Whether the guest page is waiting for a first-response for the main resource of
14756 isWaitingForResponse(): boolean;
14758 * The promise will resolve when the page has finished loading (see
14759 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
14761 * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
14762 * the `http://` or `file://`.
14764 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
14766 * Opens a DevTools window for guest page.
14768 openDevTools(): void;
14770 * Executes editing command `paste` in page.
14774 * Executes editing command `pasteAndMatchStyle` in page.
14776 pasteAndMatchStyle(): void;
14778 * Prints `webview`'s web page. Same as `webContents.print([options])`.
14780 print(options?: WebviewTagPrintOptions): Promise<void>;
14782 * Resolves with the generated PDF data.
14784 * Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
14786 printToPDF(options: PrintToPDFOptions): Promise<Uint8Array>;
14788 * Executes editing command `redo` in page.
14792 * Reloads the guest page.
14796 * Reloads the guest page and ignores cache.
14798 reloadIgnoringCache(): void;
14800 * Resolves if the removal was successful.
14802 * Removes the inserted CSS from the current web page. The stylesheet is identified
14803 * by its key, which is returned from `<webview>.insertCSS(css)`.
14805 removeInsertedCSS(key: string): Promise<void>;
14807 * Executes editing command `replace` in page.
14809 replace(text: string): void;
14811 * Executes editing command `replaceMisspelling` in page.
14813 replaceMisspelling(text: string): void;
14815 * Scrolls to the bottom of the current `<webview>`.
14817 scrollToBottom(): void;
14819 * Scrolls to the top of the current `<webview>`.
14821 scrollToTop(): void;
14823 * Executes editing command `selectAll` in page.
14827 * Send an asynchronous message to renderer process via `channel`, you can also
14828 * send arbitrary arguments. The renderer process can handle the message by
14829 * listening to the `channel` event with the `ipcRenderer` module.
14831 * See webContents.send for examples.
14833 send(channel: string, ...args: any[]): Promise<void>;
14835 * Sends an input `event` to the page.
14837 * See webContents.sendInputEvent for detailed description of `event` object.
14839 sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
14841 * Send an asynchronous message to renderer process via `channel`, you can also
14842 * send arbitrary arguments. The renderer process can handle the message by
14843 * listening to the `channel` event with the `ipcRenderer` module.
14845 * See webContents.sendToFrame for examples.
14847 sendToFrame(frameId: [number, number], channel: string, ...args: any[]): Promise<void>;
14849 * Set guest page muted.
14851 setAudioMuted(muted: boolean): void;
14853 * Overrides the user agent for the guest page.
14855 setUserAgent(userAgent: string): void;
14857 * Sets the maximum and minimum pinch-to-zoom level.
14859 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
14861 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
14862 * divided by 100, so 300% = 3.0.
14864 setZoomFactor(factor: number): void;
14866 * Changes the zoom level to the specified level. The original size is 0 and each
14867 * increment above or below represents zooming 20% larger or smaller to default
14868 * limits of 300% and 50% of original size, respectively. The formula for this is
14869 * `scale := 1.2 ^ level`.
14871 * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
14872 * the zoom level for a specific domain propagates across all instances of windows
14873 * with the same domain. Differentiating the window URLs will make zoom work
14876 setZoomLevel(level: number): void;
14878 * Shows pop-up dictionary that searches the selected word on the page.
14882 showDefinitionForSelection(): void;
14884 * Stops any pending navigation.
14888 * Stops any `findInPage` request for the `webview` with the provided `action`.
14890 stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
14892 * Executes editing command `undo` in page.
14896 * Executes editing command `unselect` in page.
14900 * A `boolean`. When this attribute is present the guest page will be allowed to
14901 * open new windows. Popups are disabled by default.
14903 allowpopups: boolean;
14905 * A `string` which is a list of strings which specifies the blink features to be
14906 * disabled separated by `,`. The full list of supported feature strings can be
14907 * found in the RuntimeEnabledFeatures.json5 file.
14909 disableblinkfeatures: string;
14911 * A `boolean`. When this attribute is present the guest page will have web
14912 * security disabled. Web security is enabled by default.
14914 * This value can only be modified before the first navigation.
14916 disablewebsecurity: boolean;
14918 * A `string` which is a list of strings which specifies the blink features to be
14919 * enabled separated by `,`. The full list of supported feature strings can be
14920 * found in the RuntimeEnabledFeatures.json5 file.
14922 enableblinkfeatures: string;
14924 * A `string` that sets the referrer URL for the guest page.
14926 httpreferrer: string;
14928 * A `boolean`. When this attribute is present the guest page in `webview` will
14929 * have node integration and can use node APIs like `require` and `process` to
14930 * access low level system resources. Node integration is disabled by default in
14933 nodeintegration: boolean;
14935 * A `boolean` for the experimental option for enabling NodeJS support in
14936 * sub-frames such as iframes inside the `webview`. All your preloads will load for
14937 * every iframe, you can use `process.isMainFrame` to determine if you are in the
14938 * main frame or not. This option is disabled by default in the guest page.
14940 nodeintegrationinsubframes: boolean;
14942 * A `string` that sets the session used by the page. If `partition` starts with
14943 * `persist:`, the page will use a persistent session available to all pages in the
14944 * app with the same `partition`. if there is no `persist:` prefix, the page will
14945 * use an in-memory session. By assigning the same `partition`, multiple pages can
14946 * share the same session. If the `partition` is unset then default session of the
14947 * app will be used.
14949 * This value can only be modified before the first navigation, since the session
14950 * of an active renderer process cannot change. Subsequent attempts to modify the
14951 * value will fail with a DOM exception.
14955 * A `boolean`. When this attribute is present the guest page in `webview` will be
14956 * able to use browser plugins. Plugins are disabled by default.
14960 * A `string` that specifies a script that will be loaded before other scripts run
14961 * in the guest page. The protocol of script's URL must be `file:` (even when using
14962 * `asar:` archives) because it will be loaded by Node's `require` under the hood,
14963 * which treats `asar:` archives as virtual directories.
14965 * When the guest page doesn't have node integration this script will still have
14966 * access to all Node APIs, but global objects injected by Node will be deleted
14967 * after this script has finished executing.
14971 * A `string` representing the visible URL. Writing to this attribute initiates
14972 * top-level navigation.
14974 * Assigning `src` its own value will reload the current page.
14976 * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
14981 * A `string` that sets the user agent for the guest page before the page is
14982 * navigated to. Once the page is loaded, use the `setUserAgent` method to change
14987 * A `string` which is a comma separated list of strings which specifies the web
14988 * preferences to be set on the webview. The full list of supported preference
14989 * strings can be found in BrowserWindow.
14991 * The string follows the same format as the features string in `window.open`. A
14992 * name by itself is given a `true` boolean value. A preference can be set to
14993 * another value by including an `=`, followed by the value. Special values `yes`
14994 * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
14997 webpreferences: string;
15000 interface AboutPanelOptionsOptions {
15004 applicationName?: string;
15006 * The app's version.
15008 applicationVersion?: string;
15010 * Copyright information.
15012 copyright?: string;
15014 * The app's build version number.
15020 * Credit information.
15022 * @platform darwin,win32
15026 * List of app authors.
15030 authors?: string[];
15032 * The app's website.
15038 * Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as
15039 * 64x64 pixels while retaining aspect ratio.
15041 * @platform linux,win32
15046 interface AddRepresentationOptions {
15048 * The scale factor to add the image representation for.
15050 scaleFactor?: number;
15052 * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
15056 * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
15060 * The buffer containing the raw image data.
15064 * The data URL containing either a base 64 encoded PNG or JPEG image.
15069 interface AdjustSelectionOptions {
15071 * Amount to shift the start index of the current selection.
15075 * Amount to shift the end index of the current selection.
15080 interface AnimationSettings {
15082 * Returns true if rich animations should be rendered. Looks at session type (e.g.
15083 * remote desktop) and accessibility settings to give guidance for heavy
15086 shouldRenderRichAnimation: boolean;
15088 * Determines on a per-platform basis whether scroll animations (e.g. produced by
15089 * home/end key) should be enabled.
15091 scrollAnimationsEnabledBySystem: boolean;
15093 * Determines whether the user desires reduced motion based on platform APIs.
15095 prefersReducedMotion: boolean;
15098 interface AppDetailsOptions {
15100 * Window's App User Model ID. It has to be set, otherwise the other options will
15105 * Window's Relaunch Icon.
15107 appIconPath?: string;
15109 * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
15112 appIconIndex?: number;
15114 * Window's Relaunch Command.
15116 relaunchCommand?: string;
15118 * Window's Relaunch Display Name.
15120 relaunchDisplayName?: string;
15123 interface ApplicationInfoForProtocolReturnValue {
15125 * the display icon of the app handling the protocol.
15129 * installation path of the app handling the protocol.
15133 * display name of the app handling the protocol.
15138 interface AuthenticationResponseDetails {
15142 interface AuthInfo {
15150 interface AutoResizeOptions {
15152 * If `true`, the view's width will grow and shrink together with the window.
15153 * `false` by default.
15157 * If `true`, the view's height will grow and shrink together with the window.
15158 * `false` by default.
15162 * If `true`, the view's x position and width will grow and shrink proportionally
15163 * with the window. `false` by default.
15165 horizontal?: boolean;
15167 * If `true`, the view's y position and height will grow and shrink proportionally
15168 * with the window. `false` by default.
15170 vertical?: boolean;
15173 interface BeforeSendResponse {
15176 * When provided, request will be made with these headers.
15178 requestHeaders?: Record<string, (string) | (string[])>;
15181 interface BitmapOptions {
15185 scaleFactor?: number;
15188 interface BlinkMemoryInfo {
15190 * Size of all allocated objects in Kilobytes.
15194 * Total allocated space in Kilobytes.
15199 interface BluetoothPairingHandlerHandlerDetails {
15202 * The type of pairing prompt being requested. One of the following values:
15204 pairingKind: ('confirm' | 'confirmPin' | 'providePin');
15205 frame: WebFrameMain;
15207 * The pin value to verify if `pairingKind` is `confirmPin`.
15212 interface BrowserViewConstructorOptions {
15214 * Settings of web page's features.
15216 webPreferences?: WebPreferences;
15219 interface CallbackResponse {
15222 * The original request is prevented from being sent or completed and is instead
15223 * redirected to the given URL.
15225 redirectURL?: string;
15228 interface CertificateTrustDialogOptions {
15230 * The certificate to trust/import.
15232 certificate: Certificate;
15234 * The message to display to the user.
15239 interface ClearCodeCachesOptions {
15241 * An array of url corresponding to the resource whose generated code cache needs
15242 * to be removed. If the list is empty then all entries in the cache directory will
15248 interface ClearStorageDataOptions {
15250 * Should follow `window.location.origin`’s representation `scheme://host:port`.
15254 * The types of storages to clear, can be `cookies`, `filesystem`, `indexdb`,
15255 * `localstorage`, `shadercache`, `websql`, `serviceworkers`, `cachestorage`. If
15256 * not specified, clear all storage types.
15258 storages?: Array<'cookies' | 'filesystem' | 'indexdb' | 'localstorage' | 'shadercache' | 'websql' | 'serviceworkers' | 'cachestorage'>;
15260 * The types of quotas to clear, can be `temporary`, `syncable`. If not specified,
15261 * clear all quotas.
15263 quotas?: Array<'temporary' | 'syncable'>;
15266 interface ClientRequestConstructorOptions {
15268 * The HTTP request method. Defaults to the GET method.
15272 * The request URL. Must be provided in the absolute form with the protocol scheme
15273 * specified as http or https.
15277 * The `Session` instance with which the request is associated.
15281 * The name of the `partition` with which the request is associated. Defaults to
15282 * the empty string. The `session` option supersedes `partition`. Thus if a
15283 * `session` is explicitly specified, `partition` is ignored.
15285 partition?: string;
15287 * Can be `include`, `omit` or `same-origin`. Whether to send credentials with this
15288 * request. If set to `include`, credentials from the session associated with the
15289 * request will be used. If set to `omit`, credentials will not be sent with the
15290 * request (and the `'login'` event will not be triggered in the event of a 401).
15291 * If set to `same-origin`, `origin` must also be specified. This matches the
15292 * behavior of the fetch option of the same name. If this option is not specified,
15293 * authentication data from the session will be sent, and cookies will not be sent
15294 * (unless `useSessionCookies` is set).
15296 credentials?: ('include' | 'omit' | 'same-origin');
15298 * Whether to send cookies with this request from the provided session. If
15299 * `credentials` is specified, this option has no effect. Default is `false`.
15301 useSessionCookies?: boolean;
15303 * Can be `http:` or `https:`. The protocol scheme in the form 'scheme:'. Defaults
15306 protocol?: ('http:' | 'https:');
15308 * The server host provided as a concatenation of the hostname and the port number
15313 * The server host name.
15317 * The server's listening port number.
15321 * The path part of the request URL.
15325 * Can be `follow`, `error` or `manual`. The redirect mode for this request. When
15326 * mode is `error`, any redirection will be aborted. When mode is `manual` the
15327 * redirection will be cancelled unless `request.followRedirect` is invoked
15328 * synchronously during the `redirect` event. Defaults to `follow`.
15330 redirect?: ('follow' | 'error' | 'manual');
15332 * The origin URL of the request.
15336 * can be `""`, `no-referrer`, `no-referrer-when-downgrade`, `origin`,
15337 * `origin-when-cross-origin`, `unsafe-url`, `same-origin`, `strict-origin`, or
15338 * `strict-origin-when-cross-origin`. Defaults to
15339 * `strict-origin-when-cross-origin`.
15341 referrerPolicy?: string;
15343 * can be `default`, `no-store`, `reload`, `no-cache`, `force-cache` or
15344 * `only-if-cached`.
15346 cache?: ('default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached');
15349 interface CloseOpts {
15351 * if true, fire the `beforeunload` event before closing the page. If the page
15352 * prevents the unload, the WebContents will not be closed. The
15353 * `will-prevent-unload` will be fired if the page requests prevention of unload.
15355 waitForBeforeUnload: boolean;
15360 * The proxy mode. Should be one of `direct`, `auto_detect`, `pac_script`,
15361 * `fixed_servers` or `system`. If it's unspecified, it will be automatically
15362 * determined based on other specified options.
15364 mode?: ('direct' | 'auto_detect' | 'pac_script' | 'fixed_servers' | 'system');
15366 * The URL associated with the PAC file.
15368 pacScript?: string;
15370 * Rules indicating which proxies to use.
15372 proxyRules?: string;
15374 * Rules indicating which URLs should bypass the proxy settings.
15376 proxyBypassRules?: string;
15379 interface ConfigureHostResolverOptions {
15381 * Whether the built-in host resolver is used in preference to getaddrinfo. When
15382 * enabled, the built-in resolver will attempt to use the system's DNS settings to
15383 * do DNS lookups itself. Enabled by default on macOS, disabled by default on
15384 * Windows and Linux.
15386 enableBuiltInResolver?: boolean;
15388 * Can be 'off', 'automatic' or 'secure'. Configures the DNS-over-HTTP mode. When
15389 * 'off', no DoH lookups will be performed. When 'automatic', DoH lookups will be
15390 * performed first if DoH is available, and insecure DNS lookups will be performed
15391 * as a fallback. When 'secure', only DoH lookups will be performed. Defaults to
15394 secureDnsMode?: ('off' | 'automatic' | 'secure');
15396 * A list of DNS-over-HTTP server templates. See RFC8484 § 3 for details on the
15397 * template format. Most servers support the POST method; the template for such
15398 * servers is simply a URI. Note that for some DNS providers, the resolver will
15399 * automatically upgrade to DoH unless DoH is explicitly disabled, even if there
15400 * are no DoH servers provided in this list.
15402 secureDnsServers?: string[];
15404 * Controls whether additional DNS query types, e.g. HTTPS (DNS type 65) will be
15405 * allowed besides the traditional A and AAAA queries when a request is being made
15406 * via insecure DNS. Has no effect on Secure DNS which always allows additional
15407 * types. Defaults to true.
15409 enableAdditionalDnsQueryTypes?: boolean;
15412 interface ConsoleMessageEvent extends DOMEvent {
15414 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
15419 * The actual console message
15423 * The line number of the source that triggered this console message
15429 interface ContextMenuEvent extends DOMEvent {
15433 interface ContextMenuParams {
15443 * Frame from which the context menu was invoked.
15445 frame: WebFrameMain;
15447 * URL of the link that encloses the node the context menu was invoked on.
15451 * Text associated with the link. May be an empty string if the contents of the
15452 * link are an image.
15456 * URL of the top level page that the context menu was invoked on.
15460 * URL of the subframe that the context menu was invoked on.
15464 * Source URL for the element that the context menu was invoked on. Elements with
15465 * source URLs are images, audio and video.
15469 * Type of the node the context menu was invoked on. Can be `none`, `image`,
15470 * `audio`, `video`, `canvas`, `file` or `plugin`.
15472 mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
15474 * Whether the context menu was invoked on an image which has non-empty contents.
15476 hasImageContents: boolean;
15478 * Whether the context is editable.
15480 isEditable: boolean;
15482 * Text of the selection that the context menu was invoked on.
15484 selectionText: string;
15486 * Title text of the selection that the context menu was invoked on.
15490 * Alt text of the selection that the context menu was invoked on.
15494 * Suggested filename to be used when saving file through 'Save Link As' option of
15497 suggestedFilename: string;
15499 * Rect representing the coordinates in the document space of the selection.
15501 selectionRect: Rectangle;
15503 * Start position of the selection text.
15505 selectionStartOffset: number;
15507 * The referrer policy of the frame on which the menu is invoked.
15509 referrerPolicy: Referrer;
15511 * The misspelled word under the cursor, if any.
15513 misspelledWord: string;
15515 * An array of suggested words to show the user to replace the `misspelledWord`.
15516 * Only available if there is a misspelled word and spellchecker is enabled.
15518 dictionarySuggestions: string[];
15520 * The character encoding of the frame on which the menu was invoked.
15522 frameCharset: string;
15524 * The source that the context menu was invoked on. Possible values include `none`,
15525 * `button-button`, `field-set`, `input-button`, `input-checkbox`, `input-color`,
15526 * `input-date`, `input-datetime-local`, `input-email`, `input-file`,
15527 * `input-hidden`, `input-image`, `input-month`, `input-number`, `input-password`,
15528 * `input-radio`, `input-range`, `input-reset`, `input-search`, `input-submit`,
15529 * `input-telephone`, `input-text`, `input-time`, `input-url`, `input-week`,
15530 * `output`, `reset-button`, `select-list`, `select-list`, `select-multiple`,
15531 * `select-one`, `submit-button`, and `text-area`,
15533 formControlType: ('none' | 'button-button' | 'field-set' | 'input-button' | 'input-checkbox' | 'input-color' | 'input-date' | 'input-datetime-local' | 'input-email' | 'input-file' | 'input-hidden' | 'input-image' | 'input-month' | 'input-number' | 'input-password' | 'input-radio' | 'input-range' | 'input-reset' | 'input-search' | 'input-submit' | 'input-telephone' | 'input-text' | 'input-time' | 'input-url' | 'input-week' | 'output' | 'reset-button' | 'select-list' | 'select-list' | 'select-multiple' | 'select-one' | 'submit-button' | 'text-area');
15535 * If the context menu was invoked on an input field, the type of that field.
15536 * Possible values include `none`, `plainText`, `password`, `other`.
15540 inputFieldType: ('none' | 'plainText' | 'password' | 'other');
15542 * If the context is editable, whether or not spellchecking is enabled.
15544 spellcheckEnabled: boolean;
15546 * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
15547 * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
15548 * `adjustSelection`, or `adjustSelectionReset`.
15550 menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
15552 * The flags for the media element the context menu was invoked on.
15554 mediaFlags: MediaFlags;
15556 * These flags indicate whether the renderer believes it is able to perform the
15557 * corresponding action.
15559 editFlags: EditFlags;
15562 interface ContinueActivityDetails {
15564 * A string identifying the URL of the webpage accessed by the activity on another
15565 * device, if available.
15567 webpageURL?: string;
15570 interface CookiesGetFilter {
15572 * Retrieves cookies which are associated with `url`. Empty implies retrieving
15573 * cookies of all URLs.
15577 * Filters cookies by name.
15581 * Retrieves cookies whose domains match or are subdomains of `domains`.
15585 * Retrieves cookies whose path matches `path`.
15589 * Filters cookies by their Secure property.
15593 * Filters out session or persistent cookies.
15597 * Filters cookies by httpOnly.
15599 httpOnly?: boolean;
15602 interface CookiesSetDetails {
15604 * The URL to associate the cookie with. The promise will be rejected if the URL is
15609 * The name of the cookie. Empty by default if omitted.
15613 * The value of the cookie. Empty by default if omitted.
15617 * The domain of the cookie; this will be normalized with a preceding dot so that
15618 * it's also valid for subdomains. Empty by default if omitted.
15622 * The path of the cookie. Empty by default if omitted.
15626 * Whether the cookie should be marked as Secure. Defaults to false unless Same
15627 * Site=None attribute is used.
15631 * Whether the cookie should be marked as HTTP only. Defaults to false.
15633 httpOnly?: boolean;
15635 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
15636 * If omitted then the cookie becomes a session cookie and will not be retained
15637 * between sessions.
15639 expirationDate?: number;
15641 * The Same Site policy to apply to this cookie. Can be `unspecified`,
15642 * `no_restriction`, `lax` or `strict`. Default is `lax`.
15644 sameSite?: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
15647 interface CrashReporterStartOptions {
15649 * URL that crash reports will be sent to as POST. Required unless `uploadToServer`
15652 submitURL?: string;
15654 * Defaults to `app.name`.
15656 productName?: string;
15658 * Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
15662 companyName?: string;
15664 * Whether crash reports should be sent to the server. If false, crash reports will
15665 * be collected and stored in the crashes directory, but not uploaded. Default is
15668 uploadToServer?: boolean;
15670 * If true, crashes generated in the main process will not be forwarded to the
15671 * system crash handler. Default is `false`.
15673 ignoreSystemCrashHandler?: boolean;
15675 * If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
15677 * @platform darwin,win32
15679 rateLimit?: boolean;
15681 * If true, crash reports will be compressed and uploaded with `Content-Encoding:
15682 * gzip`. Default is `true`.
15684 compress?: boolean;
15686 * Extra string key/value annotations that will be sent along with crash reports
15687 * that are generated in the main process. Only string values are supported.
15688 * Crashes generated in child processes will not contain these extra parameters to
15689 * crash reports generated from child processes, call `addExtraParameter` from the
15692 extra?: Record<string, string>;
15694 * Extra string key/value annotations that will be sent along with any crash
15695 * reports generated in any process. These annotations cannot be changed once the
15696 * crash reporter has been started. If a key is present in both the global extra
15697 * parameters and the process-specific extra parameters, then the global one will
15698 * take precedence. By default, `productName` and the app version are included, as
15699 * well as the Electron version.
15701 globalExtra?: Record<string, string>;
15704 interface CreateFromBitmapOptions {
15710 scaleFactor?: number;
15713 interface CreateFromBufferOptions {
15715 * Required for bitmap buffers.
15719 * Required for bitmap buffers.
15725 scaleFactor?: number;
15728 interface CreateInterruptedDownloadOptions {
15730 * Absolute path of the download.
15734 * Complete URL chain for the download.
15736 urlChain: string[];
15739 * Start range for the download.
15743 * Total length of the download.
15747 * Last-Modified header value.
15749 lastModified?: string;
15751 * ETag header value.
15755 * Time when download was started in number of seconds since UNIX epoch.
15757 startTime?: number;
15763 image?: NativeImage;
15766 * The title of the URL at `text`.
15771 interface DefaultFontFamily {
15773 * Defaults to `Times New Roman`.
15777 * Defaults to `Times New Roman`.
15781 * Defaults to `Arial`.
15783 sansSerif?: string;
15785 * Defaults to `Courier New`.
15787 monospace?: string;
15789 * Defaults to `Script`.
15793 * Defaults to `Impact`.
15797 * Defaults to `Latin Modern Math`.
15802 interface Details {
15804 * Process type. One of the following values:
15806 type: ('Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
15808 * The reason the child process is gone. Possible values:
15810 reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
15812 * The exit code for the process (e.g. status from waitpid if on posix, from
15813 * GetExitCodeProcess on Windows).
15817 * The non-localized name of the process.
15819 serviceName?: string;
15821 * The name of the process. Examples for utility: `Audio Service`, `Content
15822 * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
15827 interface DevicePermissionHandlerHandlerDetails {
15829 * The type of device that permission is being requested on, can be `hid`,
15830 * `serial`, or `usb`.
15832 deviceType: ('hid' | 'serial' | 'usb');
15834 * The origin URL of the device permission check.
15838 * the device that permission is being requested for.
15840 device: (HIDDevice) | (SerialPort) | (USBDevice);
15843 interface DevtoolsOpenUrlEvent extends DOMEvent {
15845 * URL of the link that was clicked or selected.
15850 interface DidChangeThemeColorEvent extends DOMEvent {
15851 themeColor: string;
15854 interface DidCreateWindowDetails {
15856 * URL for the created window.
15860 * Name given to the created window in the `window.open()` call.
15864 * The options used to create the BrowserWindow. They are merged in increasing
15865 * precedence: parsed options from the `features` string from `window.open()`,
15866 * security-related webPreferences inherited from the parent, and options given by
15867 * `webContents.setWindowOpenHandler`. Unrecognized options are not filtered out.
15869 options: BrowserWindowConstructorOptions;
15871 * The referrer that will be passed to the new window. May or may not result in the
15872 * `Referer` header being sent, depending on the referrer policy.
15874 referrer: Referrer;
15876 * The post data that will be sent to the new window, along with the appropriate
15877 * headers that will be set. If no post data is to be sent, the value will be
15878 * `null`. Only defined when the window is being created by a form that set
15881 postBody?: PostBody;
15883 * Can be `default`, `foreground-tab`, `background-tab`, `new-window` or `other`.
15885 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'other');
15888 interface DidFailLoadEvent extends DOMEvent {
15890 errorDescription: string;
15891 validatedURL: string;
15892 isMainFrame: boolean;
15895 interface DidFrameFinishLoadEvent extends DOMEvent {
15896 isMainFrame: boolean;
15899 interface DidFrameNavigateEvent extends DOMEvent {
15902 * -1 for non HTTP navigations
15904 httpResponseCode: number;
15906 * empty for non HTTP navigations,
15908 httpStatusText: string;
15909 isMainFrame: boolean;
15910 frameProcessId: number;
15911 frameRoutingId: number;
15914 interface DidNavigateEvent extends DOMEvent {
15918 interface DidNavigateInPageEvent extends DOMEvent {
15919 isMainFrame: boolean;
15923 interface DidRedirectNavigationEvent extends DOMEvent {
15925 isInPlace: boolean;
15926 isMainFrame: boolean;
15927 frameProcessId: number;
15928 frameRoutingId: number;
15931 interface DidStartNavigationEvent extends DOMEvent {
15933 isInPlace: boolean;
15934 isMainFrame: boolean;
15935 frameProcessId: number;
15936 frameRoutingId: number;
15939 interface DisplayBalloonOptions {
15941 * Icon to use when `iconType` is `custom`.
15943 icon?: (NativeImage) | (string);
15945 * Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
15947 iconType?: ('none' | 'info' | 'warning' | 'error' | 'custom');
15951 * The large version of the icon should be used. Default is `true`. Maps to
15952 * `NIIF_LARGE_ICON`.
15954 largeIcon?: boolean;
15956 * Do not play the associated sound. Default is `false`. Maps to `NIIF_NOSOUND`.
15960 * Do not display the balloon notification if the current user is in "quiet time".
15961 * Default is `false`. Maps to `NIIF_RESPECT_QUIET_TIME`.
15963 respectQuietTime?: boolean;
15966 interface DisplayMediaRequestHandlerHandlerRequest {
15968 * Frame that is requesting access to media.
15970 frame: WebFrameMain;
15972 * Origin of the page making the request.
15974 securityOrigin: string;
15976 * true if the web content requested a video stream.
15978 videoRequested: boolean;
15980 * true if the web content requested an audio stream.
15982 audioRequested: boolean;
15984 * Whether a user gesture was active when this request was triggered.
15986 userGesture: boolean;
15989 interface DownloadURLOptions {
15991 * HTTP request headers.
15993 headers?: Record<string, string>;
15996 interface EnableNetworkEmulationOptions {
15998 * Whether to emulate network outage. Defaults to false.
16002 * RTT in ms. Defaults to 0 which will disable latency throttling.
16006 * Download rate in Bps. Defaults to 0 which will disable download throttling.
16008 downloadThroughput?: number;
16010 * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
16012 uploadThroughput?: number;
16015 interface FeedURLOptions {
16018 * HTTP request headers.
16022 headers?: Record<string, string>;
16024 * Can be `json` or `default`, see the Squirrel.Mac README for more information.
16028 serverType?: ('json' | 'default');
16031 interface FileIconOptions {
16032 size: ('small' | 'normal' | 'large');
16035 interface FindInPageOptions {
16037 * Whether to search forward or backward, defaults to `true`.
16041 * Whether to begin a new text finding session with this request. Should be `true`
16042 * for initial requests, and `false` for follow-up requests. Defaults to `false`.
16044 findNext?: boolean;
16046 * Whether search should be case-sensitive, defaults to `false`.
16048 matchCase?: boolean;
16051 interface FocusOptions {
16053 * Make the receiver the active app even if another app is currently active.
16060 interface ForkOptions {
16062 * Environment key-value pairs. Default is `process.env`.
16066 * List of string arguments passed to the executable.
16068 execArgv?: string[];
16070 * Current working directory of the child process.
16074 * Allows configuring the mode for `stdout` and `stderr` of the child process.
16075 * Default is `inherit`. String value can be one of `pipe`, `ignore`, `inherit`,
16076 * for more details on these values you can refer to stdio documentation from
16077 * Node.js. Currently this option only supports configuring `stdout` and `stderr`
16078 * to either `pipe`, `inherit` or `ignore`. Configuring `stdin` is not supported;
16079 * `stdin` will always be ignored. For example, the supported values will be
16080 * processed as following:
16082 stdio?: (Array<'pipe' | 'ignore' | 'inherit'>) | (string);
16084 * Name of the process that will appear in `name` property of `ProcessMetric`
16085 * returned by `app.getAppMetrics` and `child-process-gone` event of `app`. Default
16086 * is `Node Utility Process`.
16088 serviceName?: string;
16090 * With this flag, the utility process will be launched via the `Electron Helper
16091 * (Plugin).app` helper executable on macOS, which can be codesigned with
16092 * `com.apple.security.cs.disable-library-validation` and
16093 * `com.apple.security.cs.allow-unsigned-executable-memory` entitlements. This will
16094 * allow the utility process to load unsigned libraries. Unless you specifically
16095 * need this capability, it is best to leave this disabled. Default is `false`.
16099 allowLoadingUnsignedLibraries?: boolean;
16102 interface FoundInPageEvent extends DOMEvent {
16103 result: FoundInPageResult;
16106 interface FrameCreatedDetails {
16107 frame: WebFrameMain;
16110 interface FromPartitionOptions {
16112 * Whether to enable cache.
16117 interface FromPathOptions {
16119 * Whether to enable cache.
16124 interface HandlerDetails {
16126 * The _resolved_ version of the URL passed to `window.open()`. e.g. opening a
16127 * window with `window.open('foo')` will yield something like
16128 * `https://the-origin/the/current/path/foo`.
16132 * Name of the window provided in `window.open()`
16136 * Comma separated list of window features provided to `window.open()`.
16140 * Can be `default`, `foreground-tab`, `background-tab`, `new-window` or `other`.
16142 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'other');
16144 * The referrer that will be passed to the new window. May or may not result in the
16145 * `Referer` header being sent, depending on the referrer policy.
16147 referrer: Referrer;
16149 * The post data that will be sent to the new window, along with the appropriate
16150 * headers that will be set. If no post data is to be sent, the value will be
16151 * `null`. Only defined when the window is being created by a form that set
16154 postBody?: PostBody;
16157 interface HeadersReceivedResponse {
16160 * When provided, the server is assumed to have responded with these headers.
16162 responseHeaders?: Record<string, (string) | (string[])>;
16164 * Should be provided when overriding `responseHeaders` to change header status
16165 * otherwise original response header's status will be used.
16167 statusLine?: string;
16170 interface HeapStatistics {
16171 totalHeapSize: number;
16172 totalHeapSizeExecutable: number;
16173 totalPhysicalSize: number;
16174 totalAvailableSize: number;
16175 usedHeapSize: number;
16176 heapSizeLimit: number;
16177 mallocedMemory: number;
16178 peakMallocedMemory: number;
16179 doesZapGarbage: boolean;
16182 interface HidDeviceAddedDetails {
16184 frame: WebFrameMain;
16187 interface HidDeviceRemovedDetails {
16189 frame: WebFrameMain;
16192 interface HidDeviceRevokedDetails {
16195 * The origin that the device has been revoked from.
16200 interface IgnoreMouseEventsOptions {
16202 * If true, forwards mouse move messages to Chromium, enabling mouse related events
16203 * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
16204 * forwarding is always disabled regardless of this value.
16206 * @platform darwin,win32
16211 interface ImportCertificateOptions {
16213 * Path for the pkcs12 file.
16215 certificate: string;
16217 * Passphrase for the certificate.
16224 * Security origin for the isolated world.
16226 securityOrigin?: string;
16228 * Content Security Policy for the isolated world.
16232 * Name for isolated world. Useful in devtools.
16239 * Either `keyUp` or `keyDown`.
16243 * Equivalent to KeyboardEvent.key.
16247 * Equivalent to KeyboardEvent.code.
16251 * Equivalent to KeyboardEvent.repeat.
16253 isAutoRepeat: boolean;
16255 * Equivalent to KeyboardEvent.isComposing.
16257 isComposing: boolean;
16259 * Equivalent to KeyboardEvent.shiftKey.
16263 * Equivalent to KeyboardEvent.controlKey.
16267 * Equivalent to KeyboardEvent.altKey.
16271 * Equivalent to KeyboardEvent.metaKey.
16275 * Equivalent to KeyboardEvent.location.
16279 * See InputEvent.modifiers.
16281 modifiers: string[];
16284 interface InsertCSSOptions {
16286 * Can be 'user' or 'author'. Sets the cascade origin of the inserted stylesheet.
16287 * Default is 'author'.
16289 cssOrigin?: ('user' | 'author');
16292 interface IpcMessageEvent extends DOMEvent {
16294 * pair of `[processId, frameId]`.
16296 frameId: [number, number];
16303 * The path to the file being dragged.
16307 * The paths to the files being dragged. (`files` will override `file` field)
16311 * The image must be non-empty on macOS.
16313 icon: (NativeImage) | (string);
16316 interface JumpListSettings {
16318 * The minimum number of items that will be shown in the Jump List (for a more
16319 * detailed description of this value see the MSDN docs).
16323 * Array of `JumpListItem` objects that correspond to items that the user has
16324 * explicitly removed from custom categories in the Jump List. These items must not
16325 * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
16326 * Windows will not display any custom category that contains any of the removed
16329 removedItems: JumpListItem[];
16332 interface LoadCommitEvent extends DOMEvent {
16334 isMainFrame: boolean;
16337 interface LoadExtensionOptions {
16339 * Whether to allow the extension to read local files over `file://` protocol and
16340 * inject content scripts into `file://` pages. This is required e.g. for loading
16341 * devtools extensions on `file://` URLs. Defaults to false.
16343 allowFileAccess: boolean;
16346 interface LoadFileOptions {
16348 * Passed to `url.format()`.
16350 query?: Record<string, string>;
16352 * Passed to `url.format()`.
16356 * Passed to `url.format()`.
16361 interface LoadURLOptions {
16363 * An HTTP Referrer url.
16365 httpReferrer?: (string) | (Referrer);
16367 * A user agent originating the request.
16369 userAgent?: string;
16371 * Extra headers separated by "\n"
16373 extraHeaders?: string;
16374 postData?: Array<(UploadRawData) | (UploadFile)>;
16376 * Base url (with trailing path separator) for files to be loaded by the data url.
16377 * This is needed only if the specified `url` is a data url and needs to load other
16380 baseURLForDataURL?: string;
16383 interface LoginItemSettings {
16385 * `true` if the app is set to open at login.
16387 openAtLogin: boolean;
16389 * `true` if the app is set to open as hidden at login. This setting is not
16390 * available on MAS builds.
16394 openAsHidden: boolean;
16396 * `true` if the app was opened at login automatically. This setting is not
16397 * available on MAS builds.
16401 wasOpenedAtLogin: boolean;
16403 * `true` if the app was opened as a hidden login item. This indicates that the app
16404 * should not open any windows at startup. This setting is not available on MAS
16409 wasOpenedAsHidden: boolean;
16411 * `true` if the app was opened as a login item that should restore the state from
16412 * the previous session. This indicates that the app should restore the windows
16413 * that were open the last time the app was closed. This setting is not available
16418 restoreState: boolean;
16420 * `true` if app is set to open at login and its run key is not deactivated. This
16421 * differs from `openAtLogin` as it ignores the `args` option, this property will
16422 * be true if the given executable would be launched at login with **any**
16427 executableWillLaunchAtLogin: boolean;
16428 launchItems: LaunchItems[];
16431 interface LoginItemSettingsOptions {
16433 * The executable path to compare against. Defaults to `process.execPath`.
16439 * The command-line arguments to compare against. Defaults to an empty array.
16446 interface MenuItemConstructorOptions {
16448 * Will be called with `click(menuItem, browserWindow, event)` when the menu item
16451 click?: (menuItem: MenuItem, browserWindow: (BrowserWindow) | (undefined), event: KeyboardEvent) => void;
16453 * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
16454 * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
16455 * `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`,
16456 * `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`,
16457 * `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`,
16458 * `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`,
16459 * `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`,
16460 * `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `showAllTabs`,
16461 * `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
16462 * - Define the action of the menu item, when specified the `click` property will
16463 * be ignored. See roles.
16465 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' | 'showAllTabs' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
16467 * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
16469 type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
16473 * Hover text for this menu item.
16478 accelerator?: Accelerator;
16479 icon?: (NativeImage) | (string);
16481 * If false, the menu item will be greyed out and unclickable.
16485 * default is `true`, and when `false` will prevent the accelerator from triggering
16486 * the item if the item is not visible.
16490 acceleratorWorksWhenHidden?: boolean;
16492 * If false, the menu item will be entirely hidden.
16496 * Should only be specified for `checkbox` or `radio` type menu items.
16500 * If false, the accelerator won't be registered with the system, but it will still
16501 * be displayed. Defaults to true.
16503 * @platform linux,win32
16505 registerAccelerator?: boolean;
16507 * The item to share when the `role` is `shareMenu`.
16511 sharingItem?: SharingItem;
16513 * Should be specified for `submenu` type menu items. If `submenu` is specified,
16514 * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
16515 * be automatically converted to one using `Menu.buildFromTemplate`.
16517 submenu?: (MenuItemConstructorOptions[]) | (Menu);
16519 * Unique within a single menu. If defined then it can be used as a reference to
16520 * this item by the position attribute.
16524 * Inserts this item before the item with the specified label. If the referenced
16525 * item doesn't exist the item will be inserted at the end of the menu. Also
16526 * implies that the menu item in question should be placed in the same “group” as
16531 * Inserts this item after the item with the specified label. If the referenced
16532 * item doesn't exist the item will be inserted at the end of the menu.
16536 * Provides a means for a single context menu to declare the placement of their
16537 * containing group before the containing group of the item with the specified
16540 beforeGroupContaining?: string[];
16542 * Provides a means for a single context menu to declare the placement of their
16543 * containing group after the containing group of the item with the specified
16546 afterGroupContaining?: string[];
16549 interface MessageBoxOptions {
16551 * Content of the message box.
16555 * Can be `none`, `info`, `error`, `question` or `warning`. On Windows, `question`
16556 * displays the same icon as `info`, unless you set an icon using the `icon`
16557 * option. On macOS, both `warning` and `error` display the same warning icon.
16559 type?: ('none' | 'info' | 'error' | 'question' | 'warning');
16561 * Array of texts for buttons. On Windows, an empty array will result in one button
16564 buttons?: string[];
16566 * Index of the button in the buttons array which will be selected by default when
16567 * the message box opens.
16569 defaultId?: number;
16571 * Pass an instance of AbortSignal to optionally close the message box, the message
16572 * box will behave as if it was cancelled by the user. On macOS, `signal` does not
16573 * work with message boxes that do not have a parent window, since those message
16574 * boxes run synchronously due to platform limitations.
16576 signal?: AbortSignal;
16578 * Title of the message box, some platforms will not show it.
16582 * Extra information of the message.
16586 * If provided, the message box will include a checkbox with the given label.
16588 checkboxLabel?: string;
16590 * Initial checked state of the checkbox. `false` by default.
16592 checkboxChecked?: boolean;
16593 icon?: (NativeImage) | (string);
16595 * Custom width of the text in the message box.
16599 textWidth?: number;
16601 * The index of the button to be used to cancel the dialog, via the `Esc` key. By
16602 * default this is assigned to the first button with "cancel" or "no" as the label.
16603 * If no such labeled buttons exist and this option is not set, `0` will be used as
16604 * the return value.
16608 * On Windows Electron will try to figure out which one of the `buttons` are common
16609 * buttons (like "Cancel" or "Yes"), and show the others as command links in the
16610 * dialog. This can make the dialog appear in the style of modern Windows apps. If
16611 * you don't like this behavior, you can set `noLink` to `true`.
16615 * Normalize the keyboard access keys across platforms. Default is `false`.
16616 * Enabling this assumes `&` is used in the button labels for the placement of the
16617 * keyboard shortcut access key and labels will be converted so they work correctly
16618 * on each platform, `&` characters are removed on macOS, converted to `_` on
16619 * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
16620 * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
16621 * via `Alt-W` on Windows and Linux.
16623 normalizeAccessKeys?: boolean;
16626 interface MessageBoxReturnValue {
16628 * The index of the clicked button.
16632 * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
16634 checkboxChecked: boolean;
16637 interface MessageBoxSyncOptions {
16639 * Content of the message box.
16643 * Can be `none`, `info`, `error`, `question` or `warning`. On Windows, `question`
16644 * displays the same icon as `info`, unless you set an icon using the `icon`
16645 * option. On macOS, both `warning` and `error` display the same warning icon.
16647 type?: ('none' | 'info' | 'error' | 'question' | 'warning');
16649 * Array of texts for buttons. On Windows, an empty array will result in one button
16652 buttons?: string[];
16654 * Index of the button in the buttons array which will be selected by default when
16655 * the message box opens.
16657 defaultId?: number;
16659 * Title of the message box, some platforms will not show it.
16663 * Extra information of the message.
16666 icon?: (NativeImage) | (string);
16668 * Custom width of the text in the message box.
16672 textWidth?: number;
16674 * The index of the button to be used to cancel the dialog, via the `Esc` key. By
16675 * default this is assigned to the first button with "cancel" or "no" as the label.
16676 * If no such labeled buttons exist and this option is not set, `0` will be used as
16677 * the return value.
16681 * On Windows Electron will try to figure out which one of the `buttons` are common
16682 * buttons (like "Cancel" or "Yes"), and show the others as command links in the
16683 * dialog. This can make the dialog appear in the style of modern Windows apps. If
16684 * you don't like this behavior, you can set `noLink` to `true`.
16688 * Normalize the keyboard access keys across platforms. Default is `false`.
16689 * Enabling this assumes `&` is used in the button labels for the placement of the
16690 * keyboard shortcut access key and labels will be converted so they work correctly
16691 * on each platform, `&` characters are removed on macOS, converted to `_` on
16692 * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
16693 * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
16694 * via `Alt-W` on Windows and Linux.
16696 normalizeAccessKeys?: boolean;
16699 interface MessageDetails {
16701 * The actual console message
16705 * The version ID of the service worker that sent the log message
16709 * The type of source for this message. Can be `javascript`, `xml`, `network`,
16710 * `console-api`, `storage`, `rendering`, `security`, `deprecation`, `worker`,
16711 * `violation`, `intervention`, `recommendation` or `other`.
16713 source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
16715 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
16720 * The URL the message came from
16724 * The line number of the source that triggered this console message
16726 lineNumber: number;
16729 interface MessageEvent {
16731 ports: MessagePortMain[];
16734 interface MoveToApplicationsFolderOptions {
16736 * A handler for potential conflict in move failure.
16738 conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
16741 interface NotificationConstructorOptions {
16743 * A title for the notification, which will be displayed at the top of the
16744 * notification window when it is shown.
16748 * A subtitle for the notification, which will be displayed below the title.
16754 * The body text of the notification, which will be displayed below the title or
16759 * Whether or not to suppress the OS notification noise when showing the
16764 * An icon to use in the notification.
16766 icon?: (string) | (NativeImage);
16768 * Whether or not to add an inline reply option to the notification.
16772 hasReply?: boolean;
16774 * The timeout duration of the notification. Can be 'default' or 'never'.
16776 * @platform linux,win32
16778 timeoutType?: ('default' | 'never');
16780 * The placeholder to write in the inline reply input field.
16784 replyPlaceholder?: string;
16786 * The name of the sound file to play when the notification is shown.
16792 * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
16796 urgency?: ('normal' | 'critical' | 'low');
16798 * Actions to add to the notification. Please read the available actions and
16799 * limitations in the `NotificationAction` documentation.
16803 actions?: NotificationAction[];
16805 * A custom title for the close button of an alert. An empty string will cause the
16806 * default localized text to be used.
16810 closeButtonText?: string;
16812 * A custom description of the Notification on Windows superseding all properties
16813 * above. Provides full customization of design and behavior of the notification.
16820 interface OnBeforeRedirectListenerDetails {
16824 webContentsId?: number;
16825 webContents?: WebContents;
16826 frame?: WebFrameMain;
16828 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
16829 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
16831 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
16834 redirectURL: string;
16835 statusCode: number;
16836 statusLine: string;
16838 * The server IP address that the request was actually sent to.
16841 fromCache: boolean;
16842 responseHeaders?: Record<string, string[]>;
16845 interface OnBeforeRequestListenerDetails {
16849 webContentsId?: number;
16850 webContents?: WebContents;
16851 frame?: WebFrameMain;
16853 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
16854 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
16856 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
16859 uploadData: UploadData[];
16862 interface OnBeforeSendHeadersListenerDetails {
16866 webContentsId?: number;
16867 webContents?: WebContents;
16868 frame?: WebFrameMain;
16870 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
16871 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
16873 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
16876 uploadData?: UploadData[];
16877 requestHeaders: Record<string, string>;
16880 interface OnCompletedListenerDetails {
16884 webContentsId?: number;
16885 webContents?: WebContents;
16886 frame?: WebFrameMain;
16888 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
16889 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
16891 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
16894 responseHeaders?: Record<string, string[]>;
16895 fromCache: boolean;
16896 statusCode: number;
16897 statusLine: string;
16901 interface OnErrorOccurredListenerDetails {
16905 webContentsId?: number;
16906 webContents?: WebContents;
16907 frame?: WebFrameMain;
16909 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
16910 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
16912 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
16915 fromCache: boolean;
16917 * The error description.
16922 interface OnHeadersReceivedListenerDetails {
16926 webContentsId?: number;
16927 webContents?: WebContents;
16928 frame?: WebFrameMain;
16930 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
16931 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
16933 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
16936 statusLine: string;
16937 statusCode: number;
16938 responseHeaders?: Record<string, string[]>;
16941 interface OnResponseStartedListenerDetails {
16945 webContentsId?: number;
16946 webContents?: WebContents;
16947 frame?: WebFrameMain;
16949 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
16950 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
16952 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
16955 responseHeaders?: Record<string, string[]>;
16957 * Indicates whether the response was fetched from disk cache.
16959 fromCache: boolean;
16960 statusCode: number;
16961 statusLine: string;
16964 interface OnSendHeadersListenerDetails {
16968 webContentsId?: number;
16969 webContents?: WebContents;
16970 frame?: WebFrameMain;
16972 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
16973 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
16975 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
16978 requestHeaders: Record<string, string>;
16981 interface OpenDevToolsOptions {
16983 * Opens the devtools with specified dock state, can be `left`, `right`, `bottom`,
16984 * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
16985 * possible to dock back. In `detach` mode it's not.
16987 mode: ('left' | 'right' | 'bottom' | 'undocked' | 'detach');
16989 * Whether to bring the opened devtools window to the foreground. The default is
16992 activate?: boolean;
16994 * A title for the DevTools window (only in `undocked` or `detach` mode).
16999 interface OpenDialogOptions {
17001 defaultPath?: string;
17003 * Custom label for the confirmation button, when left empty the default label will
17006 buttonLabel?: string;
17007 filters?: FileFilter[];
17009 * Contains which features the dialog should use. The following values are
17012 properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
17014 * Message to display above input boxes.
17020 * Create security scoped bookmarks when packaged for the Mac App Store.
17022 * @platform darwin,mas
17024 securityScopedBookmarks?: boolean;
17027 interface OpenDialogReturnValue {
17029 * whether or not the dialog was canceled.
17033 * An array of file paths chosen by the user. If the dialog is cancelled this will
17034 * be an empty array.
17036 filePaths: string[];
17038 * An array matching the `filePaths` array of base64 encoded strings which contains
17039 * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
17040 * this to be populated. (For return values, see table here.)
17042 * @platform darwin,mas
17044 bookmarks?: string[];
17047 interface OpenDialogSyncOptions {
17049 defaultPath?: string;
17051 * Custom label for the confirmation button, when left empty the default label will
17054 buttonLabel?: string;
17055 filters?: FileFilter[];
17057 * Contains which features the dialog should use. The following values are
17060 properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
17062 * Message to display above input boxes.
17068 * Create security scoped bookmarks when packaged for the Mac App Store.
17070 * @platform darwin,mas
17072 securityScopedBookmarks?: boolean;
17075 interface OpenExternalOptions {
17077 * `true` to bring the opened application to the foreground. The default is `true`.
17081 activate?: boolean;
17083 * The working directory.
17087 workingDirectory?: string;
17089 * Indicates a user initiated launch that enables tracking of frequently used
17090 * programs and other behaviors. The default is `false`.
17094 logUsage?: boolean;
17097 interface Options {
17102 * Keep the page hidden instead of visible. Default is `false`.
17104 stayHidden?: boolean;
17106 * Keep the system awake instead of allowing it to sleep. Default is `false`.
17108 stayAwake?: boolean;
17111 interface PageFaviconUpdatedEvent extends DOMEvent {
17115 favicons: string[];
17118 interface PageTitleUpdatedEvent extends DOMEvent {
17120 explicitSet: boolean;
17123 interface Parameters {
17125 * Specify the screen type to emulate (default: `desktop`):
17127 screenPosition: ('desktop' | 'mobile');
17129 * Set the emulated screen size (screenPosition == mobile).
17133 * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
17136 viewPosition: Point;
17138 * Set the device scale factor (if zero defaults to original device scale factor)
17141 deviceScaleFactor: number;
17143 * Set the emulated view size (empty means no override)
17147 * Scale of emulated view inside available space (not in fit to view mode)
17153 interface Payment {
17155 * The identifier of the purchased product.
17157 productIdentifier: string;
17159 * The quantity purchased.
17163 * An opaque identifier for the user’s account on your system.
17165 applicationUsername: string;
17167 * The details of the discount offer to apply to the payment.
17169 paymentDiscount?: PaymentDiscount;
17172 interface PermissionCheckHandlerHandlerDetails {
17174 * The origin of the frame embedding the frame that made the permission check.
17175 * Only set for cross-origin sub frames making permission checks.
17177 embeddingOrigin?: string;
17179 * The security origin of the `media` check.
17181 securityOrigin?: string;
17183 * The type of media access being requested, can be `video`, `audio` or `unknown`
17185 mediaType?: ('video' | 'audio' | 'unknown');
17187 * The last URL the requesting frame loaded. This is not provided for cross-origin
17188 * sub frames making permission checks.
17190 requestingUrl?: string;
17192 * Whether the frame making the request is the main frame
17194 isMainFrame: boolean;
17197 interface PermissionRequestHandlerHandlerDetails {
17199 * The url of the `openExternal` request.
17201 externalURL?: string;
17203 * The security origin of the `media` request.
17205 securityOrigin?: string;
17207 * The types of media access being requested, elements can be `video` or `audio`
17209 mediaTypes?: Array<'video' | 'audio'>;
17211 * The last URL the requesting frame loaded
17213 requestingUrl: string;
17215 * Whether the frame making the request is the main frame
17217 isMainFrame: boolean;
17220 interface PluginCrashedEvent extends DOMEvent {
17225 interface PopupOptions {
17227 * Default is the focused window.
17229 window?: BrowserWindow;
17231 * Default is the current mouse cursor position. Must be declared if `y` is
17236 * Default is the current mouse cursor position. Must be declared if `x` is
17241 * The index of the menu item to be positioned under the mouse cursor at the
17242 * specified coordinates. Default is -1.
17246 positioningItem?: number;
17248 * This should map to the `menuSourceType` provided by the `context-menu` event. It
17249 * is not recommended to set this value manually, only provide values you receive
17250 * from other APIs or leave it `undefined`. Can be `none`, `mouse`, `keyboard`,
17251 * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
17252 * `adjustSelection`, or `adjustSelectionReset`.
17254 * @platform win32,linux
17256 sourceType?: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
17258 * Called when menu is closed.
17260 callback?: () => void;
17263 interface PreconnectOptions {
17265 * URL for preconnect. Only the origin is relevant for opening the socket.
17269 * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
17271 numSockets?: number;
17274 interface PrintToPDFOptions {
17276 * Paper orientation.`true` for landscape, `false` for portrait. Defaults to false.
17278 landscape?: boolean;
17280 * Whether to display header and footer. Defaults to false.
17282 displayHeaderFooter?: boolean;
17284 * Whether to print background graphics. Defaults to false.
17286 printBackground?: boolean;
17288 * Scale of the webpage rendering. Defaults to 1.
17292 * Specify page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, `A4`,
17293 * `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing
17294 * `height` and `width` in inches. Defaults to `Letter`.
17296 pageSize?: (('A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'Legal' | 'Letter' | 'Tabloid' | 'Ledger')) | (Size);
17299 * Page ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which
17300 * means print all pages.
17302 pageRanges?: string;
17304 * HTML template for the print header. Should be valid HTML markup with following
17305 * classes used to inject printing values into them: `date` (formatted print date),
17306 * `title` (document title), `url` (document location), `pageNumber` (current page
17307 * number) and `totalPages` (total pages in the document). For example, `<span
17308 * class=title></span>` would generate span containing the title.
17310 headerTemplate?: string;
17312 * HTML template for the print footer. Should use the same format as the
17313 * `headerTemplate`.
17315 footerTemplate?: string;
17317 * Whether or not to prefer page size as defined by css. Defaults to false, in
17318 * which case the content will be scaled to fit the paper size.
17320 preferCSSPageSize?: boolean;
17322 * Whether or not to generate a tagged (accessible) PDF. Defaults to false. As this
17323 * property is experimental, the generated PDF may not adhere fully to PDF/UA and
17328 generateTaggedPDF?: boolean;
17331 interface Privileges {
17335 standard?: boolean;
17343 bypassCSP?: boolean;
17347 allowServiceWorkers?: boolean;
17351 supportFetchAPI?: boolean;
17355 corsEnabled?: boolean;
17361 * Enable V8 code cache for the scheme, only works when `standard` is also set to
17362 * true. Default false.
17364 codeCache?: boolean;
17367 interface ProgressBarOptions {
17369 * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
17374 mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
17377 interface Provider {
17378 spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
17381 interface PurchaseProductOpts {
17383 * The number of items the user wants to purchase.
17387 * The string that associates the transaction with a user account on your service
17388 * (applicationUsername).
17393 interface ReadBookmark {
17398 interface RegistrationCompletedDetails {
17400 * The base URL that a service worker is registered for
17405 interface RelaunchOptions {
17410 interface RenderProcessGoneEvent extends DOMEvent {
17411 details: RenderProcessGoneDetails;
17414 interface Request {
17416 certificate: Certificate;
17417 validatedCertificate: Certificate;
17419 * `true` if Chromium recognises the root CA as a standard root. If it isn't then
17420 * it's probably the case that this certificate was generated by a MITM proxy whose
17421 * root has been installed locally (for example, by a corporate proxy). This should
17422 * not be trusted if the `verificationResult` is not `OK`.
17424 isIssuedByKnownRoot: boolean;
17426 * `OK` if the certificate is trusted, otherwise an error like `CERT_REVOKED`.
17428 verificationResult: string;
17435 interface ResizeOptions {
17437 * Defaults to the image's width.
17441 * Defaults to the image's height.
17445 * The desired quality of the resize image. Possible values include `good`,
17446 * `better`, or `best`. The default is `best`. These values express a desired
17447 * quality/speed tradeoff. They are translated into an algorithm-specific method
17448 * that depends on the capabilities (CPU, GPU) of the underlying platform. It is
17449 * possible for all three methods to be mapped to the same algorithm on a given
17452 quality?: ('good' | 'better' | 'best');
17455 interface ResolveHostOptions {
17457 * Requested DNS query type. If unspecified, resolver will pick A or AAAA (or both)
17458 * based on IPv4/IPv6 settings:
17460 queryType?: ('A' | 'AAAA');
17462 * The source to use for resolved addresses. Default allows the resolver to pick an
17463 * appropriate source. Only affects use of big external sources (e.g. calling the
17464 * system for resolution or using DNS). Even if a source is specified, results can
17465 * still come from cache, resolving "localhost" or IP literals, etc. One of the
17466 * following values:
17468 source?: ('any' | 'system' | 'dns' | 'mdns' | 'localOnly');
17470 * Indicates what DNS cache entries, if any, can be used to provide a response. One
17471 * of the following values:
17473 cacheUsage?: ('allowed' | 'staleAllowed' | 'disallowed');
17475 * Controls the resolver's Secure DNS behavior for this request. One of the
17476 * following values:
17478 secureDnsPolicy?: ('allow' | 'disable');
17481 interface ResourceUsage {
17482 images: MemoryUsageDetails;
17483 scripts: MemoryUsageDetails;
17484 cssStyleSheets: MemoryUsageDetails;
17485 xslStyleSheets: MemoryUsageDetails;
17486 fonts: MemoryUsageDetails;
17487 other: MemoryUsageDetails;
17490 interface Response {
17492 * `false` should be passed in if the dialog is canceled. If the `pairingKind` is
17493 * `confirm` or `confirmPin`, this value should indicate if the pairing is
17494 * confirmed. If the `pairingKind` is `providePin` the value should be `true` when
17495 * a value is provided.
17497 confirmed: boolean;
17499 * When the `pairingKind` is `providePin` this value should be the required pin for
17500 * the Bluetooth device.
17502 pin?: (string) | (null);
17508 * Position of the active match.
17510 activeMatchOrdinal: number;
17512 * Number of Matches.
17516 * Coordinates of first match region.
17518 selectionArea: Rectangle;
17519 finalUpdate: boolean;
17522 interface SaveDialogOptions {
17524 * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
17528 * Absolute directory path, absolute file path, or file name to use by default.
17530 defaultPath?: string;
17532 * Custom label for the confirmation button, when left empty the default label will
17535 buttonLabel?: string;
17536 filters?: FileFilter[];
17538 * Message to display above text fields.
17544 * Custom label for the text displayed in front of the filename text field.
17548 nameFieldLabel?: string;
17550 * Show the tags input box, defaults to `true`.
17554 showsTagField?: boolean;
17555 properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
17557 * Create a security scoped bookmark when packaged for the Mac App Store. If this
17558 * option is enabled and the file doesn't already exist a blank file will be
17559 * created at the chosen path.
17561 * @platform darwin,mas
17563 securityScopedBookmarks?: boolean;
17566 interface SaveDialogReturnValue {
17568 * whether or not the dialog was canceled.
17572 * If the dialog is canceled, this will be `undefined`.
17576 * Base64 encoded string which contains the security scoped bookmark data for the
17577 * saved file. `securityScopedBookmarks` must be enabled for this to be present.
17578 * (For return values, see table here.)
17580 * @platform darwin,mas
17585 interface SaveDialogSyncOptions {
17587 * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
17591 * Absolute directory path, absolute file path, or file name to use by default.
17593 defaultPath?: string;
17595 * Custom label for the confirmation button, when left empty the default label will
17598 buttonLabel?: string;
17599 filters?: FileFilter[];
17601 * Message to display above text fields.
17607 * Custom label for the text displayed in front of the filename text field.
17611 nameFieldLabel?: string;
17613 * Show the tags input box, defaults to `true`.
17617 showsTagField?: boolean;
17618 properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
17620 * Create a security scoped bookmark when packaged for the Mac App Store. If this
17621 * option is enabled and the file doesn't already exist a blank file will be
17622 * created at the chosen path.
17624 * @platform darwin,mas
17626 securityScopedBookmarks?: boolean;
17629 interface SelectHidDeviceDetails {
17630 deviceList: HIDDevice[];
17631 frame: WebFrameMain;
17634 interface SelectUsbDeviceDetails {
17635 deviceList: USBDevice[];
17636 frame: WebFrameMain;
17639 interface SerialPortRevokedDetails {
17641 frame: WebFrameMain;
17643 * The origin that the device has been revoked from.
17648 interface Settings {
17650 * `true` to open the app at login, `false` to remove the app as a login item.
17651 * Defaults to `false`.
17653 openAtLogin?: boolean;
17655 * `true` to open the app as hidden. Defaults to `false`. The user can edit this
17656 * setting from the System Preferences so
17657 * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
17658 * opened to know the current value. This setting is not available on MAS builds.
17662 openAsHidden?: boolean;
17664 * The executable to launch at login. Defaults to `process.execPath`.
17670 * The command-line arguments to pass to the executable. Defaults to an empty
17671 * array. Take care to wrap paths in quotes.
17677 * `true` will change the startup approved registry key and `enable / disable` the
17678 * App in Task Manager and Windows Settings. Defaults to `true`.
17684 * value name to write into registry. Defaults to the app's AppUserModelId(). Set
17685 * the app's login item settings.
17692 interface SourcesOptions {
17694 * An array of strings that lists the types of desktop sources to be captured,
17695 * available types can be `screen` and `window`.
17697 types: Array<'screen' | 'window'>;
17699 * The size that the media source thumbnail should be scaled to. Default is `150` x
17700 * `150`. Set width or height to 0 when you do not need the thumbnails. This will
17701 * save the processing time required for capturing the content of each window and
17704 thumbnailSize?: Size;
17706 * Set to true to enable fetching window icons. The default value is false. When
17707 * false the appIcon property of the sources return null. Same if a source has the
17710 fetchWindowIcons?: boolean;
17713 interface SSLConfigConfig {
17715 * Can be `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. The minimum SSL version to allow
17716 * when connecting to remote servers. Defaults to `tls1`.
17718 minVersion?: ('tls1' | 'tls1.1' | 'tls1.2' | 'tls1.3');
17720 * Can be `tls1.2` or `tls1.3`. The maximum SSL version to allow when connecting to
17721 * remote servers. Defaults to `tls1.3`.
17723 maxVersion?: ('tls1.2' | 'tls1.3');
17725 * List of cipher suites which should be explicitly prevented from being used in
17726 * addition to those disabled by the net built-in policy. Supported literal forms:
17727 * 0xAABB, where AA is `cipher_suite[0]` and BB is `cipher_suite[1]`, as defined in
17728 * RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form
17729 * will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify
17730 * 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note
17731 * that TLSv1.3 ciphers cannot be disabled using this mechanism.
17733 disabledCipherSuites?: number[];
17736 interface StartLoggingOptions {
17738 * What kinds of data should be captured. By default, only metadata about requests
17739 * will be captured. Setting this to `includeSensitive` will include cookies and
17740 * authentication data. Setting it to `everything` will include all bytes
17741 * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
17743 captureMode?: ('default' | 'includeSensitive' | 'everything');
17745 * When the log grows beyond this size, logging will automatically stop. Defaults
17748 maxFileSize?: number;
17751 interface Streams {
17752 video?: (Video) | (WebFrameMain);
17754 * If a string is specified, can be `loopback` or `loopbackWithMute`. Specifying a
17755 * loopback device will capture system audio, and is currently only supported on
17756 * Windows. If a WebFrameMain is specified, will capture audio from that frame.
17758 audio?: (('loopback' | 'loopbackWithMute')) | (WebFrameMain);
17760 * If `audio` is a WebFrameMain and this is set to `true`, then local playback of
17761 * audio will not be muted (e.g. using `MediaRecorder` to record `WebFrameMain`
17762 * with this flag set to `true` will allow audio to pass through to the speakers
17763 * while recording). Default is `false`.
17765 enableLocalEcho?: boolean;
17768 interface SystemMemoryInfo {
17770 * The total amount of physical memory in Kilobytes available to the system.
17774 * The total amount of memory not being used by applications or disk cache.
17778 * The total amount of swap memory in Kilobytes available to the system.
17780 * @platform win32,linux
17784 * The free amount of swap memory in Kilobytes available to the system.
17786 * @platform win32,linux
17791 interface TitleBarOverlay {
17793 * The CSS color of the Window Controls Overlay when enabled. Default is the system
17800 * The CSS color of the symbols on the Window Controls Overlay when enabled.
17801 * Default is the system color.
17805 symbolColor?: string;
17807 * The height of the title bar and Window Controls Overlay in pixels. Default is
17810 * @platform darwin,win32
17815 interface TitleBarOverlayOptions {
17817 * The CSS color of the Window Controls Overlay when enabled.
17823 * The CSS color of the symbols on the Window Controls Overlay when enabled.
17827 symbolColor?: string;
17829 * The height of the title bar and Window Controls Overlay in pixels.
17831 * @platform darwin,win32
17836 interface TitleOptions {
17838 * The font family variant to display, can be `monospaced` or `monospacedDigit`.
17839 * `monospaced` is available in macOS 10.15+ When left blank, the title uses the
17840 * default system font.
17842 fontType?: ('monospaced' | 'monospacedDigit');
17845 interface ToBitmapOptions {
17849 scaleFactor?: number;
17852 interface ToDataURLOptions {
17856 scaleFactor?: number;
17859 interface ToPNGOptions {
17863 scaleFactor?: number;
17866 interface TouchBarButtonConstructorOptions {
17872 * A short description of the button for use by screenreaders like VoiceOver.
17874 accessibilityLabel?: string;
17876 * Button background color in hex format, i.e `#ABCDEF`.
17878 backgroundColor?: string;
17882 icon?: (NativeImage) | (string);
17884 * Can be `left`, `right` or `overlay`. Defaults to `overlay`.
17886 iconPosition?: ('left' | 'right' | 'overlay');
17888 * Function to call when the button is clicked.
17890 click?: () => void;
17892 * Whether the button is in an enabled state. Default is `true`.
17897 interface TouchBarColorPickerConstructorOptions {
17899 * Array of hex color strings to appear as possible colors to select.
17901 availableColors?: string[];
17903 * The selected hex color in the picker, i.e `#ABCDEF`.
17905 selectedColor?: string;
17907 * Function to call when a color is selected.
17909 change?: (color: string) => void;
17912 interface TouchBarConstructorOptions {
17913 items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
17914 escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
17917 interface TouchBarGroupConstructorOptions {
17919 * Items to display as a group.
17924 interface TouchBarLabelConstructorOptions {
17930 * A short description of the button for use by screenreaders like VoiceOver.
17932 accessibilityLabel?: string;
17934 * Hex color of text, i.e `#ABCDEF`.
17936 textColor?: string;
17939 interface TouchBarPopoverConstructorOptions {
17941 * Popover button text.
17945 * Popover button icon.
17947 icon?: NativeImage;
17949 * Items to display in the popover.
17953 * `true` to display a close button on the left of the popover, `false` to not show
17954 * it. Default is `true`.
17956 showCloseButton?: boolean;
17959 interface TouchBarScrubberConstructorOptions {
17961 * An array of items to place in this scrubber.
17963 items: ScrubberItem[];
17965 * Called when the user taps an item that was not the last tapped item.
17967 select?: (selectedIndex: number) => void;
17969 * Called when the user taps any item.
17971 highlight?: (highlightedIndex: number) => void;
17973 * Selected item style. Can be `background`, `outline` or `none`. Defaults to
17976 selectedStyle?: ('background' | 'outline' | 'none');
17978 * Selected overlay item style. Can be `background`, `outline` or `none`. Defaults
17981 overlayStyle?: ('background' | 'outline' | 'none');
17983 * Whether to show arrow buttons. Defaults to `false` and is only shown if `items`
17986 showArrowButtons?: boolean;
17988 * Can be `fixed` or `free`. The default is `free`.
17990 mode?: ('fixed' | 'free');
17992 * Defaults to `true`.
17994 continuous?: boolean;
17997 interface TouchBarSegmentedControlConstructorOptions {
17999 * Style of the segments:
18001 segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
18003 * The selection mode of the control:
18005 mode?: ('single' | 'multiple' | 'buttons');
18007 * An array of segments to place in this control.
18009 segments: SegmentedControlSegment[];
18011 * The index of the currently selected segment, will update automatically with user
18012 * interaction. When the mode is `multiple` it will be the last selected item.
18014 selectedIndex?: number;
18016 * Called when the user selects a new segment.
18018 change?: (selectedIndex: number, isSelected: boolean) => void;
18021 interface TouchBarSliderConstructorOptions {
18039 * Function to call when the slider is changed.
18041 change?: (newValue: number) => void;
18044 interface TouchBarSpacerConstructorOptions {
18046 * Size of spacer, possible values are:
18048 size?: ('small' | 'large' | 'flexible');
18051 interface TraceBufferUsageReturnValue {
18053 percentage: number;
18056 interface UdpPortRange {
18058 * The minimum UDP port number that WebRTC should use.
18062 * The maximum UDP port number that WebRTC should use.
18067 interface UpdateTargetUrlEvent extends DOMEvent {
18071 interface UploadProgress {
18073 * Whether the request is currently active. If this is false no other properties
18078 * Whether the upload has started. If this is false both `current` and `total` will
18083 * The number of bytes that have been uploaded so far
18087 * The number of bytes that will be uploaded this request
18092 interface UsbDeviceRevokedDetails {
18095 * The origin that the device has been revoked from.
18100 interface USBProtectedClassesHandlerHandlerDetails {
18102 * The current list of protected USB classes. Possible class values include:
18104 protectedClasses: Array<'audio' | 'audio-video' | 'hid' | 'mass-storage' | 'smart-card' | 'video' | 'wireless'>;
18107 interface VisibleOnAllWorkspacesOptions {
18109 * Sets whether the window should be visible above fullscreen windows.
18113 visibleOnFullScreen?: boolean;
18115 * Calling setVisibleOnAllWorkspaces will by default transform the process type
18116 * between UIElementApplication and ForegroundApplication to ensure the correct
18117 * behavior. However, this will hide the window and dock for a short time every
18118 * time it is called. If your window is already of type UIElementApplication, you
18119 * can bypass this transformation by passing true to skipTransformProcessType.
18123 skipTransformProcessType?: boolean;
18126 interface WebContentsAudioStateChangedEventParams {
18128 * True if one or more frames or child `webContents` are emitting audio.
18133 interface WebContentsDidRedirectNavigationEventParams {
18135 * The URL the frame is navigating to.
18139 * Whether the navigation happened without changing document. Examples of same
18140 * document navigations are reference fragment navigations, pushState/replaceState,
18141 * and same page history navigation.
18143 isSameDocument: boolean;
18145 * True if the navigation is taking place in a main frame.
18147 isMainFrame: boolean;
18149 * The frame to be navigated.
18151 frame: WebFrameMain;
18153 * The frame which initiated the navigation, which can be a parent frame (e.g. via
18154 * `window.open` with a frame's name), or null if the navigation was not initiated
18155 * by a frame. This can also be null if the initiating frame was deleted before the
18156 * event was emitted.
18158 initiator?: WebFrameMain;
18161 interface WebContentsDidStartNavigationEventParams {
18163 * The URL the frame is navigating to.
18167 * Whether the navigation happened without changing document. Examples of same
18168 * document navigations are reference fragment navigations, pushState/replaceState,
18169 * and same page history navigation.
18171 isSameDocument: boolean;
18173 * True if the navigation is taking place in a main frame.
18175 isMainFrame: boolean;
18177 * The frame to be navigated.
18179 frame: WebFrameMain;
18181 * The frame which initiated the navigation, which can be a parent frame (e.g. via
18182 * `window.open` with a frame's name), or null if the navigation was not initiated
18183 * by a frame. This can also be null if the initiating frame was deleted before the
18184 * event was emitted.
18186 initiator?: WebFrameMain;
18189 interface WebContentsPrintOptions {
18191 * Don't ask user for print settings. Default is `false`.
18195 * Prints the background color and image of the web page. Default is `false`.
18197 printBackground?: boolean;
18199 * Set the printer device name to use. Must be the system-defined name and not the
18200 * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
18202 deviceName?: string;
18204 * Set whether the printed web page will be in color or grayscale. Default is
18210 * Whether the web page should be printed in landscape mode. Default is `false`.
18212 landscape?: boolean;
18214 * The scale factor of the web page.
18216 scaleFactor?: number;
18218 * The number of pages to print per page sheet.
18220 pagesPerSheet?: number;
18222 * Whether the web page should be collated.
18226 * The number of copies of the web page to print.
18230 * The page range to print. On macOS, only one range is honored.
18232 pageRanges?: PageRanges[];
18234 * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
18237 duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
18238 dpi?: Record<string, number>;
18240 * string to be printed as page header.
18244 * string to be printed as page footer.
18248 * Specify page size of the printed document. Can be `A0`, `A1`, `A2`, `A3`, `A4`,
18249 * `A5`, `A6`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and
18252 pageSize?: (('A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'Legal' | 'Letter' | 'Tabloid')) | (Size);
18255 interface WebContentsWillFrameNavigateEventParams {
18257 * The URL the frame is navigating to.
18261 * This event does not fire for same document navigations using window.history api
18262 * and reference fragment navigations. This property is always set to `false` for
18265 isSameDocument: boolean;
18267 * True if the navigation is taking place in a main frame.
18269 isMainFrame: boolean;
18271 * The frame to be navigated.
18273 frame: WebFrameMain;
18275 * The frame which initiated the navigation, which can be a parent frame (e.g. via
18276 * `window.open` with a frame's name), or null if the navigation was not initiated
18277 * by a frame. This can also be null if the initiating frame was deleted before the
18278 * event was emitted.
18280 initiator?: WebFrameMain;
18283 interface WebContentsWillNavigateEventParams {
18285 * The URL the frame is navigating to.
18289 * This event does not fire for same document navigations using window.history api
18290 * and reference fragment navigations. This property is always set to `false` for
18293 isSameDocument: boolean;
18295 * True if the navigation is taking place in a main frame.
18297 isMainFrame: boolean;
18299 * The frame to be navigated.
18301 frame: WebFrameMain;
18303 * The frame which initiated the navigation, which can be a parent frame (e.g. via
18304 * `window.open` with a frame's name), or null if the navigation was not initiated
18305 * by a frame. This can also be null if the initiating frame was deleted before the
18306 * event was emitted.
18308 initiator?: WebFrameMain;
18311 interface WebContentsWillRedirectEventParams {
18313 * The URL the frame is navigating to.
18317 * Whether the navigation happened without changing document. Examples of same
18318 * document navigations are reference fragment navigations, pushState/replaceState,
18319 * and same page history navigation.
18321 isSameDocument: boolean;
18323 * True if the navigation is taking place in a main frame.
18325 isMainFrame: boolean;
18327 * The frame to be navigated.
18329 frame: WebFrameMain;
18331 * The frame which initiated the navigation, which can be a parent frame (e.g. via
18332 * `window.open` with a frame's name), or null if the navigation was not initiated
18333 * by a frame. This can also be null if the initiating frame was deleted before the
18334 * event was emitted.
18336 initiator?: WebFrameMain;
18339 interface WebRTCUDPPortRange {
18341 * The minimum UDP port number that WebRTC should use.
18345 * The maximum UDP port number that WebRTC should use.
18350 interface WebviewTagPrintOptions {
18352 * Don't ask user for print settings. Default is `false`.
18356 * Prints the background color and image of the web page. Default is `false`.
18358 printBackground?: boolean;
18360 * Set the printer device name to use. Must be the system-defined name and not the
18361 * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
18363 deviceName?: string;
18365 * Set whether the printed web page will be in color or grayscale. Default is
18371 * Whether the web page should be printed in landscape mode. Default is `false`.
18373 landscape?: boolean;
18375 * The scale factor of the web page.
18377 scaleFactor?: number;
18379 * The number of pages to print per page sheet.
18381 pagesPerSheet?: number;
18383 * Whether the web page should be collated.
18387 * The number of copies of the web page to print.
18391 * The page range to print.
18393 pageRanges?: PageRanges[];
18395 * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
18398 duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
18399 dpi?: Record<string, number>;
18401 * string to be printed as page header.
18405 * string to be printed as page footer.
18409 * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
18410 * `Letter`, `Tabloid` or an Object containing `height` in microns.
18412 pageSize?: (('A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid')) | (Size);
18415 interface WillFrameNavigateEvent extends DOMEvent {
18417 isMainFrame: boolean;
18418 frameProcessId: number;
18419 frameRoutingId: number;
18422 interface WillNavigateEvent extends DOMEvent {
18426 interface WillResizeDetails {
18428 * The edge of the window being dragged for resizing. Can be `bottom`, `left`,
18429 * `right`, `top-left`, `top-right`, `bottom-left` or `bottom-right`.
18431 edge: ('bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right');
18434 interface EditFlags {
18436 * Whether the renderer believes it can undo.
18440 * Whether the renderer believes it can redo.
18444 * Whether the renderer believes it can cut.
18448 * Whether the renderer believes it can copy.
18452 * Whether the renderer believes it can paste.
18456 * Whether the renderer believes it can delete.
18458 canDelete: boolean;
18460 * Whether the renderer believes it can select all.
18462 canSelectAll: boolean;
18464 * Whether the renderer believes it can edit text richly.
18466 canEditRichly: boolean;
18472 interface FoundInPageResult {
18475 * Position of the active match.
18477 activeMatchOrdinal: number;
18479 * Number of Matches.
18483 * Coordinates of first match region.
18485 selectionArea: Rectangle;
18486 finalUpdate: boolean;
18489 interface LaunchItems {
18491 * name value of a registry entry.
18497 * The executable to an app that corresponds to a registry entry.
18503 * the command-line arguments to pass to the executable.
18509 * one of `user` or `machine`. Indicates whether the registry entry is under
18510 * `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
18516 * `true` if the app registry key is startup approved and therefore shows as
18517 * `enabled` in Task Manager and Windows settings.
18524 interface Margins {
18526 * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
18527 * you will also need to specify `top`, `bottom`, `left`, and `right`.
18529 marginType?: ('default' | 'none' | 'printableArea' | 'custom');
18531 * The top margin of the printed web page, in pixels.
18535 * The bottom margin of the printed web page, in pixels.
18539 * The left margin of the printed web page, in pixels.
18543 * The right margin of the printed web page, in pixels.
18548 interface MediaFlags {
18550 * Whether the media element has crashed.
18554 * Whether the media element is paused.
18558 * Whether the media element is muted.
18562 * Whether the media element has audio.
18566 * Whether the media element is looping.
18568 isLooping: boolean;
18570 * Whether the media element's controls are visible.
18572 isControlsVisible: boolean;
18574 * Whether the media element's controls are toggleable.
18576 canToggleControls: boolean;
18578 * Whether the media element can be printed.
18582 * Whether or not the media element can be downloaded.
18586 * Whether the media element can show picture-in-picture.
18588 canShowPictureInPicture: boolean;
18590 * Whether the media element is currently showing picture-in-picture.
18592 isShowingPictureInPicture: boolean;
18594 * Whether the media element can be rotated.
18596 canRotate: boolean;
18598 * Whether the media element can be looped.
18603 interface PageRanges {
18605 * Index of the first page to print (0-based).
18609 * Index of the last page to print (inclusive) (0-based).
18624 * URL of the link that encloses the node the context menu was invoked on.
18628 * Text associated with the link. May be an empty string if the contents of the
18629 * link are an image.
18633 * URL of the top level page that the context menu was invoked on.
18637 * URL of the subframe that the context menu was invoked on.
18641 * Source URL for the element that the context menu was invoked on. Elements with
18642 * source URLs are images, audio and video.
18646 * Type of the node the context menu was invoked on. Can be `none`, `image`,
18647 * `audio`, `video`, `canvas`, `file` or `plugin`.
18649 mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
18651 * Whether the context menu was invoked on an image which has non-empty contents.
18653 hasImageContents: boolean;
18655 * Whether the context is editable.
18657 isEditable: boolean;
18659 * Text of the selection that the context menu was invoked on.
18661 selectionText: string;
18663 * Title text of the selection that the context menu was invoked on.
18667 * Alt text of the selection that the context menu was invoked on.
18671 * Suggested filename to be used when saving file through 'Save Link As' option of
18674 suggestedFilename: string;
18676 * Rect representing the coordinates in the document space of the selection.
18678 selectionRect: Rectangle;
18680 * Start position of the selection text.
18682 selectionStartOffset: number;
18684 * The referrer policy of the frame on which the menu is invoked.
18686 referrerPolicy: Referrer;
18688 * The misspelled word under the cursor, if any.
18690 misspelledWord: string;
18692 * An array of suggested words to show the user to replace the `misspelledWord`.
18693 * Only available if there is a misspelled word and spellchecker is enabled.
18695 dictionarySuggestions: string[];
18697 * The character encoding of the frame on which the menu was invoked.
18699 frameCharset: string;
18701 * The source that the context menu was invoked on. Possible values include `none`,
18702 * `button-button`, `field-set`, `input-button`, `input-checkbox`, `input-color`,
18703 * `input-date`, `input-datetime-local`, `input-email`, `input-file`,
18704 * `input-hidden`, `input-image`, `input-month`, `input-number`, `input-password`,
18705 * `input-radio`, `input-range`, `input-reset`, `input-search`, `input-submit`,
18706 * `input-telephone`, `input-text`, `input-time`, `input-url`, `input-week`,
18707 * `output`, `reset-button`, `select-list`, `select-list`, `select-multiple`,
18708 * `select-one`, `submit-button`, and `text-area`,
18710 formControlType: ('none' | 'button-button' | 'field-set' | 'input-button' | 'input-checkbox' | 'input-color' | 'input-date' | 'input-datetime-local' | 'input-email' | 'input-file' | 'input-hidden' | 'input-image' | 'input-month' | 'input-number' | 'input-password' | 'input-radio' | 'input-range' | 'input-reset' | 'input-search' | 'input-submit' | 'input-telephone' | 'input-text' | 'input-time' | 'input-url' | 'input-week' | 'output' | 'reset-button' | 'select-list' | 'select-list' | 'select-multiple' | 'select-one' | 'submit-button' | 'text-area');
18712 * If the context menu was invoked on an input field, the type of that field.
18713 * Possible values include `none`, `plainText`, `password`, `other`.
18717 inputFieldType: ('none' | 'plainText' | 'password' | 'other');
18719 * If the context is editable, whether or not spellchecking is enabled.
18721 spellcheckEnabled: boolean;
18723 * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
18724 * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
18725 * `adjustSelection`, or `adjustSelectionReset`.
18727 menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
18729 * The flags for the media element the context menu was invoked on.
18731 mediaFlags: MediaFlags;
18733 * These flags indicate whether the renderer believes it is able to perform the
18734 * corresponding action.
18736 editFlags: EditFlags;
18741 * The id of the stream being granted. This will usually come from a
18742 * DesktopCapturerSource object.
18746 * The name of the stream being granted. This will usually come from a
18747 * DesktopCapturerSource object.
18752 interface RemoteMainInterface {
18754 autoUpdater: AutoUpdater;
18755 BrowserView: typeof BrowserView;
18756 BrowserWindow: typeof BrowserWindow;
18757 clipboard: Clipboard;
18758 contentTracing: ContentTracing;
18759 crashReporter: CrashReporter;
18760 desktopCapturer: DesktopCapturer;
18762 globalShortcut: GlobalShortcut;
18763 inAppPurchase: InAppPurchase;
18766 MenuItem: typeof MenuItem;
18767 MessageChannelMain: typeof MessageChannelMain;
18768 nativeImage: typeof NativeImage;
18769 nativeTheme: NativeTheme;
18772 Notification: typeof Notification;
18773 powerMonitor: PowerMonitor;
18774 powerSaveBlocker: PowerSaveBlocker;
18775 protocol: Protocol;
18776 pushNotifications: PushNotifications;
18777 safeStorage: SafeStorage;
18779 session: typeof Session;
18780 ShareMenu: typeof ShareMenu;
18782 systemPreferences: SystemPreferences;
18783 TouchBar: typeof TouchBar;
18785 utilityProcess: typeof UtilityProcess;
18786 webContents: typeof WebContents;
18787 webFrameMain: typeof WebFrameMain;
18793 type Event<Params extends object = {}> = Electron.Event<Params>;
18794 const clipboard: Clipboard;
18795 type Clipboard = Electron.Clipboard;
18796 const crashReporter: CrashReporter;
18797 type CrashReporter = Electron.CrashReporter;
18798 const nativeImage: typeof NativeImage;
18799 type NativeImage = Electron.NativeImage;
18800 const shell: Shell;
18801 type Shell = Electron.Shell;
18802 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
18803 type AddRepresentationOptions = Electron.AddRepresentationOptions;
18804 type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
18805 type AnimationSettings = Electron.AnimationSettings;
18806 type AppDetailsOptions = Electron.AppDetailsOptions;
18807 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
18808 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
18809 type AuthInfo = Electron.AuthInfo;
18810 type AutoResizeOptions = Electron.AutoResizeOptions;
18811 type BeforeSendResponse = Electron.BeforeSendResponse;
18812 type BitmapOptions = Electron.BitmapOptions;
18813 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
18814 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
18815 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
18816 type CallbackResponse = Electron.CallbackResponse;
18817 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
18818 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
18819 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
18820 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
18821 type CloseOpts = Electron.CloseOpts;
18822 type Config = Electron.Config;
18823 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
18824 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
18825 type ContextMenuEvent = Electron.ContextMenuEvent;
18826 type ContextMenuParams = Electron.ContextMenuParams;
18827 type ContinueActivityDetails = Electron.ContinueActivityDetails;
18828 type CookiesGetFilter = Electron.CookiesGetFilter;
18829 type CookiesSetDetails = Electron.CookiesSetDetails;
18830 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
18831 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
18832 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
18833 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
18834 type Data = Electron.Data;
18835 type DefaultFontFamily = Electron.DefaultFontFamily;
18836 type Details = Electron.Details;
18837 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
18838 type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
18839 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
18840 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
18841 type DidFailLoadEvent = Electron.DidFailLoadEvent;
18842 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
18843 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
18844 type DidNavigateEvent = Electron.DidNavigateEvent;
18845 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
18846 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
18847 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
18848 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
18849 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
18850 type DownloadURLOptions = Electron.DownloadURLOptions;
18851 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
18852 type FeedURLOptions = Electron.FeedURLOptions;
18853 type FileIconOptions = Electron.FileIconOptions;
18854 type FindInPageOptions = Electron.FindInPageOptions;
18855 type FocusOptions = Electron.FocusOptions;
18856 type ForkOptions = Electron.ForkOptions;
18857 type FoundInPageEvent = Electron.FoundInPageEvent;
18858 type FrameCreatedDetails = Electron.FrameCreatedDetails;
18859 type FromPartitionOptions = Electron.FromPartitionOptions;
18860 type FromPathOptions = Electron.FromPathOptions;
18861 type HandlerDetails = Electron.HandlerDetails;
18862 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
18863 type HeapStatistics = Electron.HeapStatistics;
18864 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
18865 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
18866 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
18867 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
18868 type ImportCertificateOptions = Electron.ImportCertificateOptions;
18869 type Info = Electron.Info;
18870 type Input = Electron.Input;
18871 type InsertCSSOptions = Electron.InsertCSSOptions;
18872 type IpcMessageEvent = Electron.IpcMessageEvent;
18873 type Item = Electron.Item;
18874 type JumpListSettings = Electron.JumpListSettings;
18875 type LoadCommitEvent = Electron.LoadCommitEvent;
18876 type LoadExtensionOptions = Electron.LoadExtensionOptions;
18877 type LoadFileOptions = Electron.LoadFileOptions;
18878 type LoadURLOptions = Electron.LoadURLOptions;
18879 type LoginItemSettings = Electron.LoginItemSettings;
18880 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
18881 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
18882 type MessageBoxOptions = Electron.MessageBoxOptions;
18883 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
18884 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
18885 type MessageDetails = Electron.MessageDetails;
18886 type MessageEvent = Electron.MessageEvent;
18887 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
18888 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
18889 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
18890 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
18891 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
18892 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
18893 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
18894 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
18895 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
18896 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
18897 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
18898 type OpenDialogOptions = Electron.OpenDialogOptions;
18899 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
18900 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
18901 type OpenExternalOptions = Electron.OpenExternalOptions;
18902 type Options = Electron.Options;
18903 type Opts = Electron.Opts;
18904 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
18905 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
18906 type Parameters = Electron.Parameters;
18907 type Payment = Electron.Payment;
18908 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
18909 type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
18910 type PluginCrashedEvent = Electron.PluginCrashedEvent;
18911 type PopupOptions = Electron.PopupOptions;
18912 type PreconnectOptions = Electron.PreconnectOptions;
18913 type PrintToPDFOptions = Electron.PrintToPDFOptions;
18914 type Privileges = Electron.Privileges;
18915 type ProgressBarOptions = Electron.ProgressBarOptions;
18916 type Provider = Electron.Provider;
18917 type PurchaseProductOpts = Electron.PurchaseProductOpts;
18918 type ReadBookmark = Electron.ReadBookmark;
18919 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
18920 type RelaunchOptions = Electron.RelaunchOptions;
18921 type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
18922 type Request = Electron.Request;
18923 type ResizeOptions = Electron.ResizeOptions;
18924 type ResolveHostOptions = Electron.ResolveHostOptions;
18925 type ResourceUsage = Electron.ResourceUsage;
18926 type Response = Electron.Response;
18927 type Result = Electron.Result;
18928 type SaveDialogOptions = Electron.SaveDialogOptions;
18929 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
18930 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
18931 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
18932 type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
18933 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
18934 type Settings = Electron.Settings;
18935 type SourcesOptions = Electron.SourcesOptions;
18936 type SSLConfigConfig = Electron.SSLConfigConfig;
18937 type StartLoggingOptions = Electron.StartLoggingOptions;
18938 type Streams = Electron.Streams;
18939 type SystemMemoryInfo = Electron.SystemMemoryInfo;
18940 type TitleBarOverlay = Electron.TitleBarOverlay;
18941 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
18942 type TitleOptions = Electron.TitleOptions;
18943 type ToBitmapOptions = Electron.ToBitmapOptions;
18944 type ToDataURLOptions = Electron.ToDataURLOptions;
18945 type ToPNGOptions = Electron.ToPNGOptions;
18946 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
18947 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
18948 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
18949 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
18950 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
18951 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
18952 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
18953 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
18954 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
18955 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
18956 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
18957 type UdpPortRange = Electron.UdpPortRange;
18958 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
18959 type UploadProgress = Electron.UploadProgress;
18960 type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
18961 type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
18962 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
18963 type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
18964 type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
18965 type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
18966 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
18967 type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
18968 type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
18969 type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
18970 type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
18971 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
18972 type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
18973 type WillNavigateEvent = Electron.WillNavigateEvent;
18974 type WillResizeDetails = Electron.WillResizeDetails;
18975 type EditFlags = Electron.EditFlags;
18976 type Env = Electron.Env;
18977 type FoundInPageResult = Electron.FoundInPageResult;
18978 type LaunchItems = Electron.LaunchItems;
18979 type Margins = Electron.Margins;
18980 type MediaFlags = Electron.MediaFlags;
18981 type PageRanges = Electron.PageRanges;
18982 type Params = Electron.Params;
18983 type Video = Electron.Video;
18984 type BluetoothDevice = Electron.BluetoothDevice;
18985 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
18986 type Certificate = Electron.Certificate;
18987 type CertificatePrincipal = Electron.CertificatePrincipal;
18988 type Cookie = Electron.Cookie;
18989 type CPUUsage = Electron.CPUUsage;
18990 type CrashReport = Electron.CrashReport;
18991 type CustomScheme = Electron.CustomScheme;
18992 type DesktopCapturerSource = Electron.DesktopCapturerSource;
18993 type Display = Electron.Display;
18994 type Extension = Electron.Extension;
18995 type ExtensionInfo = Electron.ExtensionInfo;
18996 type FileFilter = Electron.FileFilter;
18997 type FilePathWithHeaders = Electron.FilePathWithHeaders;
18998 type GPUFeatureStatus = Electron.GPUFeatureStatus;
18999 type HIDDevice = Electron.HIDDevice;
19000 type InputEvent = Electron.InputEvent;
19001 type IOCounters = Electron.IOCounters;
19002 type IpcMainEvent = Electron.IpcMainEvent;
19003 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
19004 type IpcRendererEvent = Electron.IpcRendererEvent;
19005 type JumpListCategory = Electron.JumpListCategory;
19006 type JumpListItem = Electron.JumpListItem;
19007 type KeyboardEvent = Electron.KeyboardEvent;
19008 type KeyboardInputEvent = Electron.KeyboardInputEvent;
19009 type MemoryInfo = Electron.MemoryInfo;
19010 type MemoryUsageDetails = Electron.MemoryUsageDetails;
19011 type MimeTypedBuffer = Electron.MimeTypedBuffer;
19012 type MouseInputEvent = Electron.MouseInputEvent;
19013 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
19014 type NotificationAction = Electron.NotificationAction;
19015 type NotificationResponse = Electron.NotificationResponse;
19016 type PaymentDiscount = Electron.PaymentDiscount;
19017 type Point = Electron.Point;
19018 type PostBody = Electron.PostBody;
19019 type PrinterInfo = Electron.PrinterInfo;
19020 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
19021 type ProcessMetric = Electron.ProcessMetric;
19022 type Product = Electron.Product;
19023 type ProductDiscount = Electron.ProductDiscount;
19024 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
19025 type ProtocolRequest = Electron.ProtocolRequest;
19026 type ProtocolResponse = Electron.ProtocolResponse;
19027 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
19028 type Rectangle = Electron.Rectangle;
19029 type Referrer = Electron.Referrer;
19030 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
19031 type ResolvedEndpoint = Electron.ResolvedEndpoint;
19032 type ResolvedHost = Electron.ResolvedHost;
19033 type ScrubberItem = Electron.ScrubberItem;
19034 type SegmentedControlSegment = Electron.SegmentedControlSegment;
19035 type SerialPort = Electron.SerialPort;
19036 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
19037 type SharedWorkerInfo = Electron.SharedWorkerInfo;
19038 type SharingItem = Electron.SharingItem;
19039 type ShortcutDetails = Electron.ShortcutDetails;
19040 type Size = Electron.Size;
19041 type Task = Electron.Task;
19042 type ThumbarButton = Electron.ThumbarButton;
19043 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
19044 type TraceConfig = Electron.TraceConfig;
19045 type Transaction = Electron.Transaction;
19046 type UploadData = Electron.UploadData;
19047 type UploadFile = Electron.UploadFile;
19048 type UploadRawData = Electron.UploadRawData;
19049 type USBDevice = Electron.USBDevice;
19050 type UserDefaultTypes = Electron.UserDefaultTypes;
19051 type WebPreferences = Electron.WebPreferences;
19052 type WebRequestFilter = Electron.WebRequestFilter;
19053 type WebSource = Electron.WebSource;
19057 type Event<Params extends object = {}> = Electron.Event<Params>;
19059 type App = Electron.App;
19060 const autoUpdater: AutoUpdater;
19061 type AutoUpdater = Electron.AutoUpdater;
19062 class BrowserView extends Electron.BrowserView {}
19063 class BrowserWindow extends Electron.BrowserWindow {}
19064 type ClientRequest = Electron.ClientRequest;
19065 type CommandLine = Electron.CommandLine;
19066 const contentTracing: ContentTracing;
19067 type ContentTracing = Electron.ContentTracing;
19068 type Cookies = Electron.Cookies;
19069 type Debugger = Electron.Debugger;
19070 const desktopCapturer: DesktopCapturer;
19071 type DesktopCapturer = Electron.DesktopCapturer;
19072 const dialog: Dialog;
19073 type Dialog = Electron.Dialog;
19074 type Dock = Electron.Dock;
19075 type DownloadItem = Electron.DownloadItem;
19076 const globalShortcut: GlobalShortcut;
19077 type GlobalShortcut = Electron.GlobalShortcut;
19078 const inAppPurchase: InAppPurchase;
19079 type InAppPurchase = Electron.InAppPurchase;
19080 type IncomingMessage = Electron.IncomingMessage;
19081 const ipcMain: IpcMain;
19082 type IpcMain = Electron.IpcMain;
19083 class Menu extends Electron.Menu {}
19084 class MenuItem extends Electron.MenuItem {}
19085 class MessageChannelMain extends Electron.MessageChannelMain {}
19086 type MessagePortMain = Electron.MessagePortMain;
19087 const nativeTheme: NativeTheme;
19088 type NativeTheme = Electron.NativeTheme;
19090 type Net = Electron.Net;
19091 const netLog: NetLog;
19092 type NetLog = Electron.NetLog;
19093 class Notification extends Electron.Notification {}
19094 const powerMonitor: PowerMonitor;
19095 type PowerMonitor = Electron.PowerMonitor;
19096 const powerSaveBlocker: PowerSaveBlocker;
19097 type PowerSaveBlocker = Electron.PowerSaveBlocker;
19098 const protocol: Protocol;
19099 type Protocol = Electron.Protocol;
19100 const pushNotifications: PushNotifications;
19101 type PushNotifications = Electron.PushNotifications;
19102 const safeStorage: SafeStorage;
19103 type SafeStorage = Electron.SafeStorage;
19104 const screen: Screen;
19105 type Screen = Electron.Screen;
19106 type ServiceWorkers = Electron.ServiceWorkers;
19107 const session: typeof Session;
19108 type Session = Electron.Session;
19109 class ShareMenu extends Electron.ShareMenu {}
19110 const systemPreferences: SystemPreferences;
19111 type SystemPreferences = Electron.SystemPreferences;
19112 class TouchBar extends Electron.TouchBar {}
19113 type TouchBarButton = Electron.TouchBarButton;
19114 type TouchBarColorPicker = Electron.TouchBarColorPicker;
19115 type TouchBarGroup = Electron.TouchBarGroup;
19116 type TouchBarLabel = Electron.TouchBarLabel;
19117 type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
19118 type TouchBarPopover = Electron.TouchBarPopover;
19119 type TouchBarScrubber = Electron.TouchBarScrubber;
19120 type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
19121 type TouchBarSlider = Electron.TouchBarSlider;
19122 type TouchBarSpacer = Electron.TouchBarSpacer;
19123 class Tray extends Electron.Tray {}
19124 const utilityProcess: typeof UtilityProcess;
19125 type UtilityProcess = Electron.UtilityProcess;
19126 const webContents: typeof WebContents;
19127 type WebContents = Electron.WebContents;
19128 const webFrameMain: typeof WebFrameMain;
19129 type WebFrameMain = Electron.WebFrameMain;
19130 type WebRequest = Electron.WebRequest;
19131 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
19132 type AddRepresentationOptions = Electron.AddRepresentationOptions;
19133 type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
19134 type AnimationSettings = Electron.AnimationSettings;
19135 type AppDetailsOptions = Electron.AppDetailsOptions;
19136 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
19137 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
19138 type AuthInfo = Electron.AuthInfo;
19139 type AutoResizeOptions = Electron.AutoResizeOptions;
19140 type BeforeSendResponse = Electron.BeforeSendResponse;
19141 type BitmapOptions = Electron.BitmapOptions;
19142 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
19143 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
19144 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
19145 type CallbackResponse = Electron.CallbackResponse;
19146 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
19147 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
19148 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
19149 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
19150 type CloseOpts = Electron.CloseOpts;
19151 type Config = Electron.Config;
19152 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
19153 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
19154 type ContextMenuEvent = Electron.ContextMenuEvent;
19155 type ContextMenuParams = Electron.ContextMenuParams;
19156 type ContinueActivityDetails = Electron.ContinueActivityDetails;
19157 type CookiesGetFilter = Electron.CookiesGetFilter;
19158 type CookiesSetDetails = Electron.CookiesSetDetails;
19159 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
19160 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
19161 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
19162 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
19163 type Data = Electron.Data;
19164 type DefaultFontFamily = Electron.DefaultFontFamily;
19165 type Details = Electron.Details;
19166 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
19167 type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
19168 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
19169 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
19170 type DidFailLoadEvent = Electron.DidFailLoadEvent;
19171 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
19172 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
19173 type DidNavigateEvent = Electron.DidNavigateEvent;
19174 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
19175 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
19176 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
19177 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
19178 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
19179 type DownloadURLOptions = Electron.DownloadURLOptions;
19180 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
19181 type FeedURLOptions = Electron.FeedURLOptions;
19182 type FileIconOptions = Electron.FileIconOptions;
19183 type FindInPageOptions = Electron.FindInPageOptions;
19184 type FocusOptions = Electron.FocusOptions;
19185 type ForkOptions = Electron.ForkOptions;
19186 type FoundInPageEvent = Electron.FoundInPageEvent;
19187 type FrameCreatedDetails = Electron.FrameCreatedDetails;
19188 type FromPartitionOptions = Electron.FromPartitionOptions;
19189 type FromPathOptions = Electron.FromPathOptions;
19190 type HandlerDetails = Electron.HandlerDetails;
19191 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
19192 type HeapStatistics = Electron.HeapStatistics;
19193 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
19194 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
19195 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
19196 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
19197 type ImportCertificateOptions = Electron.ImportCertificateOptions;
19198 type Info = Electron.Info;
19199 type Input = Electron.Input;
19200 type InsertCSSOptions = Electron.InsertCSSOptions;
19201 type IpcMessageEvent = Electron.IpcMessageEvent;
19202 type Item = Electron.Item;
19203 type JumpListSettings = Electron.JumpListSettings;
19204 type LoadCommitEvent = Electron.LoadCommitEvent;
19205 type LoadExtensionOptions = Electron.LoadExtensionOptions;
19206 type LoadFileOptions = Electron.LoadFileOptions;
19207 type LoadURLOptions = Electron.LoadURLOptions;
19208 type LoginItemSettings = Electron.LoginItemSettings;
19209 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
19210 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
19211 type MessageBoxOptions = Electron.MessageBoxOptions;
19212 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
19213 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
19214 type MessageDetails = Electron.MessageDetails;
19215 type MessageEvent = Electron.MessageEvent;
19216 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
19217 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
19218 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
19219 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
19220 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
19221 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
19222 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
19223 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
19224 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
19225 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
19226 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
19227 type OpenDialogOptions = Electron.OpenDialogOptions;
19228 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
19229 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
19230 type OpenExternalOptions = Electron.OpenExternalOptions;
19231 type Options = Electron.Options;
19232 type Opts = Electron.Opts;
19233 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
19234 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
19235 type Parameters = Electron.Parameters;
19236 type Payment = Electron.Payment;
19237 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
19238 type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
19239 type PluginCrashedEvent = Electron.PluginCrashedEvent;
19240 type PopupOptions = Electron.PopupOptions;
19241 type PreconnectOptions = Electron.PreconnectOptions;
19242 type PrintToPDFOptions = Electron.PrintToPDFOptions;
19243 type Privileges = Electron.Privileges;
19244 type ProgressBarOptions = Electron.ProgressBarOptions;
19245 type Provider = Electron.Provider;
19246 type PurchaseProductOpts = Electron.PurchaseProductOpts;
19247 type ReadBookmark = Electron.ReadBookmark;
19248 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
19249 type RelaunchOptions = Electron.RelaunchOptions;
19250 type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
19251 type Request = Electron.Request;
19252 type ResizeOptions = Electron.ResizeOptions;
19253 type ResolveHostOptions = Electron.ResolveHostOptions;
19254 type ResourceUsage = Electron.ResourceUsage;
19255 type Response = Electron.Response;
19256 type Result = Electron.Result;
19257 type SaveDialogOptions = Electron.SaveDialogOptions;
19258 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
19259 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
19260 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
19261 type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
19262 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
19263 type Settings = Electron.Settings;
19264 type SourcesOptions = Electron.SourcesOptions;
19265 type SSLConfigConfig = Electron.SSLConfigConfig;
19266 type StartLoggingOptions = Electron.StartLoggingOptions;
19267 type Streams = Electron.Streams;
19268 type SystemMemoryInfo = Electron.SystemMemoryInfo;
19269 type TitleBarOverlay = Electron.TitleBarOverlay;
19270 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
19271 type TitleOptions = Electron.TitleOptions;
19272 type ToBitmapOptions = Electron.ToBitmapOptions;
19273 type ToDataURLOptions = Electron.ToDataURLOptions;
19274 type ToPNGOptions = Electron.ToPNGOptions;
19275 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
19276 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
19277 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
19278 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
19279 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
19280 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
19281 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
19282 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
19283 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
19284 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
19285 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
19286 type UdpPortRange = Electron.UdpPortRange;
19287 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
19288 type UploadProgress = Electron.UploadProgress;
19289 type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
19290 type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
19291 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
19292 type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
19293 type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
19294 type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
19295 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
19296 type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
19297 type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
19298 type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
19299 type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
19300 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
19301 type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
19302 type WillNavigateEvent = Electron.WillNavigateEvent;
19303 type WillResizeDetails = Electron.WillResizeDetails;
19304 type EditFlags = Electron.EditFlags;
19305 type Env = Electron.Env;
19306 type FoundInPageResult = Electron.FoundInPageResult;
19307 type LaunchItems = Electron.LaunchItems;
19308 type Margins = Electron.Margins;
19309 type MediaFlags = Electron.MediaFlags;
19310 type PageRanges = Electron.PageRanges;
19311 type Params = Electron.Params;
19312 type Video = Electron.Video;
19313 type BluetoothDevice = Electron.BluetoothDevice;
19314 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
19315 type Certificate = Electron.Certificate;
19316 type CertificatePrincipal = Electron.CertificatePrincipal;
19317 type Cookie = Electron.Cookie;
19318 type CPUUsage = Electron.CPUUsage;
19319 type CrashReport = Electron.CrashReport;
19320 type CustomScheme = Electron.CustomScheme;
19321 type DesktopCapturerSource = Electron.DesktopCapturerSource;
19322 type Display = Electron.Display;
19323 type Extension = Electron.Extension;
19324 type ExtensionInfo = Electron.ExtensionInfo;
19325 type FileFilter = Electron.FileFilter;
19326 type FilePathWithHeaders = Electron.FilePathWithHeaders;
19327 type GPUFeatureStatus = Electron.GPUFeatureStatus;
19328 type HIDDevice = Electron.HIDDevice;
19329 type InputEvent = Electron.InputEvent;
19330 type IOCounters = Electron.IOCounters;
19331 type IpcMainEvent = Electron.IpcMainEvent;
19332 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
19333 type IpcRendererEvent = Electron.IpcRendererEvent;
19334 type JumpListCategory = Electron.JumpListCategory;
19335 type JumpListItem = Electron.JumpListItem;
19336 type KeyboardEvent = Electron.KeyboardEvent;
19337 type KeyboardInputEvent = Electron.KeyboardInputEvent;
19338 type MemoryInfo = Electron.MemoryInfo;
19339 type MemoryUsageDetails = Electron.MemoryUsageDetails;
19340 type MimeTypedBuffer = Electron.MimeTypedBuffer;
19341 type MouseInputEvent = Electron.MouseInputEvent;
19342 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
19343 type NotificationAction = Electron.NotificationAction;
19344 type NotificationResponse = Electron.NotificationResponse;
19345 type PaymentDiscount = Electron.PaymentDiscount;
19346 type Point = Electron.Point;
19347 type PostBody = Electron.PostBody;
19348 type PrinterInfo = Electron.PrinterInfo;
19349 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
19350 type ProcessMetric = Electron.ProcessMetric;
19351 type Product = Electron.Product;
19352 type ProductDiscount = Electron.ProductDiscount;
19353 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
19354 type ProtocolRequest = Electron.ProtocolRequest;
19355 type ProtocolResponse = Electron.ProtocolResponse;
19356 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
19357 type Rectangle = Electron.Rectangle;
19358 type Referrer = Electron.Referrer;
19359 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
19360 type ResolvedEndpoint = Electron.ResolvedEndpoint;
19361 type ResolvedHost = Electron.ResolvedHost;
19362 type ScrubberItem = Electron.ScrubberItem;
19363 type SegmentedControlSegment = Electron.SegmentedControlSegment;
19364 type SerialPort = Electron.SerialPort;
19365 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
19366 type SharedWorkerInfo = Electron.SharedWorkerInfo;
19367 type SharingItem = Electron.SharingItem;
19368 type ShortcutDetails = Electron.ShortcutDetails;
19369 type Size = Electron.Size;
19370 type Task = Electron.Task;
19371 type ThumbarButton = Electron.ThumbarButton;
19372 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
19373 type TraceConfig = Electron.TraceConfig;
19374 type Transaction = Electron.Transaction;
19375 type UploadData = Electron.UploadData;
19376 type UploadFile = Electron.UploadFile;
19377 type UploadRawData = Electron.UploadRawData;
19378 type USBDevice = Electron.USBDevice;
19379 type UserDefaultTypes = Electron.UserDefaultTypes;
19380 type WebPreferences = Electron.WebPreferences;
19381 type WebRequestFilter = Electron.WebRequestFilter;
19382 type WebSource = Electron.WebSource;
19385 namespace Renderer {
19386 type Event<Params extends object = {}> = Electron.Event<Params>;
19387 const contextBridge: ContextBridge;
19388 type ContextBridge = Electron.ContextBridge;
19389 const ipcRenderer: IpcRenderer;
19390 type IpcRenderer = Electron.IpcRenderer;
19391 const webFrame: WebFrame;
19392 type WebFrame = Electron.WebFrame;
19393 type WebviewTag = Electron.WebviewTag;
19394 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
19395 type AddRepresentationOptions = Electron.AddRepresentationOptions;
19396 type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
19397 type AnimationSettings = Electron.AnimationSettings;
19398 type AppDetailsOptions = Electron.AppDetailsOptions;
19399 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
19400 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
19401 type AuthInfo = Electron.AuthInfo;
19402 type AutoResizeOptions = Electron.AutoResizeOptions;
19403 type BeforeSendResponse = Electron.BeforeSendResponse;
19404 type BitmapOptions = Electron.BitmapOptions;
19405 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
19406 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
19407 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
19408 type CallbackResponse = Electron.CallbackResponse;
19409 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
19410 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
19411 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
19412 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
19413 type CloseOpts = Electron.CloseOpts;
19414 type Config = Electron.Config;
19415 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
19416 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
19417 type ContextMenuEvent = Electron.ContextMenuEvent;
19418 type ContextMenuParams = Electron.ContextMenuParams;
19419 type ContinueActivityDetails = Electron.ContinueActivityDetails;
19420 type CookiesGetFilter = Electron.CookiesGetFilter;
19421 type CookiesSetDetails = Electron.CookiesSetDetails;
19422 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
19423 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
19424 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
19425 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
19426 type Data = Electron.Data;
19427 type DefaultFontFamily = Electron.DefaultFontFamily;
19428 type Details = Electron.Details;
19429 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
19430 type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
19431 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
19432 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
19433 type DidFailLoadEvent = Electron.DidFailLoadEvent;
19434 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
19435 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
19436 type DidNavigateEvent = Electron.DidNavigateEvent;
19437 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
19438 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
19439 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
19440 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
19441 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
19442 type DownloadURLOptions = Electron.DownloadURLOptions;
19443 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
19444 type FeedURLOptions = Electron.FeedURLOptions;
19445 type FileIconOptions = Electron.FileIconOptions;
19446 type FindInPageOptions = Electron.FindInPageOptions;
19447 type FocusOptions = Electron.FocusOptions;
19448 type ForkOptions = Electron.ForkOptions;
19449 type FoundInPageEvent = Electron.FoundInPageEvent;
19450 type FrameCreatedDetails = Electron.FrameCreatedDetails;
19451 type FromPartitionOptions = Electron.FromPartitionOptions;
19452 type FromPathOptions = Electron.FromPathOptions;
19453 type HandlerDetails = Electron.HandlerDetails;
19454 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
19455 type HeapStatistics = Electron.HeapStatistics;
19456 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
19457 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
19458 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
19459 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
19460 type ImportCertificateOptions = Electron.ImportCertificateOptions;
19461 type Info = Electron.Info;
19462 type Input = Electron.Input;
19463 type InsertCSSOptions = Electron.InsertCSSOptions;
19464 type IpcMessageEvent = Electron.IpcMessageEvent;
19465 type Item = Electron.Item;
19466 type JumpListSettings = Electron.JumpListSettings;
19467 type LoadCommitEvent = Electron.LoadCommitEvent;
19468 type LoadExtensionOptions = Electron.LoadExtensionOptions;
19469 type LoadFileOptions = Electron.LoadFileOptions;
19470 type LoadURLOptions = Electron.LoadURLOptions;
19471 type LoginItemSettings = Electron.LoginItemSettings;
19472 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
19473 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
19474 type MessageBoxOptions = Electron.MessageBoxOptions;
19475 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
19476 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
19477 type MessageDetails = Electron.MessageDetails;
19478 type MessageEvent = Electron.MessageEvent;
19479 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
19480 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
19481 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
19482 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
19483 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
19484 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
19485 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
19486 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
19487 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
19488 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
19489 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
19490 type OpenDialogOptions = Electron.OpenDialogOptions;
19491 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
19492 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
19493 type OpenExternalOptions = Electron.OpenExternalOptions;
19494 type Options = Electron.Options;
19495 type Opts = Electron.Opts;
19496 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
19497 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
19498 type Parameters = Electron.Parameters;
19499 type Payment = Electron.Payment;
19500 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
19501 type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
19502 type PluginCrashedEvent = Electron.PluginCrashedEvent;
19503 type PopupOptions = Electron.PopupOptions;
19504 type PreconnectOptions = Electron.PreconnectOptions;
19505 type PrintToPDFOptions = Electron.PrintToPDFOptions;
19506 type Privileges = Electron.Privileges;
19507 type ProgressBarOptions = Electron.ProgressBarOptions;
19508 type Provider = Electron.Provider;
19509 type PurchaseProductOpts = Electron.PurchaseProductOpts;
19510 type ReadBookmark = Electron.ReadBookmark;
19511 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
19512 type RelaunchOptions = Electron.RelaunchOptions;
19513 type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
19514 type Request = Electron.Request;
19515 type ResizeOptions = Electron.ResizeOptions;
19516 type ResolveHostOptions = Electron.ResolveHostOptions;
19517 type ResourceUsage = Electron.ResourceUsage;
19518 type Response = Electron.Response;
19519 type Result = Electron.Result;
19520 type SaveDialogOptions = Electron.SaveDialogOptions;
19521 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
19522 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
19523 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
19524 type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
19525 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
19526 type Settings = Electron.Settings;
19527 type SourcesOptions = Electron.SourcesOptions;
19528 type SSLConfigConfig = Electron.SSLConfigConfig;
19529 type StartLoggingOptions = Electron.StartLoggingOptions;
19530 type Streams = Electron.Streams;
19531 type SystemMemoryInfo = Electron.SystemMemoryInfo;
19532 type TitleBarOverlay = Electron.TitleBarOverlay;
19533 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
19534 type TitleOptions = Electron.TitleOptions;
19535 type ToBitmapOptions = Electron.ToBitmapOptions;
19536 type ToDataURLOptions = Electron.ToDataURLOptions;
19537 type ToPNGOptions = Electron.ToPNGOptions;
19538 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
19539 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
19540 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
19541 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
19542 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
19543 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
19544 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
19545 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
19546 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
19547 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
19548 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
19549 type UdpPortRange = Electron.UdpPortRange;
19550 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
19551 type UploadProgress = Electron.UploadProgress;
19552 type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
19553 type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
19554 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
19555 type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
19556 type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
19557 type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
19558 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
19559 type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
19560 type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
19561 type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
19562 type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
19563 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
19564 type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
19565 type WillNavigateEvent = Electron.WillNavigateEvent;
19566 type WillResizeDetails = Electron.WillResizeDetails;
19567 type EditFlags = Electron.EditFlags;
19568 type Env = Electron.Env;
19569 type FoundInPageResult = Electron.FoundInPageResult;
19570 type LaunchItems = Electron.LaunchItems;
19571 type Margins = Electron.Margins;
19572 type MediaFlags = Electron.MediaFlags;
19573 type PageRanges = Electron.PageRanges;
19574 type Params = Electron.Params;
19575 type Video = Electron.Video;
19576 type BluetoothDevice = Electron.BluetoothDevice;
19577 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
19578 type Certificate = Electron.Certificate;
19579 type CertificatePrincipal = Electron.CertificatePrincipal;
19580 type Cookie = Electron.Cookie;
19581 type CPUUsage = Electron.CPUUsage;
19582 type CrashReport = Electron.CrashReport;
19583 type CustomScheme = Electron.CustomScheme;
19584 type DesktopCapturerSource = Electron.DesktopCapturerSource;
19585 type Display = Electron.Display;
19586 type Extension = Electron.Extension;
19587 type ExtensionInfo = Electron.ExtensionInfo;
19588 type FileFilter = Electron.FileFilter;
19589 type FilePathWithHeaders = Electron.FilePathWithHeaders;
19590 type GPUFeatureStatus = Electron.GPUFeatureStatus;
19591 type HIDDevice = Electron.HIDDevice;
19592 type InputEvent = Electron.InputEvent;
19593 type IOCounters = Electron.IOCounters;
19594 type IpcMainEvent = Electron.IpcMainEvent;
19595 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
19596 type IpcRendererEvent = Electron.IpcRendererEvent;
19597 type JumpListCategory = Electron.JumpListCategory;
19598 type JumpListItem = Electron.JumpListItem;
19599 type KeyboardEvent = Electron.KeyboardEvent;
19600 type KeyboardInputEvent = Electron.KeyboardInputEvent;
19601 type MemoryInfo = Electron.MemoryInfo;
19602 type MemoryUsageDetails = Electron.MemoryUsageDetails;
19603 type MimeTypedBuffer = Electron.MimeTypedBuffer;
19604 type MouseInputEvent = Electron.MouseInputEvent;
19605 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
19606 type NotificationAction = Electron.NotificationAction;
19607 type NotificationResponse = Electron.NotificationResponse;
19608 type PaymentDiscount = Electron.PaymentDiscount;
19609 type Point = Electron.Point;
19610 type PostBody = Electron.PostBody;
19611 type PrinterInfo = Electron.PrinterInfo;
19612 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
19613 type ProcessMetric = Electron.ProcessMetric;
19614 type Product = Electron.Product;
19615 type ProductDiscount = Electron.ProductDiscount;
19616 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
19617 type ProtocolRequest = Electron.ProtocolRequest;
19618 type ProtocolResponse = Electron.ProtocolResponse;
19619 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
19620 type Rectangle = Electron.Rectangle;
19621 type Referrer = Electron.Referrer;
19622 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
19623 type ResolvedEndpoint = Electron.ResolvedEndpoint;
19624 type ResolvedHost = Electron.ResolvedHost;
19625 type ScrubberItem = Electron.ScrubberItem;
19626 type SegmentedControlSegment = Electron.SegmentedControlSegment;
19627 type SerialPort = Electron.SerialPort;
19628 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
19629 type SharedWorkerInfo = Electron.SharedWorkerInfo;
19630 type SharingItem = Electron.SharingItem;
19631 type ShortcutDetails = Electron.ShortcutDetails;
19632 type Size = Electron.Size;
19633 type Task = Electron.Task;
19634 type ThumbarButton = Electron.ThumbarButton;
19635 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
19636 type TraceConfig = Electron.TraceConfig;
19637 type Transaction = Electron.Transaction;
19638 type UploadData = Electron.UploadData;
19639 type UploadFile = Electron.UploadFile;
19640 type UploadRawData = Electron.UploadRawData;
19641 type USBDevice = Electron.USBDevice;
19642 type UserDefaultTypes = Electron.UserDefaultTypes;
19643 type WebPreferences = Electron.WebPreferences;
19644 type WebRequestFilter = Electron.WebRequestFilter;
19645 type WebSource = Electron.WebSource;
19648 namespace CrossProcessExports {
19649 type Event<Params extends object = {}> = Electron.Event<Params>;
19651 type App = Electron.App;
19652 const autoUpdater: AutoUpdater;
19653 type AutoUpdater = Electron.AutoUpdater;
19654 class BrowserView extends Electron.BrowserView {}
19655 class BrowserWindow extends Electron.BrowserWindow {}
19656 type ClientRequest = Electron.ClientRequest;
19657 const clipboard: Clipboard;
19658 type Clipboard = Electron.Clipboard;
19659 type CommandLine = Electron.CommandLine;
19660 const contentTracing: ContentTracing;
19661 type ContentTracing = Electron.ContentTracing;
19662 const contextBridge: ContextBridge;
19663 type ContextBridge = Electron.ContextBridge;
19664 type Cookies = Electron.Cookies;
19665 const crashReporter: CrashReporter;
19666 type CrashReporter = Electron.CrashReporter;
19667 type Debugger = Electron.Debugger;
19668 const desktopCapturer: DesktopCapturer;
19669 type DesktopCapturer = Electron.DesktopCapturer;
19670 const dialog: Dialog;
19671 type Dialog = Electron.Dialog;
19672 type Dock = Electron.Dock;
19673 type DownloadItem = Electron.DownloadItem;
19674 const globalShortcut: GlobalShortcut;
19675 type GlobalShortcut = Electron.GlobalShortcut;
19676 const inAppPurchase: InAppPurchase;
19677 type InAppPurchase = Electron.InAppPurchase;
19678 type IncomingMessage = Electron.IncomingMessage;
19679 const ipcMain: IpcMain;
19680 type IpcMain = Electron.IpcMain;
19681 const ipcRenderer: IpcRenderer;
19682 type IpcRenderer = Electron.IpcRenderer;
19683 class Menu extends Electron.Menu {}
19684 class MenuItem extends Electron.MenuItem {}
19685 class MessageChannelMain extends Electron.MessageChannelMain {}
19686 type MessagePortMain = Electron.MessagePortMain;
19687 const nativeImage: typeof NativeImage;
19688 type NativeImage = Electron.NativeImage;
19689 const nativeTheme: NativeTheme;
19690 type NativeTheme = Electron.NativeTheme;
19692 type Net = Electron.Net;
19693 const netLog: NetLog;
19694 type NetLog = Electron.NetLog;
19695 class Notification extends Electron.Notification {}
19696 const powerMonitor: PowerMonitor;
19697 type PowerMonitor = Electron.PowerMonitor;
19698 const powerSaveBlocker: PowerSaveBlocker;
19699 type PowerSaveBlocker = Electron.PowerSaveBlocker;
19700 const protocol: Protocol;
19701 type Protocol = Electron.Protocol;
19702 const pushNotifications: PushNotifications;
19703 type PushNotifications = Electron.PushNotifications;
19704 const safeStorage: SafeStorage;
19705 type SafeStorage = Electron.SafeStorage;
19706 const screen: Screen;
19707 type Screen = Electron.Screen;
19708 type ServiceWorkers = Electron.ServiceWorkers;
19709 const session: typeof Session;
19710 type Session = Electron.Session;
19711 class ShareMenu extends Electron.ShareMenu {}
19712 const shell: Shell;
19713 type Shell = Electron.Shell;
19714 const systemPreferences: SystemPreferences;
19715 type SystemPreferences = Electron.SystemPreferences;
19716 class TouchBar extends Electron.TouchBar {}
19717 type TouchBarButton = Electron.TouchBarButton;
19718 type TouchBarColorPicker = Electron.TouchBarColorPicker;
19719 type TouchBarGroup = Electron.TouchBarGroup;
19720 type TouchBarLabel = Electron.TouchBarLabel;
19721 type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
19722 type TouchBarPopover = Electron.TouchBarPopover;
19723 type TouchBarScrubber = Electron.TouchBarScrubber;
19724 type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
19725 type TouchBarSlider = Electron.TouchBarSlider;
19726 type TouchBarSpacer = Electron.TouchBarSpacer;
19727 class Tray extends Electron.Tray {}
19728 const utilityProcess: typeof UtilityProcess;
19729 type UtilityProcess = Electron.UtilityProcess;
19730 const webContents: typeof WebContents;
19731 type WebContents = Electron.WebContents;
19732 const webFrame: WebFrame;
19733 type WebFrame = Electron.WebFrame;
19734 const webFrameMain: typeof WebFrameMain;
19735 type WebFrameMain = Electron.WebFrameMain;
19736 type WebRequest = Electron.WebRequest;
19737 type WebviewTag = Electron.WebviewTag;
19738 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
19739 type AddRepresentationOptions = Electron.AddRepresentationOptions;
19740 type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
19741 type AnimationSettings = Electron.AnimationSettings;
19742 type AppDetailsOptions = Electron.AppDetailsOptions;
19743 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
19744 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
19745 type AuthInfo = Electron.AuthInfo;
19746 type AutoResizeOptions = Electron.AutoResizeOptions;
19747 type BeforeSendResponse = Electron.BeforeSendResponse;
19748 type BitmapOptions = Electron.BitmapOptions;
19749 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
19750 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
19751 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
19752 type CallbackResponse = Electron.CallbackResponse;
19753 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
19754 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
19755 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
19756 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
19757 type CloseOpts = Electron.CloseOpts;
19758 type Config = Electron.Config;
19759 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
19760 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
19761 type ContextMenuEvent = Electron.ContextMenuEvent;
19762 type ContextMenuParams = Electron.ContextMenuParams;
19763 type ContinueActivityDetails = Electron.ContinueActivityDetails;
19764 type CookiesGetFilter = Electron.CookiesGetFilter;
19765 type CookiesSetDetails = Electron.CookiesSetDetails;
19766 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
19767 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
19768 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
19769 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
19770 type Data = Electron.Data;
19771 type DefaultFontFamily = Electron.DefaultFontFamily;
19772 type Details = Electron.Details;
19773 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
19774 type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
19775 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
19776 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
19777 type DidFailLoadEvent = Electron.DidFailLoadEvent;
19778 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
19779 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
19780 type DidNavigateEvent = Electron.DidNavigateEvent;
19781 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
19782 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
19783 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
19784 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
19785 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
19786 type DownloadURLOptions = Electron.DownloadURLOptions;
19787 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
19788 type FeedURLOptions = Electron.FeedURLOptions;
19789 type FileIconOptions = Electron.FileIconOptions;
19790 type FindInPageOptions = Electron.FindInPageOptions;
19791 type FocusOptions = Electron.FocusOptions;
19792 type ForkOptions = Electron.ForkOptions;
19793 type FoundInPageEvent = Electron.FoundInPageEvent;
19794 type FrameCreatedDetails = Electron.FrameCreatedDetails;
19795 type FromPartitionOptions = Electron.FromPartitionOptions;
19796 type FromPathOptions = Electron.FromPathOptions;
19797 type HandlerDetails = Electron.HandlerDetails;
19798 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
19799 type HeapStatistics = Electron.HeapStatistics;
19800 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
19801 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
19802 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
19803 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
19804 type ImportCertificateOptions = Electron.ImportCertificateOptions;
19805 type Info = Electron.Info;
19806 type Input = Electron.Input;
19807 type InsertCSSOptions = Electron.InsertCSSOptions;
19808 type IpcMessageEvent = Electron.IpcMessageEvent;
19809 type Item = Electron.Item;
19810 type JumpListSettings = Electron.JumpListSettings;
19811 type LoadCommitEvent = Electron.LoadCommitEvent;
19812 type LoadExtensionOptions = Electron.LoadExtensionOptions;
19813 type LoadFileOptions = Electron.LoadFileOptions;
19814 type LoadURLOptions = Electron.LoadURLOptions;
19815 type LoginItemSettings = Electron.LoginItemSettings;
19816 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
19817 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
19818 type MessageBoxOptions = Electron.MessageBoxOptions;
19819 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
19820 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
19821 type MessageDetails = Electron.MessageDetails;
19822 type MessageEvent = Electron.MessageEvent;
19823 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
19824 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
19825 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
19826 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
19827 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
19828 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
19829 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
19830 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
19831 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
19832 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
19833 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
19834 type OpenDialogOptions = Electron.OpenDialogOptions;
19835 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
19836 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
19837 type OpenExternalOptions = Electron.OpenExternalOptions;
19838 type Options = Electron.Options;
19839 type Opts = Electron.Opts;
19840 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
19841 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
19842 type Parameters = Electron.Parameters;
19843 type Payment = Electron.Payment;
19844 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
19845 type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
19846 type PluginCrashedEvent = Electron.PluginCrashedEvent;
19847 type PopupOptions = Electron.PopupOptions;
19848 type PreconnectOptions = Electron.PreconnectOptions;
19849 type PrintToPDFOptions = Electron.PrintToPDFOptions;
19850 type Privileges = Electron.Privileges;
19851 type ProgressBarOptions = Electron.ProgressBarOptions;
19852 type Provider = Electron.Provider;
19853 type PurchaseProductOpts = Electron.PurchaseProductOpts;
19854 type ReadBookmark = Electron.ReadBookmark;
19855 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
19856 type RelaunchOptions = Electron.RelaunchOptions;
19857 type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
19858 type Request = Electron.Request;
19859 type ResizeOptions = Electron.ResizeOptions;
19860 type ResolveHostOptions = Electron.ResolveHostOptions;
19861 type ResourceUsage = Electron.ResourceUsage;
19862 type Response = Electron.Response;
19863 type Result = Electron.Result;
19864 type SaveDialogOptions = Electron.SaveDialogOptions;
19865 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
19866 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
19867 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
19868 type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
19869 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
19870 type Settings = Electron.Settings;
19871 type SourcesOptions = Electron.SourcesOptions;
19872 type SSLConfigConfig = Electron.SSLConfigConfig;
19873 type StartLoggingOptions = Electron.StartLoggingOptions;
19874 type Streams = Electron.Streams;
19875 type SystemMemoryInfo = Electron.SystemMemoryInfo;
19876 type TitleBarOverlay = Electron.TitleBarOverlay;
19877 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
19878 type TitleOptions = Electron.TitleOptions;
19879 type ToBitmapOptions = Electron.ToBitmapOptions;
19880 type ToDataURLOptions = Electron.ToDataURLOptions;
19881 type ToPNGOptions = Electron.ToPNGOptions;
19882 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
19883 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
19884 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
19885 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
19886 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
19887 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
19888 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
19889 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
19890 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
19891 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
19892 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
19893 type UdpPortRange = Electron.UdpPortRange;
19894 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
19895 type UploadProgress = Electron.UploadProgress;
19896 type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
19897 type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
19898 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
19899 type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
19900 type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
19901 type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
19902 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
19903 type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
19904 type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
19905 type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
19906 type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
19907 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
19908 type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
19909 type WillNavigateEvent = Electron.WillNavigateEvent;
19910 type WillResizeDetails = Electron.WillResizeDetails;
19911 type EditFlags = Electron.EditFlags;
19912 type Env = Electron.Env;
19913 type FoundInPageResult = Electron.FoundInPageResult;
19914 type LaunchItems = Electron.LaunchItems;
19915 type Margins = Electron.Margins;
19916 type MediaFlags = Electron.MediaFlags;
19917 type PageRanges = Electron.PageRanges;
19918 type Params = Electron.Params;
19919 type Video = Electron.Video;
19920 type BluetoothDevice = Electron.BluetoothDevice;
19921 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
19922 type Certificate = Electron.Certificate;
19923 type CertificatePrincipal = Electron.CertificatePrincipal;
19924 type Cookie = Electron.Cookie;
19925 type CPUUsage = Electron.CPUUsage;
19926 type CrashReport = Electron.CrashReport;
19927 type CustomScheme = Electron.CustomScheme;
19928 type DesktopCapturerSource = Electron.DesktopCapturerSource;
19929 type Display = Electron.Display;
19930 type Extension = Electron.Extension;
19931 type ExtensionInfo = Electron.ExtensionInfo;
19932 type FileFilter = Electron.FileFilter;
19933 type FilePathWithHeaders = Electron.FilePathWithHeaders;
19934 type GPUFeatureStatus = Electron.GPUFeatureStatus;
19935 type HIDDevice = Electron.HIDDevice;
19936 type InputEvent = Electron.InputEvent;
19937 type IOCounters = Electron.IOCounters;
19938 type IpcMainEvent = Electron.IpcMainEvent;
19939 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
19940 type IpcRendererEvent = Electron.IpcRendererEvent;
19941 type JumpListCategory = Electron.JumpListCategory;
19942 type JumpListItem = Electron.JumpListItem;
19943 type KeyboardEvent = Electron.KeyboardEvent;
19944 type KeyboardInputEvent = Electron.KeyboardInputEvent;
19945 type MemoryInfo = Electron.MemoryInfo;
19946 type MemoryUsageDetails = Electron.MemoryUsageDetails;
19947 type MimeTypedBuffer = Electron.MimeTypedBuffer;
19948 type MouseInputEvent = Electron.MouseInputEvent;
19949 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
19950 type NotificationAction = Electron.NotificationAction;
19951 type NotificationResponse = Electron.NotificationResponse;
19952 type PaymentDiscount = Electron.PaymentDiscount;
19953 type Point = Electron.Point;
19954 type PostBody = Electron.PostBody;
19955 type PrinterInfo = Electron.PrinterInfo;
19956 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
19957 type ProcessMetric = Electron.ProcessMetric;
19958 type Product = Electron.Product;
19959 type ProductDiscount = Electron.ProductDiscount;
19960 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
19961 type ProtocolRequest = Electron.ProtocolRequest;
19962 type ProtocolResponse = Electron.ProtocolResponse;
19963 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
19964 type Rectangle = Electron.Rectangle;
19965 type Referrer = Electron.Referrer;
19966 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
19967 type ResolvedEndpoint = Electron.ResolvedEndpoint;
19968 type ResolvedHost = Electron.ResolvedHost;
19969 type ScrubberItem = Electron.ScrubberItem;
19970 type SegmentedControlSegment = Electron.SegmentedControlSegment;
19971 type SerialPort = Electron.SerialPort;
19972 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
19973 type SharedWorkerInfo = Electron.SharedWorkerInfo;
19974 type SharingItem = Electron.SharingItem;
19975 type ShortcutDetails = Electron.ShortcutDetails;
19976 type Size = Electron.Size;
19977 type Task = Electron.Task;
19978 type ThumbarButton = Electron.ThumbarButton;
19979 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
19980 type TraceConfig = Electron.TraceConfig;
19981 type Transaction = Electron.Transaction;
19982 type UploadData = Electron.UploadData;
19983 type UploadFile = Electron.UploadFile;
19984 type UploadRawData = Electron.UploadRawData;
19985 type USBDevice = Electron.USBDevice;
19986 type UserDefaultTypes = Electron.UserDefaultTypes;
19987 type WebPreferences = Electron.WebPreferences;
19988 type WebRequestFilter = Electron.WebRequestFilter;
19989 type WebSource = Electron.WebSource;
19993 const autoUpdater: AutoUpdater;
19994 const clipboard: Clipboard;
19995 const contentTracing: ContentTracing;
19996 const contextBridge: ContextBridge;
19997 const crashReporter: CrashReporter;
19998 const desktopCapturer: DesktopCapturer;
19999 const dialog: Dialog;
20000 const globalShortcut: GlobalShortcut;
20001 const inAppPurchase: InAppPurchase;
20002 const ipcMain: IpcMain;
20003 const ipcRenderer: IpcRenderer;
20004 const nativeImage: typeof NativeImage;
20005 const nativeTheme: NativeTheme;
20007 const netLog: NetLog;
20008 const parentPort: ParentPort;
20009 const powerMonitor: PowerMonitor;
20010 const powerSaveBlocker: PowerSaveBlocker;
20011 const protocol: Protocol;
20012 const pushNotifications: PushNotifications;
20013 const safeStorage: SafeStorage;
20014 const screen: Screen;
20015 const session: typeof Session;
20016 const shell: Shell;
20017 const systemPreferences: SystemPreferences;
20018 const utilityProcess: typeof UtilityProcess;
20019 const webContents: typeof WebContents;
20020 const webFrame: WebFrame;
20021 const webFrameMain: typeof WebFrameMain;
20025 declare module 'electron' {
20026 export = Electron.CrossProcessExports;
20029 declare module 'electron/main' {
20030 export = Electron.Main;
20033 declare module 'electron/common' {
20034 export = Electron.Common;
20037 declare module 'electron/renderer' {
20038 export = Electron.Renderer;
20041 interface NodeRequireFunction {
20042 (moduleName: 'electron'): typeof Electron.CrossProcessExports;
20043 (moduleName: 'electron/main'): typeof Electron.Main;
20044 (moduleName: 'electron/common'): typeof Electron.Common;
20045 (moduleName: 'electron/renderer'): typeof Electron.Renderer;
20048 interface NodeRequire {
20049 (moduleName: 'electron'): typeof Electron.CrossProcessExports;
20050 (moduleName: 'electron/main'): typeof Electron.Main;
20051 (moduleName: 'electron/common'): typeof Electron.Common;
20052 (moduleName: 'electron/renderer'): typeof Electron.Renderer;
20057 * The real path to the file on the users filesystem
20062 declare module 'original-fs' {
20063 import * as fs from 'fs';
20067 declare module 'node:original-fs' {
20068 import * as fs from 'fs';
20072 interface Document {
20073 createElement(tagName: 'webview'): Electron.WebviewTag;
20077 declare namespace NodeJS {
20078 interface Process extends NodeJS.EventEmitter {
20080 // Docs: https://electronjs.org/docs/api/process
20083 * Emitted when Electron has loaded its internal initialization script and is
20084 * beginning to load the web page or the main script.
20086 on(event: 'loaded', listener: Function): this;
20087 off(event: 'loaded', listener: Function): this;
20088 once(event: 'loaded', listener: Function): this;
20089 addListener(event: 'loaded', listener: Function): this;
20090 removeListener(event: 'loaded', listener: Function): this;
20092 * Causes the main thread of the current process crash.
20096 * * `allocated` Integer - Size of all allocated objects in Kilobytes.
20097 * * `total` Integer - Total allocated space in Kilobytes.
20099 * Returns an object with Blink memory information. It can be useful for debugging
20100 * rendering / DOM related memory issues. Note that all values are reported in
20103 getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
20104 getCPUUsage(): Electron.CPUUsage;
20106 * The number of milliseconds since epoch, or `null` if the information is
20109 * Indicates the creation time of the application. The time is represented as
20110 * number of milliseconds since epoch. It returns null if it is unable to get the
20111 * process creation time.
20113 getCreationTime(): (number) | (null);
20115 * * `totalHeapSize` Integer
20116 * * `totalHeapSizeExecutable` Integer
20117 * * `totalPhysicalSize` Integer
20118 * * `totalAvailableSize` Integer
20119 * * `usedHeapSize` Integer
20120 * * `heapSizeLimit` Integer
20121 * * `mallocedMemory` Integer
20122 * * `peakMallocedMemory` Integer
20123 * * `doesZapGarbage` boolean
20125 * Returns an object with V8 heap statistics. Note that all statistics are reported
20128 getHeapStatistics(): Electron.HeapStatistics;
20130 * @platform win32,linux
20132 getIOCounters(): Electron.IOCounters;
20134 * Resolves with a ProcessMemoryInfo
20136 * Returns an object giving memory usage statistics about the current process. Note
20137 * that all statistics are reported in Kilobytes. This api should be called after
20140 * Chromium does not provide `residentSet` value for macOS. This is because macOS
20141 * performs in-memory compression of pages that haven't been recently used. As a
20142 * result the resident set size value is not what one would expect. `private`
20143 * memory is more representative of the actual pre-compression memory usage of the
20144 * process on macOS.
20146 getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
20148 * * `total` Integer - The total amount of physical memory in Kilobytes available
20150 * * `free` Integer - The total amount of memory not being used by applications or
20152 * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
20153 * Kilobytes available to the system.
20154 * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
20155 * Kilobytes available to the system.
20157 * Returns an object giving memory usage statistics about the entire system. Note
20158 * that all statistics are reported in Kilobytes.
20160 getSystemMemoryInfo(): Electron.SystemMemoryInfo;
20162 * The version of the host operating system.
20166 * **Note:** It returns the actual operating system version instead of kernel
20167 * version on macOS unlike `os.release()`.
20169 getSystemVersion(): string;
20171 * Causes the main thread of the current process hang.
20175 * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
20176 * whichever is lower for the current process.
20178 * @platform darwin,linux
20180 setFdLimit(maxDescriptors: number): void;
20182 * Indicates whether the snapshot has been created successfully.
20184 * Takes a V8 heap snapshot and saves it to `filePath`.
20186 takeHeapSnapshot(filePath: string): boolean;
20188 * A `string` representing Chrome's version string.
20191 readonly chrome: string;
20193 * A `string` (optional) representing a globally unique ID of the current
20194 * JavaScript context. Each frame has its own JavaScript context. When
20195 * contextIsolation is enabled, the isolated world also has a separate JavaScript
20196 * context. This property is only available in the renderer process.
20199 readonly contextId?: string;
20201 * A `boolean` that indicates whether the current renderer context has
20202 * `contextIsolation` enabled. It is `undefined` in the main process.
20205 readonly contextIsolated: boolean;
20207 * A `boolean`. When the app is started by being passed as parameter to the default
20208 * Electron executable, this property is `true` in the main process, otherwise it
20209 * is `undefined`. For example when running the app with `electron .`, it is
20210 * `true`, even if the app is packaged (`isPackaged`) is `true`. This can be useful
20211 * to determine how many arguments will need to be sliced off from `process.argv`.
20214 readonly defaultApp: boolean;
20216 * A `string` representing Electron's version string.
20219 readonly electron: string;
20221 * A `boolean`, `true` when the current renderer context is the "main" renderer
20222 * frame. If you want the ID of the current frame you should use
20223 * `webFrame.routingId`.
20226 readonly isMainFrame: boolean;
20228 * A `boolean`. For Mac App Store build, this property is `true`, for other builds
20229 * it is `undefined`.
20232 readonly mas: boolean;
20234 * A `boolean` that controls ASAR support inside your application. Setting this to
20235 * `true` will disable the support for `asar` archives in Node's built-in modules.
20239 * A `boolean` that controls whether or not deprecation warnings are printed to
20240 * `stderr`. Setting this to `true` will silence deprecation warnings. This
20241 * property is used instead of the `--no-deprecation` command line flag.
20243 noDeprecation: boolean;
20245 * A `Electron.ParentPort` property if this is a `UtilityProcess` (or `null`
20246 * otherwise) allowing communication with the parent process.
20248 parentPort: Electron.ParentPort;
20250 * A `string` representing the path to the resources directory.
20253 readonly resourcesPath: string;
20255 * A `boolean`. When the renderer process is sandboxed, this property is `true`,
20256 * otherwise it is `undefined`.
20259 readonly sandboxed: boolean;
20261 * A `boolean` that controls whether or not deprecation warnings will be thrown as
20262 * exceptions. Setting this to `true` will throw errors for deprecations. This
20263 * property is used instead of the `--throw-deprecation` command line flag.
20265 throwDeprecation: boolean;
20267 * A `boolean` that controls whether or not deprecations printed to `stderr`
20268 * include their stack trace. Setting this to `true` will print stack traces for
20269 * deprecations. This property is instead of the `--trace-deprecation` command line
20272 traceDeprecation: boolean;
20274 * A `boolean` that controls whether or not process warnings printed to `stderr`
20275 * include their stack trace. Setting this to `true` will print stack traces for
20276 * process warnings (including deprecations). This property is instead of the
20277 * `--trace-warnings` command line flag.
20279 traceProcessWarnings: boolean;
20281 * A `string` representing the current process's type, can be:
20283 * * `browser` - The main process
20284 * * `renderer` - A renderer process
20285 * * `worker` - In a web worker
20286 * * `utility` - In a node process launched as a service
20289 readonly type: ('browser' | 'renderer' | 'worker' | 'utility');
20291 * A `boolean`. If the app is running as a Windows Store app (appx), this property
20292 * is `true`, for otherwise it is `undefined`.
20295 readonly windowsStore: boolean;
20297 interface ProcessVersions {
20298 readonly electron: string;
20299 readonly chrome: string;