UNPKG

969 kBTypeScriptView Raw
1// Type definitions for Electron 30.0.4
2// Project: http://electronjs.org/
3// Definitions by: The Electron Team <https://github.com/electron/electron>
4// Definitions: https://github.com/electron/typescript-definitions
5
6/// <reference types="node" />
7
8type DOMEvent = Event;
9type GlobalResponse = Response;
10type GlobalRequest = Request;
11
12declare namespace Electron {
13 const NodeEventEmitter: typeof import('events').EventEmitter;
14
15 type Accelerator = string;
16 type Event<Params extends object = {}> = {
17 preventDefault: () => void;
18 readonly defaultPrevented: boolean;
19 } & Params;
20
21 interface App extends NodeJS.EventEmitter {
22
23 // Docs: https://electronjs.org/docs/api/app
24
25 /**
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
29 * details.
30 *
31 * @platform darwin,win32
32 */
33 on(event: 'accessibility-support-changed', listener: (event: Event,
34 /**
35 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
36 */
37 accessibilitySupportEnabled: boolean) => void): this;
38 /**
39 * @platform darwin,win32
40 */
41 off(event: 'accessibility-support-changed', listener: (event: Event,
42 /**
43 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
44 */
45 accessibilitySupportEnabled: boolean) => void): this;
46 /**
47 * @platform darwin,win32
48 */
49 once(event: 'accessibility-support-changed', listener: (event: Event,
50 /**
51 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
52 */
53 accessibilitySupportEnabled: boolean) => void): this;
54 /**
55 * @platform darwin,win32
56 */
57 addListener(event: 'accessibility-support-changed', listener: (event: Event,
58 /**
59 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
60 */
61 accessibilitySupportEnabled: boolean) => void): this;
62 /**
63 * @platform darwin,win32
64 */
65 removeListener(event: 'accessibility-support-changed', listener: (event: Event,
66 /**
67 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
68 */
69 accessibilitySupportEnabled: boolean) => void): this;
70 /**
71 * Emitted when the application is activated. Various actions can trigger this
72 * event, such as launching the application for the first time, attempting to
73 * re-launch the application when it's already running, or clicking on the
74 * application's dock or taskbar icon.
75 *
76 * @platform darwin
77 */
78 on(event: 'activate', listener: (event: Event,
79 hasVisibleWindows: boolean) => void): this;
80 /**
81 * @platform darwin
82 */
83 off(event: 'activate', listener: (event: Event,
84 hasVisibleWindows: boolean) => void): this;
85 /**
86 * @platform darwin
87 */
88 once(event: 'activate', listener: (event: Event,
89 hasVisibleWindows: boolean) => void): this;
90 /**
91 * @platform darwin
92 */
93 addListener(event: 'activate', listener: (event: Event,
94 hasVisibleWindows: boolean) => void): this;
95 /**
96 * @platform darwin
97 */
98 removeListener(event: 'activate', listener: (event: Event,
99 hasVisibleWindows: boolean) => void): this;
100 /**
101 * Emitted during Handoff after an activity from this device was successfully
102 * resumed on another one.
103 *
104 * @platform darwin
105 */
106 on(event: 'activity-was-continued', listener: (event: Event,
107 /**
108 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
109 */
110 type: string,
111 /**
112 * Contains app-specific state stored by the activity.
113 */
114 userInfo: unknown) => void): this;
115 /**
116 * @platform darwin
117 */
118 off(event: 'activity-was-continued', listener: (event: Event,
119 /**
120 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
121 */
122 type: string,
123 /**
124 * Contains app-specific state stored by the activity.
125 */
126 userInfo: unknown) => void): this;
127 /**
128 * @platform darwin
129 */
130 once(event: 'activity-was-continued', listener: (event: Event,
131 /**
132 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
133 */
134 type: string,
135 /**
136 * Contains app-specific state stored by the activity.
137 */
138 userInfo: unknown) => void): this;
139 /**
140 * @platform darwin
141 */
142 addListener(event: 'activity-was-continued', listener: (event: Event,
143 /**
144 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
145 */
146 type: string,
147 /**
148 * Contains app-specific state stored by the activity.
149 */
150 userInfo: unknown) => void): this;
151 /**
152 * @platform darwin
153 */
154 removeListener(event: 'activity-was-continued', listener: (event: Event,
155 /**
156 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
157 */
158 type: string,
159 /**
160 * Contains app-specific state stored by the activity.
161 */
162 userInfo: unknown) => void): this;
163 /**
164 * Emitted before the application starts closing its windows. Calling
165 * `event.preventDefault()` will prevent the default behavior, which is terminating
166 * the application.
167 *
168 * **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
169 * then `before-quit` is emitted _after_ emitting `close` event on all windows and
170 * closing them.
171 *
172 * **Note:** On Windows, this event will not be emitted if the app is closed due to
173 * a shutdown/restart of the system or a user logout.
174 */
175 on(event: 'before-quit', listener: (event: Event) => void): this;
176 off(event: 'before-quit', listener: (event: Event) => void): this;
177 once(event: 'before-quit', listener: (event: Event) => void): this;
178 addListener(event: 'before-quit', listener: (event: Event) => void): this;
179 removeListener(event: 'before-quit', listener: (event: Event) => void): this;
180 /**
181 * Emitted when a browserWindow gets blurred.
182 */
183 on(event: 'browser-window-blur', listener: (event: Event,
184 window: BrowserWindow) => void): this;
185 off(event: 'browser-window-blur', listener: (event: Event,
186 window: BrowserWindow) => void): this;
187 once(event: 'browser-window-blur', listener: (event: Event,
188 window: BrowserWindow) => void): this;
189 addListener(event: 'browser-window-blur', listener: (event: Event,
190 window: BrowserWindow) => void): this;
191 removeListener(event: 'browser-window-blur', listener: (event: Event,
192 window: BrowserWindow) => void): this;
193 /**
194 * Emitted when a new browserWindow is created.
195 */
196 on(event: 'browser-window-created', listener: (event: Event,
197 window: BrowserWindow) => void): this;
198 off(event: 'browser-window-created', listener: (event: Event,
199 window: BrowserWindow) => void): this;
200 once(event: 'browser-window-created', listener: (event: Event,
201 window: BrowserWindow) => void): this;
202 addListener(event: 'browser-window-created', listener: (event: Event,
203 window: BrowserWindow) => void): this;
204 removeListener(event: 'browser-window-created', listener: (event: Event,
205 window: BrowserWindow) => void): this;
206 /**
207 * Emitted when a browserWindow gets focused.
208 */
209 on(event: 'browser-window-focus', listener: (event: Event,
210 window: BrowserWindow) => void): this;
211 off(event: 'browser-window-focus', listener: (event: Event,
212 window: BrowserWindow) => void): this;
213 once(event: 'browser-window-focus', listener: (event: Event,
214 window: BrowserWindow) => void): this;
215 addListener(event: 'browser-window-focus', listener: (event: Event,
216 window: BrowserWindow) => void): this;
217 removeListener(event: 'browser-window-focus', listener: (event: Event,
218 window: BrowserWindow) => void): this;
219 /**
220 * Emitted when failed to verify the `certificate` for `url`, to trust the
221 * certificate you should prevent the default behavior with
222 * `event.preventDefault()` and call `callback(true)`.
223 */
224 on(event: 'certificate-error', listener: (event: Event,
225 webContents: WebContents,
226 url: string,
227 /**
228 * The error code
229 */
230 error: string,
231 certificate: Certificate,
232 callback: (isTrusted: boolean) => void,
233 isMainFrame: boolean) => void): this;
234 off(event: 'certificate-error', listener: (event: Event,
235 webContents: WebContents,
236 url: string,
237 /**
238 * The error code
239 */
240 error: string,
241 certificate: Certificate,
242 callback: (isTrusted: boolean) => void,
243 isMainFrame: boolean) => void): this;
244 once(event: 'certificate-error', listener: (event: Event,
245 webContents: WebContents,
246 url: string,
247 /**
248 * The error code
249 */
250 error: string,
251 certificate: Certificate,
252 callback: (isTrusted: boolean) => void,
253 isMainFrame: boolean) => void): this;
254 addListener(event: 'certificate-error', listener: (event: Event,
255 webContents: WebContents,
256 url: string,
257 /**
258 * The error code
259 */
260 error: string,
261 certificate: Certificate,
262 callback: (isTrusted: boolean) => void,
263 isMainFrame: boolean) => void): this;
264 removeListener(event: 'certificate-error', listener: (event: Event,
265 webContents: WebContents,
266 url: string,
267 /**
268 * The error code
269 */
270 error: string,
271 certificate: Certificate,
272 callback: (isTrusted: boolean) => void,
273 isMainFrame: boolean) => void): this;
274 /**
275 * Emitted when the child process unexpectedly disappears. This is normally because
276 * it was crashed or killed. It does not include renderer processes.
277 */
278 on(event: 'child-process-gone', listener: (event: Event,
279 details: Details) => void): this;
280 off(event: 'child-process-gone', listener: (event: Event,
281 details: Details) => void): this;
282 once(event: 'child-process-gone', listener: (event: Event,
283 details: Details) => void): this;
284 addListener(event: 'child-process-gone', listener: (event: Event,
285 details: Details) => void): this;
286 removeListener(event: 'child-process-gone', listener: (event: Event,
287 details: Details) => void): this;
288 /**
289 * Emitted during Handoff when an activity from a different device wants to be
290 * resumed. You should call `event.preventDefault()` if you want to handle this
291 * event.
292 *
293 * A user activity can be continued only in an app that has the same developer Team
294 * ID as the activity's source app and that supports the activity's type. Supported
295 * activity types are specified in the app's `Info.plist` under the
296 * `NSUserActivityTypes` key.
297 *
298 * @platform darwin
299 */
300 on(event: 'continue-activity', listener: (event: Event,
301 /**
302 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
303 */
304 type: string,
305 /**
306 * Contains app-specific state stored by the activity on another device.
307 */
308 userInfo: unknown,
309 details: ContinueActivityDetails) => void): this;
310 /**
311 * @platform darwin
312 */
313 off(event: 'continue-activity', listener: (event: Event,
314 /**
315 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
316 */
317 type: string,
318 /**
319 * Contains app-specific state stored by the activity on another device.
320 */
321 userInfo: unknown,
322 details: ContinueActivityDetails) => void): this;
323 /**
324 * @platform darwin
325 */
326 once(event: 'continue-activity', listener: (event: Event,
327 /**
328 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
329 */
330 type: string,
331 /**
332 * Contains app-specific state stored by the activity on another device.
333 */
334 userInfo: unknown,
335 details: ContinueActivityDetails) => void): this;
336 /**
337 * @platform darwin
338 */
339 addListener(event: 'continue-activity', listener: (event: Event,
340 /**
341 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
342 */
343 type: string,
344 /**
345 * Contains app-specific state stored by the activity on another device.
346 */
347 userInfo: unknown,
348 details: ContinueActivityDetails) => void): this;
349 /**
350 * @platform darwin
351 */
352 removeListener(event: 'continue-activity', listener: (event: Event,
353 /**
354 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
355 */
356 type: string,
357 /**
358 * Contains app-specific state stored by the activity on another device.
359 */
360 userInfo: unknown,
361 details: ContinueActivityDetails) => void): this;
362 /**
363 * Emitted during Handoff when an activity from a different device fails to be
364 * resumed.
365 *
366 * @platform darwin
367 */
368 on(event: 'continue-activity-error', listener: (event: Event,
369 /**
370 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
371 */
372 type: string,
373 /**
374 * A string with the error's localized description.
375 */
376 error: string) => void): this;
377 /**
378 * @platform darwin
379 */
380 off(event: 'continue-activity-error', listener: (event: Event,
381 /**
382 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
383 */
384 type: string,
385 /**
386 * A string with the error's localized description.
387 */
388 error: string) => void): this;
389 /**
390 * @platform darwin
391 */
392 once(event: 'continue-activity-error', listener: (event: Event,
393 /**
394 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
395 */
396 type: string,
397 /**
398 * A string with the error's localized description.
399 */
400 error: string) => void): this;
401 /**
402 * @platform darwin
403 */
404 addListener(event: 'continue-activity-error', listener: (event: Event,
405 /**
406 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
407 */
408 type: string,
409 /**
410 * A string with the error's localized description.
411 */
412 error: string) => void): this;
413 /**
414 * @platform darwin
415 */
416 removeListener(event: 'continue-activity-error', listener: (event: Event,
417 /**
418 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
419 */
420 type: string,
421 /**
422 * A string with the error's localized description.
423 */
424 error: string) => void): this;
425 /**
426 * Emitted when the application becomes active. This differs from the `activate`
427 * event in that `did-become-active` is emitted every time the app becomes active,
428 * not only when Dock icon is clicked or application is re-launched. It is also
429 * emitted when a user switches to the app via the macOS App Switcher.
430 *
431 * @platform darwin
432 */
433 on(event: 'did-become-active', listener: (event: Event) => void): this;
434 /**
435 * @platform darwin
436 */
437 off(event: 'did-become-active', listener: (event: Event) => void): this;
438 /**
439 * @platform darwin
440 */
441 once(event: 'did-become-active', listener: (event: Event) => void): this;
442 /**
443 * @platform darwin
444 */
445 addListener(event: 'did-become-active', listener: (event: Event) => void): this;
446 /**
447 * @platform darwin
448 */
449 removeListener(event: 'did-become-active', listener: (event: Event) => void): this;
450 /**
451 * Emitted when the app is no longer active and doesn’t have focus. This can be
452 * triggered, for example, by clicking on another application or by using the macOS
453 * App Switcher to switch to another application.
454 *
455 * @platform darwin
456 */
457 on(event: 'did-resign-active', listener: (event: Event) => void): this;
458 /**
459 * @platform darwin
460 */
461 off(event: 'did-resign-active', listener: (event: Event) => void): this;
462 /**
463 * @platform darwin
464 */
465 once(event: 'did-resign-active', listener: (event: Event) => void): this;
466 /**
467 * @platform darwin
468 */
469 addListener(event: 'did-resign-active', listener: (event: Event) => void): this;
470 /**
471 * @platform darwin
472 */
473 removeListener(event: 'did-resign-active', listener: (event: Event) => void): this;
474 /**
475 * Emitted whenever there is a GPU info update.
476 */
477 on(event: 'gpu-info-update', listener: Function): this;
478 off(event: 'gpu-info-update', listener: Function): this;
479 once(event: 'gpu-info-update', listener: Function): this;
480 addListener(event: 'gpu-info-update', listener: Function): this;
481 removeListener(event: 'gpu-info-update', listener: Function): this;
482 /**
483 * Emitted when `webContents` wants to do basic auth.
484 *
485 * The default behavior is to cancel all authentications. To override this you
486 * should prevent the default behavior with `event.preventDefault()` and call
487 * `callback(username, password)` with the credentials.
488 *
489 * If `callback` is called without a username or password, the authentication
490 * request will be cancelled and the authentication error will be returned to the
491 * page.
492 */
493 on(event: 'login', listener: (event: Event,
494 webContents: WebContents,
495 authenticationResponseDetails: AuthenticationResponseDetails,
496 authInfo: AuthInfo,
497 callback: (username?: string, password?: string) => void) => void): this;
498 off(event: 'login', listener: (event: Event,
499 webContents: WebContents,
500 authenticationResponseDetails: AuthenticationResponseDetails,
501 authInfo: AuthInfo,
502 callback: (username?: string, password?: string) => void) => void): this;
503 once(event: 'login', listener: (event: Event,
504 webContents: WebContents,
505 authenticationResponseDetails: AuthenticationResponseDetails,
506 authInfo: AuthInfo,
507 callback: (username?: string, password?: string) => void) => void): this;
508 addListener(event: 'login', listener: (event: Event,
509 webContents: WebContents,
510 authenticationResponseDetails: AuthenticationResponseDetails,
511 authInfo: AuthInfo,
512 callback: (username?: string, password?: string) => void) => void): this;
513 removeListener(event: 'login', listener: (event: Event,
514 webContents: WebContents,
515 authenticationResponseDetails: AuthenticationResponseDetails,
516 authInfo: AuthInfo,
517 callback: (username?: string, password?: string) => void) => void): this;
518 /**
519 * Emitted when the user clicks the native macOS new tab button. The new tab button
520 * is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
521 *
522 * @platform darwin
523 */
524 on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
525 /**
526 * @platform darwin
527 */
528 off(event: 'new-window-for-tab', listener: (event: Event) => void): this;
529 /**
530 * @platform darwin
531 */
532 once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
533 /**
534 * @platform darwin
535 */
536 addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
537 /**
538 * @platform darwin
539 */
540 removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
541 /**
542 * Emitted when the user wants to open a file with the application. The `open-file`
543 * event is usually emitted when the application is already open and the OS wants
544 * to reuse the application to open the file. `open-file` is also emitted when a
545 * file is dropped onto the dock and the application is not yet running. Make sure
546 * to listen for the `open-file` event very early in your application startup to
547 * handle this case (even before the `ready` event is emitted).
548 *
549 * You should call `event.preventDefault()` if you want to handle this event.
550 *
551 * On Windows, you have to parse `process.argv` (in the main process) to get the
552 * filepath.
553 *
554 * @platform darwin
555 */
556 on(event: 'open-file', listener: (event: Event,
557 path: string) => void): this;
558 /**
559 * @platform darwin
560 */
561 off(event: 'open-file', listener: (event: Event,
562 path: string) => void): this;
563 /**
564 * @platform darwin
565 */
566 once(event: 'open-file', listener: (event: Event,
567 path: string) => void): this;
568 /**
569 * @platform darwin
570 */
571 addListener(event: 'open-file', listener: (event: Event,
572 path: string) => void): this;
573 /**
574 * @platform darwin
575 */
576 removeListener(event: 'open-file', listener: (event: Event,
577 path: string) => void): this;
578 /**
579 * Emitted when the user wants to open a URL with the application. Your
580 * application's `Info.plist` file must define the URL scheme within the
581 * `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
582 *
583 * As with the `open-file` event, be sure to register a listener for the `open-url`
584 * event early in your application startup to detect if the application is being
585 * opened to handle a URL. If you register the listener in response to a `ready`
586 * event, you'll miss URLs that trigger the launch of your application.
587 *
588 * @platform darwin
589 */
590 on(event: 'open-url', listener: (event: Event,
591 url: string) => void): this;
592 /**
593 * @platform darwin
594 */
595 off(event: 'open-url', listener: (event: Event,
596 url: string) => void): this;
597 /**
598 * @platform darwin
599 */
600 once(event: 'open-url', listener: (event: Event,
601 url: string) => void): this;
602 /**
603 * @platform darwin
604 */
605 addListener(event: 'open-url', listener: (event: Event,
606 url: string) => void): this;
607 /**
608 * @platform darwin
609 */
610 removeListener(event: 'open-url', listener: (event: Event,
611 url: string) => void): this;
612 /**
613 * Emitted when the application is quitting.
614 *
615 * **Note:** On Windows, this event will not be emitted if the app is closed due to
616 * a shutdown/restart of the system or a user logout.
617 */
618 on(event: 'quit', listener: (event: Event,
619 exitCode: number) => void): this;
620 off(event: 'quit', listener: (event: Event,
621 exitCode: number) => void): this;
622 once(event: 'quit', listener: (event: Event,
623 exitCode: number) => void): this;
624 addListener(event: 'quit', listener: (event: Event,
625 exitCode: number) => void): this;
626 removeListener(event: 'quit', listener: (event: Event,
627 exitCode: number) => void): this;
628 /**
629 * Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
630 * holds the `userInfo` of the `NSUserNotification` or information from
631 * `UNNotificationResponse` that was used to open the application, if it was
632 * launched from Notification Center. You can also call `app.isReady()` to check if
633 * this event has already fired and `app.whenReady()` to get a Promise that is
634 * fulfilled when Electron is initialized.
635 *
636 * **Note**: The `ready` event is only fired after the main process has finished
637 * running the first tick of the event loop. If an Electron API needs to be called
638 * before the `ready` event, ensure that it is called synchronously in the
639 * top-level context of the main process.
640 */
641 on(event: 'ready', listener: (event: Event,
642 /**
643 * @platform darwin
644 */
645 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
646 off(event: 'ready', listener: (event: Event,
647 /**
648 * @platform darwin
649 */
650 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
651 once(event: 'ready', listener: (event: Event,
652 /**
653 * @platform darwin
654 */
655 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
656 addListener(event: 'ready', listener: (event: Event,
657 /**
658 * @platform darwin
659 */
660 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
661 removeListener(event: 'ready', listener: (event: Event,
662 /**
663 * @platform darwin
664 */
665 launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
666 /**
667 * Emitted when the renderer process unexpectedly disappears. This is normally
668 * because it was crashed or killed.
669 */
670 on(event: 'render-process-gone', listener: (event: Event,
671 webContents: WebContents,
672 details: RenderProcessGoneDetails) => void): this;
673 off(event: 'render-process-gone', listener: (event: Event,
674 webContents: WebContents,
675 details: RenderProcessGoneDetails) => void): this;
676 once(event: 'render-process-gone', listener: (event: Event,
677 webContents: WebContents,
678 details: RenderProcessGoneDetails) => void): this;
679 addListener(event: 'render-process-gone', listener: (event: Event,
680 webContents: WebContents,
681 details: RenderProcessGoneDetails) => void): this;
682 removeListener(event: 'render-process-gone', listener: (event: Event,
683 webContents: WebContents,
684 details: RenderProcessGoneDetails) => void): this;
685 /**
686 * This event will be emitted inside the primary instance of your application when
687 * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
688 *
689 * `argv` is an Array of the second instance's command line arguments, and
690 * `workingDirectory` is its current working directory. Usually applications
691 * respond to this by making their primary window focused and non-minimized.
692 *
693 * **Note:** `argv` will not be exactly the same list of arguments as those passed
694 * to the second instance. The order might change and additional arguments might be
695 * appended. If you need to maintain the exact same arguments, it's advised to use
696 * `additionalData` instead.
697 *
698 * **Note:** If the second instance is started by a different user than the first,
699 * the `argv` array will not include the arguments.
700 *
701 * This event is guaranteed to be emitted after the `ready` event of `app` gets
702 * emitted.
703 *
704 * **Note:** Extra command line arguments might be added by Chromium, such as
705 * `--original-process-start-time`.
706 */
707 on(event: 'second-instance', listener: (event: Event,
708 /**
709 * An array of the second instance's command line arguments
710 */
711 argv: string[],
712 /**
713 * The second instance's working directory
714 */
715 workingDirectory: string,
716 /**
717 * A JSON object of additional data passed from the second instance
718 */
719 additionalData: unknown) => void): this;
720 off(event: 'second-instance', listener: (event: Event,
721 /**
722 * An array of the second instance's command line arguments
723 */
724 argv: string[],
725 /**
726 * The second instance's working directory
727 */
728 workingDirectory: string,
729 /**
730 * A JSON object of additional data passed from the second instance
731 */
732 additionalData: unknown) => void): this;
733 once(event: 'second-instance', listener: (event: Event,
734 /**
735 * An array of the second instance's command line arguments
736 */
737 argv: string[],
738 /**
739 * The second instance's working directory
740 */
741 workingDirectory: string,
742 /**
743 * A JSON object of additional data passed from the second instance
744 */
745 additionalData: unknown) => void): this;
746 addListener(event: 'second-instance', listener: (event: Event,
747 /**
748 * An array of the second instance's command line arguments
749 */
750 argv: string[],
751 /**
752 * The second instance's working directory
753 */
754 workingDirectory: string,
755 /**
756 * A JSON object of additional data passed from the second instance
757 */
758 additionalData: unknown) => void): this;
759 removeListener(event: 'second-instance', listener: (event: Event,
760 /**
761 * An array of the second instance's command line arguments
762 */
763 argv: string[],
764 /**
765 * The second instance's working directory
766 */
767 workingDirectory: string,
768 /**
769 * A JSON object of additional data passed from the second instance
770 */
771 additionalData: unknown) => void): this;
772 /**
773 * Emitted when a client certificate is requested.
774 *
775 * The `url` corresponds to the navigation entry requesting the client certificate
776 * and `callback` can be called with an entry filtered from the list. Using
777 * `event.preventDefault()` prevents the application from using the first
778 * certificate from the store.
779 */
780 on(event: 'select-client-certificate', listener: (event: Event,
781 webContents: WebContents,
782 url: string,
783 certificateList: Certificate[],
784 callback: (certificate?: Certificate) => void) => void): this;
785 off(event: 'select-client-certificate', listener: (event: Event,
786 webContents: WebContents,
787 url: string,
788 certificateList: Certificate[],
789 callback: (certificate?: Certificate) => void) => void): this;
790 once(event: 'select-client-certificate', listener: (event: Event,
791 webContents: WebContents,
792 url: string,
793 certificateList: Certificate[],
794 callback: (certificate?: Certificate) => void) => void): this;
795 addListener(event: 'select-client-certificate', listener: (event: Event,
796 webContents: WebContents,
797 url: string,
798 certificateList: Certificate[],
799 callback: (certificate?: Certificate) => void) => void): this;
800 removeListener(event: 'select-client-certificate', listener: (event: Event,
801 webContents: WebContents,
802 url: string,
803 certificateList: Certificate[],
804 callback: (certificate?: Certificate) => void) => void): this;
805 /**
806 * Emitted when Electron has created a new `session`.
807 */
808 on(event: 'session-created', listener: (session: Session) => void): this;
809 off(event: 'session-created', listener: (session: Session) => void): this;
810 once(event: 'session-created', listener: (session: Session) => void): this;
811 addListener(event: 'session-created', listener: (session: Session) => void): this;
812 removeListener(event: 'session-created', listener: (session: Session) => void): this;
813 /**
814 * Emitted when Handoff is about to be resumed on another device. If you need to
815 * update the state to be transferred, you should call `event.preventDefault()`
816 * immediately, construct a new `userInfo` dictionary and call
817 * `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
818 * fail and `continue-activity-error` will be called.
819 *
820 * @platform darwin
821 */
822 on(event: 'update-activity-state', listener: (event: Event,
823 /**
824 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
825 */
826 type: string,
827 /**
828 * Contains app-specific state stored by the activity.
829 */
830 userInfo: unknown) => void): this;
831 /**
832 * @platform darwin
833 */
834 off(event: 'update-activity-state', listener: (event: Event,
835 /**
836 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
837 */
838 type: string,
839 /**
840 * Contains app-specific state stored by the activity.
841 */
842 userInfo: unknown) => void): this;
843 /**
844 * @platform darwin
845 */
846 once(event: 'update-activity-state', listener: (event: Event,
847 /**
848 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
849 */
850 type: string,
851 /**
852 * Contains app-specific state stored by the activity.
853 */
854 userInfo: unknown) => void): this;
855 /**
856 * @platform darwin
857 */
858 addListener(event: 'update-activity-state', listener: (event: Event,
859 /**
860 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
861 */
862 type: string,
863 /**
864 * Contains app-specific state stored by the activity.
865 */
866 userInfo: unknown) => void): this;
867 /**
868 * @platform darwin
869 */
870 removeListener(event: 'update-activity-state', listener: (event: Event,
871 /**
872 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
873 */
874 type: string,
875 /**
876 * Contains app-specific state stored by the activity.
877 */
878 userInfo: unknown) => void): this;
879 /**
880 * Emitted when a new webContents is created.
881 */
882 on(event: 'web-contents-created', listener: (event: Event,
883 webContents: WebContents) => void): this;
884 off(event: 'web-contents-created', listener: (event: Event,
885 webContents: WebContents) => void): this;
886 once(event: 'web-contents-created', listener: (event: Event,
887 webContents: WebContents) => void): this;
888 addListener(event: 'web-contents-created', listener: (event: Event,
889 webContents: WebContents) => void): this;
890 removeListener(event: 'web-contents-created', listener: (event: Event,
891 webContents: WebContents) => void): this;
892 /**
893 * Emitted during Handoff before an activity from a different device wants to be
894 * resumed. You should call `event.preventDefault()` if you want to handle this
895 * event.
896 *
897 * @platform darwin
898 */
899 on(event: 'will-continue-activity', listener: (event: Event,
900 /**
901 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
902 */
903 type: string) => void): this;
904 /**
905 * @platform darwin
906 */
907 off(event: 'will-continue-activity', listener: (event: Event,
908 /**
909 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
910 */
911 type: string) => void): this;
912 /**
913 * @platform darwin
914 */
915 once(event: 'will-continue-activity', listener: (event: Event,
916 /**
917 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
918 */
919 type: string) => void): this;
920 /**
921 * @platform darwin
922 */
923 addListener(event: 'will-continue-activity', listener: (event: Event,
924 /**
925 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
926 */
927 type: string) => void): this;
928 /**
929 * @platform darwin
930 */
931 removeListener(event: 'will-continue-activity', listener: (event: Event,
932 /**
933 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
934 */
935 type: string) => void): this;
936 /**
937 * Emitted when the application has finished basic startup. On Windows and Linux,
938 * the `will-finish-launching` event is the same as the `ready` event; on macOS,
939 * this event represents the `applicationWillFinishLaunching` notification of
940 * `NSApplication`.
941 *
942 * In most cases, you should do everything in the `ready` event handler.
943 */
944 on(event: 'will-finish-launching', listener: Function): this;
945 off(event: 'will-finish-launching', listener: Function): this;
946 once(event: 'will-finish-launching', listener: Function): this;
947 addListener(event: 'will-finish-launching', listener: Function): this;
948 removeListener(event: 'will-finish-launching', listener: Function): this;
949 /**
950 * Emitted when all windows have been closed and the application will quit. Calling
951 * `event.preventDefault()` will prevent the default behavior, which is terminating
952 * the application.
953 *
954 * See the description of the `window-all-closed` event for the differences between
955 * the `will-quit` and `window-all-closed` events.
956 *
957 * **Note:** On Windows, this event will not be emitted if the app is closed due to
958 * a shutdown/restart of the system or a user logout.
959 */
960 on(event: 'will-quit', listener: (event: Event) => void): this;
961 off(event: 'will-quit', listener: (event: Event) => void): this;
962 once(event: 'will-quit', listener: (event: Event) => void): this;
963 addListener(event: 'will-quit', listener: (event: Event) => void): this;
964 removeListener(event: 'will-quit', listener: (event: Event) => void): this;
965 /**
966 * Emitted when all windows have been closed.
967 *
968 * If you do not subscribe to this event and all windows are closed, the default
969 * behavior is to quit the app; however, if you subscribe, you control whether the
970 * app quits or not. If the user pressed `Cmd + Q`, or the developer called
971 * `app.quit()`, Electron will first try to close all the windows and then emit the
972 * `will-quit` event, and in this case the `window-all-closed` event would not be
973 * emitted.
974 */
975 on(event: 'window-all-closed', listener: Function): this;
976 off(event: 'window-all-closed', listener: Function): this;
977 once(event: 'window-all-closed', listener: Function): this;
978 addListener(event: 'window-all-closed', listener: Function): this;
979 removeListener(event: 'window-all-closed', listener: Function): this;
980 /**
981 * Adds `path` to the recent documents list.
982 *
983 * This list is managed by the OS. On Windows, you can visit the list from the task
984 * bar, and on macOS, you can visit it from dock menu.
985 *
986 * @platform darwin,win32
987 */
988 addRecentDocument(path: string): void;
989 /**
990 * Clears the recent documents list.
991 *
992 * @platform darwin,win32
993 */
994 clearRecentDocuments(): void;
995 /**
996 * Configures host resolution (DNS and DNS-over-HTTPS). By default, the following
997 * resolvers will be used, in order:
998 *
999 * * DNS-over-HTTPS, if the DNS provider supports it, then
1000 * * the built-in resolver (enabled on macOS only by default), then
1001 * * the system's resolver (e.g. `getaddrinfo`).
1002 *
1003 * This can be configured to either restrict usage of non-encrypted DNS
1004 * (`secureDnsMode: "secure"`), or disable DNS-over-HTTPS (`secureDnsMode: "off"`).
1005 * It is also possible to enable or disable the built-in resolver.
1006 *
1007 * To disable insecure DNS, you can specify a `secureDnsMode` of `"secure"`. If you
1008 * do so, you should make sure to provide a list of DNS-over-HTTPS servers to use,
1009 * in case the user's DNS configuration does not include a provider that supports
1010 * DoH.
1011 *
1012 * This API must be called after the `ready` event is emitted.
1013 */
1014 configureHostResolver(options: ConfigureHostResolverOptions): void;
1015 /**
1016 * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
1017 * basis if the GPU processes crashes too frequently. This function disables that
1018 * behavior.
1019 *
1020 * This method can only be called before app is ready.
1021 */
1022 disableDomainBlockingFor3DAPIs(): void;
1023 /**
1024 * Disables hardware acceleration for current app.
1025 *
1026 * This method can only be called before app is ready.
1027 */
1028 disableHardwareAcceleration(): void;
1029 /**
1030 * Enables full sandbox mode on the app. This means that all renderers will be
1031 * launched sandboxed, regardless of the value of the `sandbox` flag in
1032 * `WebPreferences`.
1033 *
1034 * This method can only be called before app is ready.
1035 */
1036 enableSandbox(): void;
1037 /**
1038 * Exits immediately with `exitCode`. `exitCode` defaults to 0.
1039 *
1040 * All windows will be closed immediately without asking the user, and the
1041 * `before-quit` and `will-quit` events will not be emitted.
1042 */
1043 exit(exitCode?: number): void;
1044 /**
1045 * On Linux, focuses on the first visible window. On macOS, makes the application
1046 * the active app. On Windows, focuses on the application's first window.
1047 *
1048 * You should seek to use the `steal` option as sparingly as possible.
1049 */
1050 focus(options?: FocusOptions): void;
1051 /**
1052 * Resolve with an object containing the following:
1053 *
1054 * * `icon` NativeImage - the display icon of the app handling the protocol.
1055 * * `path` string - installation path of the app handling the protocol.
1056 * * `name` string - display name of the app handling the protocol.
1057 *
1058 * This method returns a promise that contains the application name, icon and path
1059 * of the default handler for the protocol (aka URI scheme) of a URL.
1060 *
1061 * @platform darwin,win32
1062 */
1063 getApplicationInfoForProtocol(url: string): Promise<Electron.ApplicationInfoForProtocolReturnValue>;
1064 /**
1065 * Name of the application handling the protocol, or an empty string if there is no
1066 * handler. For instance, if Electron is the default handler of the URL, this could
1067 * be `Electron` on Windows and Mac. However, don't rely on the precise format
1068 * which is not guaranteed to remain unchanged. Expect a different format on Linux,
1069 * possibly with a `.desktop` suffix.
1070 *
1071 * This method returns the application name of the default handler for the protocol
1072 * (aka URI scheme) of a URL.
1073 */
1074 getApplicationNameForProtocol(url: string): string;
1075 /**
1076 * Array of `ProcessMetric` objects that correspond to memory and CPU usage
1077 * statistics of all the processes associated with the app.
1078 */
1079 getAppMetrics(): ProcessMetric[];
1080 /**
1081 * The current application directory.
1082 */
1083 getAppPath(): string;
1084 /**
1085 * The current value displayed in the counter badge.
1086 *
1087 * @platform linux,darwin
1088 */
1089 getBadgeCount(): number;
1090 /**
1091 * The type of the currently running activity.
1092 *
1093 * @platform darwin
1094 */
1095 getCurrentActivityType(): string;
1096 /**
1097 * fulfilled with the app's icon, which is a NativeImage.
1098 *
1099 * Fetches a path's associated icon.
1100 *
1101 * On _Windows_, there a 2 kinds of icons:
1102 *
1103 * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
1104 * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
1105 *
1106 * On _Linux_ and _macOS_, icons depend on the application associated with file
1107 * mime type.
1108 */
1109 getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
1110 /**
1111 * The Graphics Feature Status from `chrome://gpu/`.
1112 *
1113 * **Note:** This information is only usable after the `gpu-info-update` event is
1114 * emitted.
1115 */
1116 getGPUFeatureStatus(): GPUFeatureStatus;
1117 /**
1118 * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
1119 * containing all the GPU Information as in chromium's GPUInfo object. This
1120 * includes the version and driver information that's shown on `chrome://gpu` page.
1121 *
1122 * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
1123 * fewer attributes than when requested with `complete`. Here's an example of basic
1124 * response:
1125 *
1126 * Using `basic` should be preferred if only basic information like `vendorId` or
1127 * `deviceId` is needed.
1128 */
1129 getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
1130 /**
1131 * * `minItems` Integer - The minimum number of items that will be shown in the
1132 * Jump List (for a more detailed description of this value see the MSDN docs).
1133 * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
1134 * correspond to items that the user has explicitly removed from custom categories
1135 * in the Jump List. These items must not be re-added to the Jump List in the
1136 * **next** call to `app.setJumpList()`, Windows will not display any custom
1137 * category that contains any of the removed items.
1138 *
1139 * @platform win32
1140 */
1141 getJumpListSettings(): JumpListSettings;
1142 /**
1143 * The current application locale, fetched using Chromium's `l10n_util` library.
1144 * Possible return values are documented here.
1145 *
1146 * To set the locale, you'll want to use a command line switch at app startup,
1147 * which may be found here.
1148 *
1149 * **Note:** When distributing your packaged app, you have to also ship the
1150 * `locales` folder.
1151 *
1152 * **Note:** This API must be called after the `ready` event is emitted.
1153 *
1154 * **Note:** To see example return values of this API compared to other locale and
1155 * language APIs, see `app.getPreferredSystemLanguages()`.
1156 */
1157 getLocale(): string;
1158 /**
1159 * User operating system's locale two-letter ISO 3166 country code. The value is
1160 * taken from native OS APIs.
1161 *
1162 * **Note:** When unable to detect locale country code, it returns empty string.
1163 */
1164 getLocaleCountryCode(): string;
1165 /**
1166 * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
1167 * you need to pass the same arguments here for `openAtLogin` to be set correctly.
1168 *
1169 *
1170 * * `openAtLogin` boolean - `true` if the app is set to open at login.
1171 * * `openAsHidden` boolean _macOS_ _Deprecated_ - `true` if the app is set to open
1172 * as hidden at login. This does not work on macOS 13 and up.
1173 * * `wasOpenedAtLogin` boolean _macOS_ _Deprecated_ - `true` if the app was opened
1174 * at login automatically. This setting is not available on MAS builds or on macOS
1175 * 13 and up.
1176 * * `wasOpenedAsHidden` boolean _macOS_ _Deprecated_ - `true` if the app was
1177 * opened as a hidden login item. This indicates that the app should not open any
1178 * windows at startup. This setting is not available on MAS builds or on macOS 13
1179 * and up.
1180 * * `restoreState` boolean _macOS_ _Deprecated_ - `true` if the app was opened as
1181 * a login item that should restore the state from the previous session. This
1182 * indicates that the app should restore the windows that were open the last time
1183 * the app was closed. This setting is not available on MAS builds or on macOS 13
1184 * and up.
1185 * * `status` string _macOS_ - can be one of `not-registered`, `enabled`,
1186 * `requires-approval`, or `not-found`.
1187 * * `executableWillLaunchAtLogin` boolean _Windows_ - `true` if app is set to open
1188 * at login and its run key is not deactivated. This differs from `openAtLogin` as
1189 * it ignores the `args` option, this property will be true if the given executable
1190 * would be launched at login with **any** arguments.
1191 * * `launchItems` Object[] _Windows_
1192 * * `name` string _Windows_ - name value of a registry entry.
1193 * * `path` string _Windows_ - The executable to an app that corresponds to a
1194 * registry entry.
1195 * * `args` string[] _Windows_ - the command-line arguments to pass to the
1196 * executable.
1197 * * `scope` string _Windows_ - one of `user` or `machine`. Indicates whether the
1198 * registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
1199 * * `enabled` boolean _Windows_ - `true` if the app registry key is startup
1200 * approved and therefore shows as `enabled` in Task Manager and Windows settings.
1201 *
1202 * @platform darwin,win32
1203 */
1204 getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
1205 /**
1206 * The current application's name, which is the name in the application's
1207 * `package.json` file.
1208 *
1209 * Usually the `name` field of `package.json` is a short lowercase name, according
1210 * to the npm modules spec. You should usually also specify a `productName` field,
1211 * which is your application's full capitalized name, and which will be preferred
1212 * over `name` by Electron.
1213 */
1214 getName(): string;
1215 /**
1216 * A path to a special directory or file associated with `name`. On failure, an
1217 * `Error` is thrown.
1218 *
1219 * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
1220 * called first, a default log directory will be created equivalent to calling
1221 * `app.setAppLogsPath()` without a `path` parameter.
1222 */
1223 getPath(name: 'home' | 'appData' | 'userData' | 'sessionData' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'crashDumps'): string;
1224 /**
1225 * The user's preferred system languages from most preferred to least preferred,
1226 * including the country codes if applicable. A user can modify and add to this
1227 * list on Windows or macOS through the Language and Region settings.
1228 *
1229 * The API uses `GlobalizationPreferences` (with a fallback to
1230 * `GetSystemPreferredUILanguages`) on Windows, `\[NSLocale preferredLanguages\]`
1231 * on macOS, and `g_get_language_names` on Linux.
1232 *
1233 * This API can be used for purposes such as deciding what language to present the
1234 * application in.
1235 *
1236 * Here are some examples of return values of the various language and locale APIs
1237 * with different configurations:
1238 *
1239 * On Windows, given application locale is German, the regional format is Finnish
1240 * (Finland), and the preferred system languages from most to least preferred are
1241 * French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish
1242 * (Latin America):
1243 *
1244 * On macOS, given the application locale is German, the region is Finland, and the
1245 * preferred system languages from most to least preferred are French (Canada),
1246 * English (US), Simplified Chinese, and Spanish (Latin America):
1247 *
1248 * Both the available languages and regions and the possible return values differ
1249 * between the two operating systems.
1250 *
1251 * As can be seen with the example above, on Windows, it is possible that a
1252 * preferred system language has no country code, and that one of the preferred
1253 * system languages corresponds with the language used for the regional format. On
1254 * macOS, the region serves more as a default country code: the user doesn't need
1255 * to have Finnish as a preferred language to use Finland as the region,and the
1256 * country code `FI` is used as the country code for preferred system languages
1257 * that do not have associated countries in the language name.
1258 */
1259 getPreferredSystemLanguages(): string[];
1260 /**
1261 * The current system locale. On Windows and Linux, it is fetched using Chromium's
1262 * `i18n` library. On macOS, `[NSLocale currentLocale]` is used instead. To get the
1263 * user's current system language, which is not always the same as the locale, it
1264 * is better to use `app.getPreferredSystemLanguages()`.
1265 *
1266 * Different operating systems also use the regional data differently:
1267 *
1268 * * Windows 11 uses the regional format for numbers, dates, and times.
1269 * * macOS Monterey uses the region for formatting numbers, dates, times, and for
1270 * selecting the currency symbol to use.
1271 *
1272 * Therefore, this API can be used for purposes such as choosing a format for
1273 * rendering dates and times in a calendar app, especially when the developer wants
1274 * the format to be consistent with the OS.
1275 *
1276 * **Note:** This API must be called after the `ready` event is emitted.
1277 *
1278 * **Note:** To see example return values of this API compared to other locale and
1279 * language APIs, see `app.getPreferredSystemLanguages()`.
1280 */
1281 getSystemLocale(): string;
1282 /**
1283 * The version of the loaded application. If no version is found in the
1284 * application's `package.json` file, the version of the current bundle or
1285 * executable is returned.
1286 */
1287 getVersion(): string;
1288 /**
1289 * This method returns whether or not this instance of your app is currently
1290 * holding the single instance lock. You can request the lock with
1291 * `app.requestSingleInstanceLock()` and release with
1292 * `app.releaseSingleInstanceLock()`
1293 */
1294 hasSingleInstanceLock(): boolean;
1295 /**
1296 * Hides all application windows without minimizing them.
1297 *
1298 * @platform darwin
1299 */
1300 hide(): void;
1301 /**
1302 * Imports the certificate in pkcs12 format into the platform certificate store.
1303 * `callback` is called with the `result` of import operation, a value of `0`
1304 * indicates success while any other value indicates failure according to Chromium
1305 * net_error_list.
1306 *
1307 * @platform linux
1308 */
1309 importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
1310 /**
1311 * Invalidates the current Handoff user activity.
1312 *
1313 * @platform darwin
1314 */
1315 invalidateCurrentActivity(): void;
1316 /**
1317 * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
1318 * will return `true` if the use of assistive technologies, such as screen readers,
1319 * has been detected. See
1320 * https://www.chromium.org/developers/design-documents/accessibility for more
1321 * details.
1322 *
1323 * @platform darwin,win32
1324 */
1325 isAccessibilitySupportEnabled(): boolean;
1326 /**
1327 * Whether the current executable is the default handler for a protocol (aka URI
1328 * scheme).
1329 *
1330 * **Note:** On macOS, you can use this method to check if the app has been
1331 * registered as the default protocol handler for a protocol. You can also verify
1332 * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
1333 * macOS machine. Please refer to Apple's documentation for details.
1334 *
1335 * The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
1336 * internally.
1337 */
1338 isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1339 /**
1340 * whether or not the current OS version allows for native emoji pickers.
1341 */
1342 isEmojiPanelSupported(): boolean;
1343 /**
1344 * `true` if the application—including all of its windows—is hidden (e.g. with
1345 * `Command-H`), `false` otherwise.
1346 *
1347 * @platform darwin
1348 */
1349 isHidden(): boolean;
1350 /**
1351 * Whether the application is currently running from the systems Application
1352 * folder. Use in combination with `app.moveToApplicationsFolder()`
1353 *
1354 * @platform darwin
1355 */
1356 isInApplicationsFolder(): boolean;
1357 /**
1358 * `true` if Electron has finished initializing, `false` otherwise. See also
1359 * `app.whenReady()`.
1360 */
1361 isReady(): boolean;
1362 /**
1363 * whether `Secure Keyboard Entry` is enabled.
1364 *
1365 * By default this API will return `false`.
1366 *
1367 * @platform darwin
1368 */
1369 isSecureKeyboardEntryEnabled(): boolean;
1370 /**
1371 * Whether the current desktop environment is Unity launcher.
1372 *
1373 * @platform linux
1374 */
1375 isUnityRunning(): boolean;
1376 /**
1377 * Whether the move was successful. Please note that if the move is successful,
1378 * your application will quit and relaunch.
1379 *
1380 * No confirmation dialog will be presented by default. If you wish to allow the
1381 * user to confirm the operation, you may do so using the `dialog` API.
1382 *
1383 * **NOTE:** This method throws errors if anything other than the user causes the
1384 * move to fail. For instance if the user cancels the authorization dialog, this
1385 * method returns false. If we fail to perform the copy, then this method will
1386 * throw an error. The message in the error should be informative and tell you
1387 * exactly what went wrong.
1388 *
1389 * By default, if an app of the same name as the one being moved exists in the
1390 * Applications directory and is _not_ running, the existing app will be trashed
1391 * and the active app moved into its place. If it _is_ running, the preexisting
1392 * running app will assume focus and the previously active app will quit itself.
1393 * This behavior can be changed by providing the optional conflict handler, where
1394 * the boolean returned by the handler determines whether or not the move conflict
1395 * is resolved with default behavior. i.e. returning `false` will ensure no
1396 * further action is taken, returning `true` will result in the default behavior
1397 * and the method continuing.
1398 *
1399 * For example:
1400 *
1401 * Would mean that if an app already exists in the user directory, if the user
1402 * chooses to 'Continue Move' then the function would continue with its default
1403 * behavior and the existing app will be trashed and the active app moved into its
1404 * place.
1405 *
1406 * @platform darwin
1407 */
1408 moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
1409 /**
1410 * Try to close all windows. The `before-quit` event will be emitted first. If all
1411 * windows are successfully closed, the `will-quit` event will be emitted and by
1412 * default the application will terminate.
1413 *
1414 * This method guarantees that all `beforeunload` and `unload` event handlers are
1415 * correctly executed. It is possible that a window cancels the quitting by
1416 * returning `false` in the `beforeunload` event handler.
1417 */
1418 quit(): void;
1419 /**
1420 * Relaunches the app when current instance exits.
1421 *
1422 * By default, the new instance will use the same working directory and command
1423 * line arguments with current instance. When `args` is specified, the `args` will
1424 * be passed as command line arguments instead. When `execPath` is specified, the
1425 * `execPath` will be executed for relaunch instead of current app.
1426 *
1427 * Note that this method does not quit the app when executed, you have to call
1428 * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
1429 *
1430 * When `app.relaunch` is called for multiple times, multiple instances will be
1431 * started after current instance exited.
1432 *
1433 * An example of restarting current instance immediately and adding a new command
1434 * line argument to the new instance:
1435 */
1436 relaunch(options?: RelaunchOptions): void;
1437 /**
1438 * Releases all locks that were created by `requestSingleInstanceLock`. This will
1439 * allow multiple instances of the application to once again run side by side.
1440 */
1441 releaseSingleInstanceLock(): void;
1442 /**
1443 * Whether the call succeeded.
1444 *
1445 * This method checks if the current executable as the default handler for a
1446 * protocol (aka URI scheme). If so, it will remove the app as the default handler.
1447 *
1448 * @platform darwin,win32
1449 */
1450 removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1451 /**
1452 * The return value of this method indicates whether or not this instance of your
1453 * application successfully obtained the lock. If it failed to obtain the lock,
1454 * you can assume that another instance of your application is already running with
1455 * the lock and exit immediately.
1456 *
1457 * I.e. This method returns `true` if your process is the primary instance of your
1458 * application and your app should continue loading. It returns `false` if your
1459 * process should immediately quit as it has sent its parameters to another
1460 * instance that has already acquired the lock.
1461 *
1462 * On macOS, the system enforces single instance automatically when users try to
1463 * open a second instance of your app in Finder, and the `open-file` and `open-url`
1464 * events will be emitted for that. However when users start your app in command
1465 * line, the system's single instance mechanism will be bypassed, and you have to
1466 * use this method to ensure single instance.
1467 *
1468 * An example of activating the window of primary instance when a second instance
1469 * starts:
1470 */
1471 requestSingleInstanceLock(additionalData?: Record<any, any>): boolean;
1472 /**
1473 * Marks the current Handoff user activity as inactive without invalidating it.
1474 *
1475 * @platform darwin
1476 */
1477 resignCurrentActivity(): void;
1478 /**
1479 * Resolves with the proxy information for `url` that will be used when attempting
1480 * to make requests using Net in the utility process.
1481 */
1482 resolveProxy(url: string): Promise<string>;
1483 /**
1484 * Set the about panel options. This will override the values defined in the app's
1485 * `.plist` file on macOS. See the Apple docs for more details. On Linux, values
1486 * must be set in order to be shown; there are no defaults.
1487 *
1488 * If you do not set `credits` but still wish to surface them in your app, AppKit
1489 * will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in
1490 * that order, in the bundle returned by the NSBundle class method main. The first
1491 * file found is used, and if none is found, the info area is left blank. See Apple
1492 * documentation for more information.
1493 */
1494 setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
1495 /**
1496 * Manually enables Chrome's accessibility support, allowing to expose
1497 * accessibility switch to users in application settings. See Chromium's
1498 * accessibility docs for more details. Disabled by default.
1499 *
1500 * This API must be called after the `ready` event is emitted.
1501 *
1502 * **Note:** Rendering accessibility tree can significantly affect the performance
1503 * of your app. It should not be enabled by default.
1504 *
1505 * @platform darwin,win32
1506 */
1507 setAccessibilitySupportEnabled(enabled: boolean): void;
1508 /**
1509 * Sets the activation policy for a given app.
1510 *
1511 * Activation policy types:
1512 *
1513 * * 'regular' - The application is an ordinary app that appears in the Dock and
1514 * may have a user interface.
1515 * * 'accessory' - The application doesn’t appear in the Dock and doesn’t have a
1516 * menu bar, but it may be activated programmatically or by clicking on one of its
1517 * windows.
1518 * * 'prohibited' - The application doesn’t appear in the Dock and may not create
1519 * windows or be activated.
1520 *
1521 * @platform darwin
1522 */
1523 setActivationPolicy(policy: 'regular' | 'accessory' | 'prohibited'): void;
1524 /**
1525 * Sets or creates a directory your app's logs which can then be manipulated with
1526 * `app.getPath()` or `app.setPath(pathName, newPath)`.
1527 *
1528 * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
1529 * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
1530 * `userData` directory on _Linux_ and _Windows_.
1531 */
1532 setAppLogsPath(path?: string): void;
1533 /**
1534 * Changes the Application User Model ID to `id`.
1535 *
1536 * @platform win32
1537 */
1538 setAppUserModelId(id: string): void;
1539 /**
1540 * Whether the call succeeded.
1541 *
1542 * Sets the current executable as the default handler for a protocol (aka URI
1543 * scheme). It allows you to integrate your app deeper into the operating system.
1544 * Once registered, all links with `your-protocol://` will be opened with the
1545 * current executable. The whole link, including protocol, will be passed to your
1546 * application as a parameter.
1547 *
1548 * **Note:** On macOS, you can only register protocols that have been added to your
1549 * app's `info.plist`, which cannot be modified at runtime. However, you can change
1550 * the file during build time via Electron Forge, Electron Packager, or by editing
1551 * `info.plist` with a text editor. Please refer to Apple's documentation for
1552 * details.
1553 *
1554 * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
1555 * will return `true` for all calls but the registry key it sets won't be
1556 * accessible by other applications. In order to register your Windows Store
1557 * application as a default protocol handler you must declare the protocol in your
1558 * manifest.
1559 *
1560 * The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme`
1561 * internally.
1562 */
1563 setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1564 /**
1565 * Whether the call succeeded.
1566 *
1567 * Sets the counter badge for current app. Setting the count to `0` will hide the
1568 * badge.
1569 *
1570 * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
1571 *
1572 * **Note:** Unity launcher requires a `.desktop` file to work. For more
1573 * information, please read the Unity integration documentation.
1574 *
1575 * **Note:** On macOS, you need to ensure that your application has the permission
1576 * to display notifications for this method to work.
1577 *
1578 * @platform linux,darwin
1579 */
1580 setBadgeCount(count?: number): boolean;
1581 /**
1582 * Sets or removes a custom Jump List for the application, and returns one of the
1583 * following strings:
1584 *
1585 * * `ok` - Nothing went wrong.
1586 * * `error` - One or more errors occurred, enable runtime logging to figure out
1587 * the likely cause.
1588 * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
1589 * category in the Jump List. Separators are only allowed in the standard `Tasks`
1590 * category.
1591 * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
1592 * Jump List for a file type the app isn't registered to handle.
1593 * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
1594 * Jump List due to user privacy or group policy settings.
1595 *
1596 * If `categories` is `null` the previously set custom Jump List (if any) will be
1597 * replaced by the standard Jump List for the app (managed by Windows).
1598 *
1599 * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
1600 * property set then its `type` is assumed to be `tasks`. If the `name` property is
1601 * set but the `type` property is omitted then the `type` is assumed to be
1602 * `custom`.
1603 *
1604 * **Note:** Users can remove items from custom categories, and Windows will not
1605 * allow a removed item to be added back into a custom category until **after** the
1606 * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
1607 * removed item to a custom category earlier than that will result in the entire
1608 * custom category being omitted from the Jump List. The list of removed items can
1609 * be obtained using `app.getJumpListSettings()`.
1610 *
1611 * **Note:** The maximum length of a Jump List item's `description` property is 260
1612 * characters. Beyond this limit, the item will not be added to the Jump List, nor
1613 * will it be displayed.
1614 *
1615 * Here's a very simple example of creating a custom Jump List:
1616 *
1617 * @platform win32
1618 */
1619 setJumpList(categories: (JumpListCategory[]) | (null)): ('ok' | 'error' | 'invalidSeparatorError' | 'fileTypeRegistrationError' | 'customCategoryAccessDeniedError');
1620 /**
1621 * Set the app's login item settings.
1622 *
1623 * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
1624 * want to set the launch path to Update.exe, and pass arguments that specify your
1625 * application name. For example:
1626 *
1627 * For more information about setting different services as login items on macOS 13
1628 * and up, see `SMAppService`.
1629 *
1630 * @platform darwin,win32
1631 */
1632 setLoginItemSettings(settings: Settings): void;
1633 /**
1634 * Overrides the current application's name.
1635 *
1636 * **Note:** This function overrides the name used internally by Electron; it does
1637 * not affect the name that the OS uses.
1638 */
1639 setName(name: string): void;
1640 /**
1641 * Overrides the `path` to a special directory or file associated with `name`. If
1642 * the path specifies a directory that does not exist, an `Error` is thrown. In
1643 * that case, the directory should be created with `fs.mkdirSync` or similar.
1644 *
1645 * You can only override paths of a `name` defined in `app.getPath`.
1646 *
1647 * By default, web pages' cookies and caches will be stored under the `sessionData`
1648 * directory. If you want to change this location, you have to override the
1649 * `sessionData` path before the `ready` event of the `app` module is emitted.
1650 */
1651 setPath(name: string, path: string): void;
1652 setProxy(config: ProxyConfig): void;
1653 /**
1654 * Set the `Secure Keyboard Entry` is enabled in your application.
1655 *
1656 * By using this API, important information such as password and other sensitive
1657 * information can be prevented from being intercepted by other processes.
1658 *
1659 * See Apple's documentation for more details.
1660 *
1661 * **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it
1662 * when it is no longer needed.
1663 *
1664 * @platform darwin
1665 */
1666 setSecureKeyboardEntryEnabled(enabled: boolean): void;
1667 /**
1668 * Creates an `NSUserActivity` and sets it as the current activity. The activity is
1669 * eligible for Handoff to another device afterward.
1670 *
1671 * @platform darwin
1672 */
1673 setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
1674 /**
1675 * Adds `tasks` to the Tasks category of the Jump List on Windows.
1676 *
1677 * `tasks` is an array of `Task` objects.
1678 *
1679 * Whether the call succeeded.
1680 *
1681 * **Note:** If you'd like to customize the Jump List even more use
1682 * `app.setJumpList(categories)` instead.
1683 *
1684 * @platform win32
1685 */
1686 setUserTasks(tasks: Task[]): boolean;
1687 /**
1688 * Shows application windows after they were hidden. Does not automatically focus
1689 * them.
1690 *
1691 * @platform darwin
1692 */
1693 show(): void;
1694 /**
1695 * Show the app's about panel options. These options can be overridden with
1696 * `app.setAboutPanelOptions(options)`. This function runs asynchronously.
1697 */
1698 showAboutPanel(): void;
1699 /**
1700 * Show the platform's native emoji picker.
1701 *
1702 * @platform darwin,win32
1703 */
1704 showEmojiPanel(): void;
1705 /**
1706 * This function **must** be called once you have finished accessing the security
1707 * scoped file. If you do not remember to stop accessing the bookmark, kernel
1708 * resources will be leaked and your app will lose its ability to reach outside the
1709 * sandbox completely, until your app is restarted.
1710 *
1711 * Start accessing a security scoped resource. With this method Electron
1712 * applications that are packaged for the Mac App Store may reach outside their
1713 * sandbox to access files chosen by the user. See Apple's documentation for a
1714 * description of how this system works.
1715 *
1716 * @platform mas
1717 */
1718 startAccessingSecurityScopedResource(bookmarkData: string): Function;
1719 /**
1720 * Updates the current activity if its type matches `type`, merging the entries
1721 * from `userInfo` into its current `userInfo` dictionary.
1722 *
1723 * @platform darwin
1724 */
1725 updateCurrentActivity(type: string, userInfo: any): void;
1726 /**
1727 * fulfilled when Electron is initialized. May be used as a convenient alternative
1728 * to checking `app.isReady()` and subscribing to the `ready` event if the app is
1729 * not ready yet.
1730 */
1731 whenReady(): Promise<void>;
1732 /**
1733 * A `boolean` property that's `true` if Chrome's accessibility support is enabled,
1734 * `false` otherwise. This property will be `true` if the use of assistive
1735 * technologies, such as screen readers, has been detected. Setting this property
1736 * to `true` manually enables Chrome's accessibility support, allowing developers
1737 * to expose accessibility switch to users in application settings.
1738 *
1739 * See Chromium's accessibility docs for more details. Disabled by default.
1740 *
1741 * This API must be called after the `ready` event is emitted.
1742 *
1743 * **Note:** Rendering accessibility tree can significantly affect the performance
1744 * of your app. It should not be enabled by default.
1745 *
1746 * @platform darwin,win32
1747 */
1748 accessibilitySupportEnabled: boolean;
1749 /**
1750 * A `Menu | null` property that returns `Menu` if one has been set and `null`
1751 * otherwise. Users can pass a Menu to set this property.
1752 */
1753 applicationMenu: (Menu) | (null);
1754 /**
1755 * An `Integer` property that returns the badge count for current app. Setting the
1756 * count to `0` will hide the badge.
1757 *
1758 * On macOS, setting this with any nonzero integer shows on the dock icon. On
1759 * Linux, this property only works for Unity launcher.
1760 *
1761 * **Note:** Unity launcher requires a `.desktop` file to work. For more
1762 * information, please read the Unity integration documentation.
1763 *
1764 * **Note:** On macOS, you need to ensure that your application has the permission
1765 * to display notifications for this property to take effect.
1766 *
1767 * @platform linux,darwin
1768 */
1769 badgeCount: number;
1770 /**
1771 * A `CommandLine` object that allows you to read and manipulate the command line
1772 * arguments that Chromium uses.
1773 *
1774 */
1775 readonly commandLine: CommandLine;
1776 /**
1777 * A `Dock` `| undefined` object that allows you to perform actions on your app
1778 * icon in the user's dock on macOS.
1779 *
1780 * @platform darwin
1781 */
1782 readonly dock: Dock;
1783 /**
1784 * A `boolean` property that returns `true` if the app is packaged, `false`
1785 * otherwise. For many apps, this property can be used to distinguish development
1786 * and production environments.
1787 *
1788 */
1789 readonly isPackaged: boolean;
1790 /**
1791 * A `string` property that indicates the current application's name, which is the
1792 * name in the application's `package.json` file.
1793 *
1794 * Usually the `name` field of `package.json` is a short lowercase name, according
1795 * to the npm modules spec. You should usually also specify a `productName` field,
1796 * which is your application's full capitalized name, and which will be preferred
1797 * over `name` by Electron.
1798 */
1799 name: string;
1800 /**
1801 * A `boolean` which when `true` indicates that the app is currently running under
1802 * an ARM64 translator (like the macOS Rosetta Translator Environment or Windows
1803 * WOW).
1804 *
1805 * You can use this property to prompt users to download the arm64 version of your
1806 * application when they are mistakenly running the x64 version under Rosetta or
1807 * WOW.
1808 *
1809 * @platform darwin,win32
1810 */
1811 readonly runningUnderARM64Translation: boolean;
1812 /**
1813 * A `string` which is the user agent string Electron will use as a global
1814 * fallback.
1815 *
1816 * This is the user agent that will be used when no user agent is set at the
1817 * `webContents` or `session` level. It is useful for ensuring that your entire
1818 * app has the same user agent. Set to a custom value as early as possible in your
1819 * app's initialization to ensure that your overridden value is used.
1820 */
1821 userAgentFallback: string;
1822 }
1823
1824 interface AutoUpdater extends NodeJS.EventEmitter {
1825
1826 // Docs: https://electronjs.org/docs/api/auto-updater
1827
1828 /**
1829 * This event is emitted after a user calls `quitAndInstall()`.
1830 *
1831 * When this API is called, the `before-quit` event is not emitted before all
1832 * windows are closed. As a result you should listen to this event if you wish to
1833 * perform actions before the windows are closed while a process is quitting, as
1834 * well as listening to `before-quit`.
1835 */
1836 on(event: 'before-quit-for-update', listener: Function): this;
1837 off(event: 'before-quit-for-update', listener: Function): this;
1838 once(event: 'before-quit-for-update', listener: Function): this;
1839 addListener(event: 'before-quit-for-update', listener: Function): this;
1840 removeListener(event: 'before-quit-for-update', listener: Function): this;
1841 /**
1842 * Emitted when checking if an update has started.
1843 */
1844 on(event: 'checking-for-update', listener: Function): this;
1845 off(event: 'checking-for-update', listener: Function): this;
1846 once(event: 'checking-for-update', listener: Function): this;
1847 addListener(event: 'checking-for-update', listener: Function): this;
1848 removeListener(event: 'checking-for-update', listener: Function): this;
1849 /**
1850 * Emitted when there is an error while updating.
1851 */
1852 on(event: 'error', listener: (error: Error) => void): this;
1853 off(event: 'error', listener: (error: Error) => void): this;
1854 once(event: 'error', listener: (error: Error) => void): this;
1855 addListener(event: 'error', listener: (error: Error) => void): this;
1856 removeListener(event: 'error', listener: (error: Error) => void): this;
1857 /**
1858 * Emitted when there is an available update. The update is downloaded
1859 * automatically.
1860 */
1861 on(event: 'update-available', listener: Function): this;
1862 off(event: 'update-available', listener: Function): this;
1863 once(event: 'update-available', listener: Function): this;
1864 addListener(event: 'update-available', listener: Function): this;
1865 removeListener(event: 'update-available', listener: Function): this;
1866 /**
1867 * Emitted when an update has been downloaded.
1868 *
1869 * On Windows only `releaseName` is available.
1870 *
1871 * **Note:** It is not strictly necessary to handle this event. A successfully
1872 * downloaded update will still be applied the next time the application starts.
1873 */
1874 on(event: 'update-downloaded', listener: (event: Event,
1875 releaseNotes: string,
1876 releaseName: string,
1877 releaseDate: Date,
1878 updateURL: string) => void): this;
1879 off(event: 'update-downloaded', listener: (event: Event,
1880 releaseNotes: string,
1881 releaseName: string,
1882 releaseDate: Date,
1883 updateURL: string) => void): this;
1884 once(event: 'update-downloaded', listener: (event: Event,
1885 releaseNotes: string,
1886 releaseName: string,
1887 releaseDate: Date,
1888 updateURL: string) => void): this;
1889 addListener(event: 'update-downloaded', listener: (event: Event,
1890 releaseNotes: string,
1891 releaseName: string,
1892 releaseDate: Date,
1893 updateURL: string) => void): this;
1894 removeListener(event: 'update-downloaded', listener: (event: Event,
1895 releaseNotes: string,
1896 releaseName: string,
1897 releaseDate: Date,
1898 updateURL: string) => void): this;
1899 /**
1900 * Emitted when there is no available update.
1901 */
1902 on(event: 'update-not-available', listener: Function): this;
1903 off(event: 'update-not-available', listener: Function): this;
1904 once(event: 'update-not-available', listener: Function): this;
1905 addListener(event: 'update-not-available', listener: Function): this;
1906 removeListener(event: 'update-not-available', listener: Function): this;
1907 /**
1908 * Asks the server whether there is an update. You must call `setFeedURL` before
1909 * using this API.
1910 *
1911 * **Note:** If an update is available it will be downloaded automatically. Calling
1912 * `autoUpdater.checkForUpdates()` twice will download the update two times.
1913 */
1914 checkForUpdates(): void;
1915 /**
1916 * The current update feed URL.
1917 */
1918 getFeedURL(): string;
1919 /**
1920 * Restarts the app and installs the update after it has been downloaded. It should
1921 * only be called after `update-downloaded` has been emitted.
1922 *
1923 * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
1924 * windows first, and automatically call `app.quit()` after all windows have been
1925 * closed.
1926 *
1927 * **Note:** It is not strictly necessary to call this function to apply an update,
1928 * as a successfully downloaded update will always be applied the next time the
1929 * application starts.
1930 */
1931 quitAndInstall(): void;
1932 /**
1933 * Sets the `url` and initialize the auto updater.
1934 */
1935 setFeedURL(options: FeedURLOptions): void;
1936 }
1937
1938 class BaseWindow extends NodeEventEmitter {
1939
1940 // Docs: https://electronjs.org/docs/api/base-window
1941
1942 /**
1943 * Emitted when the window is set or unset to show always on top of other windows.
1944 */
1945 on(event: 'always-on-top-changed', listener: (event: Event,
1946 isAlwaysOnTop: boolean) => void): this;
1947 off(event: 'always-on-top-changed', listener: (event: Event,
1948 isAlwaysOnTop: boolean) => void): this;
1949 once(event: 'always-on-top-changed', listener: (event: Event,
1950 isAlwaysOnTop: boolean) => void): this;
1951 addListener(event: 'always-on-top-changed', listener: (event: Event,
1952 isAlwaysOnTop: boolean) => void): this;
1953 removeListener(event: 'always-on-top-changed', listener: (event: Event,
1954 isAlwaysOnTop: boolean) => void): this;
1955 /**
1956 * Emitted when an App Command is invoked. These are typically related to keyboard
1957 * media keys or browser commands, as well as the "Back" button built into some
1958 * mice on Windows.
1959 *
1960 * Commands are lowercased, underscores are replaced with hyphens, and the
1961 * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
1962 * emitted as `browser-backward`.
1963 *
1964 * The following app commands are explicitly supported on Linux:
1965 *
1966 * * `browser-backward`
1967 * * `browser-forward`
1968 *
1969 * @platform win32,linux
1970 */
1971 on(event: 'app-command', listener: (event: Event,
1972 command: string) => void): this;
1973 /**
1974 * @platform win32,linux
1975 */
1976 off(event: 'app-command', listener: (event: Event,
1977 command: string) => void): this;
1978 /**
1979 * @platform win32,linux
1980 */
1981 once(event: 'app-command', listener: (event: Event,
1982 command: string) => void): this;
1983 /**
1984 * @platform win32,linux
1985 */
1986 addListener(event: 'app-command', listener: (event: Event,
1987 command: string) => void): this;
1988 /**
1989 * @platform win32,linux
1990 */
1991 removeListener(event: 'app-command', listener: (event: Event,
1992 command: string) => void): this;
1993 /**
1994 * Emitted when the window loses focus.
1995 */
1996 on(event: 'blur', listener: Function): this;
1997 off(event: 'blur', listener: Function): this;
1998 once(event: 'blur', listener: Function): this;
1999 addListener(event: 'blur', listener: Function): this;
2000 removeListener(event: 'blur', listener: Function): this;
2001 /**
2002 * Emitted when the window is going to be closed. It's emitted before the
2003 * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
2004 * will cancel the close.
2005 *
2006 * Usually you would want to use the `beforeunload` handler to decide whether the
2007 * window should be closed, which will also be called when the window is reloaded.
2008 * In Electron, returning any value other than `undefined` would cancel the close.
2009 * For example:
2010 *
2011 * _**Note**: There is a subtle difference between the behaviors of
2012 * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
2013 * handler)`. It is recommended to always set the `event.returnValue` explicitly,
2014 * instead of only returning a value, as the former works more consistently within
2015 * Electron._
2016 */
2017 on(event: 'close', listener: (event: Event) => void): this;
2018 off(event: 'close', listener: (event: Event) => void): this;
2019 once(event: 'close', listener: (event: Event) => void): this;
2020 addListener(event: 'close', listener: (event: Event) => void): this;
2021 removeListener(event: 'close', listener: (event: Event) => void): this;
2022 /**
2023 * Emitted when the window is closed. After you have received this event you should
2024 * remove the reference to the window and avoid using it any more.
2025 */
2026 on(event: 'closed', listener: Function): this;
2027 off(event: 'closed', listener: Function): this;
2028 once(event: 'closed', listener: Function): this;
2029 addListener(event: 'closed', listener: Function): this;
2030 removeListener(event: 'closed', listener: Function): this;
2031 /**
2032 * Emitted when the window enters a full-screen state.
2033 */
2034 on(event: 'enter-full-screen', listener: Function): this;
2035 off(event: 'enter-full-screen', listener: Function): this;
2036 once(event: 'enter-full-screen', listener: Function): this;
2037 addListener(event: 'enter-full-screen', listener: Function): this;
2038 removeListener(event: 'enter-full-screen', listener: Function): this;
2039 /**
2040 * Emitted when the window gains focus.
2041 */
2042 on(event: 'focus', listener: Function): this;
2043 off(event: 'focus', listener: Function): this;
2044 once(event: 'focus', listener: Function): this;
2045 addListener(event: 'focus', listener: Function): this;
2046 removeListener(event: 'focus', listener: Function): this;
2047 /**
2048 * Emitted when the window is hidden.
2049 */
2050 on(event: 'hide', listener: Function): this;
2051 off(event: 'hide', listener: Function): this;
2052 once(event: 'hide', listener: Function): this;
2053 addListener(event: 'hide', listener: Function): this;
2054 removeListener(event: 'hide', listener: Function): this;
2055 /**
2056 * Emitted when the window leaves a full-screen state.
2057 */
2058 on(event: 'leave-full-screen', listener: Function): this;
2059 off(event: 'leave-full-screen', listener: Function): this;
2060 once(event: 'leave-full-screen', listener: Function): this;
2061 addListener(event: 'leave-full-screen', listener: Function): this;
2062 removeListener(event: 'leave-full-screen', listener: Function): this;
2063 /**
2064 * Emitted when window is maximized.
2065 */
2066 on(event: 'maximize', listener: Function): this;
2067 off(event: 'maximize', listener: Function): this;
2068 once(event: 'maximize', listener: Function): this;
2069 addListener(event: 'maximize', listener: Function): this;
2070 removeListener(event: 'maximize', listener: Function): this;
2071 /**
2072 * Emitted when the window is minimized.
2073 */
2074 on(event: 'minimize', listener: Function): this;
2075 off(event: 'minimize', listener: Function): this;
2076 once(event: 'minimize', listener: Function): this;
2077 addListener(event: 'minimize', listener: Function): this;
2078 removeListener(event: 'minimize', listener: Function): this;
2079 /**
2080 * Emitted when the window is being moved to a new position.
2081 */
2082 on(event: 'move', listener: Function): this;
2083 off(event: 'move', listener: Function): this;
2084 once(event: 'move', listener: Function): this;
2085 addListener(event: 'move', listener: Function): this;
2086 removeListener(event: 'move', listener: Function): this;
2087 /**
2088 * Emitted once when the window is moved to a new position.
2089 *
2090 * **Note**: On macOS this event is an alias of `move`.
2091 *
2092 * @platform darwin,win32
2093 */
2094 on(event: 'moved', listener: Function): this;
2095 /**
2096 * @platform darwin,win32
2097 */
2098 off(event: 'moved', listener: Function): this;
2099 /**
2100 * @platform darwin,win32
2101 */
2102 once(event: 'moved', listener: Function): this;
2103 /**
2104 * @platform darwin,win32
2105 */
2106 addListener(event: 'moved', listener: Function): this;
2107 /**
2108 * @platform darwin,win32
2109 */
2110 removeListener(event: 'moved', listener: Function): this;
2111 /**
2112 * Emitted when the native new tab button is clicked.
2113 *
2114 * @platform darwin
2115 */
2116 on(event: 'new-window-for-tab', listener: Function): this;
2117 /**
2118 * @platform darwin
2119 */
2120 off(event: 'new-window-for-tab', listener: Function): this;
2121 /**
2122 * @platform darwin
2123 */
2124 once(event: 'new-window-for-tab', listener: Function): this;
2125 /**
2126 * @platform darwin
2127 */
2128 addListener(event: 'new-window-for-tab', listener: Function): this;
2129 /**
2130 * @platform darwin
2131 */
2132 removeListener(event: 'new-window-for-tab', listener: Function): this;
2133 /**
2134 * Emitted after the window has been resized.
2135 */
2136 on(event: 'resize', listener: Function): this;
2137 off(event: 'resize', listener: Function): this;
2138 once(event: 'resize', listener: Function): this;
2139 addListener(event: 'resize', listener: Function): this;
2140 removeListener(event: 'resize', listener: Function): this;
2141 /**
2142 * Emitted once when the window has finished being resized.
2143 *
2144 * This is usually emitted when the window has been resized manually. On macOS,
2145 * resizing the window with `setBounds`/`setSize` and setting the `animate`
2146 * parameter to `true` will also emit this event once resizing has finished.
2147 *
2148 * @platform darwin,win32
2149 */
2150 on(event: 'resized', listener: Function): this;
2151 /**
2152 * @platform darwin,win32
2153 */
2154 off(event: 'resized', listener: Function): this;
2155 /**
2156 * @platform darwin,win32
2157 */
2158 once(event: 'resized', listener: Function): this;
2159 /**
2160 * @platform darwin,win32
2161 */
2162 addListener(event: 'resized', listener: Function): this;
2163 /**
2164 * @platform darwin,win32
2165 */
2166 removeListener(event: 'resized', listener: Function): this;
2167 /**
2168 * Emitted when the window is restored from a minimized state.
2169 */
2170 on(event: 'restore', listener: Function): this;
2171 off(event: 'restore', listener: Function): this;
2172 once(event: 'restore', listener: Function): this;
2173 addListener(event: 'restore', listener: Function): this;
2174 removeListener(event: 'restore', listener: Function): this;
2175 /**
2176 * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
2177 * is ended. The `rotation` value on each emission is the angle in degrees rotated
2178 * since the last emission. The last emitted event upon a rotation gesture will
2179 * always be of value `0`. Counter-clockwise rotation values are positive, while
2180 * clockwise ones are negative.
2181 *
2182 * @platform darwin
2183 */
2184 on(event: 'rotate-gesture', listener: (event: Event,
2185 rotation: number) => void): this;
2186 /**
2187 * @platform darwin
2188 */
2189 off(event: 'rotate-gesture', listener: (event: Event,
2190 rotation: number) => void): this;
2191 /**
2192 * @platform darwin
2193 */
2194 once(event: 'rotate-gesture', listener: (event: Event,
2195 rotation: number) => void): this;
2196 /**
2197 * @platform darwin
2198 */
2199 addListener(event: 'rotate-gesture', listener: (event: Event,
2200 rotation: number) => void): this;
2201 /**
2202 * @platform darwin
2203 */
2204 removeListener(event: 'rotate-gesture', listener: (event: Event,
2205 rotation: number) => void): this;
2206 /**
2207 * Emitted when window session is going to end due to force shutdown or machine
2208 * restart or session log off.
2209 *
2210 * @platform win32
2211 */
2212 on(event: 'session-end', listener: Function): this;
2213 /**
2214 * @platform win32
2215 */
2216 off(event: 'session-end', listener: Function): this;
2217 /**
2218 * @platform win32
2219 */
2220 once(event: 'session-end', listener: Function): this;
2221 /**
2222 * @platform win32
2223 */
2224 addListener(event: 'session-end', listener: Function): this;
2225 /**
2226 * @platform win32
2227 */
2228 removeListener(event: 'session-end', listener: Function): this;
2229 /**
2230 * Emitted when the window opens a sheet.
2231 *
2232 * @platform darwin
2233 */
2234 on(event: 'sheet-begin', listener: Function): this;
2235 /**
2236 * @platform darwin
2237 */
2238 off(event: 'sheet-begin', listener: Function): this;
2239 /**
2240 * @platform darwin
2241 */
2242 once(event: 'sheet-begin', listener: Function): this;
2243 /**
2244 * @platform darwin
2245 */
2246 addListener(event: 'sheet-begin', listener: Function): this;
2247 /**
2248 * @platform darwin
2249 */
2250 removeListener(event: 'sheet-begin', listener: Function): this;
2251 /**
2252 * Emitted when the window has closed a sheet.
2253 *
2254 * @platform darwin
2255 */
2256 on(event: 'sheet-end', listener: Function): this;
2257 /**
2258 * @platform darwin
2259 */
2260 off(event: 'sheet-end', listener: Function): this;
2261 /**
2262 * @platform darwin
2263 */
2264 once(event: 'sheet-end', listener: Function): this;
2265 /**
2266 * @platform darwin
2267 */
2268 addListener(event: 'sheet-end', listener: Function): this;
2269 /**
2270 * @platform darwin
2271 */
2272 removeListener(event: 'sheet-end', listener: Function): this;
2273 /**
2274 * Emitted when the window is shown.
2275 */
2276 on(event: 'show', listener: Function): this;
2277 off(event: 'show', listener: Function): this;
2278 once(event: 'show', listener: Function): this;
2279 addListener(event: 'show', listener: Function): this;
2280 removeListener(event: 'show', listener: Function): this;
2281 /**
2282 * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
2283 * `left`.
2284 *
2285 * The method underlying this event is built to handle older macOS-style trackpad
2286 * swiping, where the content on the screen doesn't move with the swipe. Most macOS
2287 * trackpads are not configured to allow this kind of swiping anymore, so in order
2288 * for it to emit properly the 'Swipe between pages' preference in `System
2289 * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
2290 * fingers'.
2291 *
2292 * @platform darwin
2293 */
2294 on(event: 'swipe', listener: (event: Event,
2295 direction: string) => void): this;
2296 /**
2297 * @platform darwin
2298 */
2299 off(event: 'swipe', listener: (event: Event,
2300 direction: string) => void): this;
2301 /**
2302 * @platform darwin
2303 */
2304 once(event: 'swipe', listener: (event: Event,
2305 direction: string) => void): this;
2306 /**
2307 * @platform darwin
2308 */
2309 addListener(event: 'swipe', listener: (event: Event,
2310 direction: string) => void): this;
2311 /**
2312 * @platform darwin
2313 */
2314 removeListener(event: 'swipe', listener: (event: Event,
2315 direction: string) => void): this;
2316 /**
2317 * Emitted when the system context menu is triggered on the window, this is
2318 * normally only triggered when the user right clicks on the non-client area of
2319 * your window. This is the window titlebar or any area you have declared as
2320 * `-webkit-app-region: drag` in a frameless window.
2321 *
2322 * Calling `event.preventDefault()` will prevent the menu from being displayed.
2323 *
2324 * @platform win32
2325 */
2326 on(event: 'system-context-menu', listener: (event: Event,
2327 /**
2328 * The screen coordinates the context menu was triggered at
2329 */
2330 point: Point) => void): this;
2331 /**
2332 * @platform win32
2333 */
2334 off(event: 'system-context-menu', listener: (event: Event,
2335 /**
2336 * The screen coordinates the context menu was triggered at
2337 */
2338 point: Point) => void): this;
2339 /**
2340 * @platform win32
2341 */
2342 once(event: 'system-context-menu', listener: (event: Event,
2343 /**
2344 * The screen coordinates the context menu was triggered at
2345 */
2346 point: Point) => void): this;
2347 /**
2348 * @platform win32
2349 */
2350 addListener(event: 'system-context-menu', listener: (event: Event,
2351 /**
2352 * The screen coordinates the context menu was triggered at
2353 */
2354 point: Point) => void): this;
2355 /**
2356 * @platform win32
2357 */
2358 removeListener(event: 'system-context-menu', listener: (event: Event,
2359 /**
2360 * The screen coordinates the context menu was triggered at
2361 */
2362 point: Point) => void): this;
2363 /**
2364 * Emitted when the window exits from a maximized state.
2365 */
2366 on(event: 'unmaximize', listener: Function): this;
2367 off(event: 'unmaximize', listener: Function): this;
2368 once(event: 'unmaximize', listener: Function): this;
2369 addListener(event: 'unmaximize', listener: Function): this;
2370 removeListener(event: 'unmaximize', listener: Function): this;
2371 /**
2372 * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
2373 * will prevent the window from being moved.
2374 *
2375 * Note that this is only emitted when the window is being moved manually. Moving
2376 * the window with `setPosition`/`setBounds`/`center` will not emit this event.
2377 *
2378 * @platform darwin,win32
2379 */
2380 on(event: 'will-move', listener: (event: Event,
2381 /**
2382 * Location the window is being moved to.
2383 */
2384 newBounds: Rectangle) => void): this;
2385 /**
2386 * @platform darwin,win32
2387 */
2388 off(event: 'will-move', listener: (event: Event,
2389 /**
2390 * Location the window is being moved to.
2391 */
2392 newBounds: Rectangle) => void): this;
2393 /**
2394 * @platform darwin,win32
2395 */
2396 once(event: 'will-move', listener: (event: Event,
2397 /**
2398 * Location the window is being moved to.
2399 */
2400 newBounds: Rectangle) => void): this;
2401 /**
2402 * @platform darwin,win32
2403 */
2404 addListener(event: 'will-move', listener: (event: Event,
2405 /**
2406 * Location the window is being moved to.
2407 */
2408 newBounds: Rectangle) => void): this;
2409 /**
2410 * @platform darwin,win32
2411 */
2412 removeListener(event: 'will-move', listener: (event: Event,
2413 /**
2414 * Location the window is being moved to.
2415 */
2416 newBounds: Rectangle) => void): this;
2417 /**
2418 * Emitted before the window is resized. Calling `event.preventDefault()` will
2419 * prevent the window from being resized.
2420 *
2421 * Note that this is only emitted when the window is being resized manually.
2422 * Resizing the window with `setBounds`/`setSize` will not emit this event.
2423 *
2424 * The possible values and behaviors of the `edge` option are platform dependent.
2425 * Possible values are:
2426 *
2427 * * On Windows, possible values are `bottom`, `top`, `left`, `right`, `top-left`,
2428 * `top-right`, `bottom-left`, `bottom-right`.
2429 * * On macOS, possible values are `bottom` and `right`.
2430 * * The value `bottom` is used to denote vertical resizing.
2431 * * The value `right` is used to denote horizontal resizing.
2432 *
2433 * @platform darwin,win32
2434 */
2435 on(event: 'will-resize', listener: (event: Event,
2436 /**
2437 * Size the window is being resized to.
2438 */
2439 newBounds: Rectangle,
2440 details: WillResizeDetails) => void): this;
2441 /**
2442 * @platform darwin,win32
2443 */
2444 off(event: 'will-resize', listener: (event: Event,
2445 /**
2446 * Size the window is being resized to.
2447 */
2448 newBounds: Rectangle,
2449 details: WillResizeDetails) => void): this;
2450 /**
2451 * @platform darwin,win32
2452 */
2453 once(event: 'will-resize', listener: (event: Event,
2454 /**
2455 * Size the window is being resized to.
2456 */
2457 newBounds: Rectangle,
2458 details: WillResizeDetails) => void): this;
2459 /**
2460 * @platform darwin,win32
2461 */
2462 addListener(event: 'will-resize', listener: (event: Event,
2463 /**
2464 * Size the window is being resized to.
2465 */
2466 newBounds: Rectangle,
2467 details: WillResizeDetails) => void): this;
2468 /**
2469 * @platform darwin,win32
2470 */
2471 removeListener(event: 'will-resize', listener: (event: Event,
2472 /**
2473 * Size the window is being resized to.
2474 */
2475 newBounds: Rectangle,
2476 details: WillResizeDetails) => void): this;
2477 /**
2478 * BaseWindow
2479 */
2480 constructor(options?: BaseWindowConstructorOptions);
2481 /**
2482 * The window with the given `id`.
2483 */
2484 static fromId(id: number): (BaseWindow) | (null);
2485 /**
2486 * An array of all opened browser windows.
2487 */
2488 static getAllWindows(): BaseWindow[];
2489 /**
2490 * The window that is focused in this application, otherwise returns `null`.
2491 */
2492 static getFocusedWindow(): (BaseWindow) | (null);
2493 /**
2494 * Adds a window as a tab on this window, after the tab for the window instance.
2495 *
2496 * @platform darwin
2497 */
2498 addTabbedWindow(baseWindow: BaseWindow): void;
2499 /**
2500 * Removes focus from the window.
2501 */
2502 blur(): void;
2503 /**
2504 * Moves window to the center of the screen.
2505 */
2506 center(): void;
2507 /**
2508 * Try to close the window. This has the same effect as a user manually clicking
2509 * the close button of the window. The web page may cancel the close though. See
2510 * the close event.
2511 */
2512 close(): void;
2513 /**
2514 * Closes the currently open Quick Look panel.
2515 *
2516 * @platform darwin
2517 */
2518 closeFilePreview(): void;
2519 /**
2520 * Force closing the window, the `unload` and `beforeunload` event won't be emitted
2521 * for the web page, and `close` event will also not be emitted for this window,
2522 * but it guarantees the `closed` event will be emitted.
2523 */
2524 destroy(): void;
2525 /**
2526 * Starts or stops flashing the window to attract user's attention.
2527 */
2528 flashFrame(flag: boolean): void;
2529 /**
2530 * Focuses on the window.
2531 */
2532 focus(): void;
2533 /**
2534 * Gets the background color of the window in Hex (`#RRGGBB`) format.
2535 *
2536 * See Setting `backgroundColor`.
2537 *
2538 * **Note:** The alpha value is _not_ returned alongside the red, green, and blue
2539 * values.
2540 */
2541 getBackgroundColor(): string;
2542 /**
2543 * The `bounds` of the window as `Object`.
2544 *
2545 * **Note:** On macOS, the y-coordinate value returned will be at minimum the Tray
2546 * height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height:
2547 * 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x:
2548 * 25, y: 38, width: 800, height: 600 }`.
2549 */
2550 getBounds(): Rectangle;
2551 /**
2552 * All child windows.
2553 */
2554 getChildWindows(): BaseWindow[];
2555 /**
2556 * The `bounds` of the window's client area as `Object`.
2557 */
2558 getContentBounds(): Rectangle;
2559 /**
2560 * Contains the window's client area's width and height.
2561 */
2562 getContentSize(): number[];
2563 /**
2564 * Returns View - The content view of the window.
2565 */
2566 getContentView(): void;
2567 /**
2568 * Contains the window's maximum width and height.
2569 */
2570 getMaximumSize(): number[];
2571 /**
2572 * Window id in the format of DesktopCapturerSource's id. For example
2573 * "window:1324:0".
2574 *
2575 * More precisely the format is `window:id:other_id` where `id` is `HWND` on
2576 * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
2577 * Linux. `other_id` is used to identify web contents (tabs) so within the same top
2578 * level window.
2579 */
2580 getMediaSourceId(): string;
2581 /**
2582 * Contains the window's minimum width and height.
2583 */
2584 getMinimumSize(): number[];
2585 /**
2586 * The platform-specific handle of the window.
2587 *
2588 * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
2589 * `Window` (`unsigned long`) on Linux.
2590 */
2591 getNativeWindowHandle(): Buffer;
2592 /**
2593 * Contains the window bounds of the normal state
2594 *
2595 * **Note:** whatever the current state of the window : maximized, minimized or in
2596 * fullscreen, this function always returns the position and size of the window in
2597 * normal state. In normal state, getBounds and getNormalBounds returns the same
2598 * `Rectangle`.
2599 */
2600 getNormalBounds(): Rectangle;
2601 /**
2602 * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
2603 * 1.
2604 */
2605 getOpacity(): number;
2606 /**
2607 * The parent window or `null` if there is no parent.
2608 */
2609 getParentWindow(): (BaseWindow) | (null);
2610 /**
2611 * Contains the window's current position.
2612 */
2613 getPosition(): number[];
2614 /**
2615 * The pathname of the file the window represents.
2616 *
2617 * @platform darwin
2618 */
2619 getRepresentedFilename(): string;
2620 /**
2621 * Contains the window's width and height.
2622 */
2623 getSize(): number[];
2624 /**
2625 * The title of the native window.
2626 *
2627 * **Note:** The title of the web page can be different from the title of the
2628 * native window.
2629 */
2630 getTitle(): string;
2631 /**
2632 * The custom position for the traffic light buttons in frameless window, `null`
2633 * will be returned when there is no custom position.
2634 *
2635 * @platform darwin
2636 */
2637 getWindowButtonPosition(): (Point) | (null);
2638 /**
2639 * Whether the window has a shadow.
2640 */
2641 hasShadow(): boolean;
2642 /**
2643 * Hides the window.
2644 */
2645 hide(): void;
2646 /**
2647 * Hooks a windows message. The `callback` is called when the message is received
2648 * in the WndProc.
2649 *
2650 * @platform win32
2651 */
2652 hookWindowMessage(message: number, callback: (wParam: Buffer, lParam: Buffer) => void): void;
2653 /**
2654 * Invalidates the window shadow so that it is recomputed based on the current
2655 * window shape.
2656 *
2657 * `BaseWindow`s that are transparent can sometimes leave behind visual artifacts
2658 * on macOS. This method can be used to clear these artifacts when, for example,
2659 * performing an animation.
2660 *
2661 * @platform darwin
2662 */
2663 invalidateShadow(): void;
2664 /**
2665 * Whether the window is always on top of other windows.
2666 */
2667 isAlwaysOnTop(): boolean;
2668 /**
2669 * Whether the window can be manually closed by user.
2670 *
2671 * On Linux always returns `true`.
2672 *
2673 * @platform darwin,win32
2674 */
2675 isClosable(): boolean;
2676 /**
2677 * Whether the window is destroyed.
2678 */
2679 isDestroyed(): boolean;
2680 /**
2681 * Whether the window's document has been edited.
2682 *
2683 * @platform darwin
2684 */
2685 isDocumentEdited(): boolean;
2686 /**
2687 * whether the window is enabled.
2688 */
2689 isEnabled(): boolean;
2690 /**
2691 * Whether the window can be focused.
2692 *
2693 * @platform darwin,win32
2694 */
2695 isFocusable(): boolean;
2696 /**
2697 * Whether the window is focused.
2698 */
2699 isFocused(): boolean;
2700 /**
2701 * Whether the window is in fullscreen mode.
2702 */
2703 isFullScreen(): boolean;
2704 /**
2705 * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
2706 * window.
2707 */
2708 isFullScreenable(): boolean;
2709 /**
2710 * Whether the window will be hidden when the user toggles into mission control.
2711 *
2712 * @platform darwin
2713 */
2714 isHiddenInMissionControl(): boolean;
2715 /**
2716 * Whether the window is in kiosk mode.
2717 */
2718 isKiosk(): boolean;
2719 /**
2720 * Whether the window can be manually maximized by user.
2721 *
2722 * On Linux always returns `true`.
2723 *
2724 * @platform darwin,win32
2725 */
2726 isMaximizable(): boolean;
2727 /**
2728 * Whether the window is maximized.
2729 */
2730 isMaximized(): boolean;
2731 /**
2732 * Whether menu bar automatically hides itself.
2733 *
2734 * @platform win32,linux
2735 */
2736 isMenuBarAutoHide(): boolean;
2737 /**
2738 * Whether the menu bar is visible.
2739 *
2740 * @platform win32,linux
2741 */
2742 isMenuBarVisible(): boolean;
2743 /**
2744 * Whether the window can be manually minimized by the user.
2745 *
2746 * On Linux always returns `true`.
2747 *
2748 * @platform darwin,win32
2749 */
2750 isMinimizable(): boolean;
2751 /**
2752 * Whether the window is minimized.
2753 */
2754 isMinimized(): boolean;
2755 /**
2756 * Whether current window is a modal window.
2757 */
2758 isModal(): boolean;
2759 /**
2760 * Whether the window can be moved by user.
2761 *
2762 * On Linux always returns `true`.
2763 *
2764 * @platform darwin,win32
2765 */
2766 isMovable(): boolean;
2767 /**
2768 * Whether the window is in normal state (not maximized, not minimized, not in
2769 * fullscreen mode).
2770 */
2771 isNormal(): boolean;
2772 /**
2773 * Whether the window can be manually resized by the user.
2774 */
2775 isResizable(): boolean;
2776 /**
2777 * Whether the window is in simple (pre-Lion) fullscreen mode.
2778 *
2779 * @platform darwin
2780 */
2781 isSimpleFullScreen(): boolean;
2782 /**
2783 * Whether the window is in Windows 10 tablet mode.
2784 *
2785 * Since Windows 10 users can use their PC as tablet, under this mode apps can
2786 * choose to optimize their UI for tablets, such as enlarging the titlebar and
2787 * hiding titlebar buttons.
2788 *
2789 * This API returns whether the window is in tablet mode, and the `resize` event
2790 * can be be used to listen to changes to tablet mode.
2791 *
2792 * @platform win32
2793 */
2794 isTabletMode(): boolean;
2795 /**
2796 * Whether the window is visible to the user in the foreground of the app.
2797 */
2798 isVisible(): boolean;
2799 /**
2800 * Whether the window is visible on all workspaces.
2801 *
2802 * **Note:** This API always returns false on Windows.
2803 *
2804 * @platform darwin,linux
2805 */
2806 isVisibleOnAllWorkspaces(): boolean;
2807 /**
2808 * `true` or `false` depending on whether the message is hooked.
2809 *
2810 * @platform win32
2811 */
2812 isWindowMessageHooked(message: number): boolean;
2813 /**
2814 * Maximizes the window. This will also show (but not focus) the window if it isn't
2815 * being displayed already.
2816 */
2817 maximize(): void;
2818 /**
2819 * Merges all windows into one window with multiple tabs when native tabs are
2820 * enabled and there is more than one open window.
2821 *
2822 * @platform darwin
2823 */
2824 mergeAllWindows(): void;
2825 /**
2826 * Minimizes the window. On some platforms the minimized window will be shown in
2827 * the Dock.
2828 */
2829 minimize(): void;
2830 /**
2831 * Moves window above the source window in the sense of z-order. If the
2832 * `mediaSourceId` is not of type window or if the window does not exist then this
2833 * method throws an error.
2834 */
2835 moveAbove(mediaSourceId: string): void;
2836 /**
2837 * Moves the current tab into a new window if native tabs are enabled and there is
2838 * more than one tab in the current window.
2839 *
2840 * @platform darwin
2841 */
2842 moveTabToNewWindow(): void;
2843 /**
2844 * Moves window to top(z-order) regardless of focus
2845 */
2846 moveTop(): void;
2847 /**
2848 * Uses Quick Look to preview a file at a given path.
2849 *
2850 * @platform darwin
2851 */
2852 previewFile(path: string, displayName?: string): void;
2853 /**
2854 * Remove the window's menu bar.
2855 *
2856 * @platform linux,win32
2857 */
2858 removeMenu(): void;
2859 /**
2860 * Restores the window from minimized state to its previous state.
2861 */
2862 restore(): void;
2863 /**
2864 * Selects the next tab when native tabs are enabled and there are other tabs in
2865 * the window.
2866 *
2867 * @platform darwin
2868 */
2869 selectNextTab(): void;
2870 /**
2871 * Selects the previous tab when native tabs are enabled and there are other tabs
2872 * in the window.
2873 *
2874 * @platform darwin
2875 */
2876 selectPreviousTab(): void;
2877 /**
2878 * Sets whether the window should show always on top of other windows. After
2879 * setting this, the window is still a normal window, not a toolbox window which
2880 * can not be focused on.
2881 */
2882 setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
2883 /**
2884 * Sets the properties for the window's taskbar button.
2885 *
2886 * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
2887 * together. If one of those properties is not set, then neither will be used.
2888 *
2889 * @platform win32
2890 */
2891 setAppDetails(options: AppDetailsOptions): void;
2892 /**
2893 * This will make a window maintain an aspect ratio. The extra size allows a
2894 * developer to have space, specified in pixels, not included within the aspect
2895 * ratio calculations. This API already takes into account the difference between a
2896 * window's size and its content size.
2897 *
2898 * Consider a normal window with an HD video player and associated controls.
2899 * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
2900 * on the right edge and 50 pixels of controls below the player. In order to
2901 * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
2902 * the player itself we would call this function with arguments of 16/9 and {
2903 * width: 40, height: 50 }. The second argument doesn't care where the extra width
2904 * and height are within the content view--only that they exist. Sum any extra
2905 * width and height areas you have within the overall content view.
2906 *
2907 * The aspect ratio is not respected when window is resized programmatically with
2908 * APIs like `win.setSize`.
2909 *
2910 * To reset an aspect ratio, pass 0 as the `aspectRatio` value:
2911 * `win.setAspectRatio(0)`.
2912 */
2913 setAspectRatio(aspectRatio: number, extraSize?: Size): void;
2914 /**
2915 * Controls whether to hide cursor when typing.
2916 *
2917 * @platform darwin
2918 */
2919 setAutoHideCursor(autoHide: boolean): void;
2920 /**
2921 * Sets whether the window menu bar should hide itself automatically. Once set the
2922 * menu bar will only show when users press the single `Alt` key.
2923 *
2924 * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
2925 * hide it immediately.
2926 *
2927 * @platform win32,linux
2928 */
2929 setAutoHideMenuBar(hide: boolean): void;
2930 /**
2931 * Examples of valid `backgroundColor` values:
2932 *
2933 * * Hex
2934 * * #fff (shorthand RGB)
2935 * * #ffff (shorthand ARGB)
2936 * * #ffffff (RGB)
2937 * * #ffffffff (ARGB)
2938 * * RGB
2939 * * `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)`
2940 * * e.g. rgb(255, 255, 255)
2941 * * RGBA
2942 * * `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)`
2943 * * e.g. rgba(255, 255, 255, 1.0)
2944 * * HSL
2945 * * `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)`
2946 * * e.g. hsl(200, 20%, 50%)
2947 * * HSLA
2948 * * `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)`
2949 * * e.g. hsla(200, 20%, 50%, 0.5)
2950 * * Color name
2951 * * Options are listed in SkParseColor.cpp
2952 * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
2953 * * e.g. `blueviolet` or `red`
2954 *
2955 * Sets the background color of the window. See Setting `backgroundColor`.
2956 */
2957 setBackgroundColor(backgroundColor: string): void;
2958 /**
2959 * This method sets the browser window's system-drawn background material,
2960 * including behind the non-client area.
2961 *
2962 * See the Windows documentation for more details.
2963 *
2964 * **Note:** This method is only supported on Windows 11 22H2 and up.
2965 *
2966 * @platform win32
2967 */
2968 setBackgroundMaterial(material: 'auto' | 'none' | 'mica' | 'acrylic' | 'tabbed'): void;
2969 /**
2970 * Resizes and moves the window to the supplied bounds. Any properties that are not
2971 * supplied will default to their current values.
2972 *
2973 * **Note:** On macOS, the y-coordinate value cannot be smaller than the Tray
2974 * height. The tray height has changed over time and depends on the operating
2975 * system, but is between 20-40px. Passing a value lower than the tray height will
2976 * result in a window that is flush to the tray.
2977 */
2978 setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
2979 /**
2980 * Sets whether the window can be manually closed by user. On Linux does nothing.
2981 *
2982 * @platform darwin,win32
2983 */
2984 setClosable(closable: boolean): void;
2985 /**
2986 * Resizes and moves the window's client area (e.g. the web page) to the supplied
2987 * bounds.
2988 */
2989 setContentBounds(bounds: Rectangle, animate?: boolean): void;
2990 /**
2991 * Prevents the window contents from being captured by other apps.
2992 *
2993 * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
2994 * it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`. For Windows 10
2995 * version 2004 and up the window will be removed from capture entirely, older
2996 * Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
2997 *
2998 * @platform darwin,win32
2999 */
3000 setContentProtection(enable: boolean): void;
3001 /**
3002 * Resizes the window's client area (e.g. the web page) to `width` and `height`.
3003 */
3004 setContentSize(width: number, height: number, animate?: boolean): void;
3005 /**
3006 * Sets the content view of the window.
3007 */
3008 setContentView(view: View): void;
3009 /**
3010 * Specifies whether the window’s document has been edited, and the icon in title
3011 * bar will become gray when set to `true`.
3012 *
3013 * @platform darwin
3014 */
3015 setDocumentEdited(edited: boolean): void;
3016 /**
3017 * Disable or enable the window.
3018 */
3019 setEnabled(enable: boolean): void;
3020 /**
3021 * Changes whether the window can be focused.
3022 *
3023 * On macOS it does not remove the focus from the window.
3024 *
3025 * @platform darwin,win32
3026 */
3027 setFocusable(focusable: boolean): void;
3028 /**
3029 * Sets whether the window should be in fullscreen mode.
3030 *
3031 * **Note:** On macOS, fullscreen transitions take place asynchronously. If further
3032 * actions depend on the fullscreen state, use the 'enter-full-screen' or
3033 * 'leave-full-screen' events.
3034 */
3035 setFullScreen(flag: boolean): void;
3036 /**
3037 * Sets whether the maximize/zoom window button toggles fullscreen mode or
3038 * maximizes the window.
3039 */
3040 setFullScreenable(fullscreenable: boolean): void;
3041 /**
3042 * Sets whether the window should have a shadow.
3043 */
3044 setHasShadow(hasShadow: boolean): void;
3045 /**
3046 * Sets whether the window will be hidden when the user toggles into mission
3047 * control.
3048 *
3049 * @platform darwin
3050 */
3051 setHiddenInMissionControl(hidden: boolean): void;
3052 /**
3053 * Changes window icon.
3054 *
3055 * @platform win32,linux
3056 */
3057 setIcon(icon: (NativeImage) | (string)): void;
3058 /**
3059 * Makes the window ignore all mouse events.
3060 *
3061 * All mouse events happened in this window will be passed to the window below this
3062 * window, but if this window has focus, it will still receive keyboard events.
3063 */
3064 setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
3065 /**
3066 * Enters or leaves kiosk mode.
3067 */
3068 setKiosk(flag: boolean): void;
3069 /**
3070 * Sets whether the window can be manually maximized by user. On Linux does
3071 * nothing.
3072 *
3073 * @platform darwin,win32
3074 */
3075 setMaximizable(maximizable: boolean): void;
3076 /**
3077 * Sets the maximum size of window to `width` and `height`.
3078 */
3079 setMaximumSize(width: number, height: number): void;
3080 /**
3081 * Sets the `menu` as the window's menu bar.
3082 *
3083 * @platform linux,win32
3084 */
3085 setMenu(menu: (Menu) | (null)): void;
3086 /**
3087 * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
3088 * can still bring up the menu bar by pressing the single `Alt` key.
3089 *
3090 * @platform win32,linux
3091 */
3092 setMenuBarVisibility(visible: boolean): void;
3093 /**
3094 * Sets whether the window can be manually minimized by user. On Linux does
3095 * nothing.
3096 *
3097 * @platform darwin,win32
3098 */
3099 setMinimizable(minimizable: boolean): void;
3100 /**
3101 * Sets the minimum size of window to `width` and `height`.
3102 */
3103 setMinimumSize(width: number, height: number): void;
3104 /**
3105 * Sets whether the window can be moved by user. On Linux does nothing.
3106 *
3107 * @platform darwin,win32
3108 */
3109 setMovable(movable: boolean): void;
3110 /**
3111 * Sets the opacity of the window. On Linux, does nothing. Out of bound number
3112 * values are clamped to the [0, 1] range.
3113 *
3114 * @platform win32,darwin
3115 */
3116 setOpacity(opacity: number): void;
3117 /**
3118 * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
3119 * convey some sort of application status or to passively notify the user.
3120 *
3121 * @platform win32
3122 */
3123 setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
3124 /**
3125 * Sets `parent` as current window's parent window, passing `null` will turn
3126 * current window into a top-level window.
3127 */
3128 setParentWindow(parent: (BaseWindow) | (null)): void;
3129 /**
3130 * Moves window to `x` and `y`.
3131 */
3132 setPosition(x: number, y: number, animate?: boolean): void;
3133 /**
3134 * Sets progress value in progress bar. Valid range is [0, 1.0].
3135 *
3136 * Remove progress bar when progress < 0; Change to indeterminate mode when
3137 * progress > 1.
3138 *
3139 * On Linux platform, only supports Unity desktop environment, you need to specify
3140 * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
3141 * it will assume `{app.name}.desktop`.
3142 *
3143 * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
3144 * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
3145 * mode set (but with a value within the valid range), `normal` will be assumed.
3146 */
3147 setProgressBar(progress: number, options?: ProgressBarOptions): void;
3148 /**
3149 * Sets the pathname of the file the window represents, and the icon of the file
3150 * will show in window's title bar.
3151 *
3152 * @platform darwin
3153 */
3154 setRepresentedFilename(filename: string): void;
3155 /**
3156 * Sets whether the window can be manually resized by the user.
3157 */
3158 setResizable(resizable: boolean): void;
3159 /**
3160 * Setting a window shape determines the area within the window where the system
3161 * permits drawing and user interaction. Outside of the given region, no pixels
3162 * will be drawn and no mouse events will be registered. Mouse events outside of
3163 * the region will not be received by that window, but will fall through to
3164 * whatever is behind the window.
3165 *
3166 * @experimental
3167 * @platform win32,linux
3168 */
3169 setShape(rects: Rectangle[]): void;
3170 /**
3171 * Changes the attachment point for sheets on macOS. By default, sheets are
3172 * attached just below the window frame, but you may want to display them beneath a
3173 * HTML-rendered toolbar. For example:
3174 *
3175 * @platform darwin
3176 */
3177 setSheetOffset(offsetY: number, offsetX?: number): void;
3178 /**
3179 * Enters or leaves simple fullscreen mode.
3180 *
3181 * Simple fullscreen mode emulates the native fullscreen behavior found in versions
3182 * of macOS prior to Lion (10.7).
3183 *
3184 * @platform darwin
3185 */
3186 setSimpleFullScreen(flag: boolean): void;
3187 /**
3188 * Resizes the window to `width` and `height`. If `width` or `height` are below any
3189 * set minimum size constraints the window will snap to its minimum size.
3190 */
3191 setSize(width: number, height: number, animate?: boolean): void;
3192 /**
3193 * Makes the window not show in the taskbar.
3194 *
3195 * @platform darwin,win32
3196 */
3197 setSkipTaskbar(skip: boolean): void;
3198 /**
3199 * Whether the buttons were added successfully
3200 *
3201 * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
3202 * of a window in a taskbar button layout. Returns a `boolean` object indicates
3203 * whether the thumbnail has been added successfully.
3204 *
3205 * The number of buttons in thumbnail toolbar should be no greater than 7 due to
3206 * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
3207 * removed due to the platform's limitation. But you can call the API with an empty
3208 * array to clean the buttons.
3209 *
3210 * The `buttons` is an array of `Button` objects:
3211 *
3212 * * `Button` Object
3213 * * `icon` NativeImage - The icon showing in thumbnail toolbar.
3214 * * `click` Function
3215 * * `tooltip` string (optional) - The text of the button's tooltip.
3216 * * `flags` string[] (optional) - Control specific states and behaviors of the
3217 * button. By default, it is `['enabled']`.
3218 *
3219 * The `flags` is an array that can include following `string`s:
3220 *
3221 * * `enabled` - The button is active and available to the user.
3222 * * `disabled` - The button is disabled. It is present, but has a visual state
3223 * indicating it will not respond to user action.
3224 * * `dismissonclick` - When the button is clicked, the thumbnail window closes
3225 * immediately.
3226 * * `nobackground` - Do not draw a button border, use only the image.
3227 * * `hidden` - The button is not shown to the user.
3228 * * `noninteractive` - The button is enabled but not interactive; no pressed
3229 * button state is drawn. This value is intended for instances where the button is
3230 * used in a notification.
3231 *
3232 * @platform win32
3233 */
3234 setThumbarButtons(buttons: ThumbarButton[]): boolean;
3235 /**
3236 * Sets the region of the window to show as the thumbnail image displayed when
3237 * hovering over the window in the taskbar. You can reset the thumbnail to be the
3238 * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
3239 * }`.
3240 *
3241 * @platform win32
3242 */
3243 setThumbnailClip(region: Rectangle): void;
3244 /**
3245 * Sets the toolTip that is displayed when hovering over the window thumbnail in
3246 * the taskbar.
3247 *
3248 * @platform win32
3249 */
3250 setThumbnailToolTip(toolTip: string): void;
3251 /**
3252 * Changes the title of native window to `title`.
3253 */
3254 setTitle(title: string): void;
3255 /**
3256 * On a Window with Window Controls Overlay already enabled, this method updates
3257 * the style of the title bar overlay.
3258 *
3259 * @platform win32
3260 */
3261 setTitleBarOverlay(options: TitleBarOverlayOptions): void;
3262 /**
3263 * Sets the touchBar layout for the current window. Specifying `null` or
3264 * `undefined` clears the touch bar. This method only has an effect if the machine
3265 * has a touch bar.
3266 *
3267 * **Note:** The TouchBar API is currently experimental and may change or be
3268 * removed in future Electron releases.
3269 *
3270 * @platform darwin
3271 */
3272 setTouchBar(touchBar: (TouchBar) | (null)): void;
3273 /**
3274 * Adds a vibrancy effect to the window. Passing `null` or an empty string will
3275 * remove the vibrancy effect on the window.
3276 *
3277 * @platform darwin
3278 */
3279 setVibrancy(type: (('titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page')) | (null)): void;
3280 /**
3281 * Sets whether the window should be visible on all workspaces.
3282 *
3283 * **Note:** This API does nothing on Windows.
3284 *
3285 * @platform darwin,linux
3286 */
3287 setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
3288 /**
3289 * Set a custom position for the traffic light buttons in frameless window. Passing
3290 * `null` will reset the position to default.
3291 *
3292 * @platform darwin
3293 */
3294 setWindowButtonPosition(position: (Point) | (null)): void;
3295 /**
3296 * Sets whether the window traffic light buttons should be visible.
3297 *
3298 * @platform darwin
3299 */
3300 setWindowButtonVisibility(visible: boolean): void;
3301 /**
3302 * Shows and gives focus to the window.
3303 */
3304 show(): void;
3305 /**
3306 * Shows or hides the tab overview when native tabs are enabled.
3307 *
3308 * @platform darwin
3309 */
3310 showAllTabs(): void;
3311 /**
3312 * Shows the window but doesn't focus on it.
3313 */
3314 showInactive(): void;
3315 /**
3316 * Toggles the visibility of the tab bar if native tabs are enabled and there is
3317 * only one tab in the current window.
3318 *
3319 * @platform darwin
3320 */
3321 toggleTabBar(): void;
3322 /**
3323 * Unhooks all of the window messages.
3324 *
3325 * @platform win32
3326 */
3327 unhookAllWindowMessages(): void;
3328 /**
3329 * Unhook the window message.
3330 *
3331 * @platform win32
3332 */
3333 unhookWindowMessage(message: number): void;
3334 /**
3335 * Unmaximizes the window.
3336 */
3337 unmaximize(): void;
3338 /**
3339 * A `string` property that defines an alternative title provided only to
3340 * accessibility tools such as screen readers. This string is not directly visible
3341 * to users.
3342 */
3343 accessibleTitle: string;
3344 /**
3345 * A `boolean` property that determines whether the window menu bar should hide
3346 * itself automatically. Once set, the menu bar will only show when users press the
3347 * single `Alt` key.
3348 *
3349 * If the menu bar is already visible, setting this property to `true` won't hide
3350 * it immediately.
3351 */
3352 autoHideMenuBar: boolean;
3353 /**
3354 * A `boolean` property that determines whether the window can be manually closed
3355 * by user.
3356 *
3357 * On Linux the setter is a no-op, although the getter returns `true`.
3358 *
3359 * @platform darwin,win32
3360 */
3361 closable: boolean;
3362 /**
3363 * A `View` property for the content view of the window.
3364 */
3365 contentView: View;
3366 /**
3367 * A `boolean` property that specifies whether the window’s document has been
3368 * edited.
3369 *
3370 * The icon in title bar will become gray when set to `true`.
3371 *
3372 * @platform darwin
3373 */
3374 documentEdited: boolean;
3375 /**
3376 * A `boolean` property that determines whether the window is excluded from the
3377 * application’s Windows menu. `false` by default.
3378 *
3379 * @platform darwin
3380 */
3381 excludedFromShownWindowsMenu: boolean;
3382 /**
3383 * A `boolean` property that determines whether the window is focusable.
3384 *
3385 * @platform win32,darwin
3386 */
3387 focusable: boolean;
3388 /**
3389 * A `boolean` property that determines whether the window is in fullscreen mode.
3390 */
3391 fullScreen: boolean;
3392 /**
3393 * A `boolean` property that determines whether the maximize/zoom window button
3394 * toggles fullscreen mode or maximizes the window.
3395 */
3396 fullScreenable: boolean;
3397 /**
3398 * A `Integer` property representing the unique ID of the window. Each ID is unique
3399 * among all `BaseWindow` instances of the entire Electron application.
3400 *
3401 */
3402 readonly id: number;
3403 /**
3404 * A `boolean` property that determines whether the window is in kiosk mode.
3405 */
3406 kiosk: boolean;
3407 /**
3408 * A `boolean` property that determines whether the window can be manually
3409 * maximized by user.
3410 *
3411 * On Linux the setter is a no-op, although the getter returns `true`.
3412 *
3413 * @platform darwin,win32
3414 */
3415 maximizable: boolean;
3416 /**
3417 * A `boolean` property that determines whether the menu bar should be visible.
3418 *
3419 * **Note:** If the menu bar is auto-hide, users can still bring up the menu bar by
3420 * pressing the single `Alt` key.
3421 *
3422 * @platform win32,linux
3423 */
3424 menuBarVisible: boolean;
3425 /**
3426 * A `boolean` property that determines whether the window can be manually
3427 * minimized by user.
3428 *
3429 * On Linux the setter is a no-op, although the getter returns `true`.
3430 *
3431 * @platform darwin,win32
3432 */
3433 minimizable: boolean;
3434 /**
3435 * A `boolean` property that determines Whether the window can be moved by user.
3436 *
3437 * On Linux the setter is a no-op, although the getter returns `true`.
3438 *
3439 * @platform darwin,win32
3440 */
3441 movable: boolean;
3442 /**
3443 * A `string` property that determines the pathname of the file the window
3444 * represents, and the icon of the file will show in window's title bar.
3445 *
3446 * @platform darwin
3447 */
3448 representedFilename: string;
3449 /**
3450 * A `boolean` property that determines whether the window can be manually resized
3451 * by user.
3452 */
3453 resizable: boolean;
3454 /**
3455 * A `boolean` property that determines whether the window has a shadow.
3456 */
3457 shadow: boolean;
3458 /**
3459 * A `boolean` property that determines whether the window is in simple (pre-Lion)
3460 * fullscreen mode.
3461 */
3462 simpleFullScreen: boolean;
3463 /**
3464 * A `string` (optional) property that is equal to the `tabbingIdentifier` passed
3465 * to the `BrowserWindow` constructor or `undefined` if none was set.
3466 *
3467 * @platform darwin
3468 */
3469 readonly tabbingIdentifier?: string;
3470 /**
3471 * A `string` property that determines the title of the native window.
3472 *
3473 * **Note:** The title of the web page can be different from the title of the
3474 * native window.
3475 */
3476 title: string;
3477 /**
3478 * A `boolean` property that determines whether the window is visible on all
3479 * workspaces.
3480 *
3481 * **Note:** Always returns false on Windows.
3482 *
3483 * @platform darwin,linux
3484 */
3485 visibleOnAllWorkspaces: boolean;
3486 }
3487
3488 interface BaseWindowConstructorOptions {
3489
3490 // Docs: https://electronjs.org/docs/api/structures/base-window-options
3491
3492 /**
3493 * Whether clicking an inactive window will also click through to the web contents.
3494 * Default is `false` on macOS. This option is not configurable on other platforms.
3495 *
3496 * @platform darwin
3497 */
3498 acceptFirstMouse?: boolean;
3499 /**
3500 * Whether the window should always stay on top of other windows. Default is
3501 * `false`.
3502 */
3503 alwaysOnTop?: boolean;
3504 /**
3505 * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
3506 */
3507 autoHideMenuBar?: boolean;
3508 /**
3509 * The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color
3510 * format. Alpha in #AARRGGBB format is supported if `transparent` is set to
3511 * `true`. Default is `#FFF` (white). See win.setBackgroundColor for more
3512 * information.
3513 */
3514 backgroundColor?: string;
3515 /**
3516 * Set the window's system-drawn background material, including behind the
3517 * non-client area. Can be `auto`, `none`, `mica`, `acrylic` or `tabbed`. See
3518 * win.setBackgroundMaterial for more information.
3519 *
3520 * @platform win32
3521 */
3522 backgroundMaterial?: ('auto' | 'none' | 'mica' | 'acrylic' | 'tabbed');
3523 /**
3524 * Show window in the center of the screen. Default is `false`.
3525 */
3526 center?: boolean;
3527 /**
3528 * Whether window is closable. This is not implemented on Linux. Default is `true`.
3529 *
3530 * @platform darwin,win32
3531 */
3532 closable?: boolean;
3533 /**
3534 * Forces using dark theme for the window, only works on some GTK+3 desktop
3535 * environments. Default is `false`.
3536 */
3537 darkTheme?: boolean;
3538 /**
3539 * Whether to hide cursor when typing. Default is `false`.
3540 */
3541 disableAutoHideCursor?: boolean;
3542 /**
3543 * Enable the window to be resized larger than screen. Only relevant for macOS, as
3544 * other OSes allow larger-than-screen windows by default. Default is `false`.
3545 *
3546 * @platform darwin
3547 */
3548 enableLargerThanScreen?: boolean;
3549 /**
3550 * Whether the window can be focused. Default is `true`. On Windows setting
3551 * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
3552 * `focusable: false` makes the window stop interacting with wm, so the window will
3553 * always stay on top in all workspaces.
3554 */
3555 focusable?: boolean;
3556 /**
3557 * Specify `false` to create a frameless window. Default is `true`.
3558 */
3559 frame?: boolean;
3560 /**
3561 * Whether the window should show in fullscreen. When explicitly set to `false` the
3562 * fullscreen button will be hidden or disabled on macOS. Default is `false`.
3563 */
3564 fullscreen?: boolean;
3565 /**
3566 * Whether the window can be put into fullscreen mode. On macOS, also whether the
3567 * maximize/zoom button should toggle full screen mode or maximize window. Default
3568 * is `true`.
3569 */
3570 fullscreenable?: boolean;
3571 /**
3572 * Whether window should have a shadow. Default is `true`.
3573 */
3574 hasShadow?: boolean;
3575 /**
3576 * Window's height in pixels. Default is `600`.
3577 */
3578 height?: number;
3579 /**
3580 * Whether window should be hidden when the user toggles into mission control.
3581 *
3582 * @platform darwin
3583 */
3584 hiddenInMissionControl?: boolean;
3585 /**
3586 * The window icon. On Windows it is recommended to use `ICO` icons to get best
3587 * visual effects, you can also leave it undefined so the executable's icon will be
3588 * used.
3589 */
3590 icon?: (NativeImage) | (string);
3591 /**
3592 * Whether the window is in kiosk mode. Default is `false`.
3593 */
3594 kiosk?: boolean;
3595 /**
3596 * Window's maximum height. Default is no limit.
3597 */
3598 maxHeight?: number;
3599 /**
3600 * Whether window is maximizable. This is not implemented on Linux. Default is
3601 * `true`.
3602 *
3603 * @platform darwin,win32
3604 */
3605 maximizable?: boolean;
3606 /**
3607 * Window's maximum width. Default is no limit.
3608 */
3609 maxWidth?: number;
3610 /**
3611 * Window's minimum height. Default is `0`.
3612 */
3613 minHeight?: number;
3614 /**
3615 * Whether window is minimizable. This is not implemented on Linux. Default is
3616 * `true`.
3617 *
3618 * @platform darwin,win32
3619 */
3620 minimizable?: boolean;
3621 /**
3622 * Window's minimum width. Default is `0`.
3623 */
3624 minWidth?: number;
3625 /**
3626 * Whether this is a modal window. This only works when the window is a child
3627 * window. Default is `false`.
3628 */
3629 modal?: boolean;
3630 /**
3631 * Whether window is movable. This is not implemented on Linux. Default is `true`.
3632 *
3633 * @platform darwin,win32
3634 */
3635 movable?: boolean;
3636 /**
3637 * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
3638 * (fully opaque). This is only implemented on Windows and macOS.
3639 *
3640 * @platform darwin,win32
3641 */
3642 opacity?: number;
3643 /**
3644 * Specify parent window. Default is `null`.
3645 */
3646 parent?: BaseWindow;
3647 /**
3648 * Whether window is resizable. Default is `true`.
3649 */
3650 resizable?: boolean;
3651 /**
3652 * Whether frameless window should have rounded corners on macOS. Default is
3653 * `true`. Setting this property to `false` will prevent the window from being
3654 * fullscreenable.
3655 *
3656 * @platform darwin
3657 */
3658 roundedCorners?: boolean;
3659 /**
3660 * Whether window should be shown when created. Default is `true`.
3661 */
3662 show?: boolean;
3663 /**
3664 * Use pre-Lion fullscreen on macOS. Default is `false`.
3665 *
3666 * @platform darwin
3667 */
3668 simpleFullscreen?: boolean;
3669 /**
3670 * Whether to show the window in taskbar. Default is `false`.
3671 *
3672 * @platform darwin,win32
3673 */
3674 skipTaskbar?: boolean;
3675 /**
3676 * Tab group name, allows opening the window as a native tab. Windows with the same
3677 * tabbing identifier will be grouped together. This also adds a native new tab
3678 * button to your window's tab bar and allows your `app` and window to receive the
3679 * `new-window-for-tab` event.
3680 *
3681 * @platform darwin
3682 */
3683 tabbingIdentifier?: string;
3684 /**
3685 * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
3686 * window frame. Setting it to `false` will remove window shadow and window
3687 * animations. Default is `true`.
3688 */
3689 thickFrame?: boolean;
3690 /**
3691 * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
3692 * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
3693 */
3694 title?: string;
3695 /**
3696 * The style of window title bar. Default is `default`. Possible values are:
3697 *
3698 * @platform darwin,win32
3699 */
3700 titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
3701 /**
3702 * Set a custom position for the traffic light buttons in frameless windows.
3703 *
3704 * @platform darwin
3705 */
3706 trafficLightPosition?: Point;
3707 /**
3708 * Makes the window transparent. Default is `false`. On Windows, does not work
3709 * unless the window is frameless.
3710 */
3711 transparent?: boolean;
3712 /**
3713 * The type of window, default is normal window. See more about this below.
3714 */
3715 type?: string;
3716 /**
3717 * The `width` and `height` would be used as web page's size, which means the
3718 * actual window's size will include window frame's size and be slightly larger.
3719 * Default is `false`.
3720 */
3721 useContentSize?: boolean;
3722 /**
3723 * Add a type of vibrancy effect to the window, only on macOS. Can be
3724 * `appearance-based`, `titlebar`, `selection`, `menu`, `popover`, `sidebar`,
3725 * `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`,
3726 * `under-window`, or `under-page`.
3727 *
3728 * @platform darwin
3729 */
3730 vibrancy?: ('appearance-based' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page');
3731 /**
3732 * Specify how the material appearance should reflect window activity state on
3733 * macOS. Must be used with the `vibrancy` property. Possible values are:
3734 *
3735 * @platform darwin
3736 */
3737 visualEffectState?: ('followWindow' | 'active' | 'inactive');
3738 /**
3739 * Window's width in pixels. Default is `800`.
3740 */
3741 width?: number;
3742 /**
3743 * (**required** if y is used) Window's left offset from screen. Default is to
3744 * center the window.
3745 */
3746 x?: number;
3747 /**
3748 * (**required** if x is used) Window's top offset from screen. Default is to
3749 * center the window.
3750 */
3751 y?: number;
3752 /**
3753 * Controls the behavior on macOS when option-clicking the green stoplight button
3754 * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
3755 * will grow to the preferred width of the web page when zoomed, `false` will cause
3756 * it to zoom to the width of the screen. This will also affect the behavior when
3757 * calling `maximize()` directly. Default is `false`.
3758 *
3759 * @platform darwin
3760 */
3761 zoomToPageWidth?: boolean;
3762 }
3763
3764 interface BluetoothDevice {
3765
3766 // Docs: https://electronjs.org/docs/api/structures/bluetooth-device
3767
3768 deviceId: string;
3769 deviceName: string;
3770 }
3771
3772 class BrowserView {
3773
3774 // Docs: https://electronjs.org/docs/api/browser-view
3775
3776 /**
3777 * BrowserView
3778 */
3779 constructor(options?: BrowserViewConstructorOptions);
3780 /**
3781 * The `bounds` of this BrowserView instance as `Object`.
3782 *
3783 * @experimental
3784 * @deprecated
3785 */
3786 getBounds(): Rectangle;
3787 /**
3788 * @experimental
3789 * @deprecated
3790 */
3791 setAutoResize(options: AutoResizeOptions): void;
3792 /**
3793 * Examples of valid `color` values:
3794 *
3795 * * Hex
3796 * * `#fff` (RGB)
3797 * * `#ffff` (ARGB)
3798 * * `#ffffff` (RRGGBB)
3799 * * `#ffffffff` (AARRGGBB)
3800 * * RGB
3801 * * `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)`
3802 * * e.g. `rgb(255, 255, 255)`
3803 * * RGBA
3804 * * `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)`
3805 * * e.g. `rgba(255, 255, 255, 1.0)`
3806 * * HSL
3807 * * `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)`
3808 * * e.g. `hsl(200, 20%, 50%)`
3809 * * HSLA
3810 * * `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)`
3811 * * e.g. `hsla(200, 20%, 50%, 0.5)`
3812 * * Color name
3813 * * Options are listed in SkParseColor.cpp
3814 * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
3815 * * e.g. `blueviolet` or `red`
3816 *
3817 * **Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or
3818 * `RGB`.
3819 *
3820 * @experimental
3821 * @deprecated
3822 */
3823 setBackgroundColor(color: string): void;
3824 /**
3825 * Resizes and moves the view to the supplied bounds relative to the window.
3826 *
3827 * @experimental
3828 * @deprecated
3829 */
3830 setBounds(bounds: Rectangle): void;
3831 /**
3832 * A `WebContents` object owned by this view.
3833 *
3834 * @experimental
3835 * @deprecated
3836 */
3837 webContents: WebContents;
3838 }
3839
3840 class BrowserWindow extends BaseWindow {
3841
3842 // Docs: https://electronjs.org/docs/api/browser-window
3843
3844 /**
3845 * Emitted when the window is set or unset to show always on top of other windows.
3846 */
3847 on(event: 'always-on-top-changed', listener: (event: Event,
3848 isAlwaysOnTop: boolean) => void): this;
3849 off(event: 'always-on-top-changed', listener: (event: Event,
3850 isAlwaysOnTop: boolean) => void): this;
3851 once(event: 'always-on-top-changed', listener: (event: Event,
3852 isAlwaysOnTop: boolean) => void): this;
3853 addListener(event: 'always-on-top-changed', listener: (event: Event,
3854 isAlwaysOnTop: boolean) => void): this;
3855 removeListener(event: 'always-on-top-changed', listener: (event: Event,
3856 isAlwaysOnTop: boolean) => void): this;
3857 /**
3858 * Emitted when the window is set or unset to show always on top of other windows.
3859 */
3860 on(event: 'always-on-top-changed', listener: (event: Event,
3861 isAlwaysOnTop: boolean) => void): this;
3862 off(event: 'always-on-top-changed', listener: (event: Event,
3863 isAlwaysOnTop: boolean) => void): this;
3864 once(event: 'always-on-top-changed', listener: (event: Event,
3865 isAlwaysOnTop: boolean) => void): this;
3866 addListener(event: 'always-on-top-changed', listener: (event: Event,
3867 isAlwaysOnTop: boolean) => void): this;
3868 removeListener(event: 'always-on-top-changed', listener: (event: Event,
3869 isAlwaysOnTop: boolean) => void): this;
3870 /**
3871 * Emitted when an App Command is invoked. These are typically related to keyboard
3872 * media keys or browser commands, as well as the "Back" button built into some
3873 * mice on Windows.
3874 *
3875 * Commands are lowercased, underscores are replaced with hyphens, and the
3876 * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
3877 * emitted as `browser-backward`.
3878 *
3879 * The following app commands are explicitly supported on Linux:
3880 *
3881 * * `browser-backward`
3882 * * `browser-forward`
3883 *
3884 * @platform win32,linux
3885 */
3886 on(event: 'app-command', listener: (event: Event,
3887 command: string) => void): this;
3888 /**
3889 * @platform win32,linux
3890 */
3891 off(event: 'app-command', listener: (event: Event,
3892 command: string) => void): this;
3893 /**
3894 * @platform win32,linux
3895 */
3896 once(event: 'app-command', listener: (event: Event,
3897 command: string) => void): this;
3898 /**
3899 * @platform win32,linux
3900 */
3901 addListener(event: 'app-command', listener: (event: Event,
3902 command: string) => void): this;
3903 /**
3904 * @platform win32,linux
3905 */
3906 removeListener(event: 'app-command', listener: (event: Event,
3907 command: string) => void): this;
3908 /**
3909 * Emitted when an App Command is invoked. These are typically related to keyboard
3910 * media keys or browser commands, as well as the "Back" button built into some
3911 * mice on Windows.
3912 *
3913 * Commands are lowercased, underscores are replaced with hyphens, and the
3914 * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
3915 * emitted as `browser-backward`.
3916 *
3917 * The following app commands are explicitly supported on Linux:
3918 *
3919 * * `browser-backward`
3920 * * `browser-forward`
3921 *
3922 * @platform win32,linux
3923 */
3924 on(event: 'app-command', listener: (event: Event,
3925 command: string) => void): this;
3926 /**
3927 * @platform win32,linux
3928 */
3929 off(event: 'app-command', listener: (event: Event,
3930 command: string) => void): this;
3931 /**
3932 * @platform win32,linux
3933 */
3934 once(event: 'app-command', listener: (event: Event,
3935 command: string) => void): this;
3936 /**
3937 * @platform win32,linux
3938 */
3939 addListener(event: 'app-command', listener: (event: Event,
3940 command: string) => void): this;
3941 /**
3942 * @platform win32,linux
3943 */
3944 removeListener(event: 'app-command', listener: (event: Event,
3945 command: string) => void): this;
3946 /**
3947 * Emitted when the window loses focus.
3948 */
3949 on(event: 'blur', listener: Function): this;
3950 off(event: 'blur', listener: Function): this;
3951 once(event: 'blur', listener: Function): this;
3952 addListener(event: 'blur', listener: Function): this;
3953 removeListener(event: 'blur', listener: Function): this;
3954 /**
3955 * Emitted when the window loses focus.
3956 */
3957 on(event: 'blur', listener: Function): this;
3958 off(event: 'blur', listener: Function): this;
3959 once(event: 'blur', listener: Function): this;
3960 addListener(event: 'blur', listener: Function): this;
3961 removeListener(event: 'blur', listener: Function): this;
3962 /**
3963 * Emitted when the window is going to be closed. It's emitted before the
3964 * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
3965 * will cancel the close.
3966 *
3967 * Usually you would want to use the `beforeunload` handler to decide whether the
3968 * window should be closed, which will also be called when the window is reloaded.
3969 * In Electron, returning any value other than `undefined` would cancel the close.
3970 * For example:
3971 *
3972 * _**Note**: There is a subtle difference between the behaviors of
3973 * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
3974 * handler)`. It is recommended to always set the `event.returnValue` explicitly,
3975 * instead of only returning a value, as the former works more consistently within
3976 * Electron._
3977 */
3978 on(event: 'close', listener: (event: Event) => void): this;
3979 off(event: 'close', listener: (event: Event) => void): this;
3980 once(event: 'close', listener: (event: Event) => void): this;
3981 addListener(event: 'close', listener: (event: Event) => void): this;
3982 removeListener(event: 'close', listener: (event: Event) => void): this;
3983 /**
3984 * Emitted when the window is going to be closed. It's emitted before the
3985 * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
3986 * will cancel the close.
3987 *
3988 * Usually you would want to use the `beforeunload` handler to decide whether the
3989 * window should be closed, which will also be called when the window is reloaded.
3990 * In Electron, returning any value other than `undefined` would cancel the close.
3991 * For example:
3992 *
3993 * _**Note**: There is a subtle difference between the behaviors of
3994 * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
3995 * handler)`. It is recommended to always set the `event.returnValue` explicitly,
3996 * instead of only returning a value, as the former works more consistently within
3997 * Electron._
3998 */
3999 on(event: 'close', listener: (event: Event) => void): this;
4000 off(event: 'close', listener: (event: Event) => void): this;
4001 once(event: 'close', listener: (event: Event) => void): this;
4002 addListener(event: 'close', listener: (event: Event) => void): this;
4003 removeListener(event: 'close', listener: (event: Event) => void): this;
4004 /**
4005 * Emitted when the window is closed. After you have received this event you should
4006 * remove the reference to the window and avoid using it any more.
4007 */
4008 on(event: 'closed', listener: Function): this;
4009 off(event: 'closed', listener: Function): this;
4010 once(event: 'closed', listener: Function): this;
4011 addListener(event: 'closed', listener: Function): this;
4012 removeListener(event: 'closed', listener: Function): this;
4013 /**
4014 * Emitted when the window is closed. After you have received this event you should
4015 * remove the reference to the window and avoid using it any more.
4016 */
4017 on(event: 'closed', listener: Function): this;
4018 off(event: 'closed', listener: Function): this;
4019 once(event: 'closed', listener: Function): this;
4020 addListener(event: 'closed', listener: Function): this;
4021 removeListener(event: 'closed', listener: Function): this;
4022 /**
4023 * Emitted when the window enters a full-screen state.
4024 */
4025 on(event: 'enter-full-screen', listener: Function): this;
4026 off(event: 'enter-full-screen', listener: Function): this;
4027 once(event: 'enter-full-screen', listener: Function): this;
4028 addListener(event: 'enter-full-screen', listener: Function): this;
4029 removeListener(event: 'enter-full-screen', listener: Function): this;
4030 /**
4031 * Emitted when the window enters a full-screen state.
4032 */
4033 on(event: 'enter-full-screen', listener: Function): this;
4034 off(event: 'enter-full-screen', listener: Function): this;
4035 once(event: 'enter-full-screen', listener: Function): this;
4036 addListener(event: 'enter-full-screen', listener: Function): this;
4037 removeListener(event: 'enter-full-screen', listener: Function): this;
4038 /**
4039 * Emitted when the window enters a full-screen state triggered by HTML API.
4040 */
4041 on(event: 'enter-html-full-screen', listener: Function): this;
4042 off(event: 'enter-html-full-screen', listener: Function): this;
4043 once(event: 'enter-html-full-screen', listener: Function): this;
4044 addListener(event: 'enter-html-full-screen', listener: Function): this;
4045 removeListener(event: 'enter-html-full-screen', listener: Function): this;
4046 /**
4047 * Emitted when the window gains focus.
4048 */
4049 on(event: 'focus', listener: Function): this;
4050 off(event: 'focus', listener: Function): this;
4051 once(event: 'focus', listener: Function): this;
4052 addListener(event: 'focus', listener: Function): this;
4053 removeListener(event: 'focus', listener: Function): this;
4054 /**
4055 * Emitted when the window gains focus.
4056 */
4057 on(event: 'focus', listener: Function): this;
4058 off(event: 'focus', listener: Function): this;
4059 once(event: 'focus', listener: Function): this;
4060 addListener(event: 'focus', listener: Function): this;
4061 removeListener(event: 'focus', listener: Function): this;
4062 /**
4063 * Emitted when the window is hidden.
4064 */
4065 on(event: 'hide', listener: Function): this;
4066 off(event: 'hide', listener: Function): this;
4067 once(event: 'hide', listener: Function): this;
4068 addListener(event: 'hide', listener: Function): this;
4069 removeListener(event: 'hide', listener: Function): this;
4070 /**
4071 * Emitted when the window is hidden.
4072 */
4073 on(event: 'hide', listener: Function): this;
4074 off(event: 'hide', listener: Function): this;
4075 once(event: 'hide', listener: Function): this;
4076 addListener(event: 'hide', listener: Function): this;
4077 removeListener(event: 'hide', listener: Function): this;
4078 /**
4079 * Emitted when the window leaves a full-screen state.
4080 */
4081 on(event: 'leave-full-screen', listener: Function): this;
4082 off(event: 'leave-full-screen', listener: Function): this;
4083 once(event: 'leave-full-screen', listener: Function): this;
4084 addListener(event: 'leave-full-screen', listener: Function): this;
4085 removeListener(event: 'leave-full-screen', listener: Function): this;
4086 /**
4087 * Emitted when the window leaves a full-screen state.
4088 */
4089 on(event: 'leave-full-screen', listener: Function): this;
4090 off(event: 'leave-full-screen', listener: Function): this;
4091 once(event: 'leave-full-screen', listener: Function): this;
4092 addListener(event: 'leave-full-screen', listener: Function): this;
4093 removeListener(event: 'leave-full-screen', listener: Function): this;
4094 /**
4095 * Emitted when the window leaves a full-screen state triggered by HTML API.
4096 */
4097 on(event: 'leave-html-full-screen', listener: Function): this;
4098 off(event: 'leave-html-full-screen', listener: Function): this;
4099 once(event: 'leave-html-full-screen', listener: Function): this;
4100 addListener(event: 'leave-html-full-screen', listener: Function): this;
4101 removeListener(event: 'leave-html-full-screen', listener: Function): this;
4102 /**
4103 * Emitted when window is maximized.
4104 */
4105 on(event: 'maximize', listener: Function): this;
4106 off(event: 'maximize', listener: Function): this;
4107 once(event: 'maximize', listener: Function): this;
4108 addListener(event: 'maximize', listener: Function): this;
4109 removeListener(event: 'maximize', listener: Function): this;
4110 /**
4111 * Emitted when window is maximized.
4112 */
4113 on(event: 'maximize', listener: Function): this;
4114 off(event: 'maximize', listener: Function): this;
4115 once(event: 'maximize', listener: Function): this;
4116 addListener(event: 'maximize', listener: Function): this;
4117 removeListener(event: 'maximize', listener: Function): this;
4118 /**
4119 * Emitted when the window is minimized.
4120 */
4121 on(event: 'minimize', listener: Function): this;
4122 off(event: 'minimize', listener: Function): this;
4123 once(event: 'minimize', listener: Function): this;
4124 addListener(event: 'minimize', listener: Function): this;
4125 removeListener(event: 'minimize', listener: Function): this;
4126 /**
4127 * Emitted when the window is minimized.
4128 */
4129 on(event: 'minimize', listener: Function): this;
4130 off(event: 'minimize', listener: Function): this;
4131 once(event: 'minimize', listener: Function): this;
4132 addListener(event: 'minimize', listener: Function): this;
4133 removeListener(event: 'minimize', listener: Function): this;
4134 /**
4135 * Emitted when the window is being moved to a new position.
4136 */
4137 on(event: 'move', listener: Function): this;
4138 off(event: 'move', listener: Function): this;
4139 once(event: 'move', listener: Function): this;
4140 addListener(event: 'move', listener: Function): this;
4141 removeListener(event: 'move', listener: Function): this;
4142 /**
4143 * Emitted when the window is being moved to a new position.
4144 */
4145 on(event: 'move', listener: Function): this;
4146 off(event: 'move', listener: Function): this;
4147 once(event: 'move', listener: Function): this;
4148 addListener(event: 'move', listener: Function): this;
4149 removeListener(event: 'move', listener: Function): this;
4150 /**
4151 * Emitted once when the window is moved to a new position.
4152 *
4153 * **Note**: On macOS this event is an alias of `move`.
4154 *
4155 * @platform darwin,win32
4156 */
4157 on(event: 'moved', listener: Function): this;
4158 /**
4159 * @platform darwin,win32
4160 */
4161 off(event: 'moved', listener: Function): this;
4162 /**
4163 * @platform darwin,win32
4164 */
4165 once(event: 'moved', listener: Function): this;
4166 /**
4167 * @platform darwin,win32
4168 */
4169 addListener(event: 'moved', listener: Function): this;
4170 /**
4171 * @platform darwin,win32
4172 */
4173 removeListener(event: 'moved', listener: Function): this;
4174 /**
4175 * Emitted once when the window is moved to a new position.
4176 *
4177 * **Note**: On macOS this event is an alias of `move`.
4178 *
4179 * @platform darwin,win32
4180 */
4181 on(event: 'moved', listener: Function): this;
4182 /**
4183 * @platform darwin,win32
4184 */
4185 off(event: 'moved', listener: Function): this;
4186 /**
4187 * @platform darwin,win32
4188 */
4189 once(event: 'moved', listener: Function): this;
4190 /**
4191 * @platform darwin,win32
4192 */
4193 addListener(event: 'moved', listener: Function): this;
4194 /**
4195 * @platform darwin,win32
4196 */
4197 removeListener(event: 'moved', listener: Function): this;
4198 /**
4199 * Emitted when the native new tab button is clicked.
4200 *
4201 * @platform darwin
4202 */
4203 on(event: 'new-window-for-tab', listener: Function): this;
4204 /**
4205 * @platform darwin
4206 */
4207 off(event: 'new-window-for-tab', listener: Function): this;
4208 /**
4209 * @platform darwin
4210 */
4211 once(event: 'new-window-for-tab', listener: Function): this;
4212 /**
4213 * @platform darwin
4214 */
4215 addListener(event: 'new-window-for-tab', listener: Function): this;
4216 /**
4217 * @platform darwin
4218 */
4219 removeListener(event: 'new-window-for-tab', listener: Function): this;
4220 /**
4221 * Emitted when the native new tab button is clicked.
4222 *
4223 * @platform darwin
4224 */
4225 on(event: 'new-window-for-tab', listener: Function): this;
4226 /**
4227 * @platform darwin
4228 */
4229 off(event: 'new-window-for-tab', listener: Function): this;
4230 /**
4231 * @platform darwin
4232 */
4233 once(event: 'new-window-for-tab', listener: Function): this;
4234 /**
4235 * @platform darwin
4236 */
4237 addListener(event: 'new-window-for-tab', listener: Function): this;
4238 /**
4239 * @platform darwin
4240 */
4241 removeListener(event: 'new-window-for-tab', listener: Function): this;
4242 /**
4243 * Emitted when the document changed its title, calling `event.preventDefault()`
4244 * will prevent the native window's title from changing. `explicitSet` is false
4245 * when title is synthesized from file URL.
4246 */
4247 on(event: 'page-title-updated', listener: (event: Event,
4248 title: string,
4249 explicitSet: boolean) => void): this;
4250 off(event: 'page-title-updated', listener: (event: Event,
4251 title: string,
4252 explicitSet: boolean) => void): this;
4253 once(event: 'page-title-updated', listener: (event: Event,
4254 title: string,
4255 explicitSet: boolean) => void): this;
4256 addListener(event: 'page-title-updated', listener: (event: Event,
4257 title: string,
4258 explicitSet: boolean) => void): this;
4259 removeListener(event: 'page-title-updated', listener: (event: Event,
4260 title: string,
4261 explicitSet: boolean) => void): this;
4262 /**
4263 * Emitted when the web page has been rendered (while not being shown) and window
4264 * can be displayed without a visual flash.
4265 *
4266 * Please note that using this event implies that the renderer will be considered
4267 * "visible" and paint even though `show` is false. This event will never fire if
4268 * you use `paintWhenInitiallyHidden: false`
4269 */
4270 on(event: 'ready-to-show', listener: Function): this;
4271 off(event: 'ready-to-show', listener: Function): this;
4272 once(event: 'ready-to-show', listener: Function): this;
4273 addListener(event: 'ready-to-show', listener: Function): this;
4274 removeListener(event: 'ready-to-show', listener: Function): this;
4275 /**
4276 * Emitted after the window has been resized.
4277 */
4278 on(event: 'resize', listener: Function): this;
4279 off(event: 'resize', listener: Function): this;
4280 once(event: 'resize', listener: Function): this;
4281 addListener(event: 'resize', listener: Function): this;
4282 removeListener(event: 'resize', listener: Function): this;
4283 /**
4284 * Emitted after the window has been resized.
4285 */
4286 on(event: 'resize', listener: Function): this;
4287 off(event: 'resize', listener: Function): this;
4288 once(event: 'resize', listener: Function): this;
4289 addListener(event: 'resize', listener: Function): this;
4290 removeListener(event: 'resize', listener: Function): this;
4291 /**
4292 * Emitted once when the window has finished being resized.
4293 *
4294 * This is usually emitted when the window has been resized manually. On macOS,
4295 * resizing the window with `setBounds`/`setSize` and setting the `animate`
4296 * parameter to `true` will also emit this event once resizing has finished.
4297 *
4298 * @platform darwin,win32
4299 */
4300 on(event: 'resized', listener: Function): this;
4301 /**
4302 * @platform darwin,win32
4303 */
4304 off(event: 'resized', listener: Function): this;
4305 /**
4306 * @platform darwin,win32
4307 */
4308 once(event: 'resized', listener: Function): this;
4309 /**
4310 * @platform darwin,win32
4311 */
4312 addListener(event: 'resized', listener: Function): this;
4313 /**
4314 * @platform darwin,win32
4315 */
4316 removeListener(event: 'resized', listener: Function): this;
4317 /**
4318 * Emitted once when the window has finished being resized.
4319 *
4320 * This is usually emitted when the window has been resized manually. On macOS,
4321 * resizing the window with `setBounds`/`setSize` and setting the `animate`
4322 * parameter to `true` will also emit this event once resizing has finished.
4323 *
4324 * @platform darwin,win32
4325 */
4326 on(event: 'resized', listener: Function): this;
4327 /**
4328 * @platform darwin,win32
4329 */
4330 off(event: 'resized', listener: Function): this;
4331 /**
4332 * @platform darwin,win32
4333 */
4334 once(event: 'resized', listener: Function): this;
4335 /**
4336 * @platform darwin,win32
4337 */
4338 addListener(event: 'resized', listener: Function): this;
4339 /**
4340 * @platform darwin,win32
4341 */
4342 removeListener(event: 'resized', listener: Function): this;
4343 /**
4344 * Emitted when the unresponsive web page becomes responsive again.
4345 */
4346 on(event: 'responsive', listener: Function): this;
4347 off(event: 'responsive', listener: Function): this;
4348 once(event: 'responsive', listener: Function): this;
4349 addListener(event: 'responsive', listener: Function): this;
4350 removeListener(event: 'responsive', listener: Function): this;
4351 /**
4352 * Emitted when the window is restored from a minimized state.
4353 */
4354 on(event: 'restore', listener: Function): this;
4355 off(event: 'restore', listener: Function): this;
4356 once(event: 'restore', listener: Function): this;
4357 addListener(event: 'restore', listener: Function): this;
4358 removeListener(event: 'restore', listener: Function): this;
4359 /**
4360 * Emitted when the window is restored from a minimized state.
4361 */
4362 on(event: 'restore', listener: Function): this;
4363 off(event: 'restore', listener: Function): this;
4364 once(event: 'restore', listener: Function): this;
4365 addListener(event: 'restore', listener: Function): this;
4366 removeListener(event: 'restore', listener: Function): this;
4367 /**
4368 * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
4369 * is ended. The `rotation` value on each emission is the angle in degrees rotated
4370 * since the last emission. The last emitted event upon a rotation gesture will
4371 * always be of value `0`. Counter-clockwise rotation values are positive, while
4372 * clockwise ones are negative.
4373 *
4374 * @platform darwin
4375 */
4376 on(event: 'rotate-gesture', listener: (event: Event,
4377 rotation: number) => void): this;
4378 /**
4379 * @platform darwin
4380 */
4381 off(event: 'rotate-gesture', listener: (event: Event,
4382 rotation: number) => void): this;
4383 /**
4384 * @platform darwin
4385 */
4386 once(event: 'rotate-gesture', listener: (event: Event,
4387 rotation: number) => void): this;
4388 /**
4389 * @platform darwin
4390 */
4391 addListener(event: 'rotate-gesture', listener: (event: Event,
4392 rotation: number) => void): this;
4393 /**
4394 * @platform darwin
4395 */
4396 removeListener(event: 'rotate-gesture', listener: (event: Event,
4397 rotation: number) => void): this;
4398 /**
4399 * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
4400 * is ended. The `rotation` value on each emission is the angle in degrees rotated
4401 * since the last emission. The last emitted event upon a rotation gesture will
4402 * always be of value `0`. Counter-clockwise rotation values are positive, while
4403 * clockwise ones are negative.
4404 *
4405 * @platform darwin
4406 */
4407 on(event: 'rotate-gesture', listener: (event: Event,
4408 rotation: number) => void): this;
4409 /**
4410 * @platform darwin
4411 */
4412 off(event: 'rotate-gesture', listener: (event: Event,
4413 rotation: number) => void): this;
4414 /**
4415 * @platform darwin
4416 */
4417 once(event: 'rotate-gesture', listener: (event: Event,
4418 rotation: number) => void): this;
4419 /**
4420 * @platform darwin
4421 */
4422 addListener(event: 'rotate-gesture', listener: (event: Event,
4423 rotation: number) => void): this;
4424 /**
4425 * @platform darwin
4426 */
4427 removeListener(event: 'rotate-gesture', listener: (event: Event,
4428 rotation: number) => void): this;
4429 /**
4430 * Emitted when window session is going to end due to force shutdown or machine
4431 * restart or session log off.
4432 *
4433 * @platform win32
4434 */
4435 on(event: 'session-end', listener: Function): this;
4436 /**
4437 * @platform win32
4438 */
4439 off(event: 'session-end', listener: Function): this;
4440 /**
4441 * @platform win32
4442 */
4443 once(event: 'session-end', listener: Function): this;
4444 /**
4445 * @platform win32
4446 */
4447 addListener(event: 'session-end', listener: Function): this;
4448 /**
4449 * @platform win32
4450 */
4451 removeListener(event: 'session-end', listener: Function): this;
4452 /**
4453 * Emitted when window session is going to end due to force shutdown or machine
4454 * restart or session log off.
4455 *
4456 * @platform win32
4457 */
4458 on(event: 'session-end', listener: Function): this;
4459 /**
4460 * @platform win32
4461 */
4462 off(event: 'session-end', listener: Function): this;
4463 /**
4464 * @platform win32
4465 */
4466 once(event: 'session-end', listener: Function): this;
4467 /**
4468 * @platform win32
4469 */
4470 addListener(event: 'session-end', listener: Function): this;
4471 /**
4472 * @platform win32
4473 */
4474 removeListener(event: 'session-end', listener: Function): this;
4475 /**
4476 * Emitted when the window opens a sheet.
4477 *
4478 * @platform darwin
4479 */
4480 on(event: 'sheet-begin', listener: Function): this;
4481 /**
4482 * @platform darwin
4483 */
4484 off(event: 'sheet-begin', listener: Function): this;
4485 /**
4486 * @platform darwin
4487 */
4488 once(event: 'sheet-begin', listener: Function): this;
4489 /**
4490 * @platform darwin
4491 */
4492 addListener(event: 'sheet-begin', listener: Function): this;
4493 /**
4494 * @platform darwin
4495 */
4496 removeListener(event: 'sheet-begin', listener: Function): this;
4497 /**
4498 * Emitted when the window opens a sheet.
4499 *
4500 * @platform darwin
4501 */
4502 on(event: 'sheet-begin', listener: Function): this;
4503 /**
4504 * @platform darwin
4505 */
4506 off(event: 'sheet-begin', listener: Function): this;
4507 /**
4508 * @platform darwin
4509 */
4510 once(event: 'sheet-begin', listener: Function): this;
4511 /**
4512 * @platform darwin
4513 */
4514 addListener(event: 'sheet-begin', listener: Function): this;
4515 /**
4516 * @platform darwin
4517 */
4518 removeListener(event: 'sheet-begin', listener: Function): this;
4519 /**
4520 * Emitted when the window has closed a sheet.
4521 *
4522 * @platform darwin
4523 */
4524 on(event: 'sheet-end', listener: Function): this;
4525 /**
4526 * @platform darwin
4527 */
4528 off(event: 'sheet-end', listener: Function): this;
4529 /**
4530 * @platform darwin
4531 */
4532 once(event: 'sheet-end', listener: Function): this;
4533 /**
4534 * @platform darwin
4535 */
4536 addListener(event: 'sheet-end', listener: Function): this;
4537 /**
4538 * @platform darwin
4539 */
4540 removeListener(event: 'sheet-end', listener: Function): this;
4541 /**
4542 * Emitted when the window has closed a sheet.
4543 *
4544 * @platform darwin
4545 */
4546 on(event: 'sheet-end', listener: Function): this;
4547 /**
4548 * @platform darwin
4549 */
4550 off(event: 'sheet-end', listener: Function): this;
4551 /**
4552 * @platform darwin
4553 */
4554 once(event: 'sheet-end', listener: Function): this;
4555 /**
4556 * @platform darwin
4557 */
4558 addListener(event: 'sheet-end', listener: Function): this;
4559 /**
4560 * @platform darwin
4561 */
4562 removeListener(event: 'sheet-end', listener: Function): this;
4563 /**
4564 * Emitted when the window is shown.
4565 */
4566 on(event: 'show', listener: Function): this;
4567 off(event: 'show', listener: Function): this;
4568 once(event: 'show', listener: Function): this;
4569 addListener(event: 'show', listener: Function): this;
4570 removeListener(event: 'show', listener: Function): this;
4571 /**
4572 * Emitted when the window is shown.
4573 */
4574 on(event: 'show', listener: Function): this;
4575 off(event: 'show', listener: Function): this;
4576 once(event: 'show', listener: Function): this;
4577 addListener(event: 'show', listener: Function): this;
4578 removeListener(event: 'show', listener: Function): this;
4579 /**
4580 * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
4581 * `left`.
4582 *
4583 * The method underlying this event is built to handle older macOS-style trackpad
4584 * swiping, where the content on the screen doesn't move with the swipe. Most macOS
4585 * trackpads are not configured to allow this kind of swiping anymore, so in order
4586 * for it to emit properly the 'Swipe between pages' preference in `System
4587 * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
4588 * fingers'.
4589 *
4590 * @platform darwin
4591 */
4592 on(event: 'swipe', listener: (event: Event,
4593 direction: string) => void): this;
4594 /**
4595 * @platform darwin
4596 */
4597 off(event: 'swipe', listener: (event: Event,
4598 direction: string) => void): this;
4599 /**
4600 * @platform darwin
4601 */
4602 once(event: 'swipe', listener: (event: Event,
4603 direction: string) => void): this;
4604 /**
4605 * @platform darwin
4606 */
4607 addListener(event: 'swipe', listener: (event: Event,
4608 direction: string) => void): this;
4609 /**
4610 * @platform darwin
4611 */
4612 removeListener(event: 'swipe', listener: (event: Event,
4613 direction: string) => void): this;
4614 /**
4615 * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
4616 * `left`.
4617 *
4618 * The method underlying this event is built to handle older macOS-style trackpad
4619 * swiping, where the content on the screen doesn't move with the swipe. Most macOS
4620 * trackpads are not configured to allow this kind of swiping anymore, so in order
4621 * for it to emit properly the 'Swipe between pages' preference in `System
4622 * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
4623 * fingers'.
4624 *
4625 * @platform darwin
4626 */
4627 on(event: 'swipe', listener: (event: Event,
4628 direction: string) => void): this;
4629 /**
4630 * @platform darwin
4631 */
4632 off(event: 'swipe', listener: (event: Event,
4633 direction: string) => void): this;
4634 /**
4635 * @platform darwin
4636 */
4637 once(event: 'swipe', listener: (event: Event,
4638 direction: string) => void): this;
4639 /**
4640 * @platform darwin
4641 */
4642 addListener(event: 'swipe', listener: (event: Event,
4643 direction: string) => void): this;
4644 /**
4645 * @platform darwin
4646 */
4647 removeListener(event: 'swipe', listener: (event: Event,
4648 direction: string) => void): this;
4649 /**
4650 * Emitted when the system context menu is triggered on the window, this is
4651 * normally only triggered when the user right clicks on the non-client area of
4652 * your window. This is the window titlebar or any area you have declared as
4653 * `-webkit-app-region: drag` in a frameless window.
4654 *
4655 * Calling `event.preventDefault()` will prevent the menu from being displayed.
4656 *
4657 * @platform win32
4658 */
4659 on(event: 'system-context-menu', listener: (event: Event,
4660 /**
4661 * The screen coordinates the context menu was triggered at
4662 */
4663 point: Point) => void): this;
4664 /**
4665 * @platform win32
4666 */
4667 off(event: 'system-context-menu', listener: (event: Event,
4668 /**
4669 * The screen coordinates the context menu was triggered at
4670 */
4671 point: Point) => void): this;
4672 /**
4673 * @platform win32
4674 */
4675 once(event: 'system-context-menu', listener: (event: Event,
4676 /**
4677 * The screen coordinates the context menu was triggered at
4678 */
4679 point: Point) => void): this;
4680 /**
4681 * @platform win32
4682 */
4683 addListener(event: 'system-context-menu', listener: (event: Event,
4684 /**
4685 * The screen coordinates the context menu was triggered at
4686 */
4687 point: Point) => void): this;
4688 /**
4689 * @platform win32
4690 */
4691 removeListener(event: 'system-context-menu', listener: (event: Event,
4692 /**
4693 * The screen coordinates the context menu was triggered at
4694 */
4695 point: Point) => void): this;
4696 /**
4697 * Emitted when the system context menu is triggered on the window, this is
4698 * normally only triggered when the user right clicks on the non-client area of
4699 * your window. This is the window titlebar or any area you have declared as
4700 * `-webkit-app-region: drag` in a frameless window.
4701 *
4702 * Calling `event.preventDefault()` will prevent the menu from being displayed.
4703 *
4704 * @platform win32
4705 */
4706 on(event: 'system-context-menu', listener: (event: Event,
4707 /**
4708 * The screen coordinates the context menu was triggered at
4709 */
4710 point: Point) => void): this;
4711 /**
4712 * @platform win32
4713 */
4714 off(event: 'system-context-menu', listener: (event: Event,
4715 /**
4716 * The screen coordinates the context menu was triggered at
4717 */
4718 point: Point) => void): this;
4719 /**
4720 * @platform win32
4721 */
4722 once(event: 'system-context-menu', listener: (event: Event,
4723 /**
4724 * The screen coordinates the context menu was triggered at
4725 */
4726 point: Point) => void): this;
4727 /**
4728 * @platform win32
4729 */
4730 addListener(event: 'system-context-menu', listener: (event: Event,
4731 /**
4732 * The screen coordinates the context menu was triggered at
4733 */
4734 point: Point) => void): this;
4735 /**
4736 * @platform win32
4737 */
4738 removeListener(event: 'system-context-menu', listener: (event: Event,
4739 /**
4740 * The screen coordinates the context menu was triggered at
4741 */
4742 point: Point) => void): this;
4743 /**
4744 * Emitted when the window exits from a maximized state.
4745 */
4746 on(event: 'unmaximize', listener: Function): this;
4747 off(event: 'unmaximize', listener: Function): this;
4748 once(event: 'unmaximize', listener: Function): this;
4749 addListener(event: 'unmaximize', listener: Function): this;
4750 removeListener(event: 'unmaximize', listener: Function): this;
4751 /**
4752 * Emitted when the window exits from a maximized state.
4753 */
4754 on(event: 'unmaximize', listener: Function): this;
4755 off(event: 'unmaximize', listener: Function): this;
4756 once(event: 'unmaximize', listener: Function): this;
4757 addListener(event: 'unmaximize', listener: Function): this;
4758 removeListener(event: 'unmaximize', listener: Function): this;
4759 /**
4760 * Emitted when the web page becomes unresponsive.
4761 */
4762 on(event: 'unresponsive', listener: Function): this;
4763 off(event: 'unresponsive', listener: Function): this;
4764 once(event: 'unresponsive', listener: Function): this;
4765 addListener(event: 'unresponsive', listener: Function): this;
4766 removeListener(event: 'unresponsive', listener: Function): this;
4767 /**
4768 * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
4769 * will prevent the window from being moved.
4770 *
4771 * Note that this is only emitted when the window is being moved manually. Moving
4772 * the window with `setPosition`/`setBounds`/`center` will not emit this event.
4773 *
4774 * @platform darwin,win32
4775 */
4776 on(event: 'will-move', listener: (event: Event,
4777 /**
4778 * Location the window is being moved to.
4779 */
4780 newBounds: Rectangle) => void): this;
4781 /**
4782 * @platform darwin,win32
4783 */
4784 off(event: 'will-move', listener: (event: Event,
4785 /**
4786 * Location the window is being moved to.
4787 */
4788 newBounds: Rectangle) => void): this;
4789 /**
4790 * @platform darwin,win32
4791 */
4792 once(event: 'will-move', listener: (event: Event,
4793 /**
4794 * Location the window is being moved to.
4795 */
4796 newBounds: Rectangle) => void): this;
4797 /**
4798 * @platform darwin,win32
4799 */
4800 addListener(event: 'will-move', listener: (event: Event,
4801 /**
4802 * Location the window is being moved to.
4803 */
4804 newBounds: Rectangle) => void): this;
4805 /**
4806 * @platform darwin,win32
4807 */
4808 removeListener(event: 'will-move', listener: (event: Event,
4809 /**
4810 * Location the window is being moved to.
4811 */
4812 newBounds: Rectangle) => void): this;
4813 /**
4814 * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
4815 * will prevent the window from being moved.
4816 *
4817 * Note that this is only emitted when the window is being moved manually. Moving
4818 * the window with `setPosition`/`setBounds`/`center` will not emit this event.
4819 *
4820 * @platform darwin,win32
4821 */
4822 on(event: 'will-move', listener: (event: Event,
4823 /**
4824 * Location the window is being moved to.
4825 */
4826 newBounds: Rectangle) => void): this;
4827 /**
4828 * @platform darwin,win32
4829 */
4830 off(event: 'will-move', listener: (event: Event,
4831 /**
4832 * Location the window is being moved to.
4833 */
4834 newBounds: Rectangle) => void): this;
4835 /**
4836 * @platform darwin,win32
4837 */
4838 once(event: 'will-move', listener: (event: Event,
4839 /**
4840 * Location the window is being moved to.
4841 */
4842 newBounds: Rectangle) => void): this;
4843 /**
4844 * @platform darwin,win32
4845 */
4846 addListener(event: 'will-move', listener: (event: Event,
4847 /**
4848 * Location the window is being moved to.
4849 */
4850 newBounds: Rectangle) => void): this;
4851 /**
4852 * @platform darwin,win32
4853 */
4854 removeListener(event: 'will-move', listener: (event: Event,
4855 /**
4856 * Location the window is being moved to.
4857 */
4858 newBounds: Rectangle) => void): this;
4859 /**
4860 * Emitted before the window is resized. Calling `event.preventDefault()` will
4861 * prevent the window from being resized.
4862 *
4863 * Note that this is only emitted when the window is being resized manually.
4864 * Resizing the window with `setBounds`/`setSize` will not emit this event.
4865 *
4866 * The possible values and behaviors of the `edge` option are platform dependent.
4867 * Possible values are:
4868 *
4869 * * On Windows, possible values are `bottom`, `top`, `left`, `right`, `top-left`,
4870 * `top-right`, `bottom-left`, `bottom-right`.
4871 * * On macOS, possible values are `bottom` and `right`.
4872 * * The value `bottom` is used to denote vertical resizing.
4873 * * The value `right` is used to denote horizontal resizing.
4874 *
4875 * @platform darwin,win32
4876 */
4877 on(event: 'will-resize', listener: (event: Event,
4878 /**
4879 * Size the window is being resized to.
4880 */
4881 newBounds: Rectangle,
4882 details: WillResizeDetails) => void): this;
4883 /**
4884 * @platform darwin,win32
4885 */
4886 off(event: 'will-resize', listener: (event: Event,
4887 /**
4888 * Size the window is being resized to.
4889 */
4890 newBounds: Rectangle,
4891 details: WillResizeDetails) => void): this;
4892 /**
4893 * @platform darwin,win32
4894 */
4895 once(event: 'will-resize', listener: (event: Event,
4896 /**
4897 * Size the window is being resized to.
4898 */
4899 newBounds: Rectangle,
4900 details: WillResizeDetails) => void): this;
4901 /**
4902 * @platform darwin,win32
4903 */
4904 addListener(event: 'will-resize', listener: (event: Event,
4905 /**
4906 * Size the window is being resized to.
4907 */
4908 newBounds: Rectangle,
4909 details: WillResizeDetails) => void): this;
4910 /**
4911 * @platform darwin,win32
4912 */
4913 removeListener(event: 'will-resize', listener: (event: Event,
4914 /**
4915 * Size the window is being resized to.
4916 */
4917 newBounds: Rectangle,
4918 details: WillResizeDetails) => void): this;
4919 /**
4920 * Emitted before the window is resized. Calling `event.preventDefault()` will
4921 * prevent the window from being resized.
4922 *
4923 * Note that this is only emitted when the window is being resized manually.
4924 * Resizing the window with `setBounds`/`setSize` will not emit this event.
4925 *
4926 * The possible values and behaviors of the `edge` option are platform dependent.
4927 * Possible values are:
4928 *
4929 * * On Windows, possible values are `bottom`, `top`, `left`, `right`, `top-left`,
4930 * `top-right`, `bottom-left`, `bottom-right`.
4931 * * On macOS, possible values are `bottom` and `right`.
4932 * * The value `bottom` is used to denote vertical resizing.
4933 * * The value `right` is used to denote horizontal resizing.
4934 *
4935 * @platform darwin,win32
4936 */
4937 on(event: 'will-resize', listener: (event: Event,
4938 /**
4939 * Size the window is being resized to.
4940 */
4941 newBounds: Rectangle,
4942 details: WillResizeDetails) => void): this;
4943 /**
4944 * @platform darwin,win32
4945 */
4946 off(event: 'will-resize', listener: (event: Event,
4947 /**
4948 * Size the window is being resized to.
4949 */
4950 newBounds: Rectangle,
4951 details: WillResizeDetails) => void): this;
4952 /**
4953 * @platform darwin,win32
4954 */
4955 once(event: 'will-resize', listener: (event: Event,
4956 /**
4957 * Size the window is being resized to.
4958 */
4959 newBounds: Rectangle,
4960 details: WillResizeDetails) => void): this;
4961 /**
4962 * @platform darwin,win32
4963 */
4964 addListener(event: 'will-resize', listener: (event: Event,
4965 /**
4966 * Size the window is being resized to.
4967 */
4968 newBounds: Rectangle,
4969 details: WillResizeDetails) => void): this;
4970 /**
4971 * @platform darwin,win32
4972 */
4973 removeListener(event: 'will-resize', listener: (event: Event,
4974 /**
4975 * Size the window is being resized to.
4976 */
4977 newBounds: Rectangle,
4978 details: WillResizeDetails) => void): this;
4979 /**
4980 * BrowserWindow
4981 */
4982 constructor(options?: BrowserWindowConstructorOptions);
4983 /**
4984 * > **Note** The `BrowserView` class is deprecated, and replaced by the new
4985 * `WebContentsView` class.
4986 *
4987 * The window that owns the given `browserView`. If the given view is not attached
4988 * to any window, returns `null`.
4989 *
4990 * @deprecated
4991 */
4992 static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
4993 /**
4994 * The window with the given `id`.
4995 */
4996 static fromId(id: number): (BrowserWindow) | (null);
4997 /**
4998 * The window that owns the given `webContents` or `null` if the contents are not
4999 * owned by a window.
5000 */
5001 static fromWebContents(webContents: WebContents): (BrowserWindow) | (null);
5002 /**
5003 * An array of all opened browser windows.
5004 */
5005 static getAllWindows(): BrowserWindow[];
5006 /**
5007 * The window that is focused in this application, otherwise returns `null`.
5008 */
5009 static getFocusedWindow(): (BrowserWindow) | (null);
5010 /**
5011 * Replacement API for setBrowserView supporting work with multi browser views.
5012 *
5013 * > **Note** The `BrowserView` class is deprecated, and replaced by the new
5014 * `WebContentsView` class.
5015 *
5016 * @experimental
5017 * @deprecated
5018 */
5019 addBrowserView(browserView: BrowserView): void;
5020 /**
5021 * Adds a window as a tab on this window, after the tab for the window instance.
5022 *
5023 * @platform darwin
5024 */
5025 addTabbedWindow(browserWindow: BrowserWindow): void;
5026 /**
5027 * Removes focus from the window.
5028 */
5029 blur(): void;
5030 blurWebView(): void;
5031 /**
5032 * Resolves with a NativeImage
5033 *
5034 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
5035 * whole visible page. If the page is not visible, `rect` may be empty. The page is
5036 * considered visible when its browser window is hidden and the capturer count is
5037 * non-zero. If you would like the page to stay hidden, you should ensure that
5038 * `stayHidden` is set to true.
5039 */
5040 capturePage(rect?: Rectangle, opts?: Opts): Promise<Electron.NativeImage>;
5041 /**
5042 * Moves window to the center of the screen.
5043 */
5044 center(): void;
5045 /**
5046 * Try to close the window. This has the same effect as a user manually clicking
5047 * the close button of the window. The web page may cancel the close though. See
5048 * the close event.
5049 */
5050 close(): void;
5051 /**
5052 * Closes the currently open Quick Look panel.
5053 *
5054 * @platform darwin
5055 */
5056 closeFilePreview(): void;
5057 /**
5058 * Force closing the window, the `unload` and `beforeunload` event won't be emitted
5059 * for the web page, and `close` event will also not be emitted for this window,
5060 * but it guarantees the `closed` event will be emitted.
5061 */
5062 destroy(): void;
5063 /**
5064 * Starts or stops flashing the window to attract user's attention.
5065 */
5066 flashFrame(flag: boolean): void;
5067 /**
5068 * Focuses on the window.
5069 */
5070 focus(): void;
5071 focusOnWebView(): void;
5072 /**
5073 * Gets the background color of the window in Hex (`#RRGGBB`) format.
5074 *
5075 * See Setting `backgroundColor`.
5076 *
5077 * **Note:** The alpha value is _not_ returned alongside the red, green, and blue
5078 * values.
5079 */
5080 getBackgroundColor(): string;
5081 /**
5082 * The `bounds` of the window as `Object`.
5083 *
5084 * **Note:** On macOS, the y-coordinate value returned will be at minimum the Tray
5085 * height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height:
5086 * 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x:
5087 * 25, y: 38, width: 800, height: 600 }`.
5088 */
5089 getBounds(): Rectangle;
5090 /**
5091 * The `BrowserView` attached to `win`. Returns `null` if one is not attached.
5092 * Throws an error if multiple `BrowserView`s are attached.
5093 *
5094 * > **Note** The `BrowserView` class is deprecated, and replaced by the new
5095 * `WebContentsView` class.
5096 *
5097 * @experimental
5098 * @deprecated
5099 */
5100 getBrowserView(): (BrowserView) | (null);
5101 /**
5102 * a sorted by z-index array of all BrowserViews that have been attached with
5103 * `addBrowserView` or `setBrowserView`. The top-most BrowserView is the last
5104 * element of the array.
5105 *
5106 * > **Note** The `BrowserView` class is deprecated, and replaced by the new
5107 * `WebContentsView` class.
5108 *
5109 * @experimental
5110 * @deprecated
5111 */
5112 getBrowserViews(): BrowserView[];
5113 /**
5114 * All child windows.
5115 */
5116 getChildWindows(): BrowserWindow[];
5117 /**
5118 * The `bounds` of the window's client area as `Object`.
5119 */
5120 getContentBounds(): Rectangle;
5121 /**
5122 * Contains the window's client area's width and height.
5123 */
5124 getContentSize(): number[];
5125 /**
5126 * Contains the window's maximum width and height.
5127 */
5128 getMaximumSize(): number[];
5129 /**
5130 * Window id in the format of DesktopCapturerSource's id. For example
5131 * "window:1324:0".
5132 *
5133 * More precisely the format is `window:id:other_id` where `id` is `HWND` on
5134 * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
5135 * Linux. `other_id` is used to identify web contents (tabs) so within the same top
5136 * level window.
5137 */
5138 getMediaSourceId(): string;
5139 /**
5140 * Contains the window's minimum width and height.
5141 */
5142 getMinimumSize(): number[];
5143 /**
5144 * The platform-specific handle of the window.
5145 *
5146 * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
5147 * `Window` (`unsigned long`) on Linux.
5148 */
5149 getNativeWindowHandle(): Buffer;
5150 /**
5151 * Contains the window bounds of the normal state
5152 *
5153 * **Note:** whatever the current state of the window : maximized, minimized or in
5154 * fullscreen, this function always returns the position and size of the window in
5155 * normal state. In normal state, getBounds and getNormalBounds returns the same
5156 * `Rectangle`.
5157 */
5158 getNormalBounds(): Rectangle;
5159 /**
5160 * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
5161 * 1.
5162 */
5163 getOpacity(): number;
5164 /**
5165 * The parent window or `null` if there is no parent.
5166 */
5167 getParentWindow(): (BrowserWindow) | (null);
5168 /**
5169 * Contains the window's current position.
5170 */
5171 getPosition(): number[];
5172 /**
5173 * The pathname of the file the window represents.
5174 *
5175 * @platform darwin
5176 */
5177 getRepresentedFilename(): string;
5178 /**
5179 * Contains the window's width and height.
5180 */
5181 getSize(): number[];
5182 /**
5183 * The title of the native window.
5184 *
5185 * **Note:** The title of the web page can be different from the title of the
5186 * native window.
5187 */
5188 getTitle(): string;
5189 /**
5190 * The custom position for the traffic light buttons in frameless window, `null`
5191 * will be returned when there is no custom position.
5192 *
5193 * @platform darwin
5194 */
5195 getWindowButtonPosition(): (Point) | (null);
5196 /**
5197 * Whether the window has a shadow.
5198 */
5199 hasShadow(): boolean;
5200 /**
5201 * Hides the window.
5202 */
5203 hide(): void;
5204 /**
5205 * Hooks a windows message. The `callback` is called when the message is received
5206 * in the WndProc.
5207 *
5208 * @platform win32
5209 */
5210 hookWindowMessage(message: number, callback: (wParam: Buffer, lParam: Buffer) => void): void;
5211 /**
5212 * Invalidates the window shadow so that it is recomputed based on the current
5213 * window shape.
5214 *
5215 * `BrowserWindows` that are transparent can sometimes leave behind visual
5216 * artifacts on macOS. This method can be used to clear these artifacts when, for
5217 * example, performing an animation.
5218 *
5219 * @platform darwin
5220 */
5221 invalidateShadow(): void;
5222 /**
5223 * Whether the window is always on top of other windows.
5224 */
5225 isAlwaysOnTop(): boolean;
5226 /**
5227 * Whether the window can be manually closed by user.
5228 *
5229 * On Linux always returns `true`.
5230 *
5231 * @platform darwin,win32
5232 */
5233 isClosable(): boolean;
5234 /**
5235 * Whether the window is destroyed.
5236 */
5237 isDestroyed(): boolean;
5238 /**
5239 * Whether the window's document has been edited.
5240 *
5241 * @platform darwin
5242 */
5243 isDocumentEdited(): boolean;
5244 /**
5245 * whether the window is enabled.
5246 */
5247 isEnabled(): boolean;
5248 /**
5249 * Whether the window can be focused.
5250 *
5251 * @platform darwin,win32
5252 */
5253 isFocusable(): boolean;
5254 /**
5255 * Whether the window is focused.
5256 */
5257 isFocused(): boolean;
5258 /**
5259 * Whether the window is in fullscreen mode.
5260 */
5261 isFullScreen(): boolean;
5262 /**
5263 * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
5264 * window.
5265 */
5266 isFullScreenable(): boolean;
5267 /**
5268 * Whether the window will be hidden when the user toggles into mission control.
5269 *
5270 * @platform darwin
5271 */
5272 isHiddenInMissionControl(): boolean;
5273 /**
5274 * Whether the window is in kiosk mode.
5275 */
5276 isKiosk(): boolean;
5277 /**
5278 * Whether the window can be manually maximized by user.
5279 *
5280 * On Linux always returns `true`.
5281 *
5282 * @platform darwin,win32
5283 */
5284 isMaximizable(): boolean;
5285 /**
5286 * Whether the window is maximized.
5287 */
5288 isMaximized(): boolean;
5289 /**
5290 * Whether menu bar automatically hides itself.
5291 *
5292 * @platform win32,linux
5293 */
5294 isMenuBarAutoHide(): boolean;
5295 /**
5296 * Whether the menu bar is visible.
5297 *
5298 * @platform win32,linux
5299 */
5300 isMenuBarVisible(): boolean;
5301 /**
5302 * Whether the window can be manually minimized by the user.
5303 *
5304 * On Linux always returns `true`.
5305 *
5306 * @platform darwin,win32
5307 */
5308 isMinimizable(): boolean;
5309 /**
5310 * Whether the window is minimized.
5311 */
5312 isMinimized(): boolean;
5313 /**
5314 * Whether current window is a modal window.
5315 */
5316 isModal(): boolean;
5317 /**
5318 * Whether the window can be moved by user.
5319 *
5320 * On Linux always returns `true`.
5321 *
5322 * @platform darwin,win32
5323 */
5324 isMovable(): boolean;
5325 /**
5326 * Whether the window is in normal state (not maximized, not minimized, not in
5327 * fullscreen mode).
5328 */
5329 isNormal(): boolean;
5330 /**
5331 * Whether the window can be manually resized by the user.
5332 */
5333 isResizable(): boolean;
5334 /**
5335 * Whether the window is in simple (pre-Lion) fullscreen mode.
5336 *
5337 * @platform darwin
5338 */
5339 isSimpleFullScreen(): boolean;
5340 /**
5341 * Whether the window is in Windows 10 tablet mode.
5342 *
5343 * Since Windows 10 users can use their PC as tablet, under this mode apps can
5344 * choose to optimize their UI for tablets, such as enlarging the titlebar and
5345 * hiding titlebar buttons.
5346 *
5347 * This API returns whether the window is in tablet mode, and the `resize` event
5348 * can be be used to listen to changes to tablet mode.
5349 *
5350 * @platform win32
5351 */
5352 isTabletMode(): boolean;
5353 /**
5354 * Whether the window is visible to the user in the foreground of the app.
5355 */
5356 isVisible(): boolean;
5357 /**
5358 * Whether the window is visible on all workspaces.
5359 *
5360 * **Note:** This API always returns false on Windows.
5361 *
5362 * @platform darwin,linux
5363 */
5364 isVisibleOnAllWorkspaces(): boolean;
5365 /**
5366 * `true` or `false` depending on whether the message is hooked.
5367 *
5368 * @platform win32
5369 */
5370 isWindowMessageHooked(message: number): boolean;
5371 /**
5372 * the promise will resolve when the page has finished loading (see
5373 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
5374 *
5375 * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
5376 * relative to the root of your application. See the `webContents` docs for more
5377 * information.
5378 */
5379 loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
5380 /**
5381 * the promise will resolve when the page has finished loading (see
5382 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
5383 *
5384 * Same as `webContents.loadURL(url[, options])`.
5385 *
5386 * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
5387 * file using the `file://` protocol.
5388 *
5389 * To ensure that file URLs are properly formatted, it is recommended to use Node's
5390 * `url.format` method:
5391 *
5392 * You can load a URL using a `POST` request with URL-encoded data by doing the
5393 * following:
5394 */
5395 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
5396 /**
5397 * Maximizes the window. This will also show (but not focus) the window if it isn't
5398 * being displayed already.
5399 */
5400 maximize(): void;
5401 /**
5402 * Merges all windows into one window with multiple tabs when native tabs are
5403 * enabled and there is more than one open window.
5404 *
5405 * @platform darwin
5406 */
5407 mergeAllWindows(): void;
5408 /**
5409 * Minimizes the window. On some platforms the minimized window will be shown in
5410 * the Dock.
5411 */
5412 minimize(): void;
5413 /**
5414 * Moves window above the source window in the sense of z-order. If the
5415 * `mediaSourceId` is not of type window or if the window does not exist then this
5416 * method throws an error.
5417 */
5418 moveAbove(mediaSourceId: string): void;
5419 /**
5420 * Moves the current tab into a new window if native tabs are enabled and there is
5421 * more than one tab in the current window.
5422 *
5423 * @platform darwin
5424 */
5425 moveTabToNewWindow(): void;
5426 /**
5427 * Moves window to top(z-order) regardless of focus
5428 */
5429 moveTop(): void;
5430 /**
5431 * Uses Quick Look to preview a file at a given path.
5432 *
5433 * @platform darwin
5434 */
5435 previewFile(path: string, displayName?: string): void;
5436 /**
5437 * Same as `webContents.reload`.
5438 */
5439 reload(): void;
5440 /**
5441 * > **Note** The `BrowserView` class is deprecated, and replaced by the new
5442 * `WebContentsView` class.
5443 *
5444 * @experimental
5445 * @deprecated
5446 */
5447 removeBrowserView(browserView: BrowserView): void;
5448 /**
5449 * Remove the window's menu bar.
5450 *
5451 * @platform linux,win32
5452 */
5453 removeMenu(): void;
5454 /**
5455 * Restores the window from minimized state to its previous state.
5456 */
5457 restore(): void;
5458 /**
5459 * Selects the next tab when native tabs are enabled and there are other tabs in
5460 * the window.
5461 *
5462 * @platform darwin
5463 */
5464 selectNextTab(): void;
5465 /**
5466 * Selects the previous tab when native tabs are enabled and there are other tabs
5467 * in the window.
5468 *
5469 * @platform darwin
5470 */
5471 selectPreviousTab(): void;
5472 /**
5473 * Sets whether the window should show always on top of other windows. After
5474 * setting this, the window is still a normal window, not a toolbox window which
5475 * can not be focused on.
5476 */
5477 setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
5478 /**
5479 * Sets the properties for the window's taskbar button.
5480 *
5481 * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
5482 * together. If one of those properties is not set, then neither will be used.
5483 *
5484 * @platform win32
5485 */
5486 setAppDetails(options: AppDetailsOptions): void;
5487 /**
5488 * This will make a window maintain an aspect ratio. The extra size allows a
5489 * developer to have space, specified in pixels, not included within the aspect
5490 * ratio calculations. This API already takes into account the difference between a
5491 * window's size and its content size.
5492 *
5493 * Consider a normal window with an HD video player and associated controls.
5494 * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
5495 * on the right edge and 50 pixels of controls below the player. In order to
5496 * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
5497 * the player itself we would call this function with arguments of 16/9 and {
5498 * width: 40, height: 50 }. The second argument doesn't care where the extra width
5499 * and height are within the content view--only that they exist. Sum any extra
5500 * width and height areas you have within the overall content view.
5501 *
5502 * The aspect ratio is not respected when window is resized programmatically with
5503 * APIs like `win.setSize`.
5504 *
5505 * To reset an aspect ratio, pass 0 as the `aspectRatio` value:
5506 * `win.setAspectRatio(0)`.
5507 */
5508 setAspectRatio(aspectRatio: number, extraSize?: Size): void;
5509 /**
5510 * Controls whether to hide cursor when typing.
5511 *
5512 * @platform darwin
5513 */
5514 setAutoHideCursor(autoHide: boolean): void;
5515 /**
5516 * Sets whether the window menu bar should hide itself automatically. Once set the
5517 * menu bar will only show when users press the single `Alt` key.
5518 *
5519 * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
5520 * hide it immediately.
5521 *
5522 * @platform win32,linux
5523 */
5524 setAutoHideMenuBar(hide: boolean): void;
5525 /**
5526 * Examples of valid `backgroundColor` values:
5527 *
5528 * * Hex
5529 * * #fff (shorthand RGB)
5530 * * #ffff (shorthand ARGB)
5531 * * #ffffff (RGB)
5532 * * #ffffffff (ARGB)
5533 * * RGB
5534 * * `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)`
5535 * * e.g. rgb(255, 255, 255)
5536 * * RGBA
5537 * * `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)`
5538 * * e.g. rgba(255, 255, 255, 1.0)
5539 * * HSL
5540 * * `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)`
5541 * * e.g. hsl(200, 20%, 50%)
5542 * * HSLA
5543 * * `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)`
5544 * * e.g. hsla(200, 20%, 50%, 0.5)
5545 * * Color name
5546 * * Options are listed in SkParseColor.cpp
5547 * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
5548 * * e.g. `blueviolet` or `red`
5549 *
5550 * Sets the background color of the window. See Setting `backgroundColor`.
5551 */
5552 setBackgroundColor(backgroundColor: string): void;
5553 /**
5554 * This method sets the browser window's system-drawn background material,
5555 * including behind the non-client area.
5556 *
5557 * See the Windows documentation for more details.
5558 *
5559 * **Note:** This method is only supported on Windows 11 22H2 and up.
5560 *
5561 * @platform win32
5562 */
5563 setBackgroundMaterial(material: 'auto' | 'none' | 'mica' | 'acrylic' | 'tabbed'): void;
5564 /**
5565 * Resizes and moves the window to the supplied bounds. Any properties that are not
5566 * supplied will default to their current values.
5567 *
5568 * **Note:** On macOS, the y-coordinate value cannot be smaller than the Tray
5569 * height. The tray height has changed over time and depends on the operating
5570 * system, but is between 20-40px. Passing a value lower than the tray height will
5571 * result in a window that is flush to the tray.
5572 */
5573 setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
5574 /**
5575 * > **Note** The `BrowserView` class is deprecated, and replaced by the new
5576 * `WebContentsView` class.
5577 *
5578 * @experimental
5579 * @deprecated
5580 */
5581 setBrowserView(browserView: (BrowserView) | (null)): void;
5582 /**
5583 * Sets whether the window can be manually closed by user. On Linux does nothing.
5584 *
5585 * @platform darwin,win32
5586 */
5587 setClosable(closable: boolean): void;
5588 /**
5589 * Resizes and moves the window's client area (e.g. the web page) to the supplied
5590 * bounds.
5591 */
5592 setContentBounds(bounds: Rectangle, animate?: boolean): void;
5593 /**
5594 * Prevents the window contents from being captured by other apps.
5595 *
5596 * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
5597 * it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`. For Windows 10
5598 * version 2004 and up the window will be removed from capture entirely, older
5599 * Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
5600 *
5601 * @platform darwin,win32
5602 */
5603 setContentProtection(enable: boolean): void;
5604 /**
5605 * Resizes the window's client area (e.g. the web page) to `width` and `height`.
5606 */
5607 setContentSize(width: number, height: number, animate?: boolean): void;
5608 /**
5609 * Specifies whether the window’s document has been edited, and the icon in title
5610 * bar will become gray when set to `true`.
5611 *
5612 * @platform darwin
5613 */
5614 setDocumentEdited(edited: boolean): void;
5615 /**
5616 * Disable or enable the window.
5617 */
5618 setEnabled(enable: boolean): void;
5619 /**
5620 * Changes whether the window can be focused.
5621 *
5622 * On macOS it does not remove the focus from the window.
5623 *
5624 * @platform darwin,win32
5625 */
5626 setFocusable(focusable: boolean): void;
5627 /**
5628 * Sets whether the window should be in fullscreen mode.
5629 *
5630 * **Note:** On macOS, fullscreen transitions take place asynchronously. If further
5631 * actions depend on the fullscreen state, use the 'enter-full-screen' or
5632 * 'leave-full-screen' events.
5633 */
5634 setFullScreen(flag: boolean): void;
5635 /**
5636 * Sets whether the maximize/zoom window button toggles fullscreen mode or
5637 * maximizes the window.
5638 */
5639 setFullScreenable(fullscreenable: boolean): void;
5640 /**
5641 * Sets whether the window should have a shadow.
5642 */
5643 setHasShadow(hasShadow: boolean): void;
5644 /**
5645 * Sets whether the window will be hidden when the user toggles into mission
5646 * control.
5647 *
5648 * @platform darwin
5649 */
5650 setHiddenInMissionControl(hidden: boolean): void;
5651 /**
5652 * Changes window icon.
5653 *
5654 * @platform win32,linux
5655 */
5656 setIcon(icon: (NativeImage) | (string)): void;
5657 /**
5658 * Makes the window ignore all mouse events.
5659 *
5660 * All mouse events happened in this window will be passed to the window below this
5661 * window, but if this window has focus, it will still receive keyboard events.
5662 */
5663 setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
5664 /**
5665 * Enters or leaves kiosk mode.
5666 */
5667 setKiosk(flag: boolean): void;
5668 /**
5669 * Sets whether the window can be manually maximized by user. On Linux does
5670 * nothing.
5671 *
5672 * @platform darwin,win32
5673 */
5674 setMaximizable(maximizable: boolean): void;
5675 /**
5676 * Sets the maximum size of window to `width` and `height`.
5677 */
5678 setMaximumSize(width: number, height: number): void;
5679 /**
5680 * Sets the `menu` as the window's menu bar.
5681 *
5682 * @platform linux,win32
5683 */
5684 setMenu(menu: (Menu) | (null)): void;
5685 /**
5686 * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
5687 * can still bring up the menu bar by pressing the single `Alt` key.
5688 *
5689 * @platform win32,linux
5690 */
5691 setMenuBarVisibility(visible: boolean): void;
5692 /**
5693 * Sets whether the window can be manually minimized by user. On Linux does
5694 * nothing.
5695 *
5696 * @platform darwin,win32
5697 */
5698 setMinimizable(minimizable: boolean): void;
5699 /**
5700 * Sets the minimum size of window to `width` and `height`.
5701 */
5702 setMinimumSize(width: number, height: number): void;
5703 /**
5704 * Sets whether the window can be moved by user. On Linux does nothing.
5705 *
5706 * @platform darwin,win32
5707 */
5708 setMovable(movable: boolean): void;
5709 /**
5710 * Sets the opacity of the window. On Linux, does nothing. Out of bound number
5711 * values are clamped to the [0, 1] range.
5712 *
5713 * @platform win32,darwin
5714 */
5715 setOpacity(opacity: number): void;
5716 /**
5717 * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
5718 * convey some sort of application status or to passively notify the user.
5719 *
5720 * @platform win32
5721 */
5722 setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
5723 /**
5724 * Sets `parent` as current window's parent window, passing `null` will turn
5725 * current window into a top-level window.
5726 */
5727 setParentWindow(parent: (BrowserWindow) | (null)): void;
5728 /**
5729 * Moves window to `x` and `y`.
5730 */
5731 setPosition(x: number, y: number, animate?: boolean): void;
5732 /**
5733 * Sets progress value in progress bar. Valid range is [0, 1.0].
5734 *
5735 * Remove progress bar when progress < 0; Change to indeterminate mode when
5736 * progress > 1.
5737 *
5738 * On Linux platform, only supports Unity desktop environment, you need to specify
5739 * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
5740 * it will assume `{app.name}.desktop`.
5741 *
5742 * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
5743 * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
5744 * mode set (but with a value within the valid range), `normal` will be assumed.
5745 */
5746 setProgressBar(progress: number, options?: ProgressBarOptions): void;
5747 /**
5748 * Sets the pathname of the file the window represents, and the icon of the file
5749 * will show in window's title bar.
5750 *
5751 * @platform darwin
5752 */
5753 setRepresentedFilename(filename: string): void;
5754 /**
5755 * Sets whether the window can be manually resized by the user.
5756 */
5757 setResizable(resizable: boolean): void;
5758 /**
5759 * Setting a window shape determines the area within the window where the system
5760 * permits drawing and user interaction. Outside of the given region, no pixels
5761 * will be drawn and no mouse events will be registered. Mouse events outside of
5762 * the region will not be received by that window, but will fall through to
5763 * whatever is behind the window.
5764 *
5765 * @experimental
5766 * @platform win32,linux
5767 */
5768 setShape(rects: Rectangle[]): void;
5769 /**
5770 * Changes the attachment point for sheets on macOS. By default, sheets are
5771 * attached just below the window frame, but you may want to display them beneath a
5772 * HTML-rendered toolbar. For example:
5773 *
5774 * @platform darwin
5775 */
5776 setSheetOffset(offsetY: number, offsetX?: number): void;
5777 /**
5778 * Enters or leaves simple fullscreen mode.
5779 *
5780 * Simple fullscreen mode emulates the native fullscreen behavior found in versions
5781 * of macOS prior to Lion (10.7).
5782 *
5783 * @platform darwin
5784 */
5785 setSimpleFullScreen(flag: boolean): void;
5786 /**
5787 * Resizes the window to `width` and `height`. If `width` or `height` are below any
5788 * set minimum size constraints the window will snap to its minimum size.
5789 */
5790 setSize(width: number, height: number, animate?: boolean): void;
5791 /**
5792 * Makes the window not show in the taskbar.
5793 *
5794 * @platform darwin,win32
5795 */
5796 setSkipTaskbar(skip: boolean): void;
5797 /**
5798 * Whether the buttons were added successfully
5799 *
5800 * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
5801 * of a window in a taskbar button layout. Returns a `boolean` object indicates
5802 * whether the thumbnail has been added successfully.
5803 *
5804 * The number of buttons in thumbnail toolbar should be no greater than 7 due to
5805 * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
5806 * removed due to the platform's limitation. But you can call the API with an empty
5807 * array to clean the buttons.
5808 *
5809 * The `buttons` is an array of `Button` objects:
5810 *
5811 * * `Button` Object
5812 * * `icon` NativeImage - The icon showing in thumbnail toolbar.
5813 * * `click` Function
5814 * * `tooltip` string (optional) - The text of the button's tooltip.
5815 * * `flags` string[] (optional) - Control specific states and behaviors of the
5816 * button. By default, it is `['enabled']`.
5817 *
5818 * The `flags` is an array that can include following `string`s:
5819 *
5820 * * `enabled` - The button is active and available to the user.
5821 * * `disabled` - The button is disabled. It is present, but has a visual state
5822 * indicating it will not respond to user action.
5823 * * `dismissonclick` - When the button is clicked, the thumbnail window closes
5824 * immediately.
5825 * * `nobackground` - Do not draw a button border, use only the image.
5826 * * `hidden` - The button is not shown to the user.
5827 * * `noninteractive` - The button is enabled but not interactive; no pressed
5828 * button state is drawn. This value is intended for instances where the button is
5829 * used in a notification.
5830 *
5831 * @platform win32
5832 */
5833 setThumbarButtons(buttons: ThumbarButton[]): boolean;
5834 /**
5835 * Sets the region of the window to show as the thumbnail image displayed when
5836 * hovering over the window in the taskbar. You can reset the thumbnail to be the
5837 * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
5838 * }`.
5839 *
5840 * @platform win32
5841 */
5842 setThumbnailClip(region: Rectangle): void;
5843 /**
5844 * Sets the toolTip that is displayed when hovering over the window thumbnail in
5845 * the taskbar.
5846 *
5847 * @platform win32
5848 */
5849 setThumbnailToolTip(toolTip: string): void;
5850 /**
5851 * Changes the title of native window to `title`.
5852 */
5853 setTitle(title: string): void;
5854 /**
5855 * On a Window with Window Controls Overlay already enabled, this method updates
5856 * the style of the title bar overlay.
5857 *
5858 * @platform win32
5859 */
5860 setTitleBarOverlay(options: TitleBarOverlay): void;
5861 /**
5862 * Raises `browserView` above other `BrowserView`s attached to `win`. Throws an
5863 * error if `browserView` is not attached to `win`.
5864 *
5865 * > **Note** The `BrowserView` class is deprecated, and replaced by the new
5866 * `WebContentsView` class.
5867 *
5868 * @experimental
5869 * @deprecated
5870 */
5871 setTopBrowserView(browserView: BrowserView): void;
5872 /**
5873 * Sets the touchBar layout for the current window. Specifying `null` or
5874 * `undefined` clears the touch bar. This method only has an effect if the machine
5875 * has a touch bar.
5876 *
5877 * **Note:** The TouchBar API is currently experimental and may change or be
5878 * removed in future Electron releases.
5879 *
5880 * @platform darwin
5881 */
5882 setTouchBar(touchBar: (TouchBar) | (null)): void;
5883 /**
5884 * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
5885 * will remove the vibrancy effect on the window.
5886 *
5887 * @platform darwin
5888 */
5889 setVibrancy(type: (('titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page')) | (null)): void;
5890 /**
5891 * Sets whether the window should be visible on all workspaces.
5892 *
5893 * **Note:** This API does nothing on Windows.
5894 *
5895 * @platform darwin,linux
5896 */
5897 setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
5898 /**
5899 * Set a custom position for the traffic light buttons in frameless window. Passing
5900 * `null` will reset the position to default.
5901 *
5902 * @platform darwin
5903 */
5904 setWindowButtonPosition(position: (Point) | (null)): void;
5905 /**
5906 * Sets whether the window traffic light buttons should be visible.
5907 *
5908 * @platform darwin
5909 */
5910 setWindowButtonVisibility(visible: boolean): void;
5911 /**
5912 * Shows and gives focus to the window.
5913 */
5914 show(): void;
5915 /**
5916 * Shows or hides the tab overview when native tabs are enabled.
5917 *
5918 * @platform darwin
5919 */
5920 showAllTabs(): void;
5921 /**
5922 * Same as `webContents.showDefinitionForSelection()`.
5923 *
5924 * @platform darwin
5925 */
5926 showDefinitionForSelection(): void;
5927 /**
5928 * Shows the window but doesn't focus on it.
5929 */
5930 showInactive(): void;
5931 /**
5932 * Toggles the visibility of the tab bar if native tabs are enabled and there is
5933 * only one tab in the current window.
5934 *
5935 * @platform darwin
5936 */
5937 toggleTabBar(): void;
5938 /**
5939 * Unhooks all of the window messages.
5940 *
5941 * @platform win32
5942 */
5943 unhookAllWindowMessages(): void;
5944 /**
5945 * Unhook the window message.
5946 *
5947 * @platform win32
5948 */
5949 unhookWindowMessage(message: number): void;
5950 /**
5951 * Unmaximizes the window.
5952 */
5953 unmaximize(): void;
5954 /**
5955 * A `string` property that defines an alternative title provided only to
5956 * accessibility tools such as screen readers. This string is not directly visible
5957 * to users.
5958 */
5959 accessibleTitle: string;
5960 /**
5961 * A `boolean` property that determines whether the window menu bar should hide
5962 * itself automatically. Once set, the menu bar will only show when users press the
5963 * single `Alt` key.
5964 *
5965 * If the menu bar is already visible, setting this property to `true` won't hide
5966 * it immediately.
5967 */
5968 autoHideMenuBar: boolean;
5969 /**
5970 * A `boolean` property that determines whether the window can be manually closed
5971 * by user.
5972 *
5973 * On Linux the setter is a no-op, although the getter returns `true`.
5974 *
5975 * @platform darwin,win32
5976 */
5977 closable: boolean;
5978 /**
5979 * A `boolean` property that specifies whether the window’s document has been
5980 * edited.
5981 *
5982 * The icon in title bar will become gray when set to `true`.
5983 *
5984 * @platform darwin
5985 */
5986 documentEdited: boolean;
5987 /**
5988 * A `boolean` property that determines whether the window is excluded from the
5989 * application’s Windows menu. `false` by default.
5990 *
5991 * @platform darwin
5992 */
5993 excludedFromShownWindowsMenu: boolean;
5994 /**
5995 * A `boolean` property that determines whether the window is focusable.
5996 *
5997 * @platform win32,darwin
5998 */
5999 focusable: boolean;
6000 /**
6001 * A `boolean` property that determines whether the window is in fullscreen mode.
6002 */
6003 fullScreen: boolean;
6004 /**
6005 * A `boolean` property that determines whether the maximize/zoom window button
6006 * toggles fullscreen mode or maximizes the window.
6007 */
6008 fullScreenable: boolean;
6009 /**
6010 * A `Integer` property representing the unique ID of the window. Each ID is unique
6011 * among all `BrowserWindow` instances of the entire Electron application.
6012 *
6013 */
6014 readonly id: number;
6015 /**
6016 * A `boolean` property that determines whether the window is in kiosk mode.
6017 */
6018 kiosk: boolean;
6019 /**
6020 * A `boolean` property that determines whether the window can be manually
6021 * maximized by user.
6022 *
6023 * On Linux the setter is a no-op, although the getter returns `true`.
6024 *
6025 * @platform darwin,win32
6026 */
6027 maximizable: boolean;
6028 /**
6029 * A `boolean` property that determines whether the menu bar should be visible.
6030 *
6031 * **Note:** If the menu bar is auto-hide, users can still bring up the menu bar by
6032 * pressing the single `Alt` key.
6033 *
6034 * @platform win32,linux
6035 */
6036 menuBarVisible: boolean;
6037 /**
6038 * A `boolean` property that determines whether the window can be manually
6039 * minimized by user.
6040 *
6041 * On Linux the setter is a no-op, although the getter returns `true`.
6042 *
6043 * @platform darwin,win32
6044 */
6045 minimizable: boolean;
6046 /**
6047 * A `boolean` property that determines Whether the window can be moved by user.
6048 *
6049 * On Linux the setter is a no-op, although the getter returns `true`.
6050 *
6051 * @platform darwin,win32
6052 */
6053 movable: boolean;
6054 /**
6055 * A `string` property that determines the pathname of the file the window
6056 * represents, and the icon of the file will show in window's title bar.
6057 *
6058 * @platform darwin
6059 */
6060 representedFilename: string;
6061 /**
6062 * A `boolean` property that determines whether the window can be manually resized
6063 * by user.
6064 */
6065 resizable: boolean;
6066 /**
6067 * A `boolean` property that determines whether the window has a shadow.
6068 */
6069 shadow: boolean;
6070 /**
6071 * A `boolean` property that determines whether the window is in simple (pre-Lion)
6072 * fullscreen mode.
6073 */
6074 simpleFullScreen: boolean;
6075 /**
6076 * A `string` (optional) property that is equal to the `tabbingIdentifier` passed
6077 * to the `BrowserWindow` constructor or `undefined` if none was set.
6078 *
6079 * @platform darwin
6080 */
6081 readonly tabbingIdentifier?: string;
6082 /**
6083 * A `string` property that determines the title of the native window.
6084 *
6085 * **Note:** The title of the web page can be different from the title of the
6086 * native window.
6087 */
6088 title: string;
6089 /**
6090 * A `boolean` property that determines whether the window is visible on all
6091 * workspaces.
6092 *
6093 * **Note:** Always returns false on Windows.
6094 *
6095 * @platform darwin,linux
6096 */
6097 visibleOnAllWorkspaces: boolean;
6098 /**
6099 * A `WebContents` object this window owns. All web page related events and
6100 * operations will be done via it.
6101 *
6102 * See the `webContents` documentation for its methods and events.
6103 *
6104 */
6105 readonly webContents: WebContents;
6106 }
6107
6108 interface BrowserWindowConstructorOptions extends BaseWindowConstructorOptions {
6109
6110 // Docs: https://electronjs.org/docs/api/structures/browser-window-options
6111
6112 /**
6113 * Whether the renderer should be active when `show` is `false` and it has just
6114 * been created. In order for `document.visibilityState` to work correctly on
6115 * first load with `show: false` you should set this to `false`. Setting this to
6116 * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
6117 */
6118 paintWhenInitiallyHidden?: boolean;
6119 /**
6120 * When using a frameless window in conjunction with
6121 * `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so
6122 * that the standard window controls ("traffic lights" on macOS) are visible, this
6123 * property enables the Window Controls Overlay JavaScript APIs and CSS Environment
6124 * Variables. Specifying `true` will result in an overlay with default system
6125 * colors. Default is `false`.
6126 */
6127 titleBarOverlay?: (TitleBarOverlay) | (boolean);
6128 /**
6129 * Settings of web page's features.
6130 */
6131 webPreferences?: WebPreferences;
6132 }
6133
6134 interface Certificate {
6135
6136 // Docs: https://electronjs.org/docs/api/structures/certificate
6137
6138 /**
6139 * PEM encoded data
6140 */
6141 data: string;
6142 /**
6143 * Fingerprint of the certificate
6144 */
6145 fingerprint: string;
6146 /**
6147 * Issuer principal
6148 */
6149 issuer: CertificatePrincipal;
6150 /**
6151 * Issuer certificate (if not self-signed)
6152 */
6153 issuerCert: Certificate;
6154 /**
6155 * Issuer's Common Name
6156 */
6157 issuerName: string;
6158 /**
6159 * Hex value represented string
6160 */
6161 serialNumber: string;
6162 /**
6163 * Subject principal
6164 */
6165 subject: CertificatePrincipal;
6166 /**
6167 * Subject's Common Name
6168 */
6169 subjectName: string;
6170 /**
6171 * End date of the certificate being valid in seconds
6172 */
6173 validExpiry: number;
6174 /**
6175 * Start date of the certificate being valid in seconds
6176 */
6177 validStart: number;
6178 }
6179
6180 interface CertificatePrincipal {
6181
6182 // Docs: https://electronjs.org/docs/api/structures/certificate-principal
6183
6184 /**
6185 * Common Name.
6186 */
6187 commonName: string;
6188 /**
6189 * Country or region.
6190 */
6191 country: string;
6192 /**
6193 * Locality.
6194 */
6195 locality: string;
6196 /**
6197 * Organization names.
6198 */
6199 organizations: string[];
6200 /**
6201 * Organization Unit names.
6202 */
6203 organizationUnits: string[];
6204 /**
6205 * State or province.
6206 */
6207 state: string;
6208 }
6209
6210 class ClientRequest extends NodeEventEmitter {
6211
6212 // Docs: https://electronjs.org/docs/api/client-request
6213
6214 /**
6215 * Emitted when the `request` is aborted. The `abort` event will not be fired if
6216 * the `request` is already closed.
6217 */
6218 on(event: 'abort', listener: Function): this;
6219 off(event: 'abort', listener: Function): this;
6220 once(event: 'abort', listener: Function): this;
6221 addListener(event: 'abort', listener: Function): this;
6222 removeListener(event: 'abort', listener: Function): this;
6223 /**
6224 * Emitted as the last event in the HTTP request-response transaction. The `close`
6225 * event indicates that no more events will be emitted on either the `request` or
6226 * `response` objects.
6227 */
6228 on(event: 'close', listener: Function): this;
6229 off(event: 'close', listener: Function): this;
6230 once(event: 'close', listener: Function): this;
6231 addListener(event: 'close', listener: Function): this;
6232 removeListener(event: 'close', listener: Function): this;
6233 /**
6234 * Emitted when the `net` module fails to issue a network request. Typically when
6235 * the `request` object emits an `error` event, a `close` event will subsequently
6236 * follow and no response object will be provided.
6237 */
6238 on(event: 'error', listener: (
6239 /**
6240 * an error object providing some information about the failure.
6241 */
6242 error: Error) => void): this;
6243 off(event: 'error', listener: (
6244 /**
6245 * an error object providing some information about the failure.
6246 */
6247 error: Error) => void): this;
6248 once(event: 'error', listener: (
6249 /**
6250 * an error object providing some information about the failure.
6251 */
6252 error: Error) => void): this;
6253 addListener(event: 'error', listener: (
6254 /**
6255 * an error object providing some information about the failure.
6256 */
6257 error: Error) => void): this;
6258 removeListener(event: 'error', listener: (
6259 /**
6260 * an error object providing some information about the failure.
6261 */
6262 error: Error) => void): this;
6263 /**
6264 * Emitted just after the last chunk of the `request`'s data has been written into
6265 * the `request` object.
6266 */
6267 on(event: 'finish', listener: Function): this;
6268 off(event: 'finish', listener: Function): this;
6269 once(event: 'finish', listener: Function): this;
6270 addListener(event: 'finish', listener: Function): this;
6271 removeListener(event: 'finish', listener: Function): this;
6272 /**
6273 * Emitted when an authenticating proxy is asking for user credentials.
6274 *
6275 * The `callback` function is expected to be called back with user credentials:
6276 *
6277 * * `username` string
6278 * * `password` string
6279 *
6280 * Providing empty credentials will cancel the request and report an authentication
6281 * error on the response object:
6282 */
6283 on(event: 'login', listener: (authInfo: AuthInfo,
6284 callback: (username?: string, password?: string) => void) => void): this;
6285 off(event: 'login', listener: (authInfo: AuthInfo,
6286 callback: (username?: string, password?: string) => void) => void): this;
6287 once(event: 'login', listener: (authInfo: AuthInfo,
6288 callback: (username?: string, password?: string) => void) => void): this;
6289 addListener(event: 'login', listener: (authInfo: AuthInfo,
6290 callback: (username?: string, password?: string) => void) => void): this;
6291 removeListener(event: 'login', listener: (authInfo: AuthInfo,
6292 callback: (username?: string, password?: string) => void) => void): this;
6293 /**
6294 * Emitted when the server returns a redirect response (e.g. 301 Moved
6295 * Permanently). Calling `request.followRedirect` will continue with the
6296 * redirection. If this event is handled, `request.followRedirect` must be called
6297 * **synchronously**, otherwise the request will be cancelled.
6298 */
6299 on(event: 'redirect', listener: (statusCode: number,
6300 method: string,
6301 redirectUrl: string,
6302 responseHeaders: Record<string, string[]>) => void): this;
6303 off(event: 'redirect', listener: (statusCode: number,
6304 method: string,
6305 redirectUrl: string,
6306 responseHeaders: Record<string, string[]>) => void): this;
6307 once(event: 'redirect', listener: (statusCode: number,
6308 method: string,
6309 redirectUrl: string,
6310 responseHeaders: Record<string, string[]>) => void): this;
6311 addListener(event: 'redirect', listener: (statusCode: number,
6312 method: string,
6313 redirectUrl: string,
6314 responseHeaders: Record<string, string[]>) => void): this;
6315 removeListener(event: 'redirect', listener: (statusCode: number,
6316 method: string,
6317 redirectUrl: string,
6318 responseHeaders: Record<string, string[]>) => void): this;
6319 on(event: 'response', listener: (
6320 /**
6321 * An object representing the HTTP response message.
6322 */
6323 response: IncomingMessage) => void): this;
6324 off(event: 'response', listener: (
6325 /**
6326 * An object representing the HTTP response message.
6327 */
6328 response: IncomingMessage) => void): this;
6329 once(event: 'response', listener: (
6330 /**
6331 * An object representing the HTTP response message.
6332 */
6333 response: IncomingMessage) => void): this;
6334 addListener(event: 'response', listener: (
6335 /**
6336 * An object representing the HTTP response message.
6337 */
6338 response: IncomingMessage) => void): this;
6339 removeListener(event: 'response', listener: (
6340 /**
6341 * An object representing the HTTP response message.
6342 */
6343 response: IncomingMessage) => void): this;
6344 /**
6345 * ClientRequest
6346 */
6347 constructor(options: (ClientRequestConstructorOptions) | (string));
6348 /**
6349 * Cancels an ongoing HTTP transaction. If the request has already emitted the
6350 * `close` event, the abort operation will have no effect. Otherwise an ongoing
6351 * event will emit `abort` and `close` events. Additionally, if there is an ongoing
6352 * response object,it will emit the `aborted` event.
6353 */
6354 abort(): void;
6355 /**
6356 * Sends the last chunk of the request data. Subsequent write or end operations
6357 * will not be allowed. The `finish` event is emitted just after the end operation.
6358 */
6359 end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): this;
6360 /**
6361 * Continues any pending redirection. Can only be called during a `'redirect'`
6362 * event.
6363 */
6364 followRedirect(): void;
6365 /**
6366 * The value of a previously set extra header name.
6367 */
6368 getHeader(name: string): string;
6369 /**
6370 * * `active` boolean - Whether the request is currently active. If this is false
6371 * no other properties will be set
6372 * * `started` boolean - Whether the upload has started. If this is false both
6373 * `current` and `total` will be set to 0.
6374 * * `current` Integer - The number of bytes that have been uploaded so far
6375 * * `total` Integer - The number of bytes that will be uploaded this request
6376 *
6377 * You can use this method in conjunction with `POST` requests to get the progress
6378 * of a file upload or other data transfer.
6379 */
6380 getUploadProgress(): UploadProgress;
6381 /**
6382 * Removes a previously set extra header name. This method can be called only
6383 * before first write. Trying to call it after the first write will throw an error.
6384 */
6385 removeHeader(name: string): void;
6386 /**
6387 * Adds an extra HTTP header. The header name will be issued as-is without
6388 * lowercasing. It can be called only before first write. Calling this method after
6389 * the first write will throw an error. If the passed value is not a `string`, its
6390 * `toString()` method will be called to obtain the final value.
6391 *
6392 * Certain headers are restricted from being set by apps. These headers are listed
6393 * below. More information on restricted headers can be found in Chromium's header
6394 * utils.
6395 *
6396 * * `Content-Length`
6397 * * `Host`
6398 * * `Trailer` or `Te`
6399 * * `Upgrade`
6400 * * `Cookie2`
6401 * * `Keep-Alive`
6402 * * `Transfer-Encoding`
6403 *
6404 * Additionally, setting the `Connection` header to the value `upgrade` is also
6405 * disallowed.
6406 */
6407 setHeader(name: string, value: string): void;
6408 /**
6409 * `callback` is essentially a dummy function introduced in the purpose of keeping
6410 * similarity with the Node.js API. It is called asynchronously in the next tick
6411 * after `chunk` content have been delivered to the Chromium networking layer.
6412 * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
6413 * content have been flushed on the wire before `callback` is called.
6414 *
6415 * Adds a chunk of data to the request body. The first write operation may cause
6416 * the request headers to be issued on the wire. After the first write operation,
6417 * it is not allowed to add or remove a custom header.
6418 */
6419 write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
6420 /**
6421 * A `boolean` specifying whether the request will use HTTP chunked transfer
6422 * encoding or not. Defaults to false. The property is readable and writable,
6423 * however it can be set only before the first write operation as the HTTP headers
6424 * are not yet put on the wire. Trying to set the `chunkedEncoding` property after
6425 * the first write will throw an error.
6426 *
6427 * Using chunked encoding is strongly recommended if you need to send a large
6428 * request body as data will be streamed in small chunks instead of being
6429 * internally buffered inside Electron process memory.
6430 */
6431 chunkedEncoding: boolean;
6432 }
6433
6434 interface Clipboard {
6435
6436 // Docs: https://electronjs.org/docs/api/clipboard
6437
6438 /**
6439 * An array of supported formats for the clipboard `type`.
6440 */
6441 availableFormats(type?: 'selection' | 'clipboard'): string[];
6442 /**
6443 * Clears the clipboard content.
6444 */
6445 clear(type?: 'selection' | 'clipboard'): void;
6446 /**
6447 * Whether the clipboard supports the specified `format`.
6448 *
6449 * @experimental
6450 */
6451 has(format: string, type?: 'selection' | 'clipboard'): boolean;
6452 /**
6453 * Reads `format` type from the clipboard.
6454 *
6455 * `format` should contain valid ASCII characters and have `/` separator. `a/c`,
6456 * `a/bc` are valid formats while `/abc`, `abc/`, `a/`, `/a`, `a` are not valid.
6457 *
6458 * @experimental
6459 */
6460 read(format: string): string;
6461 /**
6462 * * `title` string
6463 * * `url` string
6464 *
6465 * Returns an Object containing `title` and `url` keys representing the bookmark in
6466 * the clipboard. The `title` and `url` values will be empty strings when the
6467 * bookmark is unavailable. The `title` value will always be empty on Windows.
6468 *
6469 * @platform darwin,win32
6470 */
6471 readBookmark(): ReadBookmark;
6472 /**
6473 * Reads `format` type from the clipboard.
6474 *
6475 * @experimental
6476 */
6477 readBuffer(format: string): Buffer;
6478 /**
6479 * The text on the find pasteboard, which is the pasteboard that holds information
6480 * about the current state of the active application’s find panel.
6481 *
6482 * This method uses synchronous IPC when called from the renderer process. The
6483 * cached value is reread from the find pasteboard whenever the application is
6484 * activated.
6485 *
6486 * @platform darwin
6487 */
6488 readFindText(): string;
6489 /**
6490 * The content in the clipboard as markup.
6491 */
6492 readHTML(type?: 'selection' | 'clipboard'): string;
6493 /**
6494 * The image content in the clipboard.
6495 */
6496 readImage(type?: 'selection' | 'clipboard'): NativeImage;
6497 /**
6498 * The content in the clipboard as RTF.
6499 */
6500 readRTF(type?: 'selection' | 'clipboard'): string;
6501 /**
6502 * The content in the clipboard as plain text.
6503 */
6504 readText(type?: 'selection' | 'clipboard'): string;
6505 /**
6506 * Writes `data` to the clipboard.
6507 */
6508 write(data: Data, type?: 'selection' | 'clipboard'): void;
6509 /**
6510 * Writes the `title` (macOS only) and `url` into the clipboard as a bookmark.
6511 *
6512 * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
6513 * can use `clipboard.write` to write both a bookmark and fallback text to the
6514 * clipboard.
6515 *
6516 * @platform darwin,win32
6517 */
6518 writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
6519 /**
6520 * Writes the `buffer` into the clipboard as `format`.
6521 *
6522 * @experimental
6523 */
6524 writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
6525 /**
6526 * Writes the `text` into the find pasteboard (the pasteboard that holds
6527 * information about the current state of the active application’s find panel) as
6528 * plain text. This method uses synchronous IPC when called from the renderer
6529 * process.
6530 *
6531 * @platform darwin
6532 */
6533 writeFindText(text: string): void;
6534 /**
6535 * Writes `markup` to the clipboard.
6536 */
6537 writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
6538 /**
6539 * Writes `image` to the clipboard.
6540 */
6541 writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
6542 /**
6543 * Writes the `text` into the clipboard in RTF.
6544 */
6545 writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
6546 /**
6547 * Writes the `text` into the clipboard as plain text.
6548 */
6549 writeText(text: string, type?: 'selection' | 'clipboard'): void;
6550 }
6551
6552 class CommandLine {
6553
6554 // Docs: https://electronjs.org/docs/api/command-line
6555
6556 /**
6557 * Append an argument to Chromium's command line. The argument will be quoted
6558 * correctly. Switches will precede arguments regardless of appending order.
6559 *
6560 * If you're appending an argument like `--switch=value`, consider using
6561 * `appendSwitch('switch', 'value')` instead.
6562 *
6563 * **Note:** This will not affect `process.argv`. The intended usage of this
6564 * function is to control Chromium's behavior.
6565 */
6566 appendArgument(value: string): void;
6567 /**
6568 * Append a switch (with optional `value`) to Chromium's command line.
6569 *
6570 * **Note:** This will not affect `process.argv`. The intended usage of this
6571 * function is to control Chromium's behavior.
6572 */
6573 appendSwitch(the_switch: string, value?: string): void;
6574 /**
6575 * The command-line switch value.
6576 *
6577 * **Note:** When the switch is not present or has no value, it returns empty
6578 * string.
6579 */
6580 getSwitchValue(the_switch: string): string;
6581 /**
6582 * Whether the command-line switch is present.
6583 */
6584 hasSwitch(the_switch: string): boolean;
6585 /**
6586 * Removes the specified switch from Chromium's command line.
6587 *
6588 * **Note:** This will not affect `process.argv`. The intended usage of this
6589 * function is to control Chromium's behavior.
6590 */
6591 removeSwitch(the_switch: string): void;
6592 }
6593
6594 interface ContentTracing {
6595
6596 // Docs: https://electronjs.org/docs/api/content-tracing
6597
6598 /**
6599 * resolves with an array of category groups once all child processes have
6600 * acknowledged the `getCategories` request
6601 *
6602 * Get a set of category groups. The category groups can change as new code paths
6603 * are reached. See also the list of built-in tracing categories.
6604 *
6605 * > **NOTE:** Electron adds a non-default tracing category called `"electron"`.
6606 * This category can be used to capture Electron-specific tracing events.
6607 */
6608 getCategories(): Promise<string[]>;
6609 /**
6610 * Resolves with an object containing the `value` and `percentage` of trace buffer
6611 * maximum usage
6612 *
6613 * * `value` number
6614 * * `percentage` number
6615 *
6616 * Get the maximum usage across processes of trace buffer as a percentage of the
6617 * full state.
6618 */
6619 getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
6620 /**
6621 * resolved once all child processes have acknowledged the `startRecording`
6622 * request.
6623 *
6624 * Start recording on all processes.
6625 *
6626 * Recording begins immediately locally and asynchronously on child processes as
6627 * soon as they receive the EnableRecording request.
6628 *
6629 * If a recording is already running, the promise will be immediately resolved, as
6630 * only one trace operation can be in progress at a time.
6631 */
6632 startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
6633 /**
6634 * resolves with a path to a file that contains the traced data once all child
6635 * processes have acknowledged the `stopRecording` request
6636 *
6637 * Stop recording on all processes.
6638 *
6639 * Child processes typically cache trace data and only rarely flush and send trace
6640 * data back to the main process. This helps to minimize the runtime overhead of
6641 * tracing since sending trace data over IPC can be an expensive operation. So, to
6642 * end tracing, Chromium asynchronously asks all child processes to flush any
6643 * pending trace data.
6644 *
6645 * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
6646 * or not provided, trace data will be written to a temporary file, and the path
6647 * will be returned in the promise.
6648 */
6649 stopRecording(resultFilePath?: string): Promise<string>;
6650 }
6651
6652 interface ContextBridge {
6653
6654 // Docs: https://electronjs.org/docs/api/context-bridge
6655
6656 exposeInIsolatedWorld(worldId: number, apiKey: string, api: any): void;
6657 exposeInMainWorld(apiKey: string, api: any): void;
6658 }
6659
6660 interface Cookie {
6661
6662 // Docs: https://electronjs.org/docs/api/structures/cookie
6663
6664 /**
6665 * The domain of the cookie; this will be normalized with a preceding dot so that
6666 * it's also valid for subdomains.
6667 */
6668 domain?: string;
6669 /**
6670 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
6671 * Not provided for session cookies.
6672 */
6673 expirationDate?: number;
6674 /**
6675 * Whether the cookie is a host-only cookie; this will only be `true` if no domain
6676 * was passed.
6677 */
6678 hostOnly?: boolean;
6679 /**
6680 * Whether the cookie is marked as HTTP only.
6681 */
6682 httpOnly?: boolean;
6683 /**
6684 * The name of the cookie.
6685 */
6686 name: string;
6687 /**
6688 * The path of the cookie.
6689 */
6690 path?: string;
6691 /**
6692 * The Same Site policy applied to this cookie. Can be `unspecified`,
6693 * `no_restriction`, `lax` or `strict`.
6694 */
6695 sameSite: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
6696 /**
6697 * Whether the cookie is marked as secure.
6698 */
6699 secure?: boolean;
6700 /**
6701 * Whether the cookie is a session cookie or a persistent cookie with an expiration
6702 * date.
6703 */
6704 session?: boolean;
6705 /**
6706 * The value of the cookie.
6707 */
6708 value: string;
6709 }
6710
6711 class Cookies extends NodeEventEmitter {
6712
6713 // Docs: https://electronjs.org/docs/api/cookies
6714
6715 /**
6716 * Emitted when a cookie is changed because it was added, edited, removed, or
6717 * expired.
6718 */
6719 on(event: 'changed', listener: (event: Event,
6720 /**
6721 * The cookie that was changed.
6722 */
6723 cookie: Cookie,
6724 /**
6725 * The cause of the change with one of the following values:
6726 */
6727 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
6728 /**
6729 * `true` if the cookie was removed, `false` otherwise.
6730 */
6731 removed: boolean) => void): this;
6732 off(event: 'changed', listener: (event: Event,
6733 /**
6734 * The cookie that was changed.
6735 */
6736 cookie: Cookie,
6737 /**
6738 * The cause of the change with one of the following values:
6739 */
6740 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
6741 /**
6742 * `true` if the cookie was removed, `false` otherwise.
6743 */
6744 removed: boolean) => void): this;
6745 once(event: 'changed', listener: (event: Event,
6746 /**
6747 * The cookie that was changed.
6748 */
6749 cookie: Cookie,
6750 /**
6751 * The cause of the change with one of the following values:
6752 */
6753 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
6754 /**
6755 * `true` if the cookie was removed, `false` otherwise.
6756 */
6757 removed: boolean) => void): this;
6758 addListener(event: 'changed', listener: (event: Event,
6759 /**
6760 * The cookie that was changed.
6761 */
6762 cookie: Cookie,
6763 /**
6764 * The cause of the change with one of the following values:
6765 */
6766 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
6767 /**
6768 * `true` if the cookie was removed, `false` otherwise.
6769 */
6770 removed: boolean) => void): this;
6771 removeListener(event: 'changed', listener: (event: Event,
6772 /**
6773 * The cookie that was changed.
6774 */
6775 cookie: Cookie,
6776 /**
6777 * The cause of the change with one of the following values:
6778 */
6779 cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
6780 /**
6781 * `true` if the cookie was removed, `false` otherwise.
6782 */
6783 removed: boolean) => void): this;
6784 /**
6785 * A promise which resolves when the cookie store has been flushed
6786 *
6787 * Writes any unwritten cookies data to disk
6788 *
6789 * Cookies written by any method will not be written to disk immediately, but will
6790 * be written every 30 seconds or 512 operations
6791 *
6792 * Calling this method can cause the cookie to be written to disk immediately.
6793 */
6794 flushStore(): Promise<void>;
6795 /**
6796 * A promise which resolves an array of cookie objects.
6797 *
6798 * Sends a request to get all cookies matching `filter`, and resolves a promise
6799 * with the response.
6800 */
6801 get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
6802 /**
6803 * A promise which resolves when the cookie has been removed
6804 *
6805 * Removes the cookies matching `url` and `name`
6806 */
6807 remove(url: string, name: string): Promise<void>;
6808 /**
6809 * A promise which resolves when the cookie has been set
6810 *
6811 * Sets a cookie with `details`.
6812 */
6813 set(details: CookiesSetDetails): Promise<void>;
6814 }
6815
6816 interface CPUUsage {
6817
6818 // Docs: https://electronjs.org/docs/api/structures/cpu-usage
6819
6820 /**
6821 * The number of average idle CPU wakeups per second since the last call to
6822 * getCPUUsage. First call returns 0. Will always return 0 on Windows.
6823 */
6824 idleWakeupsPerSecond: number;
6825 /**
6826 * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
6827 */
6828 percentCPUUsage: number;
6829 }
6830
6831 interface CrashReport {
6832
6833 // Docs: https://electronjs.org/docs/api/structures/crash-report
6834
6835 date: Date;
6836 id: string;
6837 }
6838
6839 interface CrashReporter {
6840
6841 // Docs: https://electronjs.org/docs/api/crash-reporter
6842
6843 /**
6844 * Set an extra parameter to be sent with the crash report. The values specified
6845 * here will be sent in addition to any values set via the `extra` option when
6846 * `start` was called.
6847 *
6848 * Parameters added in this fashion (or via the `extra` parameter to
6849 * `crashReporter.start`) are specific to the calling process. Adding extra
6850 * parameters in the main process will not cause those parameters to be sent along
6851 * with crashes from renderer or other child processes. Similarly, adding extra
6852 * parameters in a renderer process will not result in those parameters being sent
6853 * with crashes that occur in other renderer processes or in the main process.
6854 *
6855 * **Note:** Parameters have limits on the length of the keys and values. Key names
6856 * must be no longer than 39 bytes, and values must be no longer than 20320 bytes.
6857 * Keys with names longer than the maximum will be silently ignored. Key values
6858 * longer than the maximum length will be truncated.
6859 */
6860 addExtraParameter(key: string, value: string): void;
6861 /**
6862 * The date and ID of the last crash report. Only crash reports that have been
6863 * uploaded will be returned; even if a crash report is present on disk it will not
6864 * be returned until it is uploaded. In the case that there are no uploaded
6865 * reports, `null` is returned.
6866 *
6867 * **Note:** This method is only available in the main process.
6868 */
6869 getLastCrashReport(): (CrashReport) | (null);
6870 /**
6871 * The current 'extra' parameters of the crash reporter.
6872 */
6873 getParameters(): Record<string, string>;
6874 /**
6875 * Returns all uploaded crash reports. Each report contains the date and uploaded
6876 * ID.
6877 *
6878 * **Note:** This method is only available in the main process.
6879 */
6880 getUploadedReports(): CrashReport[];
6881 /**
6882 * Whether reports should be submitted to the server. Set through the `start`
6883 * method or `setUploadToServer`.
6884 *
6885 * **Note:** This method is only available in the main process.
6886 */
6887 getUploadToServer(): boolean;
6888 /**
6889 * Remove an extra parameter from the current set of parameters. Future crashes
6890 * will not include this parameter.
6891 */
6892 removeExtraParameter(key: string): void;
6893 /**
6894 * This would normally be controlled by user preferences. This has no effect if
6895 * called before `start` is called.
6896 *
6897 * **Note:** This method is only available in the main process.
6898 */
6899 setUploadToServer(uploadToServer: boolean): void;
6900 /**
6901 * This method must be called before using any other `crashReporter` APIs. Once
6902 * initialized this way, the crashpad handler collects crashes from all
6903 * subsequently created processes. The crash reporter cannot be disabled once
6904 * started.
6905 *
6906 * This method should be called as early as possible in app startup, preferably
6907 * before `app.on('ready')`. If the crash reporter is not initialized at the time a
6908 * renderer process is created, then that renderer process will not be monitored by
6909 * the crash reporter.
6910 *
6911 * **Note:** You can test out the crash reporter by generating a crash using
6912 * `process.crash()`.
6913 *
6914 * **Note:** If you need to send additional/updated `extra` parameters after your
6915 * first call `start` you can call `addExtraParameter`.
6916 *
6917 * **Note:** Parameters passed in `extra`, `globalExtra` or set with
6918 * `addExtraParameter` have limits on the length of the keys and values. Key names
6919 * must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys
6920 * with names longer than the maximum will be silently ignored. Key values longer
6921 * than the maximum length will be truncated.
6922 *
6923 * **Note:** This method is only available in the main process.
6924 */
6925 start(options: CrashReporterStartOptions): void;
6926 }
6927
6928 interface CustomScheme {
6929
6930 // Docs: https://electronjs.org/docs/api/structures/custom-scheme
6931
6932 privileges?: Privileges;
6933 /**
6934 * Custom schemes to be registered with options.
6935 */
6936 scheme: string;
6937 }
6938
6939 class Debugger extends NodeEventEmitter {
6940
6941 // Docs: https://electronjs.org/docs/api/debugger
6942
6943 /**
6944 * Emitted when the debugging session is terminated. This happens either when
6945 * `webContents` is closed or devtools is invoked for the attached `webContents`.
6946 */
6947 on(event: 'detach', listener: (event: Event,
6948 /**
6949 * Reason for detaching debugger.
6950 */
6951 reason: string) => void): this;
6952 off(event: 'detach', listener: (event: Event,
6953 /**
6954 * Reason for detaching debugger.
6955 */
6956 reason: string) => void): this;
6957 once(event: 'detach', listener: (event: Event,
6958 /**
6959 * Reason for detaching debugger.
6960 */
6961 reason: string) => void): this;
6962 addListener(event: 'detach', listener: (event: Event,
6963 /**
6964 * Reason for detaching debugger.
6965 */
6966 reason: string) => void): this;
6967 removeListener(event: 'detach', listener: (event: Event,
6968 /**
6969 * Reason for detaching debugger.
6970 */
6971 reason: string) => void): this;
6972 /**
6973 * Emitted whenever the debugging target issues an instrumentation event.
6974 */
6975 on(event: 'message', listener: (event: Event,
6976 /**
6977 * Method name.
6978 */
6979 method: string,
6980 /**
6981 * Event parameters defined by the 'parameters' attribute in the remote debugging
6982 * protocol.
6983 */
6984 params: any,
6985 /**
6986 * Unique identifier of attached debugging session, will match the value sent from
6987 * `debugger.sendCommand`.
6988 */
6989 sessionId: string) => void): this;
6990 off(event: 'message', listener: (event: Event,
6991 /**
6992 * Method name.
6993 */
6994 method: string,
6995 /**
6996 * Event parameters defined by the 'parameters' attribute in the remote debugging
6997 * protocol.
6998 */
6999 params: any,
7000 /**
7001 * Unique identifier of attached debugging session, will match the value sent from
7002 * `debugger.sendCommand`.
7003 */
7004 sessionId: string) => void): this;
7005 once(event: 'message', listener: (event: Event,
7006 /**
7007 * Method name.
7008 */
7009 method: string,
7010 /**
7011 * Event parameters defined by the 'parameters' attribute in the remote debugging
7012 * protocol.
7013 */
7014 params: any,
7015 /**
7016 * Unique identifier of attached debugging session, will match the value sent from
7017 * `debugger.sendCommand`.
7018 */
7019 sessionId: string) => void): this;
7020 addListener(event: 'message', listener: (event: Event,
7021 /**
7022 * Method name.
7023 */
7024 method: string,
7025 /**
7026 * Event parameters defined by the 'parameters' attribute in the remote debugging
7027 * protocol.
7028 */
7029 params: any,
7030 /**
7031 * Unique identifier of attached debugging session, will match the value sent from
7032 * `debugger.sendCommand`.
7033 */
7034 sessionId: string) => void): this;
7035 removeListener(event: 'message', listener: (event: Event,
7036 /**
7037 * Method name.
7038 */
7039 method: string,
7040 /**
7041 * Event parameters defined by the 'parameters' attribute in the remote debugging
7042 * protocol.
7043 */
7044 params: any,
7045 /**
7046 * Unique identifier of attached debugging session, will match the value sent from
7047 * `debugger.sendCommand`.
7048 */
7049 sessionId: string) => void): this;
7050 /**
7051 * Attaches the debugger to the `webContents`.
7052 */
7053 attach(protocolVersion?: string): void;
7054 /**
7055 * Detaches the debugger from the `webContents`.
7056 */
7057 detach(): void;
7058 /**
7059 * Whether a debugger is attached to the `webContents`.
7060 */
7061 isAttached(): boolean;
7062 /**
7063 * A promise that resolves with the response defined by the 'returns' attribute of
7064 * the command description in the remote debugging protocol or is rejected
7065 * indicating the failure of the command.
7066 *
7067 * Send given command to the debugging target.
7068 */
7069 sendCommand(method: string, commandParams?: any, sessionId?: string): Promise<any>;
7070 }
7071
7072 interface DesktopCapturer {
7073
7074 // Docs: https://electronjs.org/docs/api/desktop-capturer
7075
7076 /**
7077 * Resolves with an array of `DesktopCapturerSource` objects, each
7078 * `DesktopCapturerSource` represents a screen or an individual window that can be
7079 * captured.
7080 *
7081 * **Note** Capturing the screen contents requires user consent on macOS 10.15
7082 * Catalina or higher, which can detected by
7083 * `systemPreferences.getMediaAccessStatus`.
7084 */
7085 getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
7086 }
7087
7088 interface DesktopCapturerSource {
7089
7090 // Docs: https://electronjs.org/docs/api/structures/desktop-capturer-source
7091
7092 /**
7093 * An icon image of the application that owns the window or null if the source has
7094 * a type screen. The size of the icon is not known in advance and depends on what
7095 * the application provides.
7096 */
7097 appIcon: NativeImage;
7098 /**
7099 * A unique identifier that will correspond to the `id` of the matching Display
7100 * returned by the Screen API. On some platforms, this is equivalent to the `XX`
7101 * portion of the `id` field above and on others it will differ. It will be an
7102 * empty string if not available.
7103 */
7104 display_id: string;
7105 /**
7106 * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
7107 * constraint when calling `navigator.getUserMedia`. The format of the identifier
7108 * will be `window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle. YY is 1 for
7109 * the current process, and 0 for all others. ZZ is a sequential number that
7110 * represents the screen, and it does not equal to the index in the source's name.
7111 */
7112 id: string;
7113 /**
7114 * A screen source will be named either `Entire Screen` or `Screen <index>`, while
7115 * the name of a window source will match the window title.
7116 */
7117 name: string;
7118 /**
7119 * A thumbnail image. **Note:** There is no guarantee that the size of the
7120 * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
7121 * to `desktopCapturer.getSources`. The actual size depends on the scale of the
7122 * screen or window.
7123 */
7124 thumbnail: NativeImage;
7125 }
7126
7127 interface Dialog {
7128
7129 // Docs: https://electronjs.org/docs/api/dialog
7130
7131 /**
7132 * resolves when the certificate trust dialog is shown.
7133 *
7134 * On macOS, this displays a modal dialog that shows a message and certificate
7135 * information, and gives the user the option of trusting/importing the
7136 * certificate. If you provide a `browserWindow` argument the dialog will be
7137 * attached to the parent window, making it modal.
7138 *
7139 * On Windows the options are more limited, due to the Win32 APIs used:
7140 *
7141 * * The `message` argument is not used, as the OS provides its own confirmation
7142 * dialog.
7143 * * The `browserWindow` argument is ignored since it is not possible to make this
7144 * confirmation dialog modal.
7145 *
7146 * @platform darwin,win32
7147 */
7148 showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
7149 /**
7150 * resolves when the certificate trust dialog is shown.
7151 *
7152 * On macOS, this displays a modal dialog that shows a message and certificate
7153 * information, and gives the user the option of trusting/importing the
7154 * certificate. If you provide a `browserWindow` argument the dialog will be
7155 * attached to the parent window, making it modal.
7156 *
7157 * On Windows the options are more limited, due to the Win32 APIs used:
7158 *
7159 * * The `message` argument is not used, as the OS provides its own confirmation
7160 * dialog.
7161 * * The `browserWindow` argument is ignored since it is not possible to make this
7162 * confirmation dialog modal.
7163 *
7164 * @platform darwin,win32
7165 */
7166 showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
7167 /**
7168 * Displays a modal dialog that shows an error message.
7169 *
7170 * This API can be called safely before the `ready` event the `app` module emits,
7171 * it is usually used to report errors in early stage of startup. If called before
7172 * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
7173 * dialog will appear.
7174 */
7175 showErrorBox(title: string, content: string): void;
7176 /**
7177 * resolves with a promise containing the following properties:
7178 *
7179 * * `response` number - The index of the clicked button.
7180 * * `checkboxChecked` boolean - The checked state of the checkbox if
7181 * `checkboxLabel` was set. Otherwise `false`.
7182 *
7183 * Shows a message box.
7184 *
7185 * The `browserWindow` argument allows the dialog to attach itself to a parent
7186 * window, making it modal.
7187 */
7188 showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
7189 /**
7190 * resolves with a promise containing the following properties:
7191 *
7192 * * `response` number - The index of the clicked button.
7193 * * `checkboxChecked` boolean - The checked state of the checkbox if
7194 * `checkboxLabel` was set. Otherwise `false`.
7195 *
7196 * Shows a message box.
7197 *
7198 * The `browserWindow` argument allows the dialog to attach itself to a parent
7199 * window, making it modal.
7200 */
7201 showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
7202 /**
7203 * the index of the clicked button.
7204 *
7205 * Shows a message box, it will block the process until the message box is closed.
7206 * It returns the index of the clicked button.
7207 *
7208 * The `browserWindow` argument allows the dialog to attach itself to a parent
7209 * window, making it modal. If `browserWindow` is not shown dialog will not be
7210 * attached to it. In such case it will be displayed as an independent window.
7211 */
7212 showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
7213 /**
7214 * the index of the clicked button.
7215 *
7216 * Shows a message box, it will block the process until the message box is closed.
7217 * It returns the index of the clicked button.
7218 *
7219 * The `browserWindow` argument allows the dialog to attach itself to a parent
7220 * window, making it modal. If `browserWindow` is not shown dialog will not be
7221 * attached to it. In such case it will be displayed as an independent window.
7222 */
7223 showMessageBoxSync(options: MessageBoxSyncOptions): number;
7224 /**
7225 * Resolve with an object containing the following:
7226 *
7227 * * `canceled` boolean - whether or not the dialog was canceled.
7228 * * `filePaths` string[] - An array of file paths chosen by the user. If the
7229 * dialog is cancelled this will be an empty array.
7230 * * `bookmarks` string[] (optional) _macOS_ _mas_ - An array matching the
7231 * `filePaths` array of base64 encoded strings which contains security scoped
7232 * bookmark data. `securityScopedBookmarks` must be enabled for this to be
7233 * populated. (For return values, see table here.)
7234 *
7235 * The `browserWindow` argument allows the dialog to attach itself to a parent
7236 * window, making it modal.
7237 *
7238 * The `filters` specifies an array of file types that can be displayed or selected
7239 * when you want to limit the user to a specific type. For example:
7240 *
7241 * The `extensions` array should contain extensions without wildcards or dots (e.g.
7242 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
7243 * `'*'` wildcard (no other wildcard is supported).
7244 *
7245 * **Note:** On Windows and Linux an open dialog can not be both a file selector
7246 * and a directory selector, so if you set `properties` to `['openFile',
7247 * 'openDirectory']` on these platforms, a directory selector will be shown.
7248 */
7249 showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
7250 /**
7251 * Resolve with an object containing the following:
7252 *
7253 * * `canceled` boolean - whether or not the dialog was canceled.
7254 * * `filePaths` string[] - An array of file paths chosen by the user. If the
7255 * dialog is cancelled this will be an empty array.
7256 * * `bookmarks` string[] (optional) _macOS_ _mas_ - An array matching the
7257 * `filePaths` array of base64 encoded strings which contains security scoped
7258 * bookmark data. `securityScopedBookmarks` must be enabled for this to be
7259 * populated. (For return values, see table here.)
7260 *
7261 * The `browserWindow` argument allows the dialog to attach itself to a parent
7262 * window, making it modal.
7263 *
7264 * The `filters` specifies an array of file types that can be displayed or selected
7265 * when you want to limit the user to a specific type. For example:
7266 *
7267 * The `extensions` array should contain extensions without wildcards or dots (e.g.
7268 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
7269 * `'*'` wildcard (no other wildcard is supported).
7270 *
7271 * **Note:** On Windows and Linux an open dialog can not be both a file selector
7272 * and a directory selector, so if you set `properties` to `['openFile',
7273 * 'openDirectory']` on these platforms, a directory selector will be shown.
7274 */
7275 showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
7276 /**
7277 * the file paths chosen by the user; if the dialog is cancelled it returns
7278 * `undefined`.
7279 *
7280 * The `browserWindow` argument allows the dialog to attach itself to a parent
7281 * window, making it modal.
7282 *
7283 * The `filters` specifies an array of file types that can be displayed or selected
7284 * when you want to limit the user to a specific type. For example:
7285 *
7286 * The `extensions` array should contain extensions without wildcards or dots (e.g.
7287 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
7288 * `'*'` wildcard (no other wildcard is supported).
7289 *
7290 * **Note:** On Windows and Linux an open dialog can not be both a file selector
7291 * and a directory selector, so if you set `properties` to `['openFile',
7292 * 'openDirectory']` on these platforms, a directory selector will be shown.
7293 */
7294 showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
7295 /**
7296 * the file paths chosen by the user; if the dialog is cancelled it returns
7297 * `undefined`.
7298 *
7299 * The `browserWindow` argument allows the dialog to attach itself to a parent
7300 * window, making it modal.
7301 *
7302 * The `filters` specifies an array of file types that can be displayed or selected
7303 * when you want to limit the user to a specific type. For example:
7304 *
7305 * The `extensions` array should contain extensions without wildcards or dots (e.g.
7306 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
7307 * `'*'` wildcard (no other wildcard is supported).
7308 *
7309 * **Note:** On Windows and Linux an open dialog can not be both a file selector
7310 * and a directory selector, so if you set `properties` to `['openFile',
7311 * 'openDirectory']` on these platforms, a directory selector will be shown.
7312 */
7313 showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
7314 /**
7315 * Resolve with an object containing the following:
7316 *
7317 * * `canceled` boolean - whether or not the dialog was canceled.
7318 * * `filePath` string - If the dialog is canceled, this will be an empty string.
7319 * * `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which
7320 * contains the security scoped bookmark data for the saved file.
7321 * `securityScopedBookmarks` must be enabled for this to be present. (For return
7322 * values, see table here.)
7323 *
7324 * The `browserWindow` argument allows the dialog to attach itself to a parent
7325 * window, making it modal.
7326 *
7327 * The `filters` specifies an array of file types that can be displayed, see
7328 * `dialog.showOpenDialog` for an example.
7329 *
7330 * **Note:** On macOS, using the asynchronous version is recommended to avoid
7331 * issues when expanding and collapsing the dialog.
7332 */
7333 showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
7334 /**
7335 * Resolve with an object containing the following:
7336 *
7337 * * `canceled` boolean - whether or not the dialog was canceled.
7338 * * `filePath` string - If the dialog is canceled, this will be an empty string.
7339 * * `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which
7340 * contains the security scoped bookmark data for the saved file.
7341 * `securityScopedBookmarks` must be enabled for this to be present. (For return
7342 * values, see table here.)
7343 *
7344 * The `browserWindow` argument allows the dialog to attach itself to a parent
7345 * window, making it modal.
7346 *
7347 * The `filters` specifies an array of file types that can be displayed, see
7348 * `dialog.showOpenDialog` for an example.
7349 *
7350 * **Note:** On macOS, using the asynchronous version is recommended to avoid
7351 * issues when expanding and collapsing the dialog.
7352 */
7353 showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
7354 /**
7355 * the path of the file chosen by the user; if the dialog is cancelled it returns
7356 * an empty string.
7357 *
7358 * The `browserWindow` argument allows the dialog to attach itself to a parent
7359 * window, making it modal.
7360 *
7361 * The `filters` specifies an array of file types that can be displayed, see
7362 * `dialog.showOpenDialog` for an example.
7363 */
7364 showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): string;
7365 /**
7366 * the path of the file chosen by the user; if the dialog is cancelled it returns
7367 * an empty string.
7368 *
7369 * The `browserWindow` argument allows the dialog to attach itself to a parent
7370 * window, making it modal.
7371 *
7372 * The `filters` specifies an array of file types that can be displayed, see
7373 * `dialog.showOpenDialog` for an example.
7374 */
7375 showSaveDialogSync(options: SaveDialogSyncOptions): string;
7376 }
7377
7378 interface Display {
7379
7380 // Docs: https://electronjs.org/docs/api/structures/display
7381
7382 /**
7383 * Can be `available`, `unavailable`, `unknown`.
7384 */
7385 accelerometerSupport: ('available' | 'unavailable' | 'unknown');
7386 /**
7387 * the bounds of the display in DIP points.
7388 */
7389 bounds: Rectangle;
7390 /**
7391 * The number of bits per pixel.
7392 */
7393 colorDepth: number;
7394 /**
7395 * represent a color space (three-dimensional object which contains all realizable
7396 * color combinations) for the purpose of color conversions.
7397 */
7398 colorSpace: string;
7399 /**
7400 * The number of bits per color component.
7401 */
7402 depthPerComponent: number;
7403 /**
7404 * `true`` if the display is detected by the system.
7405 */
7406 detected: boolean;
7407 /**
7408 * The display refresh rate.
7409 */
7410 displayFrequency: number;
7411 /**
7412 * Unique identifier associated with the display. A value of of -1 means the
7413 * display is invalid or the correct `id` is not yet known, and a value of -10
7414 * means the display is a virtual display assigned to a unified desktop.
7415 */
7416 id: number;
7417 /**
7418 * `true` for an internal display and `false` for an external display.
7419 */
7420 internal: boolean;
7421 /**
7422 * User-friendly label, determined by the platform.
7423 */
7424 label: string;
7425 /**
7426 * Maximum cursor size in native pixels.
7427 */
7428 maximumCursorSize: Size;
7429 /**
7430 * Whether or not the display is a monochrome display.
7431 */
7432 monochrome: boolean;
7433 /**
7434 * Returns the display's origin in pixel coordinates. Only available on windowing
7435 * systems like X11 that position displays in pixel coordinates.
7436 */
7437 nativeOrigin: Point;
7438 /**
7439 * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
7440 */
7441 rotation: number;
7442 /**
7443 * Output device's pixel scale factor.
7444 */
7445 scaleFactor: number;
7446 size: Size;
7447 /**
7448 * Can be `available`, `unavailable`, `unknown`.
7449 */
7450 touchSupport: ('available' | 'unavailable' | 'unknown');
7451 /**
7452 * the work area of the display in DIP points.
7453 */
7454 workArea: Rectangle;
7455 /**
7456 * The size of the work area.
7457 */
7458 workAreaSize: Size;
7459 }
7460
7461 class Dock {
7462
7463 // Docs: https://electronjs.org/docs/api/dock
7464
7465 /**
7466 * an ID representing the request.
7467 *
7468 * When `critical` is passed, the dock icon will bounce until either the
7469 * application becomes active or the request is canceled.
7470 *
7471 * When `informational` is passed, the dock icon will bounce for one second.
7472 * However, the request remains active until either the application becomes active
7473 * or the request is canceled.
7474 *
7475 * **Note:** This method can only be used while the app is not focused; when the
7476 * app is focused it will return -1.
7477 *
7478 * @platform darwin
7479 */
7480 bounce(type?: 'critical' | 'informational'): number;
7481 /**
7482 * Cancel the bounce of `id`.
7483 *
7484 * @platform darwin
7485 */
7486 cancelBounce(id: number): void;
7487 /**
7488 * Bounces the Downloads stack if the filePath is inside the Downloads folder.
7489 *
7490 * @platform darwin
7491 */
7492 downloadFinished(filePath: string): void;
7493 /**
7494 * The badge string of the dock.
7495 *
7496 * @platform darwin
7497 */
7498 getBadge(): string;
7499 /**
7500 * The application's dock menu.
7501 *
7502 * @platform darwin
7503 */
7504 getMenu(): (Menu) | (null);
7505 /**
7506 * Hides the dock icon.
7507 *
7508 * @platform darwin
7509 */
7510 hide(): void;
7511 /**
7512 * Whether the dock icon is visible.
7513 *
7514 * @platform darwin
7515 */
7516 isVisible(): boolean;
7517 /**
7518 * Sets the string to be displayed in the dock’s badging area.
7519 *
7520 * @platform darwin
7521 */
7522 setBadge(text: string): void;
7523 /**
7524 * Sets the `image` associated with this dock icon.
7525 *
7526 * @platform darwin
7527 */
7528 setIcon(image: (NativeImage) | (string)): void;
7529 /**
7530 * Sets the application's dock menu.
7531 *
7532 * @platform darwin
7533 */
7534 setMenu(menu: Menu): void;
7535 /**
7536 * Resolves when the dock icon is shown.
7537 *
7538 * @platform darwin
7539 */
7540 show(): Promise<void>;
7541 }
7542
7543 class DownloadItem extends NodeEventEmitter {
7544
7545 // Docs: https://electronjs.org/docs/api/download-item
7546
7547 /**
7548 * Emitted when the download is in a terminal state. This includes a completed
7549 * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
7550 * download that can't be resumed.
7551 *
7552 * The `state` can be one of following:
7553 *
7554 * * `completed` - The download completed successfully.
7555 * * `cancelled` - The download has been cancelled.
7556 * * `interrupted` - The download has interrupted and can not resume.
7557 */
7558 on(event: 'done', listener: (event: Event,
7559 /**
7560 * Can be `completed`, `cancelled` or `interrupted`.
7561 */
7562 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
7563 off(event: 'done', listener: (event: Event,
7564 /**
7565 * Can be `completed`, `cancelled` or `interrupted`.
7566 */
7567 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
7568 once(event: 'done', listener: (event: Event,
7569 /**
7570 * Can be `completed`, `cancelled` or `interrupted`.
7571 */
7572 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
7573 addListener(event: 'done', listener: (event: Event,
7574 /**
7575 * Can be `completed`, `cancelled` or `interrupted`.
7576 */
7577 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
7578 removeListener(event: 'done', listener: (event: Event,
7579 /**
7580 * Can be `completed`, `cancelled` or `interrupted`.
7581 */
7582 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
7583 /**
7584 * Emitted when the download has been updated and is not done.
7585 *
7586 * The `state` can be one of following:
7587 *
7588 * * `progressing` - The download is in-progress.
7589 * * `interrupted` - The download has interrupted and can be resumed.
7590 */
7591 on(event: 'updated', listener: (event: Event,
7592 /**
7593 * Can be `progressing` or `interrupted`.
7594 */
7595 state: ('progressing' | 'interrupted')) => void): this;
7596 off(event: 'updated', listener: (event: Event,
7597 /**
7598 * Can be `progressing` or `interrupted`.
7599 */
7600 state: ('progressing' | 'interrupted')) => void): this;
7601 once(event: 'updated', listener: (event: Event,
7602 /**
7603 * Can be `progressing` or `interrupted`.
7604 */
7605 state: ('progressing' | 'interrupted')) => void): this;
7606 addListener(event: 'updated', listener: (event: Event,
7607 /**
7608 * Can be `progressing` or `interrupted`.
7609 */
7610 state: ('progressing' | 'interrupted')) => void): this;
7611 removeListener(event: 'updated', listener: (event: Event,
7612 /**
7613 * Can be `progressing` or `interrupted`.
7614 */
7615 state: ('progressing' | 'interrupted')) => void): this;
7616 /**
7617 * Cancels the download operation.
7618 */
7619 cancel(): void;
7620 /**
7621 * Whether the download can resume.
7622 */
7623 canResume(): boolean;
7624 /**
7625 * The Content-Disposition field from the response header.
7626 */
7627 getContentDisposition(): string;
7628 /**
7629 * ETag header value.
7630 */
7631 getETag(): string;
7632 /**
7633 * The file name of the download item.
7634 *
7635 * **Note:** The file name is not always the same as the actual one saved in local
7636 * disk. If user changes the file name in a prompted download saving dialog, the
7637 * actual name of saved file will be different.
7638 */
7639 getFilename(): string;
7640 /**
7641 * Last-Modified header value.
7642 */
7643 getLastModifiedTime(): string;
7644 /**
7645 * The files mime type.
7646 */
7647 getMimeType(): string;
7648 /**
7649 * The received bytes of the download item.
7650 */
7651 getReceivedBytes(): number;
7652 /**
7653 * Returns the object previously set by
7654 * `downloadItem.setSaveDialogOptions(options)`.
7655 */
7656 getSaveDialogOptions(): SaveDialogOptions;
7657 /**
7658 * The save path of the download item. This will be either the path set via
7659 * `downloadItem.setSavePath(path)` or the path selected from the shown save
7660 * dialog.
7661 */
7662 getSavePath(): string;
7663 /**
7664 * Number of seconds since the UNIX epoch when the download was started.
7665 */
7666 getStartTime(): number;
7667 /**
7668 * The current state. Can be `progressing`, `completed`, `cancelled` or
7669 * `interrupted`.
7670 *
7671 * **Note:** The following methods are useful specifically to resume a `cancelled`
7672 * item when session is restarted.
7673 */
7674 getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
7675 /**
7676 * The total size in bytes of the download item.
7677 *
7678 * If the size is unknown, it returns 0.
7679 */
7680 getTotalBytes(): number;
7681 /**
7682 * The origin URL where the item is downloaded from.
7683 */
7684 getURL(): string;
7685 /**
7686 * The complete URL chain of the item including any redirects.
7687 */
7688 getURLChain(): string[];
7689 /**
7690 * Whether the download has user gesture.
7691 */
7692 hasUserGesture(): boolean;
7693 /**
7694 * Whether the download is paused.
7695 */
7696 isPaused(): boolean;
7697 /**
7698 * Pauses the download.
7699 */
7700 pause(): void;
7701 /**
7702 * Resumes the download that has been paused.
7703 *
7704 * **Note:** To enable resumable downloads the server you are downloading from must
7705 * support range requests and provide both `Last-Modified` and `ETag` header
7706 * values. Otherwise `resume()` will dismiss previously received bytes and restart
7707 * the download from the beginning.
7708 */
7709 resume(): void;
7710 /**
7711 * This API allows the user to set custom options for the save dialog that opens
7712 * for the download item by default. The API is only available in session's
7713 * `will-download` callback function.
7714 */
7715 setSaveDialogOptions(options: SaveDialogOptions): void;
7716 /**
7717 * The API is only available in session's `will-download` callback function. If
7718 * `path` doesn't exist, Electron will try to make the directory recursively. If
7719 * user doesn't set the save path via the API, Electron will use the original
7720 * routine to determine the save path; this usually prompts a save dialog.
7721 */
7722 setSavePath(path: string): void;
7723 /**
7724 * A `string` property that determines the save file path of the download item.
7725 *
7726 * The property is only available in session's `will-download` callback function.
7727 * If user doesn't set the save path via the property, Electron will use the
7728 * original routine to determine the save path; this usually prompts a save dialog.
7729 */
7730 savePath: string;
7731 }
7732
7733 interface Extension {
7734
7735 // Docs: https://electronjs.org/docs/api/structures/extension
7736
7737 id: string;
7738 /**
7739 * Copy of the extension's manifest data.
7740 */
7741 manifest: any;
7742 name: string;
7743 /**
7744 * The extension's file path.
7745 */
7746 path: string;
7747 /**
7748 * The extension's `chrome-extension://` URL.
7749 */
7750 url: string;
7751 version: string;
7752 }
7753
7754 interface ExtensionInfo {
7755
7756 // Docs: https://electronjs.org/docs/api/structures/extension-info
7757
7758 name: string;
7759 version: string;
7760 }
7761
7762 interface FileFilter {
7763
7764 // Docs: https://electronjs.org/docs/api/structures/file-filter
7765
7766 extensions: string[];
7767 name: string;
7768 }
7769
7770 interface FilePathWithHeaders {
7771
7772 // Docs: https://electronjs.org/docs/api/structures/file-path-with-headers
7773
7774 /**
7775 * Additional headers to be sent.
7776 */
7777 headers?: Record<string, string>;
7778 /**
7779 * The path to the file to send.
7780 */
7781 path: string;
7782 }
7783
7784 interface FilesystemPermissionRequest extends PermissionRequest {
7785
7786 // Docs: https://electronjs.org/docs/api/structures/filesystem-permission-request
7787
7788 /**
7789 * The access type of the `fileSystem` request. Can be `writable` or `readable`.
7790 */
7791 fileAccessType?: ('writable' | 'readable');
7792 /**
7793 * The path of the `fileSystem` request.
7794 */
7795 filePath?: string;
7796 /**
7797 * Whether the `fileSystem` request is a directory.
7798 */
7799 isDirectory?: boolean;
7800 }
7801
7802 interface GlobalShortcut {
7803
7804 // Docs: https://electronjs.org/docs/api/global-shortcut
7805
7806 /**
7807 * Whether this application has registered `accelerator`.
7808 *
7809 * When the accelerator is already taken by other applications, this call will
7810 * still return `false`. This behavior is intended by operating systems, since they
7811 * don't want applications to fight for global shortcuts.
7812 */
7813 isRegistered(accelerator: Accelerator): boolean;
7814 /**
7815 * Whether or not the shortcut was registered successfully.
7816 *
7817 * Registers a global shortcut of `accelerator`. The `callback` is called when the
7818 * registered shortcut is pressed by the user.
7819 *
7820 * When the accelerator is already taken by other applications, this call will
7821 * silently fail. This behavior is intended by operating systems, since they don't
7822 * want applications to fight for global shortcuts.
7823 *
7824 * The following accelerators will not be registered successfully on macOS 10.14
7825 * Mojave unless the app has been authorized as a trusted accessibility client:
7826 *
7827 * * "Media Play/Pause"
7828 * * "Media Next Track"
7829 * * "Media Previous Track"
7830 * * "Media Stop"
7831 */
7832 register(accelerator: Accelerator, callback: () => void): boolean;
7833 /**
7834 * Registers a global shortcut of all `accelerator` items in `accelerators`. The
7835 * `callback` is called when any of the registered shortcuts are pressed by the
7836 * user.
7837 *
7838 * When a given accelerator is already taken by other applications, this call will
7839 * silently fail. This behavior is intended by operating systems, since they don't
7840 * want applications to fight for global shortcuts.
7841 *
7842 * The following accelerators will not be registered successfully on macOS 10.14
7843 * Mojave unless the app has been authorized as a trusted accessibility client:
7844 *
7845 * * "Media Play/Pause"
7846 * * "Media Next Track"
7847 * * "Media Previous Track"
7848 * * "Media Stop"
7849 */
7850 registerAll(accelerators: Accelerator[], callback: () => void): void;
7851 /**
7852 * Unregisters the global shortcut of `accelerator`.
7853 */
7854 unregister(accelerator: Accelerator): void;
7855 /**
7856 * Unregisters all of the global shortcuts.
7857 */
7858 unregisterAll(): void;
7859 }
7860
7861 interface GPUFeatureStatus {
7862
7863 // Docs: https://electronjs.org/docs/api/structures/gpu-feature-status
7864
7865 /**
7866 * Canvas.
7867 */
7868 '2d_canvas': string;
7869 /**
7870 * Flash.
7871 */
7872 flash_3d: string;
7873 /**
7874 * Flash Stage3D.
7875 */
7876 flash_stage3d: string;
7877 /**
7878 * Flash Stage3D Baseline profile.
7879 */
7880 flash_stage3d_baseline: string;
7881 /**
7882 * Compositing.
7883 */
7884 gpu_compositing: string;
7885 /**
7886 * Multiple Raster Threads.
7887 */
7888 multiple_raster_threads: string;
7889 /**
7890 * Native GpuMemoryBuffers.
7891 */
7892 native_gpu_memory_buffers: string;
7893 /**
7894 * Rasterization.
7895 */
7896 rasterization: string;
7897 /**
7898 * Video Decode.
7899 */
7900 video_decode: string;
7901 /**
7902 * Video Encode.
7903 */
7904 video_encode: string;
7905 /**
7906 * VPx Video Decode.
7907 */
7908 vpx_decode: string;
7909 /**
7910 * WebGL.
7911 */
7912 webgl: string;
7913 /**
7914 * WebGL2.
7915 */
7916 webgl2: string;
7917 }
7918
7919 interface HIDDevice {
7920
7921 // Docs: https://electronjs.org/docs/api/structures/hid-device
7922
7923 /**
7924 * Unique identifier for the device.
7925 */
7926 deviceId: string;
7927 /**
7928 * Unique identifier for the HID interface. A device may have multiple HID
7929 * interfaces.
7930 */
7931 guid?: string;
7932 /**
7933 * Name of the device.
7934 */
7935 name: string;
7936 /**
7937 * The USB product ID.
7938 */
7939 productId: number;
7940 /**
7941 * The USB device serial number.
7942 */
7943 serialNumber?: string;
7944 /**
7945 * The USB vendor ID.
7946 */
7947 vendorId: number;
7948 }
7949
7950 interface InAppPurchase extends NodeJS.EventEmitter {
7951
7952 // Docs: https://electronjs.org/docs/api/in-app-purchase
7953
7954 on(event: 'transactions-updated', listener: Function): this;
7955 off(event: 'transactions-updated', listener: Function): this;
7956 once(event: 'transactions-updated', listener: Function): this;
7957 addListener(event: 'transactions-updated', listener: Function): this;
7958 removeListener(event: 'transactions-updated', listener: Function): this;
7959 /**
7960 * whether a user can make a payment.
7961 */
7962 canMakePayments(): boolean;
7963 /**
7964 * Completes all pending transactions.
7965 */
7966 finishAllTransactions(): void;
7967 /**
7968 * Completes the pending transactions corresponding to the date.
7969 */
7970 finishTransactionByDate(date: string): void;
7971 /**
7972 * Resolves with an array of `Product` objects.
7973 *
7974 * Retrieves the product descriptions.
7975 */
7976 getProducts(productIDs: string[]): Promise<Electron.Product[]>;
7977 /**
7978 * the path to the receipt.
7979 */
7980 getReceiptURL(): string;
7981 /**
7982 * Returns `true` if the product is valid and added to the payment queue.
7983 *
7984 * You should listen for the `transactions-updated` event as soon as possible and
7985 * certainly before you call `purchaseProduct`.
7986 */
7987 purchaseProduct(productID: string, opts?: (number) | (PurchaseProductOpts)): Promise<boolean>;
7988 /**
7989 * Restores finished transactions. This method can be called either to install
7990 * purchases on additional devices, or to restore purchases for an application that
7991 * the user deleted and reinstalled.
7992 *
7993 * The payment queue delivers a new transaction for each previously completed
7994 * transaction that can be restored. Each transaction includes a copy of the
7995 * original transaction.
7996 */
7997 restoreCompletedTransactions(): void;
7998 }
7999
8000 class IncomingMessage extends NodeEventEmitter {
8001
8002 // Docs: https://electronjs.org/docs/api/incoming-message
8003
8004 /**
8005 * Emitted when a request has been canceled during an ongoing HTTP transaction.
8006 */
8007 on(event: 'aborted', listener: Function): this;
8008 off(event: 'aborted', listener: Function): this;
8009 once(event: 'aborted', listener: Function): this;
8010 addListener(event: 'aborted', listener: Function): this;
8011 removeListener(event: 'aborted', listener: Function): this;
8012 /**
8013 * The `data` event is the usual method of transferring response data into
8014 * applicative code.
8015 */
8016 on(event: 'data', listener: (
8017 /**
8018 * A chunk of response body's data.
8019 */
8020 chunk: Buffer) => void): this;
8021 off(event: 'data', listener: (
8022 /**
8023 * A chunk of response body's data.
8024 */
8025 chunk: Buffer) => void): this;
8026 once(event: 'data', listener: (
8027 /**
8028 * A chunk of response body's data.
8029 */
8030 chunk: Buffer) => void): this;
8031 addListener(event: 'data', listener: (
8032 /**
8033 * A chunk of response body's data.
8034 */
8035 chunk: Buffer) => void): this;
8036 removeListener(event: 'data', listener: (
8037 /**
8038 * A chunk of response body's data.
8039 */
8040 chunk: Buffer) => void): this;
8041 /**
8042 * Indicates that response body has ended. Must be placed before 'data' event.
8043 */
8044 on(event: 'end', listener: Function): this;
8045 off(event: 'end', listener: Function): this;
8046 once(event: 'end', listener: Function): this;
8047 addListener(event: 'end', listener: Function): this;
8048 removeListener(event: 'end', listener: Function): this;
8049 /**
8050 * Returns:
8051 *
8052 * `error` Error - Typically holds an error string identifying failure root cause.
8053 *
8054 * Emitted when an error was encountered while streaming response data events. For
8055 * instance, if the server closes the underlying while the response is still
8056 * streaming, an `error` event will be emitted on the response object and a `close`
8057 * event will subsequently follow on the request object.
8058 */
8059 on(event: 'error', listener: Function): this;
8060 off(event: 'error', listener: Function): this;
8061 once(event: 'error', listener: Function): this;
8062 addListener(event: 'error', listener: Function): this;
8063 removeListener(event: 'error', listener: Function): this;
8064 /**
8065 * A `Record<string, string | string[]>` representing the HTTP response headers.
8066 * The `headers` object is formatted as follows:
8067 *
8068 * * All header names are lowercased.
8069 * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,
8070 * `etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,
8071 * `last-modified`, `location`, `max-forwards`, `proxy-authorization`, `referer`,
8072 * `retry-after`, `server`, or `user-agent` are discarded.
8073 * * `set-cookie` is always an array. Duplicates are added to the array.
8074 * * For duplicate `cookie` headers, the values are joined together with '; '.
8075 * * For all other headers, the values are joined together with ', '.
8076 */
8077 headers: Record<string, (string) | (string[])>;
8078 /**
8079 * A `string` indicating the HTTP protocol version number. Typical values are '1.0'
8080 * or '1.1'. Additionally `httpVersionMajor` and `httpVersionMinor` are two
8081 * Integer-valued readable properties that return respectively the HTTP major and
8082 * minor version numbers.
8083 */
8084 httpVersion: string;
8085 /**
8086 * An `Integer` indicating the HTTP protocol major version number.
8087 */
8088 httpVersionMajor: number;
8089 /**
8090 * An `Integer` indicating the HTTP protocol minor version number.
8091 */
8092 httpVersionMinor: number;
8093 /**
8094 * A `string[]` containing the raw HTTP response headers exactly as they were
8095 * received. The keys and values are in the same list. It is not a list of tuples.
8096 * So, the even-numbered offsets are key values, and the odd-numbered offsets are
8097 * the associated values. Header names are not lowercased, and duplicates are not
8098 * merged.
8099 */
8100 rawHeaders: string[];
8101 /**
8102 * An `Integer` indicating the HTTP response status code.
8103 */
8104 statusCode: number;
8105 /**
8106 * A `string` representing the HTTP status message.
8107 */
8108 statusMessage: string;
8109 }
8110
8111 interface InputEvent {
8112
8113 // Docs: https://electronjs.org/docs/api/structures/input-event
8114
8115 /**
8116 * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
8117 * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
8118 * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
8119 */
8120 modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
8121 /**
8122 * Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`,
8123 * `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`,
8124 * `char`, `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`,
8125 * `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`,
8126 * `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`,
8127 * `gestureTap`, `gestureTapCancel`, `gestureShortPress`, `gestureLongPress`,
8128 * `gestureLongTap`, `gestureTwoFingerTap`, `gestureTapUnconfirmed`,
8129 * `gestureDoubleTap`, `touchStart`, `touchMove`, `touchEnd`, `touchCancel`,
8130 * `touchScrollStarted`, `pointerDown`, `pointerUp`, `pointerMove`,
8131 * `pointerRawUpdate`, `pointerCancel` or `pointerCausedUaAction`.
8132 */
8133 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');
8134 }
8135
8136 interface IpcMain extends NodeJS.EventEmitter {
8137
8138 // Docs: https://electronjs.org/docs/api/ipc-main
8139
8140 /**
8141 * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
8142 * renderer calls `ipcRenderer.invoke(channel, ...args)`.
8143 *
8144 * If `listener` returns a Promise, the eventual result of the promise will be
8145 * returned as a reply to the remote caller. Otherwise, the return value of the
8146 * listener will be used as the value of the reply.
8147 *
8148 * The `event` that is passed as the first argument to the handler is the same as
8149 * that passed to a regular event listener. It includes information about which
8150 * WebContents is the source of the invoke request.
8151 *
8152 * Errors thrown through `handle` in the main process are not transparent as they
8153 * are serialized and only the `message` property from the original error is
8154 * provided to the renderer process. Please refer to #24427 for details.
8155 */
8156 handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<any>) | (any)): void;
8157 /**
8158 * Handles a single `invoke`able IPC message, then removes the listener. See
8159 * `ipcMain.handle(channel, listener)`.
8160 */
8161 handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<any>) | (any)): void;
8162 /**
8163 * Listens to `channel`, when a new message arrives `listener` would be called with
8164 * `listener(event, args...)`.
8165 */
8166 on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
8167 /**
8168 * Adds a one time `listener` function for the event. This `listener` is invoked
8169 * only the next time a message is sent to `channel`, after which it is removed.
8170 */
8171 once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
8172 /**
8173 * Removes listeners of the specified `channel`.
8174 */
8175 removeAllListeners(channel?: string): this;
8176 /**
8177 * Removes any handler for `channel`, if present.
8178 */
8179 removeHandler(channel: string): void;
8180 /**
8181 * Removes the specified `listener` from the listener array for the specified
8182 * `channel`.
8183 */
8184 removeListener(channel: string, listener: (...args: any[]) => void): this;
8185 }
8186
8187 interface IpcMainEvent extends Event {
8188
8189 // Docs: https://electronjs.org/docs/api/structures/ipc-main-event
8190
8191 /**
8192 * The ID of the renderer frame that sent this message
8193 */
8194 frameId: number;
8195 /**
8196 * A list of MessagePorts that were transferred with this message
8197 */
8198 ports: MessagePortMain[];
8199 /**
8200 * The internal ID of the renderer process that sent this message
8201 */
8202 processId: number;
8203 /**
8204 * A function that will send an IPC message to the renderer frame that sent the
8205 * original message that you are currently handling. You should use this method to
8206 * "reply" to the sent message in order to guarantee the reply will go to the
8207 * correct process and frame.
8208 */
8209 reply: (channel: string, ...args: any[]) => void;
8210 /**
8211 * Set this to the value to be returned in a synchronous message
8212 */
8213 returnValue: any;
8214 /**
8215 * Returns the `webContents` that sent the message
8216 */
8217 sender: WebContents;
8218 /**
8219 * The frame that sent this message
8220 *
8221 */
8222 readonly senderFrame: WebFrameMain;
8223 }
8224
8225 interface IpcMainInvokeEvent extends Event {
8226
8227 // Docs: https://electronjs.org/docs/api/structures/ipc-main-invoke-event
8228
8229 /**
8230 * The ID of the renderer frame that sent this message
8231 */
8232 frameId: number;
8233 /**
8234 * The internal ID of the renderer process that sent this message
8235 */
8236 processId: number;
8237 /**
8238 * Returns the `webContents` that sent the message
8239 */
8240 sender: WebContents;
8241 /**
8242 * The frame that sent this message
8243 *
8244 */
8245 readonly senderFrame: WebFrameMain;
8246 }
8247
8248 interface IpcRenderer extends NodeJS.EventEmitter {
8249
8250 // Docs: https://electronjs.org/docs/api/ipc-renderer
8251
8252 /**
8253 * Alias for `ipcRenderer.on`.
8254 */
8255 addListener(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
8256 /**
8257 * Resolves with the response from the main process.
8258 *
8259 * Send a message to the main process via `channel` and expect a result
8260 * asynchronously. Arguments will be serialized with the Structured Clone
8261 * Algorithm, just like `window.postMessage`, so prototype chains will not be
8262 * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
8263 * an exception.
8264 *
8265 * The main process should listen for `channel` with `ipcMain.handle()`.
8266 *
8267 * For example:
8268 *
8269 * If you need to transfer a `MessagePort` to the main process, use
8270 * `ipcRenderer.postMessage`.
8271 *
8272 * If you do not need a response to the message, consider using `ipcRenderer.send`.
8273 *
8274 * > **Note** Sending non-standard JavaScript types such as DOM objects or special
8275 * Electron objects will throw an exception.
8276 *
8277 * Since the main process does not have support for DOM objects such as
8278 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
8279 * Electron's IPC to the main process, as the main process would have no way to
8280 * decode them. Attempting to send such objects over IPC will result in an error.
8281 *
8282 * > **Note** If the handler in the main process throws an error, the promise
8283 * returned by `invoke` will reject. However, the `Error` object in the renderer
8284 * process will not be the same as the one thrown in the main process.
8285 */
8286 invoke(channel: string, ...args: any[]): Promise<any>;
8287 /**
8288 * Alias for `ipcRenderer.removeListener`.
8289 */
8290 off(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
8291 /**
8292 * Listens to `channel`, when a new message arrives `listener` would be called with
8293 * `listener(event, args...)`.
8294 */
8295 on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
8296 /**
8297 * Adds a one time `listener` function for the event. This `listener` is invoked
8298 * only the next time a message is sent to `channel`, after which it is removed.
8299 */
8300 once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
8301 /**
8302 * Send a message to the main process, optionally transferring ownership of zero or
8303 * more `MessagePort` objects.
8304 *
8305 * The transferred `MessagePort` objects will be available in the main process as
8306 * `MessagePortMain` objects by accessing the `ports` property of the emitted
8307 * event.
8308 *
8309 * For example:
8310 *
8311 * For more information on using `MessagePort` and `MessageChannel`, see the MDN
8312 * documentation.
8313 */
8314 postMessage(channel: string, message: any, transfer?: MessagePort[]): void;
8315 /**
8316 * Removes all listeners, or those of the specified `channel`.
8317 */
8318 removeAllListeners(channel: string): this;
8319 /**
8320 * Removes the specified `listener` from the listener array for the specified
8321 * `channel`.
8322 */
8323 removeListener(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
8324 /**
8325 * Send an asynchronous message to the main process via `channel`, along with
8326 * arguments. Arguments will be serialized with the Structured Clone Algorithm,
8327 * just like `window.postMessage`, so prototype chains will not be included.
8328 * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
8329 * exception.
8330 *
8331 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
8332 * Electron objects will throw an exception.
8333 *
8334 * Since the main process does not have support for DOM objects such as
8335 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
8336 * Electron's IPC to the main process, as the main process would have no way to
8337 * decode them. Attempting to send such objects over IPC will result in an error.
8338 *
8339 * The main process handles it by listening for `channel` with the `ipcMain`
8340 * module.
8341 *
8342 * If you need to transfer a `MessagePort` to the main process, use
8343 * `ipcRenderer.postMessage`.
8344 *
8345 * If you want to receive a single response from the main process, like the result
8346 * of a method call, consider using `ipcRenderer.invoke`.
8347 */
8348 send(channel: string, ...args: any[]): void;
8349 /**
8350 * The value sent back by the `ipcMain` handler.
8351 *
8352 * Send a message to the main process via `channel` and expect a result
8353 * synchronously. Arguments will be serialized with the Structured Clone Algorithm,
8354 * just like `window.postMessage`, so prototype chains will not be included.
8355 * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
8356 * exception.
8357 *
8358 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
8359 * Electron objects will throw an exception.
8360 *
8361 * Since the main process does not have support for DOM objects such as
8362 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
8363 * Electron's IPC to the main process, as the main process would have no way to
8364 * decode them. Attempting to send such objects over IPC will result in an error.
8365 *
8366 * The main process handles it by listening for `channel` with `ipcMain` module,
8367 * and replies by setting `event.returnValue`.
8368 *
8369 * > :warning: **WARNING**: Sending a synchronous message will block the whole
8370 * renderer process until the reply is received, so use this method only as a last
8371 * resort. It's much better to use the asynchronous version, `invoke()`.
8372 */
8373 sendSync(channel: string, ...args: any[]): any;
8374 /**
8375 * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
8376 * the host page instead of the main process.
8377 */
8378 sendToHost(channel: string, ...args: any[]): void;
8379 }
8380
8381 interface IpcRendererEvent extends Event {
8382
8383 // Docs: https://electronjs.org/docs/api/structures/ipc-renderer-event
8384
8385 /**
8386 * A list of MessagePorts that were transferred with this message
8387 */
8388 ports: MessagePort[];
8389 /**
8390 * The `IpcRenderer` instance that emitted the event originally
8391 */
8392 sender: IpcRenderer;
8393 }
8394
8395 interface JumpListCategory {
8396
8397 // Docs: https://electronjs.org/docs/api/structures/jump-list-category
8398
8399 /**
8400 * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
8401 * should be omitted.
8402 */
8403 items?: JumpListItem[];
8404 /**
8405 * Must be set if `type` is `custom`, otherwise it should be omitted.
8406 */
8407 name?: string;
8408 /**
8409 * One of the following:
8410 */
8411 type?: ('tasks' | 'frequent' | 'recent' | 'custom');
8412 }
8413
8414 interface JumpListItem {
8415
8416 // Docs: https://electronjs.org/docs/api/structures/jump-list-item
8417
8418 /**
8419 * The command line arguments when `program` is executed. Should only be set if
8420 * `type` is `task`.
8421 */
8422 args?: string;
8423 /**
8424 * Description of the task (displayed in a tooltip). Should only be set if `type`
8425 * is `task`. Maximum length 260 characters.
8426 */
8427 description?: string;
8428 /**
8429 * The index of the icon in the resource file. If a resource file contains multiple
8430 * icons this value can be used to specify the zero-based index of the icon that
8431 * should be displayed for this task. If a resource file contains only one icon,
8432 * this property should be set to zero.
8433 */
8434 iconIndex?: number;
8435 /**
8436 * The absolute path to an icon to be displayed in a Jump List, which can be an
8437 * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
8438 * can usually specify `process.execPath` to show the program icon.
8439 */
8440 iconPath?: string;
8441 /**
8442 * Path of the file to open, should only be set if `type` is `file`.
8443 */
8444 path?: string;
8445 /**
8446 * Path of the program to execute, usually you should specify `process.execPath`
8447 * which opens the current program. Should only be set if `type` is `task`.
8448 */
8449 program?: string;
8450 /**
8451 * The text to be displayed for the item in the Jump List. Should only be set if
8452 * `type` is `task`.
8453 */
8454 title?: string;
8455 /**
8456 * One of the following:
8457 */
8458 type?: ('task' | 'separator' | 'file');
8459 /**
8460 * The working directory. Default is empty.
8461 */
8462 workingDirectory?: string;
8463 }
8464
8465 interface KeyboardEvent {
8466
8467 // Docs: https://electronjs.org/docs/api/structures/keyboard-event
8468
8469 /**
8470 * whether an Alt key was used in an accelerator to trigger the Event
8471 */
8472 altKey?: boolean;
8473 /**
8474 * whether the Control key was used in an accelerator to trigger the Event
8475 */
8476 ctrlKey?: boolean;
8477 /**
8478 * whether a meta key was used in an accelerator to trigger the Event
8479 */
8480 metaKey?: boolean;
8481 /**
8482 * whether a Shift key was used in an accelerator to trigger the Event
8483 */
8484 shiftKey?: boolean;
8485 /**
8486 * whether an accelerator was used to trigger the event as opposed to another user
8487 * gesture like mouse click
8488 */
8489 triggeredByAccelerator?: boolean;
8490 }
8491
8492 interface KeyboardInputEvent extends InputEvent {
8493
8494 // Docs: https://electronjs.org/docs/api/structures/keyboard-input-event
8495
8496 /**
8497 * The character that will be sent as the keyboard event. Should only use the valid
8498 * key codes in Accelerator.
8499 */
8500 keyCode: string;
8501 /**
8502 * The type of the event, can be `rawKeyDown`, `keyDown`, `keyUp` or `char`.
8503 */
8504 type: ('rawKeyDown' | 'keyDown' | 'keyUp' | 'char');
8505 }
8506
8507 interface MediaAccessPermissionRequest extends PermissionRequest {
8508
8509 // Docs: https://electronjs.org/docs/api/structures/media-access-permission-request
8510
8511 /**
8512 * The types of media access being requested - elements can be `video` or `audio`.
8513 */
8514 mediaTypes?: Array<'video' | 'audio'>;
8515 /**
8516 * The security origin of the request.
8517 */
8518 securityOrigin?: string;
8519 }
8520
8521 interface MemoryInfo {
8522
8523 // Docs: https://electronjs.org/docs/api/structures/memory-info
8524
8525 /**
8526 * The maximum amount of memory that has ever been pinned to actual physical RAM.
8527 */
8528 peakWorkingSetSize: number;
8529 /**
8530 * The amount of memory not shared by other processes, such as JS heap or HTML
8531 * content.
8532 *
8533 * @platform win32
8534 */
8535 privateBytes?: number;
8536 /**
8537 * The amount of memory currently pinned to actual physical RAM.
8538 */
8539 workingSetSize: number;
8540 }
8541
8542 interface MemoryUsageDetails {
8543
8544 // Docs: https://electronjs.org/docs/api/structures/memory-usage-details
8545
8546 count: number;
8547 liveSize: number;
8548 size: number;
8549 }
8550
8551 class Menu extends NodeEventEmitter {
8552
8553 // Docs: https://electronjs.org/docs/api/menu
8554
8555 /**
8556 * Emitted when a popup is closed either manually or with `menu.closePopup()`.
8557 */
8558 on(event: 'menu-will-close', listener: (event: Event) => void): this;
8559 off(event: 'menu-will-close', listener: (event: Event) => void): this;
8560 once(event: 'menu-will-close', listener: (event: Event) => void): this;
8561 addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
8562 removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
8563 /**
8564 * Emitted when `menu.popup()` is called.
8565 */
8566 on(event: 'menu-will-show', listener: (event: Event) => void): this;
8567 off(event: 'menu-will-show', listener: (event: Event) => void): this;
8568 once(event: 'menu-will-show', listener: (event: Event) => void): this;
8569 addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
8570 removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
8571 /**
8572 * Menu
8573 */
8574 constructor();
8575 /**
8576 * Generally, the `template` is an array of `options` for constructing a MenuItem.
8577 * The usage can be referenced above.
8578 *
8579 * You can also attach other fields to the element of the `template` and they will
8580 * become properties of the constructed menu items.
8581 */
8582 static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
8583 /**
8584 * The application menu, if set, or `null`, if not set.
8585 *
8586 * **Note:** The returned `Menu` instance doesn't support dynamic addition or
8587 * removal of menu items. Instance properties can still be dynamically modified.
8588 */
8589 static getApplicationMenu(): (Menu) | (null);
8590 /**
8591 * Sends the `action` to the first responder of application. This is used for
8592 * emulating default macOS menu behaviors. Usually you would use the `role`
8593 * property of a `MenuItem`.
8594 *
8595 * See the macOS Cocoa Event Handling Guide for more information on macOS' native
8596 * actions.
8597 *
8598 * @platform darwin
8599 */
8600 static sendActionToFirstResponder(action: string): void;
8601 /**
8602 * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
8603 * will be set as each window's top menu.
8604 *
8605 * Also on Windows and Linux, you can use a `&` in the top-level item name to
8606 * indicate which letter should get a generated accelerator. For example, using
8607 * `&File` for the file menu would result in a generated `Alt-F` accelerator that
8608 * opens the associated menu. The indicated character in the button label then gets
8609 * an underline, and the `&` character is not displayed on the button label.
8610 *
8611 * In order to escape the `&` character in an item name, add a proceeding `&`. For
8612 * example, `&&File` would result in `&File` displayed on the button label.
8613 *
8614 * Passing `null` will suppress the default menu. On Windows and Linux, this has
8615 * the additional effect of removing the menu bar from the window.
8616 *
8617 * **Note:** The default menu will be created automatically if the app does not set
8618 * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
8619 * `Help`.
8620 */
8621 static setApplicationMenu(menu: (Menu) | (null)): void;
8622 /**
8623 * Appends the `menuItem` to the menu.
8624 */
8625 append(menuItem: MenuItem): void;
8626 /**
8627 * Closes the context menu in the `browserWindow`.
8628 */
8629 closePopup(browserWindow?: BrowserWindow): void;
8630 /**
8631 * the item with the specified `id`
8632 */
8633 getMenuItemById(id: string): (MenuItem) | (null);
8634 /**
8635 * Inserts the `menuItem` to the `pos` position of the menu.
8636 */
8637 insert(pos: number, menuItem: MenuItem): void;
8638 /**
8639 * Pops up this menu as a context menu in the `BrowserWindow`.
8640 */
8641 popup(options?: PopupOptions): void;
8642 /**
8643 * A `MenuItem[]` array containing the menu's items.
8644 *
8645 * Each `Menu` consists of multiple `MenuItem`s and each `MenuItem` can have a
8646 * submenu.
8647 */
8648 items: MenuItem[];
8649 }
8650
8651 class MenuItem {
8652
8653 // Docs: https://electronjs.org/docs/api/menu-item
8654
8655 /**
8656 * MenuItem
8657 */
8658 constructor(options: MenuItemConstructorOptions);
8659 /**
8660 * An `Accelerator` (optional) indicating the item's accelerator, if set.
8661 */
8662 accelerator?: Accelerator;
8663 /**
8664 * A `boolean` indicating whether the item is checked, this property can be
8665 * dynamically changed.
8666 *
8667 * A `checkbox` menu item will toggle the `checked` property on and off when
8668 * selected.
8669 *
8670 * A `radio` menu item will turn on its `checked` property when clicked, and will
8671 * turn off that property for all adjacent items in the same menu.
8672 *
8673 * You can add a `click` function for additional behavior.
8674 */
8675 checked: boolean;
8676 /**
8677 * A `Function` that is fired when the MenuItem receives a click event. It can be
8678 * called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
8679 *
8680 * * `event` KeyboardEvent
8681 * * `focusedWindow` BrowserWindow
8682 * * `focusedWebContents` WebContents
8683 */
8684 click: Function;
8685 /**
8686 * A `number` indicating an item's sequential unique id.
8687 */
8688 commandId: number;
8689 /**
8690 * A `boolean` indicating whether the item is enabled, this property can be
8691 * dynamically changed.
8692 */
8693 enabled: boolean;
8694 /**
8695 * A `NativeImage | string` (optional) indicating the item's icon, if set.
8696 */
8697 icon?: (NativeImage) | (string);
8698 /**
8699 * A `string` indicating the item's unique id, this property can be dynamically
8700 * changed.
8701 */
8702 id: string;
8703 /**
8704 * A `string` indicating the item's visible label.
8705 */
8706 label: string;
8707 /**
8708 * A `Menu` that the item is a part of.
8709 */
8710 menu: Menu;
8711 /**
8712 * A `boolean` indicating if the accelerator should be registered with the system
8713 * or just displayed.
8714 *
8715 * This property can be dynamically changed.
8716 */
8717 registerAccelerator: boolean;
8718 /**
8719 * A `string` (optional) indicating the item's role, if set. Can be `undo`, `redo`,
8720 * `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`,
8721 * `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`,
8722 * `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`,
8723 * `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
8724 * `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,
8725 * `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`,
8726 * `selectPreviousTab`, `showAllTabs`, `mergeAllWindows`, `clearRecentDocuments`,
8727 * `moveTabToNewWindow` or `windowMenu`
8728 */
8729 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');
8730 /**
8731 * A `SharingItem` indicating the item to share when the `role` is `shareMenu`.
8732 *
8733 * This property can be dynamically changed.
8734 *
8735 * @platform darwin
8736 */
8737 sharingItem: SharingItem;
8738 /**
8739 * A `string` indicating the item's sublabel.
8740 */
8741 sublabel: string;
8742 /**
8743 * A `Menu` (optional) containing the menu item's submenu, if present.
8744 */
8745 submenu?: Menu;
8746 /**
8747 * A `string` indicating the item's hover text.
8748 *
8749 * @platform darwin
8750 */
8751 toolTip: string;
8752 /**
8753 * A `string` indicating the type of the item. Can be `normal`, `separator`,
8754 * `submenu`, `checkbox` or `radio`.
8755 */
8756 type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
8757 /**
8758 * An `Accelerator | null` indicating the item's user-assigned accelerator for the
8759 * menu item.
8760 *
8761 * **Note:** This property is only initialized after the `MenuItem` has been added
8762 * to a `Menu`. Either via `Menu.buildFromTemplate` or via
8763 * `Menu.append()/insert()`. Accessing before initialization will just return
8764 * `null`.
8765 *
8766 * @platform darwin
8767 */
8768 readonly userAccelerator: (Accelerator) | (null);
8769 /**
8770 * A `boolean` indicating whether the item is visible, this property can be
8771 * dynamically changed.
8772 */
8773 visible: boolean;
8774 }
8775
8776 class MessageChannelMain extends NodeEventEmitter {
8777
8778 // Docs: https://electronjs.org/docs/api/message-channel-main
8779
8780 /**
8781 * A `MessagePortMain` property.
8782 */
8783 port1: MessagePortMain;
8784 /**
8785 * A `MessagePortMain` property.
8786 */
8787 port2: MessagePortMain;
8788 }
8789
8790 class MessagePortMain extends NodeEventEmitter {
8791
8792 // Docs: https://electronjs.org/docs/api/message-port-main
8793
8794 /**
8795 * Emitted when the remote end of a MessagePortMain object becomes disconnected.
8796 */
8797 on(event: 'close', listener: Function): this;
8798 off(event: 'close', listener: Function): this;
8799 once(event: 'close', listener: Function): this;
8800 addListener(event: 'close', listener: Function): this;
8801 removeListener(event: 'close', listener: Function): this;
8802 /**
8803 * Emitted when a MessagePortMain object receives a message.
8804 */
8805 on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
8806 off(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
8807 once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
8808 addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
8809 removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
8810 /**
8811 * Disconnects the port, so it is no longer active.
8812 */
8813 close(): void;
8814 /**
8815 * Sends a message from the port, and optionally, transfers ownership of objects to
8816 * other browsing contexts.
8817 */
8818 postMessage(message: any, transfer?: MessagePortMain[]): void;
8819 /**
8820 * Starts the sending of messages queued on the port. Messages will be queued until
8821 * this method is called.
8822 */
8823 start(): void;
8824 }
8825
8826 interface MimeTypedBuffer {
8827
8828 // Docs: https://electronjs.org/docs/api/structures/mime-typed-buffer
8829
8830 /**
8831 * Charset of the buffer.
8832 */
8833 charset?: string;
8834 /**
8835 * The actual Buffer content.
8836 */
8837 data: Buffer;
8838 /**
8839 * MIME type of the buffer.
8840 */
8841 mimeType?: string;
8842 }
8843
8844 interface MouseInputEvent extends InputEvent {
8845
8846 // Docs: https://electronjs.org/docs/api/structures/mouse-input-event
8847
8848 /**
8849 * The button pressed, can be `left`, `middle`, `right`.
8850 */
8851 button?: ('left' | 'middle' | 'right');
8852 clickCount?: number;
8853 globalX?: number;
8854 globalY?: number;
8855 movementX?: number;
8856 movementY?: number;
8857 /**
8858 * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
8859 * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
8860 */
8861 type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
8862 x: number;
8863 y: number;
8864 }
8865
8866 interface MouseWheelInputEvent extends MouseInputEvent {
8867
8868 // Docs: https://electronjs.org/docs/api/structures/mouse-wheel-input-event
8869
8870 accelerationRatioX?: number;
8871 accelerationRatioY?: number;
8872 canScroll?: boolean;
8873 deltaX?: number;
8874 deltaY?: number;
8875 hasPreciseScrollingDeltas?: boolean;
8876 /**
8877 * The type of the event, can be `mouseWheel`.
8878 */
8879 type: ('mouseWheel');
8880 wheelTicksX?: number;
8881 wheelTicksY?: number;
8882 }
8883
8884 class NativeImage {
8885
8886 // Docs: https://electronjs.org/docs/api/native-image
8887
8888 /**
8889 * Creates an empty `NativeImage` instance.
8890 */
8891 static createEmpty(): NativeImage;
8892 /**
8893 * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
8894 * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
8895 */
8896 static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
8897 /**
8898 * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
8899 * JPEG first.
8900 */
8901 static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
8902 /**
8903 * Creates a new `NativeImage` instance from `dataUrl`, a base 64 encoded Data URL
8904 * string.
8905 */
8906 static createFromDataURL(dataURL: string): NativeImage;
8907 /**
8908 * Creates a new `NativeImage` instance from the `NSImage` that maps to the given
8909 * image name. See Apple's `NSImageName` documentation for a list of possible
8910 * values.
8911 *
8912 * The `hslShift` is applied to the image with the following rules:
8913 *
8914 * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
8915 * and 360 on the hue color wheel (red).
8916 * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
8917 * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
8918 * saturate the image.
8919 * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
8920 * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
8921 * leave unchanged. 1 = full lightness (make all pixels white).
8922 *
8923 * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
8924 * 0]` will make the image completely black.
8925 *
8926 * In some cases, the `NSImageName` doesn't match its string representation; one
8927 * example of this is `NSFolderImageName`, whose string representation would
8928 * actually be `NSFolder`. Therefore, you'll need to determine the correct string
8929 * representation for your image before passing it in. This can be done with the
8930 * following:
8931 *
8932 * where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
8933 *
8934 * @platform darwin
8935 */
8936 static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
8937 /**
8938 * Creates a new `NativeImage` instance from a file located at `path`. This method
8939 * returns an empty image if the `path` does not exist, cannot be read, or is not a
8940 * valid image.
8941 */
8942 static createFromPath(path: string): NativeImage;
8943 /**
8944 * fulfilled with the file's thumbnail preview image, which is a NativeImage.
8945 *
8946 * Note: The Windows implementation will ignore `size.height` and scale the height
8947 * according to `size.width`.
8948 *
8949 * @platform darwin,win32
8950 */
8951 static createThumbnailFromPath(path: string, size: Size): Promise<Electron.NativeImage>;
8952 /**
8953 * Add an image representation for a specific scale factor. This can be used to
8954 * programmatically add different scale factor representations to an image. This
8955 * can be called on empty images.
8956 */
8957 addRepresentation(options: AddRepresentationOptions): void;
8958 /**
8959 * The cropped image.
8960 */
8961 crop(rect: Rectangle): NativeImage;
8962 /**
8963 * The image's aspect ratio (width divided by height).
8964 *
8965 * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
8966 * the image representation most closely matching the passed value.
8967 */
8968 getAspectRatio(scaleFactor?: number): number;
8969 /**
8970 * A Buffer that contains the image's raw bitmap pixel data.
8971 *
8972 * The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does
8973 * not copy the bitmap data, so you have to use the returned Buffer immediately in
8974 * current event loop tick; otherwise the data might be changed or destroyed.
8975 */
8976 getBitmap(options?: BitmapOptions): Buffer;
8977 /**
8978 * A Buffer that stores C pointer to underlying native handle of the image. On
8979 * macOS, a pointer to `NSImage` instance is returned.
8980 *
8981 * Notice that the returned pointer is a weak pointer to the underlying native
8982 * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
8983 * instance is kept around.
8984 *
8985 * @platform darwin
8986 */
8987 getNativeHandle(): Buffer;
8988 /**
8989 * An array of all scale factors corresponding to representations for a given
8990 * `NativeImage`.
8991 */
8992 getScaleFactors(): number[];
8993 /**
8994 * If `scaleFactor` is passed, this will return the size corresponding to the image
8995 * representation most closely matching the passed value.
8996 */
8997 getSize(scaleFactor?: number): Size;
8998 /**
8999 * Whether the image is empty.
9000 */
9001 isEmpty(): boolean;
9002 /**
9003 * Whether the image is a macOS template image.
9004 */
9005 isTemplateImage(): boolean;
9006 /**
9007 * The resized image.
9008 *
9009 * If only the `height` or the `width` are specified then the current aspect ratio
9010 * will be preserved in the resized image.
9011 */
9012 resize(options: ResizeOptions): NativeImage;
9013 /**
9014 * Marks the image as a macOS template image.
9015 */
9016 setTemplateImage(option: boolean): void;
9017 /**
9018 * A Buffer that contains a copy of the image's raw bitmap pixel data.
9019 */
9020 toBitmap(options?: ToBitmapOptions): Buffer;
9021 /**
9022 * The Data URL of the image.
9023 */
9024 toDataURL(options?: ToDataURLOptions): string;
9025 /**
9026 * A Buffer that contains the image's `JPEG` encoded data.
9027 */
9028 toJPEG(quality: number): Buffer;
9029 /**
9030 * A Buffer that contains the image's `PNG` encoded data.
9031 */
9032 toPNG(options?: ToPNGOptions): Buffer;
9033 /**
9034 * A `boolean` property that determines whether the image is considered a template
9035 * image.
9036 *
9037 * Please note that this property only has an effect on macOS.
9038 *
9039 * @platform darwin
9040 */
9041 isMacTemplateImage: boolean;
9042 }
9043
9044 interface NativeTheme extends NodeJS.EventEmitter {
9045
9046 // Docs: https://electronjs.org/docs/api/native-theme
9047
9048 /**
9049 * Emitted when something in the underlying NativeTheme has changed. This normally
9050 * means that either the value of `shouldUseDarkColors`,
9051 * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
9052 * will have to check them to determine which one has changed.
9053 */
9054 on(event: 'updated', listener: Function): this;
9055 off(event: 'updated', listener: Function): this;
9056 once(event: 'updated', listener: Function): this;
9057 addListener(event: 'updated', listener: Function): this;
9058 removeListener(event: 'updated', listener: Function): this;
9059 /**
9060 * A `boolean` indicating whether Chromium is in forced colors mode, controlled by
9061 * system accessibility settings. Currently, Windows high contrast is the only
9062 * system setting that triggers forced colors mode.
9063 *
9064 * @platform win32
9065 */
9066 readonly inForcedColorsMode: boolean;
9067 /**
9068 * A `boolean` for if the OS / Chromium currently has a dark mode enabled or is
9069 * being instructed to show a dark-style UI. If you want to modify this value you
9070 * should use `themeSource` below.
9071 *
9072 */
9073 readonly shouldUseDarkColors: boolean;
9074 /**
9075 * A `boolean` for if the OS / Chromium currently has high-contrast mode enabled or
9076 * is being instructed to show a high-contrast UI.
9077 *
9078 * @platform darwin,win32
9079 */
9080 readonly shouldUseHighContrastColors: boolean;
9081 /**
9082 * A `boolean` for if the OS / Chromium currently has an inverted color scheme or
9083 * is being instructed to use an inverted color scheme.
9084 *
9085 * @platform darwin,win32
9086 */
9087 readonly shouldUseInvertedColorScheme: boolean;
9088 /**
9089 * A `string` property that can be `system`, `light` or `dark`. It is used to
9090 * override and supersede the value that Chromium has chosen to use internally.
9091 *
9092 * Setting this property to `system` will remove the override and everything will
9093 * be reset to the OS default. By default `themeSource` is `system`.
9094 *
9095 * Settings this property to `dark` will have the following effects:
9096 *
9097 * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
9098 * * Any UI Electron renders on Linux and Windows including context menus,
9099 * devtools, etc. will use the dark UI.
9100 * * Any UI the OS renders on macOS including menus, window frames, etc. will use
9101 * the dark UI.
9102 * * The `prefers-color-scheme` CSS query will match `dark` mode.
9103 * * The `updated` event will be emitted
9104 *
9105 * Settings this property to `light` will have the following effects:
9106 *
9107 * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
9108 * * Any UI Electron renders on Linux and Windows including context menus,
9109 * devtools, etc. will use the light UI.
9110 * * Any UI the OS renders on macOS including menus, window frames, etc. will use
9111 * the light UI.
9112 * * The `prefers-color-scheme` CSS query will match `light` mode.
9113 * * The `updated` event will be emitted
9114 *
9115 * The usage of this property should align with a classic "dark mode" state machine
9116 * in your application where the user has three options.
9117 *
9118 * * `Follow OS` --> `themeSource = 'system'`
9119 * * `Dark Mode` --> `themeSource = 'dark'`
9120 * * `Light Mode` --> `themeSource = 'light'`
9121 *
9122 * Your application should then always use `shouldUseDarkColors` to determine what
9123 * CSS to apply.
9124 */
9125 themeSource: ('system' | 'light' | 'dark');
9126 }
9127
9128 class NavigationHistory extends NodeEventEmitter {
9129
9130 // Docs: https://electronjs.org/docs/api/navigation-history
9131
9132 /**
9133 * The index of the current page, from which we would go back/forward or reload.
9134 */
9135 getActiveIndex(): number;
9136 /**
9137 * * `url` string - The URL of the navigation entry at the given index.
9138 * * `title` string - The page title of the navigation entry at the given index.
9139 *
9140 * If index is out of bounds (greater than history length or less than 0), null
9141 * will be returned.
9142 */
9143 getEntryAtIndex(index: number): EntryAtIndex;
9144 /**
9145 * History length.
9146 */
9147 length(): number;
9148 }
9149
9150 interface Net {
9151
9152 // Docs: https://electronjs.org/docs/api/net
9153
9154 /**
9155 * see Response.
9156 *
9157 * Sends a request, similarly to how `fetch()` works in the renderer, using
9158 * Chrome's network stack. This differs from Node's `fetch()`, which uses Node.js's
9159 * HTTP stack.
9160 *
9161 * Example:
9162 *
9163 * This method will issue requests from the default session. To send a `fetch`
9164 * request from another session, use ses.fetch().
9165 *
9166 * See the MDN documentation for `fetch()` for more details.
9167 *
9168 * Limitations:
9169 *
9170 * * `net.fetch()` does not support the `data:` or `blob:` schemes.
9171 * * The value of the `integrity` option is ignored.
9172 * * The `.type` and `.url` values of the returned `Response` object are incorrect.
9173 *
9174 * By default, requests made with `net.fetch` can be made to custom protocols as
9175 * well as `file:`, and will trigger webRequest handlers if present. When the
9176 * non-standard `bypassCustomProtocolHandlers` option is set in RequestInit, custom
9177 * protocol handlers will not be called for this request. This allows forwarding an
9178 * intercepted request to the built-in handler. webRequest handlers will still be
9179 * triggered when bypassing custom protocols.
9180 *
9181 * Note: in the utility process custom protocols are not supported.
9182 */
9183 fetch(input: (string) | (GlobalRequest), init?: RequestInit & { bypassCustomProtocolHandlers?: boolean }): Promise<GlobalResponse>;
9184 /**
9185 * Whether there is currently internet connection.
9186 *
9187 * A return value of `false` is a pretty strong indicator that the user won't be
9188 * able to connect to remote sites. However, a return value of `true` is
9189 * inconclusive; even if some link is up, it is uncertain whether a particular
9190 * connection attempt to a particular remote site will be successful.
9191 */
9192 isOnline(): boolean;
9193 /**
9194 * Creates a `ClientRequest` instance using the provided `options` which are
9195 * directly forwarded to the `ClientRequest` constructor. The `net.request` method
9196 * would be used to issue both secure and insecure HTTP requests according to the
9197 * specified protocol scheme in the `options` object.
9198 */
9199 request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
9200 /**
9201 * Resolves with the resolved IP addresses for the `host`.
9202 *
9203 * This method will resolve hosts from the default session. To resolve a host from
9204 * another session, use ses.resolveHost().
9205 */
9206 resolveHost(host: string, options?: ResolveHostOptions): Promise<Electron.ResolvedHost>;
9207 /**
9208 * A `boolean` property. Whether there is currently internet connection.
9209 *
9210 * A return value of `false` is a pretty strong indicator that the user won't be
9211 * able to connect to remote sites. However, a return value of `true` is
9212 * inconclusive; even if some link is up, it is uncertain whether a particular
9213 * connection attempt to a particular remote site will be successful.
9214 *
9215 */
9216 readonly online: boolean;
9217 }
9218
9219 interface NetLog {
9220
9221 // Docs: https://electronjs.org/docs/api/net-log
9222
9223 /**
9224 * resolves when the net log has begun recording.
9225 *
9226 * Starts recording network events to `path`.
9227 */
9228 startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
9229 /**
9230 * resolves when the net log has been flushed to disk.
9231 *
9232 * Stops recording network events. If not called, net logging will automatically
9233 * end when app quits.
9234 */
9235 stopLogging(): Promise<void>;
9236 /**
9237 * A `boolean` property that indicates whether network logs are currently being
9238 * recorded.
9239 *
9240 */
9241 readonly currentlyLogging: boolean;
9242 }
9243
9244 class Notification extends NodeEventEmitter {
9245
9246 // Docs: https://electronjs.org/docs/api/notification
9247
9248 /**
9249 * @platform darwin
9250 */
9251 on(event: 'action', listener: (event: Event,
9252 /**
9253 * The index of the action that was activated.
9254 */
9255 index: number) => void): this;
9256 /**
9257 * @platform darwin
9258 */
9259 off(event: 'action', listener: (event: Event,
9260 /**
9261 * The index of the action that was activated.
9262 */
9263 index: number) => void): this;
9264 /**
9265 * @platform darwin
9266 */
9267 once(event: 'action', listener: (event: Event,
9268 /**
9269 * The index of the action that was activated.
9270 */
9271 index: number) => void): this;
9272 /**
9273 * @platform darwin
9274 */
9275 addListener(event: 'action', listener: (event: Event,
9276 /**
9277 * The index of the action that was activated.
9278 */
9279 index: number) => void): this;
9280 /**
9281 * @platform darwin
9282 */
9283 removeListener(event: 'action', listener: (event: Event,
9284 /**
9285 * The index of the action that was activated.
9286 */
9287 index: number) => void): this;
9288 /**
9289 * Emitted when the notification is clicked by the user.
9290 */
9291 on(event: 'click', listener: (event: Event) => void): this;
9292 off(event: 'click', listener: (event: Event) => void): this;
9293 once(event: 'click', listener: (event: Event) => void): this;
9294 addListener(event: 'click', listener: (event: Event) => void): this;
9295 removeListener(event: 'click', listener: (event: Event) => void): this;
9296 /**
9297 * Emitted when the notification is closed by manual intervention from the user.
9298 *
9299 * This event is not guaranteed to be emitted in all cases where the notification
9300 * is closed.
9301 *
9302 * On Windows, the `close` event can be emitted in one of three ways: programmatic
9303 * dismissal with `notification.close()`, by the user closing the notification, or
9304 * via system timeout. If a notification is in the Action Center after the initial
9305 * `close` event is emitted, a call to `notification.close()` will remove the
9306 * notification from the action center but the `close` event will not be emitted
9307 * again.
9308 */
9309 on(event: 'close', listener: (event: Event) => void): this;
9310 off(event: 'close', listener: (event: Event) => void): this;
9311 once(event: 'close', listener: (event: Event) => void): this;
9312 addListener(event: 'close', listener: (event: Event) => void): this;
9313 removeListener(event: 'close', listener: (event: Event) => void): this;
9314 /**
9315 * Emitted when an error is encountered while creating and showing the native
9316 * notification.
9317 *
9318 * @platform win32
9319 */
9320 on(event: 'failed', listener: (event: Event,
9321 /**
9322 * The error encountered during execution of the `show()` method.
9323 */
9324 error: string) => void): this;
9325 /**
9326 * @platform win32
9327 */
9328 off(event: 'failed', listener: (event: Event,
9329 /**
9330 * The error encountered during execution of the `show()` method.
9331 */
9332 error: string) => void): this;
9333 /**
9334 * @platform win32
9335 */
9336 once(event: 'failed', listener: (event: Event,
9337 /**
9338 * The error encountered during execution of the `show()` method.
9339 */
9340 error: string) => void): this;
9341 /**
9342 * @platform win32
9343 */
9344 addListener(event: 'failed', listener: (event: Event,
9345 /**
9346 * The error encountered during execution of the `show()` method.
9347 */
9348 error: string) => void): this;
9349 /**
9350 * @platform win32
9351 */
9352 removeListener(event: 'failed', listener: (event: Event,
9353 /**
9354 * The error encountered during execution of the `show()` method.
9355 */
9356 error: string) => void): this;
9357 /**
9358 * Emitted when the user clicks the "Reply" button on a notification with
9359 * `hasReply: true`.
9360 *
9361 * @platform darwin
9362 */
9363 on(event: 'reply', listener: (event: Event,
9364 /**
9365 * The string the user entered into the inline reply field.
9366 */
9367 reply: string) => void): this;
9368 /**
9369 * @platform darwin
9370 */
9371 off(event: 'reply', listener: (event: Event,
9372 /**
9373 * The string the user entered into the inline reply field.
9374 */
9375 reply: string) => void): this;
9376 /**
9377 * @platform darwin
9378 */
9379 once(event: 'reply', listener: (event: Event,
9380 /**
9381 * The string the user entered into the inline reply field.
9382 */
9383 reply: string) => void): this;
9384 /**
9385 * @platform darwin
9386 */
9387 addListener(event: 'reply', listener: (event: Event,
9388 /**
9389 * The string the user entered into the inline reply field.
9390 */
9391 reply: string) => void): this;
9392 /**
9393 * @platform darwin
9394 */
9395 removeListener(event: 'reply', listener: (event: Event,
9396 /**
9397 * The string the user entered into the inline reply field.
9398 */
9399 reply: string) => void): this;
9400 /**
9401 * Emitted when the notification is shown to the user. Note that this event can be
9402 * fired multiple times as a notification can be shown multiple times through the
9403 * `show()` method.
9404 */
9405 on(event: 'show', listener: (event: Event) => void): this;
9406 off(event: 'show', listener: (event: Event) => void): this;
9407 once(event: 'show', listener: (event: Event) => void): this;
9408 addListener(event: 'show', listener: (event: Event) => void): this;
9409 removeListener(event: 'show', listener: (event: Event) => void): this;
9410 /**
9411 * Notification
9412 */
9413 constructor(options?: NotificationConstructorOptions);
9414 /**
9415 * Whether or not desktop notifications are supported on the current system
9416 */
9417 static isSupported(): boolean;
9418 /**
9419 * Dismisses the notification.
9420 *
9421 * On Windows, calling `notification.close()` while the notification is visible on
9422 * screen will dismiss the notification and remove it from the Action Center. If
9423 * `notification.close()` is called after the notification is no longer visible on
9424 * screen, calling `notification.close()` will try remove it from the Action
9425 * Center.
9426 */
9427 close(): void;
9428 /**
9429 * Immediately shows the notification to the user. Unlike the web notification API,
9430 * instantiating a `new Notification()` does not immediately show it to the user.
9431 * Instead, you need to call this method before the OS will display it.
9432 *
9433 * If the notification has been shown before, this method will dismiss the
9434 * previously shown notification and create a new one with identical properties.
9435 */
9436 show(): void;
9437 /**
9438 * A `NotificationAction[]` property representing the actions of the notification.
9439 */
9440 actions: NotificationAction[];
9441 /**
9442 * A `string` property representing the body of the notification.
9443 */
9444 body: string;
9445 /**
9446 * A `string` property representing the close button text of the notification.
9447 */
9448 closeButtonText: string;
9449 /**
9450 * A `boolean` property representing whether the notification has a reply action.
9451 */
9452 hasReply: boolean;
9453 /**
9454 * A `string` property representing the reply placeholder of the notification.
9455 */
9456 replyPlaceholder: string;
9457 /**
9458 * A `boolean` property representing whether the notification is silent.
9459 */
9460 silent: boolean;
9461 /**
9462 * A `string` property representing the sound of the notification.
9463 */
9464 sound: string;
9465 /**
9466 * A `string` property representing the subtitle of the notification.
9467 */
9468 subtitle: string;
9469 /**
9470 * A `string` property representing the type of timeout duration for the
9471 * notification. Can be 'default' or 'never'.
9472 *
9473 * If `timeoutType` is set to 'never', the notification never expires. It stays
9474 * open until closed by the calling API or the user.
9475 *
9476 * @platform linux,win32
9477 */
9478 timeoutType: ('default' | 'never');
9479 /**
9480 * A `string` property representing the title of the notification.
9481 */
9482 title: string;
9483 /**
9484 * A `string` property representing the custom Toast XML of the notification.
9485 *
9486 * @platform win32
9487 */
9488 toastXml: string;
9489 /**
9490 * A `string` property representing the urgency level of the notification. Can be
9491 * 'normal', 'critical', or 'low'.
9492 *
9493 * Default is 'low' - see NotifyUrgency for more information.
9494 *
9495 * @platform linux
9496 */
9497 urgency: ('normal' | 'critical' | 'low');
9498 }
9499
9500 interface NotificationAction {
9501
9502 // Docs: https://electronjs.org/docs/api/structures/notification-action
9503
9504 /**
9505 * The label for the given action.
9506 */
9507 text?: string;
9508 /**
9509 * The type of action, can be `button`.
9510 */
9511 type: ('button');
9512 }
9513
9514 interface NotificationResponse {
9515
9516 // Docs: https://electronjs.org/docs/api/structures/notification-response
9517
9518 /**
9519 * The identifier string of the action that the user selected.
9520 */
9521 actionIdentifier: string;
9522 /**
9523 * The delivery date of the notification.
9524 */
9525 date: number;
9526 /**
9527 * The unique identifier for this notification request.
9528 */
9529 identifier: string;
9530 /**
9531 * A dictionary of custom information associated with the notification.
9532 */
9533 userInfo: Record<string, any>;
9534 /**
9535 * The text entered or chosen by the user.
9536 */
9537 userText?: string;
9538 }
9539
9540 interface OpenExternalPermissionRequest extends PermissionRequest {
9541
9542 // Docs: https://electronjs.org/docs/api/structures/open-external-permission-request
9543
9544 /**
9545 * The url of the `openExternal` request.
9546 */
9547 externalURL?: string;
9548 }
9549
9550 interface ParentPort extends NodeJS.EventEmitter {
9551
9552 // Docs: https://electronjs.org/docs/api/parent-port
9553
9554 /**
9555 * Emitted when the process receives a message. Messages received on this port will
9556 * be queued up until a handler is registered for this event.
9557 */
9558 on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
9559 off(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
9560 once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
9561 addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
9562 removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
9563 /**
9564 * Sends a message from the process to its parent.
9565 */
9566 postMessage(message: any): void;
9567 }
9568
9569 interface PaymentDiscount {
9570
9571 // Docs: https://electronjs.org/docs/api/structures/payment-discount
9572
9573 /**
9574 * A string used to uniquely identify a discount offer for a product.
9575 */
9576 identifier: string;
9577 /**
9578 * A string that identifies the key used to generate the signature.
9579 */
9580 keyIdentifier: string;
9581 /**
9582 * A universally unique ID (UUID) value that you define.
9583 */
9584 nonce: string;
9585 /**
9586 * A UTF-8 string representing the properties of a specific discount offer,
9587 * cryptographically signed.
9588 */
9589 signature: string;
9590 /**
9591 * The date and time of the signature's creation in milliseconds, formatted in Unix
9592 * epoch time.
9593 */
9594 timestamp: number;
9595 }
9596
9597 interface PermissionRequest {
9598
9599 // Docs: https://electronjs.org/docs/api/structures/permission-request
9600
9601 /**
9602 * Whether the frame making the request is the main frame.
9603 */
9604 isMainFrame: boolean;
9605 /**
9606 * The last URL the requesting frame loaded.
9607 */
9608 requestingUrl: string;
9609 }
9610
9611 interface Point {
9612
9613 // Docs: https://electronjs.org/docs/api/structures/point
9614
9615 x: number;
9616 y: number;
9617 }
9618
9619 interface PostBody {
9620
9621 // Docs: https://electronjs.org/docs/api/structures/post-body
9622
9623 /**
9624 * The boundary used to separate multiple parts of the message. Only valid when
9625 * `contentType` is `multipart/form-data`.
9626 */
9627 boundary?: string;
9628 /**
9629 * The `content-type` header used for the data. One of
9630 * `application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to the
9631 * `enctype` attribute of the submitted HTML form.
9632 */
9633 contentType: string;
9634 /**
9635 * The post data to be sent to the new window.
9636 */
9637 data: Array<(UploadRawData) | (UploadFile)>;
9638 }
9639
9640 interface PowerMonitor extends NodeJS.EventEmitter {
9641
9642 // Docs: https://electronjs.org/docs/api/power-monitor
9643
9644 /**
9645 * Emitted when the system is about to lock the screen.
9646 *
9647 * @platform darwin,win32
9648 */
9649 on(event: 'lock-screen', listener: Function): this;
9650 /**
9651 * @platform darwin,win32
9652 */
9653 off(event: 'lock-screen', listener: Function): this;
9654 /**
9655 * @platform darwin,win32
9656 */
9657 once(event: 'lock-screen', listener: Function): this;
9658 /**
9659 * @platform darwin,win32
9660 */
9661 addListener(event: 'lock-screen', listener: Function): this;
9662 /**
9663 * @platform darwin,win32
9664 */
9665 removeListener(event: 'lock-screen', listener: Function): this;
9666 /**
9667 * Emitted when the system changes to AC power.
9668 *
9669 * @platform darwin,win32
9670 */
9671 on(event: 'on-ac', listener: Function): this;
9672 /**
9673 * @platform darwin,win32
9674 */
9675 off(event: 'on-ac', listener: Function): this;
9676 /**
9677 * @platform darwin,win32
9678 */
9679 once(event: 'on-ac', listener: Function): this;
9680 /**
9681 * @platform darwin,win32
9682 */
9683 addListener(event: 'on-ac', listener: Function): this;
9684 /**
9685 * @platform darwin,win32
9686 */
9687 removeListener(event: 'on-ac', listener: Function): this;
9688 /**
9689 * Emitted when system changes to battery power.
9690 *
9691 * @platform darwin
9692 */
9693 on(event: 'on-battery', listener: Function): this;
9694 /**
9695 * @platform darwin
9696 */
9697 off(event: 'on-battery', listener: Function): this;
9698 /**
9699 * @platform darwin
9700 */
9701 once(event: 'on-battery', listener: Function): this;
9702 /**
9703 * @platform darwin
9704 */
9705 addListener(event: 'on-battery', listener: Function): this;
9706 /**
9707 * @platform darwin
9708 */
9709 removeListener(event: 'on-battery', listener: Function): this;
9710 /**
9711 * Emitted when system is resuming.
9712 */
9713 on(event: 'resume', listener: Function): this;
9714 off(event: 'resume', listener: Function): this;
9715 once(event: 'resume', listener: Function): this;
9716 addListener(event: 'resume', listener: Function): this;
9717 removeListener(event: 'resume', listener: Function): this;
9718 /**
9719 * Emitted when the system is about to reboot or shut down. If the event handler
9720 * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
9721 * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
9722 * should exit as soon as possible by calling something like `app.quit()`.
9723 *
9724 * @platform linux,darwin
9725 */
9726 on(event: 'shutdown', listener: Function): this;
9727 /**
9728 * @platform linux,darwin
9729 */
9730 off(event: 'shutdown', listener: Function): this;
9731 /**
9732 * @platform linux,darwin
9733 */
9734 once(event: 'shutdown', listener: Function): this;
9735 /**
9736 * @platform linux,darwin
9737 */
9738 addListener(event: 'shutdown', listener: Function): this;
9739 /**
9740 * @platform linux,darwin
9741 */
9742 removeListener(event: 'shutdown', listener: Function): this;
9743 /**
9744 * Notification of a change in the operating system's advertised speed limit for
9745 * CPUs, in percent. Values below 100 indicate that the system is impairing
9746 * processing power due to thermal management.
9747 *
9748 * @platform darwin,win32
9749 */
9750 on(event: 'speed-limit-change', listener: Function): this;
9751 /**
9752 * @platform darwin,win32
9753 */
9754 off(event: 'speed-limit-change', listener: Function): this;
9755 /**
9756 * @platform darwin,win32
9757 */
9758 once(event: 'speed-limit-change', listener: Function): this;
9759 /**
9760 * @platform darwin,win32
9761 */
9762 addListener(event: 'speed-limit-change', listener: Function): this;
9763 /**
9764 * @platform darwin,win32
9765 */
9766 removeListener(event: 'speed-limit-change', listener: Function): this;
9767 /**
9768 * Emitted when the system is suspending.
9769 */
9770 on(event: 'suspend', listener: Function): this;
9771 off(event: 'suspend', listener: Function): this;
9772 once(event: 'suspend', listener: Function): this;
9773 addListener(event: 'suspend', listener: Function): this;
9774 removeListener(event: 'suspend', listener: Function): this;
9775 /**
9776 * Emitted when the thermal state of the system changes. Notification of a change
9777 * in the thermal status of the system, such as entering a critical temperature
9778 * range. Depending on the severity, the system might take steps to reduce said
9779 * temperature, for example, throttling the CPU or switching on the fans if
9780 * available.
9781 *
9782 * Apps may react to the new state by reducing expensive computing tasks (e.g.
9783 * video encoding), or notifying the user. The same state might be received
9784 * repeatedly.
9785 *
9786 * See
9787 * https://developer.apple.com/library/archive/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/RespondToThermalStateChanges.html
9788 *
9789 * @platform darwin
9790 */
9791 on(event: 'thermal-state-change', listener: Function): this;
9792 /**
9793 * @platform darwin
9794 */
9795 off(event: 'thermal-state-change', listener: Function): this;
9796 /**
9797 * @platform darwin
9798 */
9799 once(event: 'thermal-state-change', listener: Function): this;
9800 /**
9801 * @platform darwin
9802 */
9803 addListener(event: 'thermal-state-change', listener: Function): this;
9804 /**
9805 * @platform darwin
9806 */
9807 removeListener(event: 'thermal-state-change', listener: Function): this;
9808 /**
9809 * Emitted as soon as the systems screen is unlocked.
9810 *
9811 * @platform darwin,win32
9812 */
9813 on(event: 'unlock-screen', listener: Function): this;
9814 /**
9815 * @platform darwin,win32
9816 */
9817 off(event: 'unlock-screen', listener: Function): this;
9818 /**
9819 * @platform darwin,win32
9820 */
9821 once(event: 'unlock-screen', listener: Function): this;
9822 /**
9823 * @platform darwin,win32
9824 */
9825 addListener(event: 'unlock-screen', listener: Function): this;
9826 /**
9827 * @platform darwin,win32
9828 */
9829 removeListener(event: 'unlock-screen', listener: Function): this;
9830 /**
9831 * Emitted when a login session is activated. See documentation for more
9832 * information.
9833 *
9834 * @platform darwin
9835 */
9836 on(event: 'user-did-become-active', listener: Function): this;
9837 /**
9838 * @platform darwin
9839 */
9840 off(event: 'user-did-become-active', listener: Function): this;
9841 /**
9842 * @platform darwin
9843 */
9844 once(event: 'user-did-become-active', listener: Function): this;
9845 /**
9846 * @platform darwin
9847 */
9848 addListener(event: 'user-did-become-active', listener: Function): this;
9849 /**
9850 * @platform darwin
9851 */
9852 removeListener(event: 'user-did-become-active', listener: Function): this;
9853 /**
9854 * Emitted when a login session is deactivated. See documentation for more
9855 * information.
9856 *
9857 * @platform darwin
9858 */
9859 on(event: 'user-did-resign-active', listener: Function): this;
9860 /**
9861 * @platform darwin
9862 */
9863 off(event: 'user-did-resign-active', listener: Function): this;
9864 /**
9865 * @platform darwin
9866 */
9867 once(event: 'user-did-resign-active', listener: Function): this;
9868 /**
9869 * @platform darwin
9870 */
9871 addListener(event: 'user-did-resign-active', listener: Function): this;
9872 /**
9873 * @platform darwin
9874 */
9875 removeListener(event: 'user-did-resign-active', listener: Function): this;
9876 /**
9877 * The system's current thermal state. Can be `unknown`, `nominal`, `fair`,
9878 * `serious`, or `critical`.
9879 *
9880 * @platform darwin
9881 */
9882 getCurrentThermalState(): ('unknown' | 'nominal' | 'fair' | 'serious' | 'critical');
9883 /**
9884 * The system's current idle state. Can be `active`, `idle`, `locked` or `unknown`.
9885 *
9886 * Calculate the system idle state. `idleThreshold` is the amount of time (in
9887 * seconds) before considered idle. `locked` is available on supported systems
9888 * only.
9889 */
9890 getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
9891 /**
9892 * Idle time in seconds
9893 *
9894 * Calculate system idle time in seconds.
9895 */
9896 getSystemIdleTime(): number;
9897 /**
9898 * Whether the system is on battery power.
9899 *
9900 * To monitor for changes in this property, use the `on-battery` and `on-ac`
9901 * events.
9902 */
9903 isOnBatteryPower(): boolean;
9904 /**
9905 * A `boolean` property. True if the system is on battery power.
9906 *
9907 * See `powerMonitor.isOnBatteryPower()`.
9908 */
9909 onBatteryPower: boolean;
9910 }
9911
9912 interface PowerSaveBlocker {
9913
9914 // Docs: https://electronjs.org/docs/api/power-save-blocker
9915
9916 /**
9917 * Whether the corresponding `powerSaveBlocker` has started.
9918 */
9919 isStarted(id: number): boolean;
9920 /**
9921 * The blocker ID that is assigned to this power blocker.
9922 *
9923 * Starts preventing the system from entering lower-power mode. Returns an integer
9924 * identifying the power save blocker.
9925 *
9926 * **Note:** `prevent-display-sleep` has higher precedence over
9927 * `prevent-app-suspension`. Only the highest precedence type takes effect. In
9928 * other words, `prevent-display-sleep` always takes precedence over
9929 * `prevent-app-suspension`.
9930 *
9931 * For example, an API calling A requests for `prevent-app-suspension`, and another
9932 * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
9933 * used until B stops its request. After that, `prevent-app-suspension` is used.
9934 */
9935 start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
9936 /**
9937 * Stops the specified power save blocker.
9938 *
9939 * Whether the specified `powerSaveBlocker` has been stopped.
9940 */
9941 stop(id: number): boolean;
9942 }
9943
9944 interface PrinterInfo {
9945
9946 // Docs: https://electronjs.org/docs/api/structures/printer-info
9947
9948 /**
9949 * a longer description of the printer's type.
9950 */
9951 description: string;
9952 /**
9953 * the name of the printer as shown in Print Preview.
9954 */
9955 displayName: string;
9956 /**
9957 * whether or not a given printer is set as the default printer on the OS.
9958 */
9959 isDefault: boolean;
9960 /**
9961 * the name of the printer as understood by the OS.
9962 */
9963 name: string;
9964 /**
9965 * an object containing a variable number of platform-specific printer information.
9966 */
9967 options: Options;
9968 /**
9969 * the current status of the printer.
9970 */
9971 status: number;
9972 }
9973
9974 interface ProcessMemoryInfo {
9975
9976 // Docs: https://electronjs.org/docs/api/structures/process-memory-info
9977
9978 /**
9979 * The amount of memory not shared by other processes, such as JS heap or HTML
9980 * content in Kilobytes.
9981 */
9982 private: number;
9983 /**
9984 * The amount of memory currently pinned to actual physical RAM in Kilobytes.
9985 *
9986 * @platform linux,win32
9987 */
9988 residentSet: number;
9989 /**
9990 * The amount of memory shared between processes, typically memory consumed by the
9991 * Electron code itself in Kilobytes.
9992 */
9993 shared: number;
9994 }
9995
9996 interface ProcessMetric {
9997
9998 // Docs: https://electronjs.org/docs/api/structures/process-metric
9999
10000 /**
10001 * CPU usage of the process.
10002 */
10003 cpu: CPUUsage;
10004 /**
10005 * Creation time for this process. The time is represented as number of
10006 * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
10007 * is useful to use both the `pid` and the `creationTime` to uniquely identify a
10008 * process.
10009 */
10010 creationTime: number;
10011 /**
10012 * One of the following values:
10013 *
10014 * @platform win32
10015 */
10016 integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
10017 /**
10018 * Memory information for the process.
10019 */
10020 memory: MemoryInfo;
10021 /**
10022 * The name of the process. Examples for utility: `Audio Service`, `Content
10023 * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
10024 */
10025 name?: string;
10026 /**
10027 * Process id of the process.
10028 */
10029 pid: number;
10030 /**
10031 * Whether the process is sandboxed on OS level.
10032 *
10033 * @platform darwin,win32
10034 */
10035 sandboxed?: boolean;
10036 /**
10037 * The non-localized name of the process.
10038 */
10039 serviceName?: string;
10040 /**
10041 * Process type. One of the following values:
10042 */
10043 type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
10044 }
10045
10046 interface Product {
10047
10048 // Docs: https://electronjs.org/docs/api/structures/product
10049
10050 /**
10051 * 3 character code presenting a product's currency based on the ISO 4217 standard.
10052 */
10053 currencyCode: string;
10054 /**
10055 * An array of discount offers
10056 */
10057 discounts: ProductDiscount[];
10058 /**
10059 * The total size of the content, in bytes.
10060 */
10061 downloadContentLengths: number[];
10062 /**
10063 * A string that identifies the version of the content.
10064 */
10065 downloadContentVersion: string;
10066 /**
10067 * The locale formatted price of the product.
10068 */
10069 formattedPrice: string;
10070 /**
10071 * The object containing introductory price information for the product. available
10072 * for the product.
10073 */
10074 introductoryPrice?: ProductDiscount;
10075 /**
10076 * A boolean value that indicates whether the App Store has downloadable content
10077 * for this product. `true` if at least one file has been associated with the
10078 * product.
10079 */
10080 isDownloadable: boolean;
10081 /**
10082 * A description of the product.
10083 */
10084 localizedDescription: string;
10085 /**
10086 * The name of the product.
10087 */
10088 localizedTitle: string;
10089 /**
10090 * The cost of the product in the local currency.
10091 */
10092 price: number;
10093 /**
10094 * The string that identifies the product to the Apple App Store.
10095 */
10096 productIdentifier: string;
10097 /**
10098 * The identifier of the subscription group to which the subscription belongs.
10099 */
10100 subscriptionGroupIdentifier: string;
10101 /**
10102 * The period details for products that are subscriptions.
10103 */
10104 subscriptionPeriod?: ProductSubscriptionPeriod;
10105 }
10106
10107 interface ProductDiscount {
10108
10109 // Docs: https://electronjs.org/docs/api/structures/product-discount
10110
10111 /**
10112 * A string used to uniquely identify a discount offer for a product.
10113 */
10114 identifier: string;
10115 /**
10116 * An integer that indicates the number of periods the product discount is
10117 * available.
10118 */
10119 numberOfPeriods: number;
10120 /**
10121 * The payment mode for this product discount. Can be `payAsYouGo`, `payUpFront`,
10122 * or `freeTrial`.
10123 */
10124 paymentMode: ('payAsYouGo' | 'payUpFront' | 'freeTrial');
10125 /**
10126 * The discount price of the product in the local currency.
10127 */
10128 price: number;
10129 /**
10130 * The locale used to format the discount price of the product.
10131 */
10132 priceLocale: string;
10133 /**
10134 * An object that defines the period for the product discount.
10135 */
10136 subscriptionPeriod?: ProductSubscriptionPeriod;
10137 /**
10138 * The type of discount offer.
10139 */
10140 type: number;
10141 }
10142
10143 interface ProductSubscriptionPeriod {
10144
10145 // Docs: https://electronjs.org/docs/api/structures/product-subscription-period
10146
10147 /**
10148 * The number of units per subscription period.
10149 */
10150 numberOfUnits: number;
10151 /**
10152 * The increment of time that a subscription period is specified in. Can be `day`,
10153 * `week`, `month`, `year`.
10154 */
10155 unit: ('day' | 'week' | 'month' | 'year');
10156 }
10157
10158 interface Protocol {
10159
10160 // Docs: https://electronjs.org/docs/api/protocol
10161
10162 /**
10163 * Register a protocol handler for `scheme`. Requests made to URLs with this scheme
10164 * will delegate to this handler to determine what response should be sent.
10165 *
10166 * Either a `Response` or a `Promise<Response>` can be returned.
10167 *
10168 * Example:
10169 *
10170 * See the MDN docs for `Request` and `Response` for more details.
10171 */
10172 handle(scheme: string, handler: (request: GlobalRequest) => (GlobalResponse) | (Promise<GlobalResponse>)): void;
10173 /**
10174 * Whether the protocol was successfully intercepted
10175 *
10176 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
10177 * which sends a `Buffer` as a response.
10178 *
10179 * @deprecated
10180 */
10181 interceptBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
10182 /**
10183 * Whether the protocol was successfully intercepted
10184 *
10185 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
10186 * which sends a file as a response.
10187 *
10188 * @deprecated
10189 */
10190 interceptFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
10191 /**
10192 * Whether the protocol was successfully intercepted
10193 *
10194 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
10195 * which sends a new HTTP request as a response.
10196 *
10197 * @deprecated
10198 */
10199 interceptHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
10200 /**
10201 * Whether the protocol was successfully intercepted
10202 *
10203 * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
10204 * protocol handler.
10205 *
10206 * @deprecated
10207 */
10208 interceptStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
10209 /**
10210 * Whether the protocol was successfully intercepted
10211 *
10212 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
10213 * which sends a `string` as a response.
10214 *
10215 * @deprecated
10216 */
10217 interceptStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
10218 /**
10219 * Whether `scheme` is already handled.
10220 */
10221 isProtocolHandled(scheme: string): boolean;
10222 /**
10223 * Whether `scheme` is already intercepted.
10224 *
10225 * @deprecated
10226 */
10227 isProtocolIntercepted(scheme: string): boolean;
10228 /**
10229 * Whether `scheme` is already registered.
10230 *
10231 * @deprecated
10232 */
10233 isProtocolRegistered(scheme: string): boolean;
10234 /**
10235 * Whether the protocol was successfully registered
10236 *
10237 * Registers a protocol of `scheme` that will send a `Buffer` as a response.
10238 *
10239 * The usage is the same with `registerFileProtocol`, except that the `callback`
10240 * should be called with either a `Buffer` object or an object that has the `data`
10241 * property.
10242 *
10243 * Example:
10244 *
10245 * @deprecated
10246 */
10247 registerBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
10248 /**
10249 * Whether the protocol was successfully registered
10250 *
10251 * Registers a protocol of `scheme` that will send a file as the response. The
10252 * `handler` will be called with `request` and `callback` where `request` is an
10253 * incoming request for the `scheme`.
10254 *
10255 * To handle the `request`, the `callback` should be called with either the file's
10256 * path or an object that has a `path` property, e.g. `callback(filePath)` or
10257 * `callback({ path: filePath })`. The `filePath` must be an absolute path.
10258 *
10259 * By default the `scheme` is treated like `http:`, which is parsed differently
10260 * from protocols that follow the "generic URI syntax" like `file:`.
10261 *
10262 * @deprecated
10263 */
10264 registerFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
10265 /**
10266 * Whether the protocol was successfully registered
10267 *
10268 * Registers a protocol of `scheme` that will send an HTTP request as a response.
10269 *
10270 * The usage is the same with `registerFileProtocol`, except that the `callback`
10271 * should be called with an object that has the `url` property.
10272 *
10273 * @deprecated
10274 */
10275 registerHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
10276 /**
10277 * **Note:** This method can only be used before the `ready` event of the `app`
10278 * module gets emitted and can be called only once.
10279 *
10280 * Registers the `scheme` as standard, secure, bypasses content security policy for
10281 * resources, allows registering ServiceWorker, supports fetch API, streaming
10282 * video/audio, and V8 code cache. Specify a privilege with the value of `true` to
10283 * enable the capability.
10284 *
10285 * An example of registering a privileged scheme, that bypasses Content Security
10286 * Policy:
10287 *
10288 * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
10289 * `http` and `https` are standard schemes, while `file` is not.
10290 *
10291 * Registering a scheme as standard allows relative and absolute resources to be
10292 * resolved correctly when served. Otherwise the scheme will behave like the `file`
10293 * protocol, but without the ability to resolve relative URLs.
10294 *
10295 * For example when you load following page with custom protocol without
10296 * registering it as standard scheme, the image will not be loaded because
10297 * non-standard schemes can not recognize relative URLs:
10298 *
10299 * Registering a scheme as standard will allow access to files through the
10300 * FileSystem API. Otherwise the renderer will throw a security error for the
10301 * scheme.
10302 *
10303 * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
10304 * cookies) are disabled for non standard schemes. So in general if you want to
10305 * register a custom protocol to replace the `http` protocol, you have to register
10306 * it as a standard scheme.
10307 *
10308 * Protocols that use streams (http and stream protocols) should set `stream:
10309 * true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
10310 * their responses by default. The `stream` flag configures those elements to
10311 * correctly expect streaming responses.
10312 */
10313 registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
10314 /**
10315 * Whether the protocol was successfully registered
10316 *
10317 * Registers a protocol of `scheme` that will send a stream as a response.
10318 *
10319 * The usage is the same with `registerFileProtocol`, except that the `callback`
10320 * should be called with either a `ReadableStream` object or an object that has the
10321 * `data` property.
10322 *
10323 * Example:
10324 *
10325 * It is possible to pass any object that implements the readable stream API (emits
10326 * `data`/`end`/`error` events). For example, here's how a file could be returned:
10327 *
10328 * @deprecated
10329 */
10330 registerStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
10331 /**
10332 * Whether the protocol was successfully registered
10333 *
10334 * Registers a protocol of `scheme` that will send a `string` as a response.
10335 *
10336 * The usage is the same with `registerFileProtocol`, except that the `callback`
10337 * should be called with either a `string` or an object that has the `data`
10338 * property.
10339 *
10340 * @deprecated
10341 */
10342 registerStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
10343 /**
10344 * Removes a protocol handler registered with `protocol.handle`.
10345 */
10346 unhandle(scheme: string): void;
10347 /**
10348 * Whether the protocol was successfully unintercepted
10349 *
10350 * Remove the interceptor installed for `scheme` and restore its original handler.
10351 *
10352 * @deprecated
10353 */
10354 uninterceptProtocol(scheme: string): boolean;
10355 /**
10356 * Whether the protocol was successfully unregistered
10357 *
10358 * Unregisters the custom protocol of `scheme`.
10359 *
10360 * @deprecated
10361 */
10362 unregisterProtocol(scheme: string): boolean;
10363 }
10364
10365 interface ProtocolRequest {
10366
10367 // Docs: https://electronjs.org/docs/api/structures/protocol-request
10368
10369 headers: Record<string, string>;
10370 method: string;
10371 referrer: string;
10372 uploadData?: UploadData[];
10373 url: string;
10374 }
10375
10376 interface ProtocolResponse {
10377
10378 // Docs: https://electronjs.org/docs/api/structures/protocol-response
10379
10380 /**
10381 * The charset of response body, default is `"utf-8"`.
10382 */
10383 charset?: string;
10384 /**
10385 * The response body. When returning stream as response, this is a Node.js readable
10386 * stream representing the response body. When returning `Buffer` as response, this
10387 * is a `Buffer`. When returning `string` as response, this is a `string`. This is
10388 * ignored for other types of responses.
10389 */
10390 data?: (Buffer) | (string) | (NodeJS.ReadableStream);
10391 /**
10392 * When assigned, the `request` will fail with the `error` number . For the
10393 * available error numbers you can use, please see the net error list.
10394 */
10395 error?: number;
10396 /**
10397 * An object containing the response headers. The keys must be string, and values
10398 * must be either string or Array of string.
10399 */
10400 headers?: Record<string, (string) | (string[])>;
10401 /**
10402 * The HTTP `method`. This is only used for file and URL responses.
10403 */
10404 method?: string;
10405 /**
10406 * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
10407 * would implicitly set the `content-type` header in response, but if
10408 * `content-type` is already set in `headers`, the `mimeType` would be ignored.
10409 */
10410 mimeType?: string;
10411 /**
10412 * Path to the file which would be sent as response body. This is only used for
10413 * file responses.
10414 */
10415 path?: string;
10416 /**
10417 * The `referrer` URL. This is only used for file and URL responses.
10418 */
10419 referrer?: string;
10420 /**
10421 * The session used for requesting URL, by default the HTTP request will reuse the
10422 * current session. Setting `session` to `null` would use a random independent
10423 * session. This is only used for URL responses.
10424 */
10425 session?: Session;
10426 /**
10427 * The HTTP response code, default is 200.
10428 */
10429 statusCode?: number;
10430 /**
10431 * The data used as upload data. This is only used for URL responses when `method`
10432 * is `"POST"`.
10433 */
10434 uploadData?: ProtocolResponseUploadData;
10435 /**
10436 * Download the `url` and pipe the result as response body. This is only used for
10437 * URL responses.
10438 */
10439 url?: string;
10440 }
10441
10442 interface ProtocolResponseUploadData {
10443
10444 // Docs: https://electronjs.org/docs/api/structures/protocol-response-upload-data
10445
10446 /**
10447 * MIME type of the content.
10448 */
10449 contentType: string;
10450 /**
10451 * Content to be sent.
10452 */
10453 data: (string) | (Buffer);
10454 }
10455
10456 interface ProxyConfig {
10457
10458 // Docs: https://electronjs.org/docs/api/structures/proxy-config
10459
10460 /**
10461 * The proxy mode. Should be one of `direct`, `auto_detect`, `pac_script`,
10462 * `fixed_servers` or `system`. Defaults to `pac_script` proxy mode if `pacScript`
10463 * option is specified otherwise defaults to `fixed_servers`.
10464 */
10465 mode?: ('direct' | 'auto_detect' | 'pac_script' | 'fixed_servers' | 'system');
10466 /**
10467 * The URL associated with the PAC file.
10468 */
10469 pacScript?: string;
10470 /**
10471 * Rules indicating which URLs should bypass the proxy settings.
10472 */
10473 proxyBypassRules?: string;
10474 /**
10475 * Rules indicating which proxies to use.
10476 */
10477 proxyRules?: string;
10478 }
10479
10480 interface PushNotifications extends NodeJS.EventEmitter {
10481
10482 // Docs: https://electronjs.org/docs/api/push-notifications
10483
10484 /**
10485 * Emitted when the app receives a remote notification while running. See:
10486 * https://developer.apple.com/documentation/appkit/nsapplicationdelegate/1428430-application?language=objc
10487 *
10488 * @platform darwin
10489 */
10490 on(event: 'received-apns-notification', listener: (event: Event,
10491 userInfo: Record<string, any>) => void): this;
10492 /**
10493 * @platform darwin
10494 */
10495 off(event: 'received-apns-notification', listener: (event: Event,
10496 userInfo: Record<string, any>) => void): this;
10497 /**
10498 * @platform darwin
10499 */
10500 once(event: 'received-apns-notification', listener: (event: Event,
10501 userInfo: Record<string, any>) => void): this;
10502 /**
10503 * @platform darwin
10504 */
10505 addListener(event: 'received-apns-notification', listener: (event: Event,
10506 userInfo: Record<string, any>) => void): this;
10507 /**
10508 * @platform darwin
10509 */
10510 removeListener(event: 'received-apns-notification', listener: (event: Event,
10511 userInfo: Record<string, any>) => void): this;
10512 /**
10513 * Registers the app with Apple Push Notification service (APNS) to receive Badge,
10514 * Sound, and Alert notifications. If registration is successful, the promise will
10515 * be resolved with the APNS device token. Otherwise, the promise will be rejected
10516 * with an error message. See:
10517 * https://developer.apple.com/documentation/appkit/nsapplication/1428476-registerforremotenotificationtyp?language=objc
10518 *
10519 * @platform darwin
10520 */
10521 registerForAPNSNotifications(): Promise<string>;
10522 /**
10523 * Unregisters the app from notifications received from APNS. See:
10524 * https://developer.apple.com/documentation/appkit/nsapplication/1428747-unregisterforremotenotifications?language=objc
10525 *
10526 * @platform darwin
10527 */
10528 unregisterForAPNSNotifications(): void;
10529 }
10530
10531 interface Rectangle {
10532
10533 // Docs: https://electronjs.org/docs/api/structures/rectangle
10534
10535 /**
10536 * The height of the rectangle (must be an integer).
10537 */
10538 height: number;
10539 /**
10540 * The width of the rectangle (must be an integer).
10541 */
10542 width: number;
10543 /**
10544 * The x coordinate of the origin of the rectangle (must be an integer).
10545 */
10546 x: number;
10547 /**
10548 * The y coordinate of the origin of the rectangle (must be an integer).
10549 */
10550 y: number;
10551 }
10552
10553 interface Referrer {
10554
10555 // Docs: https://electronjs.org/docs/api/structures/referrer
10556
10557 /**
10558 * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
10559 * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
10560 * See the Referrer-Policy spec for more details on the meaning of these values.
10561 */
10562 policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
10563 /**
10564 * HTTP Referrer URL.
10565 */
10566 url: string;
10567 }
10568
10569 interface RenderProcessGoneDetails {
10570
10571 // Docs: https://electronjs.org/docs/api/structures/render-process-gone-details
10572
10573 /**
10574 * The exit code of the process, unless `reason` is `launch-failed`, in which case
10575 * `exitCode` will be a platform-specific launch failure error code.
10576 */
10577 exitCode: number;
10578 /**
10579 * The reason the render process is gone. Possible values:
10580 */
10581 reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
10582 }
10583
10584 interface ResolvedEndpoint {
10585
10586 // Docs: https://electronjs.org/docs/api/structures/resolved-endpoint
10587
10588 address: string;
10589 /**
10590 * One of the following:
10591 */
10592 family: ('ipv4' | 'ipv6' | 'unspec');
10593 }
10594
10595 interface ResolvedHost {
10596
10597 // Docs: https://electronjs.org/docs/api/structures/resolved-host
10598
10599 /**
10600 * resolved DNS entries for the hostname
10601 */
10602 endpoints: ResolvedEndpoint[];
10603 }
10604
10605 interface SafeStorage extends NodeJS.EventEmitter {
10606
10607 // Docs: https://electronjs.org/docs/api/safe-storage
10608
10609 /**
10610 * the decrypted string. Decrypts the encrypted buffer obtained with
10611 * `safeStorage.encryptString` back into a string.
10612 *
10613 * This function will throw an error if decryption fails.
10614 */
10615 decryptString(encrypted: Buffer): string;
10616 /**
10617 * An array of bytes representing the encrypted string.
10618 *
10619 * This function will throw an error if encryption fails.
10620 */
10621 encryptString(plainText: string): Buffer;
10622 /**
10623 * User friendly name of the password manager selected on Linux.
10624 *
10625 * This function will return one of the following values:
10626 *
10627 * * `basic_text` - When the desktop environment is not recognised or if the
10628 * following command line flag is provided `--password-store="basic"`.
10629 * * `gnome_libsecret` - When the desktop environment is `X-Cinnamon`, `Deepin`,
10630 * `GNOME`, `Pantheon`, `XFCE`, `UKUI`, `unity` or if the following command line
10631 * flag is provided `--password-store="gnome-libsecret"`.
10632 * * `kwallet` - When the desktop session is `kde4` or if the following command
10633 * line flag is provided `--password-store="kwallet"`.
10634 * * `kwallet5` - When the desktop session is `kde5` or if the following command
10635 * line flag is provided `--password-store="kwallet5"`.
10636 * * `kwallet6` - When the desktop session is `kde6`.
10637 * * `unknown` - When the function is called before app has emitted the `ready`
10638 * event.
10639 *
10640 * @platform linux
10641 */
10642 getSelectedStorageBackend(): ('basic_text' | 'gnome_libsecret' | 'kwallet' | 'kwallet5' | 'kwallet6' | 'unknown');
10643 /**
10644 * Whether encryption is available.
10645 *
10646 * On Linux, returns true if the app has emitted the `ready` event and the secret
10647 * key is available. On MacOS, returns true if Keychain is available. On Windows,
10648 * returns true once the app has emitted the `ready` event.
10649 */
10650 isEncryptionAvailable(): boolean;
10651 /**
10652 * This function on Linux will force the module to use an in memory password for
10653 * creating symmetric key that is used for encrypt/decrypt functions when a valid
10654 * OS password manager cannot be determined for the current active desktop
10655 * environment. This function is a no-op on Windows and MacOS.
10656 */
10657 setUsePlainTextEncryption(usePlainText: boolean): void;
10658 }
10659
10660 interface Screen extends NodeJS.EventEmitter {
10661
10662 // Docs: https://electronjs.org/docs/api/screen
10663
10664 /**
10665 * Emitted when `newDisplay` has been added.
10666 */
10667 on(event: 'display-added', listener: (event: Event,
10668 newDisplay: Display) => void): this;
10669 off(event: 'display-added', listener: (event: Event,
10670 newDisplay: Display) => void): this;
10671 once(event: 'display-added', listener: (event: Event,
10672 newDisplay: Display) => void): this;
10673 addListener(event: 'display-added', listener: (event: Event,
10674 newDisplay: Display) => void): this;
10675 removeListener(event: 'display-added', listener: (event: Event,
10676 newDisplay: Display) => void): this;
10677 /**
10678 * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
10679 * an array of strings that describe the changes. Possible changes are `bounds`,
10680 * `workArea`, `scaleFactor` and `rotation`.
10681 */
10682 on(event: 'display-metrics-changed', listener: (event: Event,
10683 display: Display,
10684 changedMetrics: string[]) => void): this;
10685 off(event: 'display-metrics-changed', listener: (event: Event,
10686 display: Display,
10687 changedMetrics: string[]) => void): this;
10688 once(event: 'display-metrics-changed', listener: (event: Event,
10689 display: Display,
10690 changedMetrics: string[]) => void): this;
10691 addListener(event: 'display-metrics-changed', listener: (event: Event,
10692 display: Display,
10693 changedMetrics: string[]) => void): this;
10694 removeListener(event: 'display-metrics-changed', listener: (event: Event,
10695 display: Display,
10696 changedMetrics: string[]) => void): this;
10697 /**
10698 * Emitted when `oldDisplay` has been removed.
10699 */
10700 on(event: 'display-removed', listener: (event: Event,
10701 oldDisplay: Display) => void): this;
10702 off(event: 'display-removed', listener: (event: Event,
10703 oldDisplay: Display) => void): this;
10704 once(event: 'display-removed', listener: (event: Event,
10705 oldDisplay: Display) => void): this;
10706 addListener(event: 'display-removed', listener: (event: Event,
10707 oldDisplay: Display) => void): this;
10708 removeListener(event: 'display-removed', listener: (event: Event,
10709 oldDisplay: Display) => void): this;
10710 /**
10711 * Converts a screen DIP point to a screen physical point. The DPI scale is
10712 * performed relative to the display containing the DIP point.
10713 *
10714 * @platform win32
10715 */
10716 dipToScreenPoint(point: Point): Point;
10717 /**
10718 * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
10719 * relative to the display nearest to `window`. If `window` is null, scaling will
10720 * be performed to the display nearest to `rect`.
10721 *
10722 * @platform win32
10723 */
10724 dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
10725 /**
10726 * An array of displays that are currently available.
10727 */
10728 getAllDisplays(): Display[];
10729 /**
10730 * The current absolute position of the mouse pointer.
10731 *
10732 * **Note:** The return value is a DIP point, not a screen physical point.
10733 */
10734 getCursorScreenPoint(): Point;
10735 /**
10736 * The display that most closely intersects the provided bounds.
10737 */
10738 getDisplayMatching(rect: Rectangle): Display;
10739 /**
10740 * The display nearest the specified point.
10741 */
10742 getDisplayNearestPoint(point: Point): Display;
10743 /**
10744 * The primary display.
10745 */
10746 getPrimaryDisplay(): Display;
10747 /**
10748 * Converts a screen physical point to a screen DIP point. The DPI scale is
10749 * performed relative to the display containing the physical point.
10750 *
10751 * @platform win32
10752 */
10753 screenToDipPoint(point: Point): Point;
10754 /**
10755 * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
10756 * relative to the display nearest to `window`. If `window` is null, scaling will
10757 * be performed to the display nearest to `rect`.
10758 *
10759 * @platform win32
10760 */
10761 screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
10762 }
10763
10764 interface ScrubberItem {
10765
10766 // Docs: https://electronjs.org/docs/api/structures/scrubber-item
10767
10768 /**
10769 * The image to appear in this item.
10770 */
10771 icon?: NativeImage;
10772 /**
10773 * The text to appear in this item.
10774 */
10775 label?: string;
10776 }
10777
10778 interface SegmentedControlSegment {
10779
10780 // Docs: https://electronjs.org/docs/api/structures/segmented-control-segment
10781
10782 /**
10783 * Whether this segment is selectable. Default: true.
10784 */
10785 enabled?: boolean;
10786 /**
10787 * The image to appear in this segment.
10788 */
10789 icon?: NativeImage;
10790 /**
10791 * The text to appear in this segment.
10792 */
10793 label?: string;
10794 }
10795
10796 interface SerialPort {
10797
10798 // Docs: https://electronjs.org/docs/api/structures/serial-port
10799
10800 /**
10801 * A stable identifier on Windows that can be used for device permissions.
10802 *
10803 * @platform win32
10804 */
10805 deviceInstanceId?: string;
10806 /**
10807 * A string suitable for display to the user for describing this device.
10808 */
10809 displayName?: string;
10810 /**
10811 * Unique identifier for the port.
10812 */
10813 portId: string;
10814 /**
10815 * Name of the port.
10816 */
10817 portName: string;
10818 /**
10819 * The USB product ID.
10820 */
10821 productId?: string;
10822 /**
10823 * The USB device serial number.
10824 */
10825 serialNumber?: string;
10826 /**
10827 * Represents a single serial port on macOS can be enumerated by multiple drivers.
10828 *
10829 * @platform darwin
10830 */
10831 usbDriverName?: string;
10832 /**
10833 * The USB vendor ID.
10834 */
10835 vendorId?: string;
10836 }
10837
10838 interface ServiceWorkerInfo {
10839
10840 // Docs: https://electronjs.org/docs/api/structures/service-worker-info
10841
10842 /**
10843 * The virtual ID of the process that this service worker is running in. This is
10844 * not an OS level PID. This aligns with the ID set used for
10845 * `webContents.getProcessId()`.
10846 */
10847 renderProcessId: number;
10848 /**
10849 * The base URL that this service worker is active for.
10850 */
10851 scope: string;
10852 /**
10853 * The full URL to the script that this service worker runs
10854 */
10855 scriptUrl: string;
10856 }
10857
10858 class ServiceWorkers extends NodeEventEmitter {
10859
10860 // Docs: https://electronjs.org/docs/api/service-workers
10861
10862 /**
10863 * Emitted when a service worker logs something to the console.
10864 */
10865 on(event: 'console-message', listener: (event: Event,
10866 /**
10867 * Information about the console message
10868 */
10869 messageDetails: MessageDetails) => void): this;
10870 off(event: 'console-message', listener: (event: Event,
10871 /**
10872 * Information about the console message
10873 */
10874 messageDetails: MessageDetails) => void): this;
10875 once(event: 'console-message', listener: (event: Event,
10876 /**
10877 * Information about the console message
10878 */
10879 messageDetails: MessageDetails) => void): this;
10880 addListener(event: 'console-message', listener: (event: Event,
10881 /**
10882 * Information about the console message
10883 */
10884 messageDetails: MessageDetails) => void): this;
10885 removeListener(event: 'console-message', listener: (event: Event,
10886 /**
10887 * Information about the console message
10888 */
10889 messageDetails: MessageDetails) => void): this;
10890 /**
10891 * Emitted when a service worker has been registered. Can occur after a call to
10892 * `navigator.serviceWorker.register('/sw.js')` successfully resolves or when a
10893 * Chrome extension is loaded.
10894 */
10895 on(event: 'registration-completed', listener: (event: Event,
10896 /**
10897 * Information about the registered service worker
10898 */
10899 details: RegistrationCompletedDetails) => void): this;
10900 off(event: 'registration-completed', listener: (event: Event,
10901 /**
10902 * Information about the registered service worker
10903 */
10904 details: RegistrationCompletedDetails) => void): this;
10905 once(event: 'registration-completed', listener: (event: Event,
10906 /**
10907 * Information about the registered service worker
10908 */
10909 details: RegistrationCompletedDetails) => void): this;
10910 addListener(event: 'registration-completed', listener: (event: Event,
10911 /**
10912 * Information about the registered service worker
10913 */
10914 details: RegistrationCompletedDetails) => void): this;
10915 removeListener(event: 'registration-completed', listener: (event: Event,
10916 /**
10917 * Information about the registered service worker
10918 */
10919 details: RegistrationCompletedDetails) => void): this;
10920 /**
10921 * A ServiceWorkerInfo object where the keys are the service worker version ID and
10922 * the values are the information about that service worker.
10923 */
10924 getAllRunning(): Record<number, ServiceWorkerInfo>;
10925 /**
10926 * Information about this service worker
10927 *
10928 * If the service worker does not exist or is not running this method will throw an
10929 * exception.
10930 */
10931 getFromVersionID(versionId: number): ServiceWorkerInfo;
10932 }
10933
10934 class Session extends NodeEventEmitter {
10935
10936 // Docs: https://electronjs.org/docs/api/session
10937
10938 /**
10939 * A session instance from `partition` string. When there is an existing `Session`
10940 * with the same `partition`, it will be returned; otherwise a new `Session`
10941 * instance will be created with `options`.
10942 *
10943 * If `partition` starts with `persist:`, the page will use a persistent session
10944 * available to all pages in the app with the same `partition`. if there is no
10945 * `persist:` prefix, the page will use an in-memory session. If the `partition` is
10946 * empty then default session of the app will be returned.
10947 *
10948 * To create a `Session` with `options`, you have to ensure the `Session` with the
10949 * `partition` has never been used before. There is no way to change the `options`
10950 * of an existing `Session` object.
10951 */
10952 static fromPartition(partition: string, options?: FromPartitionOptions): Session;
10953 /**
10954 * A session instance from the absolute path as specified by the `path` string.
10955 * When there is an existing `Session` with the same absolute path, it will be
10956 * returned; otherwise a new `Session` instance will be created with `options`. The
10957 * call will throw an error if the path is not an absolute path. Additionally, an
10958 * error will be thrown if an empty string is provided.
10959 *
10960 * To create a `Session` with `options`, you have to ensure the `Session` with the
10961 * `path` has never been used before. There is no way to change the `options` of an
10962 * existing `Session` object.
10963 */
10964 static fromPath(path: string, options?: FromPathOptions): Session;
10965 /**
10966 * A `Session` object, the default session object of the app.
10967 */
10968 static defaultSession: Session;
10969 /**
10970 * Emitted after an extension is loaded. This occurs whenever an extension is added
10971 * to the "enabled" set of extensions. This includes:
10972 *
10973 * * Extensions being loaded from `Session.loadExtension`.
10974 * * Extensions being reloaded:
10975 * * from a crash.
10976 * * if the extension requested it (`chrome.runtime.reload()`).
10977 */
10978 on(event: 'extension-loaded', listener: (event: Event,
10979 extension: Extension) => void): this;
10980 off(event: 'extension-loaded', listener: (event: Event,
10981 extension: Extension) => void): this;
10982 once(event: 'extension-loaded', listener: (event: Event,
10983 extension: Extension) => void): this;
10984 addListener(event: 'extension-loaded', listener: (event: Event,
10985 extension: Extension) => void): this;
10986 removeListener(event: 'extension-loaded', listener: (event: Event,
10987 extension: Extension) => void): this;
10988 /**
10989 * Emitted after an extension is loaded and all necessary browser state is
10990 * initialized to support the start of the extension's background page.
10991 */
10992 on(event: 'extension-ready', listener: (event: Event,
10993 extension: Extension) => void): this;
10994 off(event: 'extension-ready', listener: (event: Event,
10995 extension: Extension) => void): this;
10996 once(event: 'extension-ready', listener: (event: Event,
10997 extension: Extension) => void): this;
10998 addListener(event: 'extension-ready', listener: (event: Event,
10999 extension: Extension) => void): this;
11000 removeListener(event: 'extension-ready', listener: (event: Event,
11001 extension: Extension) => void): this;
11002 /**
11003 * Emitted after an extension is unloaded. This occurs when
11004 * `Session.removeExtension` is called.
11005 */
11006 on(event: 'extension-unloaded', listener: (event: Event,
11007 extension: Extension) => void): this;
11008 off(event: 'extension-unloaded', listener: (event: Event,
11009 extension: Extension) => void): this;
11010 once(event: 'extension-unloaded', listener: (event: Event,
11011 extension: Extension) => void): this;
11012 addListener(event: 'extension-unloaded', listener: (event: Event,
11013 extension: Extension) => void): this;
11014 removeListener(event: 'extension-unloaded', listener: (event: Event,
11015 extension: Extension) => void): this;
11016 /**
11017 * Emitted after `navigator.hid.requestDevice` has been called and
11018 * `select-hid-device` has fired if a new device becomes available before the
11019 * callback from `select-hid-device` is called. This event is intended for use
11020 * when using a UI to ask users to pick a device so that the UI can be updated with
11021 * the newly added device.
11022 */
11023 on(event: 'hid-device-added', listener: (event: Event,
11024 details: HidDeviceAddedDetails) => void): this;
11025 off(event: 'hid-device-added', listener: (event: Event,
11026 details: HidDeviceAddedDetails) => void): this;
11027 once(event: 'hid-device-added', listener: (event: Event,
11028 details: HidDeviceAddedDetails) => void): this;
11029 addListener(event: 'hid-device-added', listener: (event: Event,
11030 details: HidDeviceAddedDetails) => void): this;
11031 removeListener(event: 'hid-device-added', listener: (event: Event,
11032 details: HidDeviceAddedDetails) => void): this;
11033 /**
11034 * Emitted after `navigator.hid.requestDevice` has been called and
11035 * `select-hid-device` has fired if a device has been removed before the callback
11036 * from `select-hid-device` is called. This event is intended for use when using a
11037 * UI to ask users to pick a device so that the UI can be updated to remove the
11038 * specified device.
11039 */
11040 on(event: 'hid-device-removed', listener: (event: Event,
11041 details: HidDeviceRemovedDetails) => void): this;
11042 off(event: 'hid-device-removed', listener: (event: Event,
11043 details: HidDeviceRemovedDetails) => void): this;
11044 once(event: 'hid-device-removed', listener: (event: Event,
11045 details: HidDeviceRemovedDetails) => void): this;
11046 addListener(event: 'hid-device-removed', listener: (event: Event,
11047 details: HidDeviceRemovedDetails) => void): this;
11048 removeListener(event: 'hid-device-removed', listener: (event: Event,
11049 details: HidDeviceRemovedDetails) => void): this;
11050 /**
11051 * Emitted after `HIDDevice.forget()` has been called. This event can be used to
11052 * help maintain persistent storage of permissions when
11053 * `setDevicePermissionHandler` is used.
11054 */
11055 on(event: 'hid-device-revoked', listener: (event: Event,
11056 details: HidDeviceRevokedDetails) => void): this;
11057 off(event: 'hid-device-revoked', listener: (event: Event,
11058 details: HidDeviceRevokedDetails) => void): this;
11059 once(event: 'hid-device-revoked', listener: (event: Event,
11060 details: HidDeviceRevokedDetails) => void): this;
11061 addListener(event: 'hid-device-revoked', listener: (event: Event,
11062 details: HidDeviceRevokedDetails) => void): this;
11063 removeListener(event: 'hid-device-revoked', listener: (event: Event,
11064 details: HidDeviceRevokedDetails) => void): this;
11065 /**
11066 * Emitted when a render process requests preconnection to a URL, generally due to
11067 * a resource hint.
11068 */
11069 on(event: 'preconnect', listener: (event: Event,
11070 /**
11071 * The URL being requested for preconnection by the renderer.
11072 */
11073 preconnectUrl: string,
11074 /**
11075 * True if the renderer is requesting that the connection include credentials (see
11076 * the spec for more details.)
11077 */
11078 allowCredentials: boolean) => void): this;
11079 off(event: 'preconnect', listener: (event: Event,
11080 /**
11081 * The URL being requested for preconnection by the renderer.
11082 */
11083 preconnectUrl: string,
11084 /**
11085 * True if the renderer is requesting that the connection include credentials (see
11086 * the spec for more details.)
11087 */
11088 allowCredentials: boolean) => void): this;
11089 once(event: 'preconnect', listener: (event: Event,
11090 /**
11091 * The URL being requested for preconnection by the renderer.
11092 */
11093 preconnectUrl: string,
11094 /**
11095 * True if the renderer is requesting that the connection include credentials (see
11096 * the spec for more details.)
11097 */
11098 allowCredentials: boolean) => void): this;
11099 addListener(event: 'preconnect', listener: (event: Event,
11100 /**
11101 * The URL being requested for preconnection by the renderer.
11102 */
11103 preconnectUrl: string,
11104 /**
11105 * True if the renderer is requesting that the connection include credentials (see
11106 * the spec for more details.)
11107 */
11108 allowCredentials: boolean) => void): this;
11109 removeListener(event: 'preconnect', listener: (event: Event,
11110 /**
11111 * The URL being requested for preconnection by the renderer.
11112 */
11113 preconnectUrl: string,
11114 /**
11115 * True if the renderer is requesting that the connection include credentials (see
11116 * the spec for more details.)
11117 */
11118 allowCredentials: boolean) => void): this;
11119 /**
11120 * Emitted when a HID device needs to be selected when a call to
11121 * `navigator.hid.requestDevice` is made. `callback` should be called with
11122 * `deviceId` to be selected; passing no arguments to `callback` will cancel the
11123 * request. Additionally, permissioning on `navigator.hid` can be further managed
11124 * by using `ses.setPermissionCheckHandler(handler)` and
11125 * `ses.setDevicePermissionHandler(handler)`.
11126 */
11127 on(event: 'select-hid-device', listener: (event: Event,
11128 details: SelectHidDeviceDetails,
11129 callback: (deviceId?: (string) | (null)) => void) => void): this;
11130 off(event: 'select-hid-device', listener: (event: Event,
11131 details: SelectHidDeviceDetails,
11132 callback: (deviceId?: (string) | (null)) => void) => void): this;
11133 once(event: 'select-hid-device', listener: (event: Event,
11134 details: SelectHidDeviceDetails,
11135 callback: (deviceId?: (string) | (null)) => void) => void): this;
11136 addListener(event: 'select-hid-device', listener: (event: Event,
11137 details: SelectHidDeviceDetails,
11138 callback: (deviceId?: (string) | (null)) => void) => void): this;
11139 removeListener(event: 'select-hid-device', listener: (event: Event,
11140 details: SelectHidDeviceDetails,
11141 callback: (deviceId?: (string) | (null)) => void) => void): this;
11142 /**
11143 * Emitted when a serial port needs to be selected when a call to
11144 * `navigator.serial.requestPort` is made. `callback` should be called with
11145 * `portId` to be selected, passing an empty string to `callback` will cancel the
11146 * request. Additionally, permissioning on `navigator.serial` can be managed by
11147 * using ses.setPermissionCheckHandler(handler) with the `serial` permission.
11148 */
11149 on(event: 'select-serial-port', listener: (event: Event,
11150 portList: SerialPort[],
11151 webContents: WebContents,
11152 callback: (portId: string) => void) => void): this;
11153 off(event: 'select-serial-port', listener: (event: Event,
11154 portList: SerialPort[],
11155 webContents: WebContents,
11156 callback: (portId: string) => void) => void): this;
11157 once(event: 'select-serial-port', listener: (event: Event,
11158 portList: SerialPort[],
11159 webContents: WebContents,
11160 callback: (portId: string) => void) => void): this;
11161 addListener(event: 'select-serial-port', listener: (event: Event,
11162 portList: SerialPort[],
11163 webContents: WebContents,
11164 callback: (portId: string) => void) => void): this;
11165 removeListener(event: 'select-serial-port', listener: (event: Event,
11166 portList: SerialPort[],
11167 webContents: WebContents,
11168 callback: (portId: string) => void) => void): this;
11169 /**
11170 * Emitted when a USB device needs to be selected when a call to
11171 * `navigator.usb.requestDevice` is made. `callback` should be called with
11172 * `deviceId` to be selected; passing no arguments to `callback` will cancel the
11173 * request. Additionally, permissioning on `navigator.usb` can be further managed
11174 * by using `ses.setPermissionCheckHandler(handler)` and
11175 * `ses.setDevicePermissionHandler(handler)`.
11176 */
11177 on(event: 'select-usb-device', listener: (event: Event,
11178 details: SelectUsbDeviceDetails,
11179 callback: (deviceId?: string) => void) => void): this;
11180 off(event: 'select-usb-device', listener: (event: Event,
11181 details: SelectUsbDeviceDetails,
11182 callback: (deviceId?: string) => void) => void): this;
11183 once(event: 'select-usb-device', listener: (event: Event,
11184 details: SelectUsbDeviceDetails,
11185 callback: (deviceId?: string) => void) => void): this;
11186 addListener(event: 'select-usb-device', listener: (event: Event,
11187 details: SelectUsbDeviceDetails,
11188 callback: (deviceId?: string) => void) => void): this;
11189 removeListener(event: 'select-usb-device', listener: (event: Event,
11190 details: SelectUsbDeviceDetails,
11191 callback: (deviceId?: string) => void) => void): this;
11192 /**
11193 * Emitted after `navigator.serial.requestPort` has been called and
11194 * `select-serial-port` has fired if a new serial port becomes available before the
11195 * callback from `select-serial-port` is called. This event is intended for use
11196 * when using a UI to ask users to pick a port so that the UI can be updated with
11197 * the newly added port.
11198 */
11199 on(event: 'serial-port-added', listener: (event: Event,
11200 port: SerialPort,
11201 webContents: WebContents) => void): this;
11202 off(event: 'serial-port-added', listener: (event: Event,
11203 port: SerialPort,
11204 webContents: WebContents) => void): this;
11205 once(event: 'serial-port-added', listener: (event: Event,
11206 port: SerialPort,
11207 webContents: WebContents) => void): this;
11208 addListener(event: 'serial-port-added', listener: (event: Event,
11209 port: SerialPort,
11210 webContents: WebContents) => void): this;
11211 removeListener(event: 'serial-port-added', listener: (event: Event,
11212 port: SerialPort,
11213 webContents: WebContents) => void): this;
11214 /**
11215 * Emitted after `navigator.serial.requestPort` has been called and
11216 * `select-serial-port` has fired if a serial port has been removed before the
11217 * callback from `select-serial-port` is called. This event is intended for use
11218 * when using a UI to ask users to pick a port so that the UI can be updated to
11219 * remove the specified port.
11220 */
11221 on(event: 'serial-port-removed', listener: (event: Event,
11222 port: SerialPort,
11223 webContents: WebContents) => void): this;
11224 off(event: 'serial-port-removed', listener: (event: Event,
11225 port: SerialPort,
11226 webContents: WebContents) => void): this;
11227 once(event: 'serial-port-removed', listener: (event: Event,
11228 port: SerialPort,
11229 webContents: WebContents) => void): this;
11230 addListener(event: 'serial-port-removed', listener: (event: Event,
11231 port: SerialPort,
11232 webContents: WebContents) => void): this;
11233 removeListener(event: 'serial-port-removed', listener: (event: Event,
11234 port: SerialPort,
11235 webContents: WebContents) => void): this;
11236 /**
11237 * Emitted after `SerialPort.forget()` has been called. This event can be used to
11238 * help maintain persistent storage of permissions when
11239 * `setDevicePermissionHandler` is used.
11240 */
11241 on(event: 'serial-port-revoked', listener: (event: Event,
11242 details: SerialPortRevokedDetails) => void): this;
11243 off(event: 'serial-port-revoked', listener: (event: Event,
11244 details: SerialPortRevokedDetails) => void): this;
11245 once(event: 'serial-port-revoked', listener: (event: Event,
11246 details: SerialPortRevokedDetails) => void): this;
11247 addListener(event: 'serial-port-revoked', listener: (event: Event,
11248 details: SerialPortRevokedDetails) => void): this;
11249 removeListener(event: 'serial-port-revoked', listener: (event: Event,
11250 details: SerialPortRevokedDetails) => void): this;
11251 /**
11252 * Emitted when a hunspell dictionary file starts downloading
11253 */
11254 on(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
11255 /**
11256 * The language code of the dictionary file
11257 */
11258 languageCode: string) => void): this;
11259 off(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
11260 /**
11261 * The language code of the dictionary file
11262 */
11263 languageCode: string) => void): this;
11264 once(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
11265 /**
11266 * The language code of the dictionary file
11267 */
11268 languageCode: string) => void): this;
11269 addListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
11270 /**
11271 * The language code of the dictionary file
11272 */
11273 languageCode: string) => void): this;
11274 removeListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
11275 /**
11276 * The language code of the dictionary file
11277 */
11278 languageCode: string) => void): this;
11279 /**
11280 * Emitted when a hunspell dictionary file download fails. For details on the
11281 * failure you should collect a netlog and inspect the download request.
11282 */
11283 on(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
11284 /**
11285 * The language code of the dictionary file
11286 */
11287 languageCode: string) => void): this;
11288 off(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
11289 /**
11290 * The language code of the dictionary file
11291 */
11292 languageCode: string) => void): this;
11293 once(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
11294 /**
11295 * The language code of the dictionary file
11296 */
11297 languageCode: string) => void): this;
11298 addListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
11299 /**
11300 * The language code of the dictionary file
11301 */
11302 languageCode: string) => void): this;
11303 removeListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
11304 /**
11305 * The language code of the dictionary file
11306 */
11307 languageCode: string) => void): this;
11308 /**
11309 * Emitted when a hunspell dictionary file has been successfully downloaded
11310 */
11311 on(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
11312 /**
11313 * The language code of the dictionary file
11314 */
11315 languageCode: string) => void): this;
11316 off(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
11317 /**
11318 * The language code of the dictionary file
11319 */
11320 languageCode: string) => void): this;
11321 once(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
11322 /**
11323 * The language code of the dictionary file
11324 */
11325 languageCode: string) => void): this;
11326 addListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
11327 /**
11328 * The language code of the dictionary file
11329 */
11330 languageCode: string) => void): this;
11331 removeListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
11332 /**
11333 * The language code of the dictionary file
11334 */
11335 languageCode: string) => void): this;
11336 /**
11337 * Emitted when a hunspell dictionary file has been successfully initialized. This
11338 * occurs after the file has been downloaded.
11339 */
11340 on(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
11341 /**
11342 * The language code of the dictionary file
11343 */
11344 languageCode: string) => void): this;
11345 off(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
11346 /**
11347 * The language code of the dictionary file
11348 */
11349 languageCode: string) => void): this;
11350 once(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
11351 /**
11352 * The language code of the dictionary file
11353 */
11354 languageCode: string) => void): this;
11355 addListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
11356 /**
11357 * The language code of the dictionary file
11358 */
11359 languageCode: string) => void): this;
11360 removeListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
11361 /**
11362 * The language code of the dictionary file
11363 */
11364 languageCode: string) => void): this;
11365 /**
11366 * Emitted after `navigator.usb.requestDevice` has been called and
11367 * `select-usb-device` has fired if a new device becomes available before the
11368 * callback from `select-usb-device` is called. This event is intended for use
11369 * when using a UI to ask users to pick a device so that the UI can be updated with
11370 * the newly added device.
11371 */
11372 on(event: 'usb-device-added', listener: (event: Event,
11373 device: USBDevice,
11374 webContents: WebContents) => void): this;
11375 off(event: 'usb-device-added', listener: (event: Event,
11376 device: USBDevice,
11377 webContents: WebContents) => void): this;
11378 once(event: 'usb-device-added', listener: (event: Event,
11379 device: USBDevice,
11380 webContents: WebContents) => void): this;
11381 addListener(event: 'usb-device-added', listener: (event: Event,
11382 device: USBDevice,
11383 webContents: WebContents) => void): this;
11384 removeListener(event: 'usb-device-added', listener: (event: Event,
11385 device: USBDevice,
11386 webContents: WebContents) => void): this;
11387 /**
11388 * Emitted after `navigator.usb.requestDevice` has been called and
11389 * `select-usb-device` has fired if a device has been removed before the callback
11390 * from `select-usb-device` is called. This event is intended for use when using a
11391 * UI to ask users to pick a device so that the UI can be updated to remove the
11392 * specified device.
11393 */
11394 on(event: 'usb-device-removed', listener: (event: Event,
11395 device: USBDevice,
11396 webContents: WebContents) => void): this;
11397 off(event: 'usb-device-removed', listener: (event: Event,
11398 device: USBDevice,
11399 webContents: WebContents) => void): this;
11400 once(event: 'usb-device-removed', listener: (event: Event,
11401 device: USBDevice,
11402 webContents: WebContents) => void): this;
11403 addListener(event: 'usb-device-removed', listener: (event: Event,
11404 device: USBDevice,
11405 webContents: WebContents) => void): this;
11406 removeListener(event: 'usb-device-removed', listener: (event: Event,
11407 device: USBDevice,
11408 webContents: WebContents) => void): this;
11409 /**
11410 * Emitted after `USBDevice.forget()` has been called. This event can be used to
11411 * help maintain persistent storage of permissions when
11412 * `setDevicePermissionHandler` is used.
11413 */
11414 on(event: 'usb-device-revoked', listener: (event: Event,
11415 details: UsbDeviceRevokedDetails) => void): this;
11416 off(event: 'usb-device-revoked', listener: (event: Event,
11417 details: UsbDeviceRevokedDetails) => void): this;
11418 once(event: 'usb-device-revoked', listener: (event: Event,
11419 details: UsbDeviceRevokedDetails) => void): this;
11420 addListener(event: 'usb-device-revoked', listener: (event: Event,
11421 details: UsbDeviceRevokedDetails) => void): this;
11422 removeListener(event: 'usb-device-revoked', listener: (event: Event,
11423 details: UsbDeviceRevokedDetails) => void): this;
11424 /**
11425 * Emitted when Electron is about to download `item` in `webContents`.
11426 *
11427 * Calling `event.preventDefault()` will cancel the download and `item` will not be
11428 * available from next tick of the process.
11429 */
11430 on(event: 'will-download', listener: (event: Event,
11431 item: DownloadItem,
11432 webContents: WebContents) => void): this;
11433 off(event: 'will-download', listener: (event: Event,
11434 item: DownloadItem,
11435 webContents: WebContents) => void): this;
11436 once(event: 'will-download', listener: (event: Event,
11437 item: DownloadItem,
11438 webContents: WebContents) => void): this;
11439 addListener(event: 'will-download', listener: (event: Event,
11440 item: DownloadItem,
11441 webContents: WebContents) => void): this;
11442 removeListener(event: 'will-download', listener: (event: Event,
11443 item: DownloadItem,
11444 webContents: WebContents) => void): this;
11445 /**
11446 * Whether the word was successfully written to the custom dictionary. This API
11447 * will not work on non-persistent (in-memory) sessions.
11448 *
11449 * **Note:** On macOS and Windows 10 this word will be written to the OS custom
11450 * dictionary as well
11451 */
11452 addWordToSpellCheckerDictionary(word: string): boolean;
11453 /**
11454 * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
11455 * authentication.
11456 */
11457 allowNTLMCredentialsForDomains(domains: string): void;
11458 /**
11459 * resolves when the session’s HTTP authentication cache has been cleared.
11460 */
11461 clearAuthCache(): Promise<void>;
11462 /**
11463 * resolves when the cache clear operation is complete.
11464 *
11465 * Clears the session’s HTTP cache.
11466 */
11467 clearCache(): Promise<void>;
11468 /**
11469 * resolves when the code cache clear operation is complete.
11470 */
11471 clearCodeCaches(options: ClearCodeCachesOptions): Promise<void>;
11472 /**
11473 * Resolves when the operation is complete.
11474 *
11475 * Clears the host resolver cache.
11476 */
11477 clearHostResolverCache(): Promise<void>;
11478 /**
11479 * resolves when the storage data has been cleared.
11480 */
11481 clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
11482 /**
11483 * Resolves when all connections are closed.
11484 *
11485 * **Note:** It will terminate / fail all requests currently in flight.
11486 */
11487 closeAllConnections(): Promise<void>;
11488 /**
11489 * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
11490 * The API will generate a DownloadItem that can be accessed with the will-download
11491 * event. The DownloadItem will not have any `WebContents` associated with it and
11492 * the initial state will be `interrupted`. The download will start only when the
11493 * `resume` API is called on the DownloadItem.
11494 */
11495 createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
11496 /**
11497 * Disables any network emulation already active for the `session`. Resets to the
11498 * original network configuration.
11499 */
11500 disableNetworkEmulation(): void;
11501 /**
11502 * Initiates a download of the resource at `url`. The API will generate a
11503 * DownloadItem that can be accessed with the will-download event.
11504 *
11505 * **Note:** This does not perform any security checks that relate to a page's
11506 * origin, unlike `webContents.downloadURL`.
11507 */
11508 downloadURL(url: string, options?: DownloadURLOptions): void;
11509 /**
11510 * Emulates network with the given configuration for the `session`.
11511 */
11512 enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
11513 /**
11514 * see Response.
11515 *
11516 * Sends a request, similarly to how `fetch()` works in the renderer, using
11517 * Chrome's network stack. This differs from Node's `fetch()`, which uses Node.js's
11518 * HTTP stack.
11519 *
11520 * Example:
11521 *
11522 * See also `net.fetch()`, a convenience method which issues requests from the
11523 * default session.
11524 *
11525 * See the MDN documentation for `fetch()` for more details.
11526 *
11527 * Limitations:
11528 *
11529 * * `net.fetch()` does not support the `data:` or `blob:` schemes.
11530 * * The value of the `integrity` option is ignored.
11531 * * The `.type` and `.url` values of the returned `Response` object are incorrect.
11532 *
11533 * By default, requests made with `net.fetch` can be made to custom protocols as
11534 * well as `file:`, and will trigger webRequest handlers if present. When the
11535 * non-standard `bypassCustomProtocolHandlers` option is set in RequestInit, custom
11536 * protocol handlers will not be called for this request. This allows forwarding an
11537 * intercepted request to the built-in handler. webRequest handlers will still be
11538 * triggered when bypassing custom protocols.
11539 */
11540 fetch(input: (string) | (GlobalRequest), init?: RequestInit & { bypassCustomProtocolHandlers?: boolean }): Promise<GlobalResponse>;
11541 /**
11542 * Writes any unwritten DOMStorage data to disk.
11543 */
11544 flushStorageData(): void;
11545 /**
11546 * Resolves when the all internal states of proxy service is reset and the latest
11547 * proxy configuration is reapplied if it's already available. The pac script will
11548 * be fetched from `pacScript` again if the proxy mode is `pac_script`.
11549 */
11550 forceReloadProxyConfig(): Promise<void>;
11551 /**
11552 * A list of all loaded extensions.
11553 *
11554 * **Note:** This API cannot be called before the `ready` event of the `app` module
11555 * is emitted.
11556 */
11557 getAllExtensions(): Extension[];
11558 /**
11559 * resolves with blob data.
11560 */
11561 getBlobData(identifier: string): Promise<Buffer>;
11562 /**
11563 * the session's current cache size, in bytes.
11564 */
11565 getCacheSize(): Promise<number>;
11566 /**
11567 * The loaded extension with the given ID.
11568 *
11569 * **Note:** This API cannot be called before the `ready` event of the `app` module
11570 * is emitted.
11571 */
11572 getExtension(extensionId: string): (Extension) | (null);
11573 /**
11574 * an array of paths to preload scripts that have been registered.
11575 */
11576 getPreloads(): string[];
11577 /**
11578 * An array of language codes the spellchecker is enabled for. If this list is
11579 * empty the spellchecker will fallback to using `en-US`. By default on launch if
11580 * this setting is an empty list Electron will try to populate this setting with
11581 * the current OS locale. This setting is persisted across restarts.
11582 *
11583 * **Note:** On macOS the OS spellchecker is used and has its own list of
11584 * languages. On macOS, this API will return whichever languages have been
11585 * configured by the OS.
11586 */
11587 getSpellCheckerLanguages(): string[];
11588 /**
11589 * The absolute file system path where data for this session is persisted on disk.
11590 * For in memory sessions this returns `null`.
11591 */
11592 getStoragePath(): (string) | (null);
11593 /**
11594 * The user agent for this session.
11595 */
11596 getUserAgent(): string;
11597 /**
11598 * Whether or not this session is a persistent one. The default `webContents`
11599 * session of a `BrowserWindow` is persistent. When creating a session from a
11600 * partition, session prefixed with `persist:` will be persistent, while others
11601 * will be temporary.
11602 */
11603 isPersistent(): boolean;
11604 /**
11605 * Whether the builtin spell checker is enabled.
11606 */
11607 isSpellCheckerEnabled(): boolean;
11608 /**
11609 * An array of all words in app's custom dictionary. Resolves when the full
11610 * dictionary is loaded from disk.
11611 */
11612 listWordsInSpellCheckerDictionary(): Promise<string[]>;
11613 /**
11614 * resolves when the extension is loaded.
11615 *
11616 * This method will raise an exception if the extension could not be loaded. If
11617 * there are warnings when installing the extension (e.g. if the extension requests
11618 * an API that Electron does not support) then they will be logged to the console.
11619 *
11620 * Note that Electron does not support the full range of Chrome extensions APIs.
11621 * See Supported Extensions APIs for more details on what is supported.
11622 *
11623 * Note that in previous versions of Electron, extensions that were loaded would be
11624 * remembered for future runs of the application. This is no longer the case:
11625 * `loadExtension` must be called on every boot of your app if you want the
11626 * extension to be loaded.
11627 *
11628 * This API does not support loading packed (.crx) extensions.
11629 *
11630 * **Note:** This API cannot be called before the `ready` event of the `app` module
11631 * is emitted.
11632 *
11633 * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
11634 * supported and will throw an error.
11635 */
11636 loadExtension(path: string, options?: LoadExtensionOptions): Promise<Electron.Extension>;
11637 /**
11638 * Preconnects the given number of sockets to an origin.
11639 */
11640 preconnect(options: PreconnectOptions): void;
11641 /**
11642 * Unloads an extension.
11643 *
11644 * **Note:** This API cannot be called before the `ready` event of the `app` module
11645 * is emitted.
11646 */
11647 removeExtension(extensionId: string): void;
11648 /**
11649 * Whether the word was successfully removed from the custom dictionary. This API
11650 * will not work on non-persistent (in-memory) sessions.
11651 *
11652 * **Note:** On macOS and Windows 10 this word will be removed from the OS custom
11653 * dictionary as well
11654 */
11655 removeWordFromSpellCheckerDictionary(word: string): boolean;
11656 /**
11657 * Resolves with the resolved IP addresses for the `host`.
11658 */
11659 resolveHost(host: string, options?: ResolveHostOptions): Promise<Electron.ResolvedHost>;
11660 /**
11661 * Resolves with the proxy information for `url`.
11662 */
11663 resolveProxy(url: string): Promise<string>;
11664 /**
11665 * Sets a handler to respond to Bluetooth pairing requests. This handler allows
11666 * developers to handle devices that require additional validation before pairing.
11667 * When a handler is not defined, any pairing on Linux or Windows that requires
11668 * additional validation will be automatically cancelled. macOS does not require a
11669 * handler because macOS handles the pairing automatically. To clear the handler,
11670 * call `setBluetoothPairingHandler(null)`.
11671 *
11672 * @platform win32,linux
11673 */
11674 setBluetoothPairingHandler(handler: ((details: BluetoothPairingHandlerHandlerDetails, callback: (response: Response) => void) => void) | (null)): void;
11675 /**
11676 * Sets the certificate verify proc for `session`, the `proc` will be called with
11677 * `proc(request, callback)` whenever a server certificate verification is
11678 * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
11679 * rejects it.
11680 *
11681 * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
11682 * verify proc.
11683 *
11684 * > **NOTE:** The result of this procedure is cached by the network service.
11685 */
11686 setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
11687 /**
11688 * Sets the directory to store the generated JS code cache for this session. The
11689 * directory is not required to be created by the user before this call, the
11690 * runtime will create if it does not exist otherwise will use the existing
11691 * directory. If directory cannot be created, then code cache will not be used and
11692 * all operations related to code cache will fail silently inside the runtime. By
11693 * default, the directory will be `Code Cache` under the respective user data
11694 * folder.
11695 *
11696 * Note that by default code cache is only enabled for http(s) URLs, to enable code
11697 * cache for custom protocols, `codeCache: true` and `standard: true` must be
11698 * specified when registering the protocol.
11699 */
11700 setCodeCachePath(path: string): void;
11701 /**
11702 * Sets the handler which can be used to respond to device permission checks for
11703 * the `session`. Returning `true` will allow the device to be permitted and
11704 * `false` will reject it. To clear the handler, call
11705 * `setDevicePermissionHandler(null)`. This handler can be used to provide default
11706 * permissioning to devices without first calling for permission to devices (eg via
11707 * `navigator.hid.requestDevice`). If this handler is not defined, the default
11708 * device permissions as granted through device selection (eg via
11709 * `navigator.hid.requestDevice`) will be used. Additionally, the default behavior
11710 * of Electron is to store granted device permission in memory. If longer term
11711 * storage is needed, a developer can store granted device permissions (eg when
11712 * handling the `select-hid-device` event) and then read from that storage with
11713 * `setDevicePermissionHandler`.
11714 */
11715 setDevicePermissionHandler(handler: ((details: DevicePermissionHandlerHandlerDetails) => boolean) | (null)): void;
11716 /**
11717 * This handler will be called when web content requests access to display media
11718 * via the `navigator.mediaDevices.getDisplayMedia` API. Use the desktopCapturer
11719 * API to choose which stream(s) to grant access to.
11720 *
11721 * Passing a WebFrameMain object as a video or audio stream will capture the video
11722 * or audio stream from that frame.
11723 *
11724 * Passing `null` instead of a function resets the handler to its default state.
11725 */
11726 setDisplayMediaRequestHandler(handler: ((request: DisplayMediaRequestHandlerHandlerRequest, callback: (streams: Streams) => void) => void) | (null)): void;
11727 /**
11728 * Sets download saving directory. By default, the download directory will be the
11729 * `Downloads` under the respective app folder.
11730 */
11731 setDownloadPath(path: string): void;
11732 /**
11733 * Sets the handler which can be used to respond to permission checks for the
11734 * `session`. Returning `true` will allow the permission and `false` will reject
11735 * it. Please note that you must also implement `setPermissionRequestHandler` to
11736 * get complete permission handling. Most web APIs do a permission check and then
11737 * make a permission request if the check is denied. To clear the handler, call
11738 * `setPermissionCheckHandler(null)`.
11739 */
11740 setPermissionCheckHandler(handler: ((webContents: (WebContents) | (null), permission: 'clipboard-read' | 'clipboard-sanitized-write' | 'geolocation' | 'fullscreen' | 'hid' | 'idle-detection' | 'media' | 'mediaKeySystem' | 'midi' | 'midiSysex' | 'notifications' | 'openExternal' | 'pointerLock' | 'serial' | 'storage-access' | 'top-level-storage-access' | 'usb', requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void;
11741 /**
11742 * Sets the handler which can be used to respond to permission requests for the
11743 * `session`. Calling `callback(true)` will allow the permission and
11744 * `callback(false)` will reject it. To clear the handler, call
11745 * `setPermissionRequestHandler(null)`. Please note that you must also implement
11746 * `setPermissionCheckHandler` to get complete permission handling. Most web APIs
11747 * do a permission check and then make a permission request if the check is denied.
11748 */
11749 setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'clipboard-sanitized-write' | 'display-capture' | 'fullscreen' | 'geolocation' | 'idle-detection' | 'media' | 'mediaKeySystem' | 'midi' | 'midiSysex' | 'notifications' | 'pointerLock' | 'keyboardLock' | 'openExternal' | 'speaker-selection' | 'storage-access' | 'top-level-storage-access' | 'window-management' | 'unknown' | 'fileSystem', callback: (permissionGranted: boolean) => void, details: (PermissionRequest) | (FilesystemPermissionRequest) | (MediaAccessPermissionRequest) | (OpenExternalPermissionRequest)) => void) | (null)): void;
11750 /**
11751 * Adds scripts that will be executed on ALL web contents that are associated with
11752 * this session just before normal `preload` scripts run.
11753 */
11754 setPreloads(preloads: string[]): void;
11755 /**
11756 * Resolves when the proxy setting process is complete.
11757 *
11758 * Sets the proxy settings.
11759 *
11760 * You may need `ses.closeAllConnections` to close currently in flight connections
11761 * to prevent pooled sockets using previous proxy from being reused by future
11762 * requests.
11763 */
11764 setProxy(config: ProxyConfig): Promise<void>;
11765 /**
11766 * By default Electron will download hunspell dictionaries from the Chromium CDN.
11767 * If you want to override this behavior you can use this API to point the
11768 * dictionary downloader at your own hosted version of the hunspell dictionaries.
11769 * We publish a `hunspell_dictionaries.zip` file with each release which contains
11770 * the files you need to host here.
11771 *
11772 * The file server must be **case insensitive**. If you cannot do this, you must
11773 * upload each file twice: once with the case it has in the ZIP file and once with
11774 * the filename as all lowercase.
11775 *
11776 * If the files present in `hunspell_dictionaries.zip` are available at
11777 * `https://example.com/dictionaries/language-code.bdic` then you should call this
11778 * api with
11779 * `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`.
11780 * Please note the trailing slash. The URL to the dictionaries is formed as
11781 * `${url}${filename}`.
11782 *
11783 * **Note:** On macOS the OS spellchecker is used and therefore we do not download
11784 * any dictionary files. This API is a no-op on macOS.
11785 */
11786 setSpellCheckerDictionaryDownloadURL(url: string): void;
11787 /**
11788 * Sets whether to enable the builtin spell checker.
11789 */
11790 setSpellCheckerEnabled(enable: boolean): void;
11791 /**
11792 * The built in spellchecker does not automatically detect what language a user is
11793 * typing in. In order for the spell checker to correctly check their words you
11794 * must call this API with an array of language codes. You can get the list of
11795 * supported language codes with the `ses.availableSpellCheckerLanguages` property.
11796 *
11797 * **Note:** On macOS the OS spellchecker is used and will detect your language
11798 * automatically. This API is a no-op on macOS.
11799 */
11800 setSpellCheckerLanguages(languages: string[]): void;
11801 /**
11802 * Sets the SSL configuration for the session. All subsequent network requests will
11803 * use the new configuration. Existing network connections (such as WebSocket
11804 * connections) will not be terminated, but old sockets in the pool will not be
11805 * reused for new connections.
11806 */
11807 setSSLConfig(config: Config): void;
11808 /**
11809 * Sets the handler which can be used to override which USB classes are protected.
11810 * The return value for the handler is a string array of USB classes which should
11811 * be considered protected (eg not available in the renderer). Valid values for
11812 * the array are:
11813 *
11814 * * `audio`
11815 * * `audio-video`
11816 * * `hid`
11817 * * `mass-storage`
11818 * * `smart-card`
11819 * * `video`
11820 * * `wireless`
11821 *
11822 * Returning an empty string array from the handler will allow all USB classes;
11823 * returning the passed in array will maintain the default list of protected USB
11824 * classes (this is also the default behavior if a handler is not defined). To
11825 * clear the handler, call `setUSBProtectedClassesHandler(null)`.
11826 */
11827 setUSBProtectedClassesHandler(handler: ((details: USBProtectedClassesHandlerHandlerDetails) => string[]) | (null)): void;
11828 /**
11829 * Overrides the `userAgent` and `acceptLanguages` for this session.
11830 *
11831 * The `acceptLanguages` must a comma separated ordered list of language codes, for
11832 * example `"en-US,fr,de,ko,zh-CN,ja"`.
11833 *
11834 * This doesn't affect existing `WebContents`, and each `WebContents` can use
11835 * `webContents.setUserAgent` to override the session-wide user agent.
11836 */
11837 setUserAgent(userAgent: string, acceptLanguages?: string): void;
11838 /**
11839 * A `string[]` array which consists of all the known available spell checker
11840 * languages. Providing a language code to the `setSpellCheckerLanguages` API that
11841 * isn't in this array will result in an error.
11842 *
11843 */
11844 readonly availableSpellCheckerLanguages: string[];
11845 /**
11846 * A `Cookies` object for this session.
11847 *
11848 */
11849 readonly cookies: Cookies;
11850 /**
11851 * A `NetLog` object for this session.
11852 *
11853 */
11854 readonly netLog: NetLog;
11855 /**
11856 * A `Protocol` object for this session.
11857 *
11858 */
11859 readonly protocol: Protocol;
11860 /**
11861 * A `ServiceWorkers` object for this session.
11862 *
11863 */
11864 readonly serviceWorkers: ServiceWorkers;
11865 /**
11866 * A `boolean` indicating whether builtin spell checker is enabled.
11867 */
11868 spellCheckerEnabled: boolean;
11869 /**
11870 * A `string | null` indicating the absolute file system path where data for this
11871 * session is persisted on disk. For in memory sessions this returns `null`.
11872 *
11873 */
11874 readonly storagePath: (string) | (null);
11875 /**
11876 * A `WebRequest` object for this session.
11877 *
11878 */
11879 readonly webRequest: WebRequest;
11880 }
11881
11882 interface SharedWorkerInfo {
11883
11884 // Docs: https://electronjs.org/docs/api/structures/shared-worker-info
11885
11886 /**
11887 * The unique id of the shared worker.
11888 */
11889 id: string;
11890 /**
11891 * The url of the shared worker.
11892 */
11893 url: string;
11894 }
11895
11896 class ShareMenu extends NodeEventEmitter {
11897
11898 // Docs: https://electronjs.org/docs/api/share-menu
11899
11900 /**
11901 * ShareMenu
11902 */
11903 constructor(sharingItem: SharingItem);
11904 /**
11905 * Closes the context menu in the `browserWindow`.
11906 */
11907 closePopup(browserWindow?: BrowserWindow): void;
11908 /**
11909 * Pops up this menu as a context menu in the `BrowserWindow`.
11910 */
11911 popup(options?: PopupOptions): void;
11912 }
11913
11914 interface SharingItem {
11915
11916 // Docs: https://electronjs.org/docs/api/structures/sharing-item
11917
11918 /**
11919 * An array of files to share.
11920 */
11921 filePaths?: string[];
11922 /**
11923 * An array of text to share.
11924 */
11925 texts?: string[];
11926 /**
11927 * An array of URLs to share.
11928 */
11929 urls?: string[];
11930 }
11931
11932 interface Shell {
11933
11934 // Docs: https://electronjs.org/docs/api/shell
11935
11936 /**
11937 * Play the beep sound.
11938 */
11939 beep(): void;
11940 /**
11941 * Open the given external protocol URL in the desktop's default manner. (For
11942 * example, mailto: URLs in the user's default mail agent).
11943 */
11944 openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
11945 /**
11946 * Resolves with a string containing the error message corresponding to the failure
11947 * if a failure occurred, otherwise "".
11948 *
11949 * Open the given file in the desktop's default manner.
11950 */
11951 openPath(path: string): Promise<string>;
11952 /**
11953 * Resolves the shortcut link at `shortcutPath`.
11954 *
11955 * An exception will be thrown when any error happens.
11956 *
11957 * @platform win32
11958 */
11959 readShortcutLink(shortcutPath: string): ShortcutDetails;
11960 /**
11961 * Show the given file in a file manager. If possible, select the file.
11962 */
11963 showItemInFolder(fullPath: string): void;
11964 /**
11965 * Resolves when the operation has been completed. Rejects if there was an error
11966 * while deleting the requested item.
11967 *
11968 * This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin
11969 * on Windows, and a desktop-environment-specific location on Linux).
11970 */
11971 trashItem(path: string): Promise<void>;
11972 /**
11973 * Whether the shortcut was created successfully.
11974 *
11975 * Creates or updates a shortcut link at `shortcutPath`.
11976 *
11977 * @platform win32
11978 */
11979 writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
11980 /**
11981 * Whether the shortcut was created successfully.
11982 *
11983 * Creates or updates a shortcut link at `shortcutPath`.
11984 *
11985 * @platform win32
11986 */
11987 writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
11988 }
11989
11990 interface ShortcutDetails {
11991
11992 // Docs: https://electronjs.org/docs/api/structures/shortcut-details
11993
11994 /**
11995 * The Application User Model ID. Default is empty.
11996 */
11997 appUserModelId?: string;
11998 /**
11999 * The arguments to be applied to `target` when launching from this shortcut.
12000 * Default is empty.
12001 */
12002 args?: string;
12003 /**
12004 * The working directory. Default is empty.
12005 */
12006 cwd?: string;
12007 /**
12008 * The description of the shortcut. Default is empty.
12009 */
12010 description?: string;
12011 /**
12012 * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
12013 * together. Default is empty, which uses the target's icon.
12014 */
12015 icon?: string;
12016 /**
12017 * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
12018 */
12019 iconIndex?: number;
12020 /**
12021 * The target to launch from this shortcut.
12022 */
12023 target: string;
12024 /**
12025 * The Application Toast Activator CLSID. Needed for participating in Action
12026 * Center.
12027 */
12028 toastActivatorClsid?: string;
12029 }
12030
12031 interface Size {
12032
12033 // Docs: https://electronjs.org/docs/api/structures/size
12034
12035 height: number;
12036 width: number;
12037 }
12038
12039 interface SystemPreferences extends NodeJS.EventEmitter {
12040
12041 // Docs: https://electronjs.org/docs/api/system-preferences
12042
12043 /**
12044 * @platform win32
12045 */
12046 on(event: 'accent-color-changed', listener: (event: Event,
12047 /**
12048 * The new RGBA color the user assigned to be their system accent color.
12049 */
12050 newColor: string) => void): this;
12051 /**
12052 * @platform win32
12053 */
12054 off(event: 'accent-color-changed', listener: (event: Event,
12055 /**
12056 * The new RGBA color the user assigned to be their system accent color.
12057 */
12058 newColor: string) => void): this;
12059 /**
12060 * @platform win32
12061 */
12062 once(event: 'accent-color-changed', listener: (event: Event,
12063 /**
12064 * The new RGBA color the user assigned to be their system accent color.
12065 */
12066 newColor: string) => void): this;
12067 /**
12068 * @platform win32
12069 */
12070 addListener(event: 'accent-color-changed', listener: (event: Event,
12071 /**
12072 * The new RGBA color the user assigned to be their system accent color.
12073 */
12074 newColor: string) => void): this;
12075 /**
12076 * @platform win32
12077 */
12078 removeListener(event: 'accent-color-changed', listener: (event: Event,
12079 /**
12080 * The new RGBA color the user assigned to be their system accent color.
12081 */
12082 newColor: string) => void): this;
12083 /**
12084 * @platform win32
12085 */
12086 on(event: 'color-changed', listener: (event: Event) => void): this;
12087 /**
12088 * @platform win32
12089 */
12090 off(event: 'color-changed', listener: (event: Event) => void): this;
12091 /**
12092 * @platform win32
12093 */
12094 once(event: 'color-changed', listener: (event: Event) => void): this;
12095 /**
12096 * @platform win32
12097 */
12098 addListener(event: 'color-changed', listener: (event: Event) => void): this;
12099 /**
12100 * @platform win32
12101 */
12102 removeListener(event: 'color-changed', listener: (event: Event) => void): this;
12103 /**
12104 * A promise that resolves with `true` if consent was granted and `false` if it was
12105 * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
12106 * access request was denied and later is changed through the System Preferences
12107 * pane, a restart of the app will be required for the new permissions to take
12108 * effect. If access has already been requested and denied, it _must_ be changed
12109 * through the preference pane; an alert will not pop up and the promise will
12110 * resolve with the existing access status.
12111 *
12112 * **Important:** In order to properly leverage this API, you must set the
12113 * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
12114 * app's `Info.plist` file. The values for these keys will be used to populate the
12115 * permission dialogs so that the user will be properly informed as to the purpose
12116 * of the permission request. See Electron Application Distribution for more
12117 * information about how to set these in the context of Electron.
12118 *
12119 * This user consent was not required until macOS 10.14 Mojave, so this method will
12120 * always return `true` if your system is running 10.13 High Sierra.
12121 *
12122 * @platform darwin
12123 */
12124 askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
12125 /**
12126 * whether or not this device has the ability to use Touch ID.
12127 *
12128 * @platform darwin
12129 */
12130 canPromptTouchID(): boolean;
12131 /**
12132 * The users current system wide accent color preference in RGBA hexadecimal form.
12133 *
12134 * This API is only available on macOS 10.14 Mojave or newer.
12135 *
12136 * @platform win32,darwin
12137 */
12138 getAccentColor(): string;
12139 /**
12140 * * `shouldRenderRichAnimation` boolean - Returns true if rich animations should
12141 * be rendered. Looks at session type (e.g. remote desktop) and accessibility
12142 * settings to give guidance for heavy animations.
12143 * * `scrollAnimationsEnabledBySystem` boolean - Determines on a per-platform basis
12144 * whether scroll animations (e.g. produced by home/end key) should be enabled.
12145 * * `prefersReducedMotion` boolean - Determines whether the user desires reduced
12146 * motion based on platform APIs.
12147 *
12148 * Returns an object with system animation settings.
12149 */
12150 getAnimationSettings(): AnimationSettings;
12151 /**
12152 * The system color setting in RGBA hexadecimal form (`#RRGGBBAA`). See the Windows
12153 * docs and the macOS docs for more details.
12154 *
12155 * The following colors are only available on macOS 10.14: `find-highlight`,
12156 * `selected-content-background`, `separator`,
12157 * `unemphasized-selected-content-background`,
12158 * `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
12159 *
12160 * @platform win32,darwin
12161 */
12162 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;
12163 /**
12164 * Can be `dark`, `light` or `unknown`.
12165 *
12166 * Gets the macOS appearance setting that is currently applied to your application,
12167 * maps to NSApplication.effectiveAppearance
12168 *
12169 * @platform darwin
12170 */
12171 getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
12172 /**
12173 * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
12174 *
12175 * This user consent was not required on macOS 10.13 High Sierra so this method
12176 * will always return `granted`. macOS 10.14 Mojave or higher requires consent for
12177 * `microphone` and `camera` access. macOS 10.15 Catalina or higher requires
12178 * consent for `screen` access.
12179 *
12180 * Windows 10 has a global setting controlling `microphone` and `camera` access for
12181 * all win32 applications. It will always return `granted` for `screen` and for all
12182 * media types on older versions of Windows.
12183 *
12184 * @platform win32,darwin
12185 */
12186 getMediaAccessStatus(mediaType: 'microphone' | 'camera' | 'screen'): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
12187 /**
12188 * The standard system color formatted as `#RRGGBBAA`.
12189 *
12190 * Returns one of several standard system colors that automatically adapt to
12191 * vibrancy and changes in accessibility settings like 'Increase contrast' and
12192 * 'Reduce transparency'. See Apple Documentation for more details.
12193 *
12194 * @platform darwin
12195 */
12196 getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
12197 /**
12198 * The value of `key` in `NSUserDefaults`.
12199 *
12200 * Some popular `key` and `type`s are:
12201 *
12202 * * `AppleInterfaceStyle`: `string`
12203 * * `AppleAquaColorVariant`: `integer`
12204 * * `AppleHighlightColor`: `string`
12205 * * `AppleShowScrollBars`: `string`
12206 * * `NSNavRecentPlaces`: `array`
12207 * * `NSPreferredWebServices`: `dictionary`
12208 * * `NSUserDictionaryReplacementItems`: `array`
12209 *
12210 * @platform darwin
12211 */
12212 getUserDefault<Type extends keyof UserDefaultTypes>(key: string, type: Type): UserDefaultTypes[Type];
12213 /**
12214 * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
12215 *
12216 * An example of using it to determine if you should create a transparent window or
12217 * not (transparent windows won't work correctly when DWM composition is disabled):
12218 *
12219 * @platform win32
12220 */
12221 isAeroGlassEnabled(): boolean;
12222 /**
12223 * Whether the Swipe between pages setting is on.
12224 *
12225 * @platform darwin
12226 */
12227 isSwipeTrackingFromScrollEventsEnabled(): boolean;
12228 /**
12229 * `true` if the current process is a trusted accessibility client and `false` if
12230 * it is not.
12231 *
12232 * @platform darwin
12233 */
12234 isTrustedAccessibilityClient(prompt: boolean): boolean;
12235 /**
12236 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
12237 * contains the user information dictionary sent along with the notification.
12238 *
12239 * @platform darwin
12240 */
12241 postLocalNotification(event: string, userInfo: Record<string, any>): void;
12242 /**
12243 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
12244 * contains the user information dictionary sent along with the notification.
12245 *
12246 * @platform darwin
12247 */
12248 postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
12249 /**
12250 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
12251 * contains the user information dictionary sent along with the notification.
12252 *
12253 * @platform darwin
12254 */
12255 postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
12256 /**
12257 * resolves if the user has successfully authenticated with Touch ID.
12258 *
12259 * This API itself will not protect your user data; rather, it is a mechanism to
12260 * allow you to do so. Native apps will need to set Access Control Constants like
12261 * `kSecAccessControlUserPresence` on their keychain entry so that reading it would
12262 * auto-prompt for Touch ID biometric consent. This could be done with
12263 * `node-keytar`, such that one would store an encryption key with `node-keytar`
12264 * and only fetch it if `promptTouchID()` resolves.
12265 *
12266 * @platform darwin
12267 */
12268 promptTouchID(reason: string): Promise<void>;
12269 /**
12270 * Add the specified defaults to your application's `NSUserDefaults`.
12271 *
12272 * @platform darwin
12273 */
12274 registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
12275 /**
12276 * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
12277 * or global value of a `key` previously set with `setUserDefault`.
12278 *
12279 * @platform darwin
12280 */
12281 removeUserDefault(key: string): void;
12282 /**
12283 * Set the value of `key` in `NSUserDefaults`.
12284 *
12285 * Note that `type` should match actual type of `value`. An exception is thrown if
12286 * they don't.
12287 *
12288 * Some popular `key` and `type`s are:
12289 *
12290 * * `ApplePressAndHoldEnabled`: `boolean`
12291 *
12292 * @platform darwin
12293 */
12294 setUserDefault<Type extends keyof UserDefaultTypes>(key: string, type: Type, value: UserDefaultTypes[Type]): void;
12295 /**
12296 * The ID of this subscription
12297 *
12298 * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
12299 * defaults. This is necessary for events such as
12300 * `NSUserDefaultsDidChangeNotification`.
12301 *
12302 * If `event` is null, the `NSNotificationCenter` doesn’t use it as criteria for
12303 * delivery to the observer. See docs for more information.
12304 *
12305 * @platform darwin
12306 */
12307 subscribeLocalNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
12308 /**
12309 * The ID of this subscription
12310 *
12311 * Subscribes to native notifications of macOS, `callback` will be called with
12312 * `callback(event, userInfo)` when the corresponding `event` happens. The
12313 * `userInfo` is an Object that contains the user information dictionary sent along
12314 * with the notification. The `object` is the sender of the notification, and only
12315 * supports `NSString` values for now.
12316 *
12317 * The `id` of the subscriber is returned, which can be used to unsubscribe the
12318 * `event`.
12319 *
12320 * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
12321 * values of `event` are:
12322 *
12323 * * `AppleInterfaceThemeChangedNotification`
12324 * * `AppleAquaColorVariantChanged`
12325 * * `AppleColorPreferencesChangedNotification`
12326 * * `AppleShowScrollBarsSettingChanged`
12327 *
12328 * If `event` is null, the `NSDistributedNotificationCenter` doesn’t use it as
12329 * criteria for delivery to the observer. See docs for more information.
12330 *
12331 * @platform darwin
12332 */
12333 subscribeNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
12334 /**
12335 * The ID of this subscription
12336 *
12337 * Same as `subscribeNotification`, but uses
12338 * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
12339 * such as `NSWorkspaceDidActivateApplicationNotification`.
12340 *
12341 * If `event` is null, the `NSWorkspaceNotificationCenter` doesn’t use it as
12342 * criteria for delivery to the observer. See docs for more information.
12343 *
12344 * @platform darwin
12345 */
12346 subscribeWorkspaceNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
12347 /**
12348 * Same as `unsubscribeNotification`, but removes the subscriber from
12349 * `NSNotificationCenter`.
12350 *
12351 * @platform darwin
12352 */
12353 unsubscribeLocalNotification(id: number): void;
12354 /**
12355 * Removes the subscriber with `id`.
12356 *
12357 * @platform darwin
12358 */
12359 unsubscribeNotification(id: number): void;
12360 /**
12361 * Same as `unsubscribeNotification`, but removes the subscriber from
12362 * `NSWorkspace.sharedWorkspace.notificationCenter`.
12363 *
12364 * @platform darwin
12365 */
12366 unsubscribeWorkspaceNotification(id: number): void;
12367 /**
12368 * A `boolean` property which determines whether the app avoids using
12369 * semitransparent backgrounds. This maps to
12370 * NSWorkspace.accessibilityDisplayShouldReduceTransparency
12371 *
12372 * @platform darwin
12373 */
12374 accessibilityDisplayShouldReduceTransparency(): boolean;
12375 /**
12376 * A `string` property that can be `dark`, `light` or `unknown`.
12377 *
12378 * Returns the macOS appearance setting that is currently applied to your
12379 * application, maps to NSApplication.effectiveAppearance
12380 *
12381 * @platform darwin
12382 */
12383 readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
12384 }
12385
12386 interface Task {
12387
12388 // Docs: https://electronjs.org/docs/api/structures/task
12389
12390 /**
12391 * The command line arguments when `program` is executed.
12392 */
12393 arguments: string;
12394 /**
12395 * Description of this task.
12396 */
12397 description: string;
12398 /**
12399 * The icon index in the icon file. If an icon file consists of two or more icons,
12400 * set this value to identify the icon. If an icon file consists of one icon, this
12401 * value is 0.
12402 */
12403 iconIndex: number;
12404 /**
12405 * The absolute path to an icon to be displayed in a JumpList, which can be an
12406 * arbitrary resource file that contains an icon. You can usually specify
12407 * `process.execPath` to show the icon of the program.
12408 */
12409 iconPath: string;
12410 /**
12411 * Path of the program to execute, usually you should specify `process.execPath`
12412 * which opens the current program.
12413 */
12414 program: string;
12415 /**
12416 * The string to be displayed in a JumpList.
12417 */
12418 title: string;
12419 /**
12420 * The working directory. Default is empty.
12421 */
12422 workingDirectory?: string;
12423 }
12424
12425 interface ThumbarButton {
12426
12427 // Docs: https://electronjs.org/docs/api/structures/thumbar-button
12428
12429 click: () => void;
12430 /**
12431 * Control specific states and behaviors of the button. By default, it is
12432 * `['enabled']`.
12433 */
12434 flags?: string[];
12435 /**
12436 * The icon showing in thumbnail toolbar.
12437 */
12438 icon: NativeImage;
12439 /**
12440 * The text of the button's tooltip.
12441 */
12442 tooltip?: string;
12443 }
12444
12445 class TouchBar {
12446
12447 // Docs: https://electronjs.org/docs/api/touch-bar
12448
12449 /**
12450 * TouchBar
12451 */
12452 constructor(options: TouchBarConstructorOptions);
12453 /**
12454 * A `TouchBarItem` that will replace the "esc" button on the touch bar when set.
12455 * Setting to `null` restores the default "esc" button. Changing this value
12456 * immediately updates the escape item in the touch bar.
12457 */
12458 escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
12459 /**
12460 * A `typeof TouchBarButton` reference to the `TouchBarButton` class.
12461 */
12462 static TouchBarButton: typeof TouchBarButton;
12463 /**
12464 * A `typeof TouchBarColorPicker` reference to the `TouchBarColorPicker` class.
12465 */
12466 static TouchBarColorPicker: typeof TouchBarColorPicker;
12467 /**
12468 * A `typeof TouchBarGroup` reference to the `TouchBarGroup` class.
12469 */
12470 static TouchBarGroup: typeof TouchBarGroup;
12471 /**
12472 * A `typeof TouchBarLabel` reference to the `TouchBarLabel` class.
12473 */
12474 static TouchBarLabel: typeof TouchBarLabel;
12475 /**
12476 * A `typeof TouchBarOtherItemsProxy` reference to the `TouchBarOtherItemsProxy`
12477 * class.
12478 */
12479 static TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
12480 /**
12481 * A `typeof TouchBarPopover` reference to the `TouchBarPopover` class.
12482 */
12483 static TouchBarPopover: typeof TouchBarPopover;
12484 /**
12485 * A `typeof TouchBarScrubber` reference to the `TouchBarScrubber` class.
12486 */
12487 static TouchBarScrubber: typeof TouchBarScrubber;
12488 /**
12489 * A `typeof TouchBarSegmentedControl` reference to the `TouchBarSegmentedControl`
12490 * class.
12491 */
12492 static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
12493 /**
12494 * A `typeof TouchBarSlider` reference to the `TouchBarSlider` class.
12495 */
12496 static TouchBarSlider: typeof TouchBarSlider;
12497 /**
12498 * A `typeof TouchBarSpacer` reference to the `TouchBarSpacer` class.
12499 */
12500 static TouchBarSpacer: typeof TouchBarSpacer;
12501 }
12502
12503 class TouchBarButton {
12504
12505 // Docs: https://electronjs.org/docs/api/touch-bar-button
12506
12507 /**
12508 * TouchBarButton
12509 */
12510 constructor(options: TouchBarButtonConstructorOptions);
12511 /**
12512 * A `string` representing the description of the button to be read by a screen
12513 * reader. Will only be read by screen readers if no label is set.
12514 */
12515 accessibilityLabel: string;
12516 /**
12517 * A `string` hex code representing the button's current background color. Changing
12518 * this value immediately updates the button in the touch bar.
12519 */
12520 backgroundColor: string;
12521 /**
12522 * A `boolean` representing whether the button is in an enabled state.
12523 */
12524 enabled: boolean;
12525 /**
12526 * A `NativeImage` representing the button's current icon. Changing this value
12527 * immediately updates the button in the touch bar.
12528 */
12529 icon: NativeImage;
12530 /**
12531 * A `string` - Can be `left`, `right` or `overlay`. Defaults to `overlay`.
12532 */
12533 iconPosition: ('left' | 'right' | 'overlay');
12534 /**
12535 * A `string` representing the button's current text. Changing this value
12536 * immediately updates the button in the touch bar.
12537 */
12538 label: string;
12539 }
12540
12541 class TouchBarColorPicker extends NodeEventEmitter {
12542
12543 // Docs: https://electronjs.org/docs/api/touch-bar-color-picker
12544
12545 /**
12546 * TouchBarColorPicker
12547 */
12548 constructor(options: TouchBarColorPickerConstructorOptions);
12549 /**
12550 * A `string[]` array representing the color picker's available colors to select.
12551 * Changing this value immediately updates the color picker in the touch bar.
12552 */
12553 availableColors: string[];
12554 /**
12555 * A `string` hex code representing the color picker's currently selected color.
12556 * Changing this value immediately updates the color picker in the touch bar.
12557 */
12558 selectedColor: string;
12559 }
12560
12561 class TouchBarGroup extends NodeEventEmitter {
12562
12563 // Docs: https://electronjs.org/docs/api/touch-bar-group
12564
12565 /**
12566 * TouchBarGroup
12567 */
12568 constructor(options: TouchBarGroupConstructorOptions);
12569 }
12570
12571 class TouchBarLabel extends NodeEventEmitter {
12572
12573 // Docs: https://electronjs.org/docs/api/touch-bar-label
12574
12575 /**
12576 * TouchBarLabel
12577 */
12578 constructor(options: TouchBarLabelConstructorOptions);
12579 /**
12580 * A `string` representing the description of the label to be read by a screen
12581 * reader.
12582 */
12583 accessibilityLabel: string;
12584 /**
12585 * A `string` representing the label's current text. Changing this value
12586 * immediately updates the label in the touch bar.
12587 */
12588 label: string;
12589 /**
12590 * A `string` hex code representing the label's current text color. Changing this
12591 * value immediately updates the label in the touch bar.
12592 */
12593 textColor: string;
12594 }
12595
12596 class TouchBarOtherItemsProxy extends NodeEventEmitter {
12597
12598 // Docs: https://electronjs.org/docs/api/touch-bar-other-items-proxy
12599
12600 /**
12601 * TouchBarOtherItemsProxy
12602 */
12603 constructor();
12604 }
12605
12606 class TouchBarPopover extends NodeEventEmitter {
12607
12608 // Docs: https://electronjs.org/docs/api/touch-bar-popover
12609
12610 /**
12611 * TouchBarPopover
12612 */
12613 constructor(options: TouchBarPopoverConstructorOptions);
12614 /**
12615 * A `NativeImage` representing the popover's current button icon. Changing this
12616 * value immediately updates the popover in the touch bar.
12617 */
12618 icon: NativeImage;
12619 /**
12620 * A `string` representing the popover's current button text. Changing this value
12621 * immediately updates the popover in the touch bar.
12622 */
12623 label: string;
12624 }
12625
12626 class TouchBarScrubber extends NodeEventEmitter {
12627
12628 // Docs: https://electronjs.org/docs/api/touch-bar-scrubber
12629
12630 /**
12631 * TouchBarScrubber
12632 */
12633 constructor(options: TouchBarScrubberConstructorOptions);
12634 /**
12635 * A `boolean` representing whether this scrubber is continuous or not. Updating
12636 * this value immediately updates the control in the touch bar.
12637 */
12638 continuous: boolean;
12639 /**
12640 * A `ScrubberItem[]` array representing the items in this scrubber. Updating this
12641 * value immediately updates the control in the touch bar. Updating deep properties
12642 * inside this array **does not update the touch bar**.
12643 */
12644 items: ScrubberItem[];
12645 /**
12646 * A `string` representing the mode of this scrubber. Updating this value
12647 * immediately updates the control in the touch bar. Possible values:
12648 *
12649 * * `fixed` - Maps to `NSScrubberModeFixed`.
12650 * * `free` - Maps to `NSScrubberModeFree`.
12651 */
12652 mode: ('fixed' | 'free');
12653 /**
12654 * A `string` representing the style that selected items in the scrubber should
12655 * have. This style is overlayed on top of the scrubber item instead of being
12656 * placed behind it. Updating this value immediately updates the control in the
12657 * touch bar. Possible values:
12658 *
12659 * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
12660 * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
12661 * * `none` - Removes all styles.
12662 */
12663 overlayStyle: ('background' | 'outline' | 'none');
12664 /**
12665 * A `string` representing the style that selected items in the scrubber should
12666 * have. Updating this value immediately updates the control in the touch bar.
12667 * Possible values:
12668 *
12669 * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
12670 * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
12671 * * `none` - Removes all styles.
12672 */
12673 selectedStyle: ('background' | 'outline' | 'none');
12674 /**
12675 * A `boolean` representing whether to show the left / right selection arrows in
12676 * this scrubber. Updating this value immediately updates the control in the touch
12677 * bar.
12678 */
12679 showArrowButtons: boolean;
12680 }
12681
12682 class TouchBarSegmentedControl extends NodeEventEmitter {
12683
12684 // Docs: https://electronjs.org/docs/api/touch-bar-segmented-control
12685
12686 /**
12687 * TouchBarSegmentedControl
12688 */
12689 constructor(options: TouchBarSegmentedControlConstructorOptions);
12690 /**
12691 * A `string` representing the current selection mode of the control. Can be
12692 * `single`, `multiple` or `buttons`.
12693 */
12694 mode: ('single' | 'multiple' | 'buttons');
12695 /**
12696 * A `SegmentedControlSegment[]` array representing the segments in this control.
12697 * Updating this value immediately updates the control in the touch bar. Updating
12698 * deep properties inside this array **does not update the touch bar**.
12699 */
12700 segments: SegmentedControlSegment[];
12701 /**
12702 * A `string` representing the controls current segment style. Updating this value
12703 * immediately updates the control in the touch bar.
12704 */
12705 segmentStyle: string;
12706 /**
12707 * An `Integer` representing the currently selected segment. Changing this value
12708 * immediately updates the control in the touch bar. User interaction with the
12709 * touch bar will update this value automatically.
12710 */
12711 selectedIndex: number;
12712 }
12713
12714 class TouchBarSlider extends NodeEventEmitter {
12715
12716 // Docs: https://electronjs.org/docs/api/touch-bar-slider
12717
12718 /**
12719 * TouchBarSlider
12720 */
12721 constructor(options: TouchBarSliderConstructorOptions);
12722 /**
12723 * A `string` representing the slider's current text. Changing this value
12724 * immediately updates the slider in the touch bar.
12725 */
12726 label: string;
12727 /**
12728 * A `number` representing the slider's current maximum value. Changing this value
12729 * immediately updates the slider in the touch bar.
12730 */
12731 maxValue: number;
12732 /**
12733 * A `number` representing the slider's current minimum value. Changing this value
12734 * immediately updates the slider in the touch bar.
12735 */
12736 minValue: number;
12737 /**
12738 * A `number` representing the slider's current value. Changing this value
12739 * immediately updates the slider in the touch bar.
12740 */
12741 value: number;
12742 }
12743
12744 class TouchBarSpacer extends NodeEventEmitter {
12745
12746 // Docs: https://electronjs.org/docs/api/touch-bar-spacer
12747
12748 /**
12749 * TouchBarSpacer
12750 */
12751 constructor(options: TouchBarSpacerConstructorOptions);
12752 /**
12753 * A `string` representing the size of the spacer. Can be `small`, `large` or
12754 * `flexible`.
12755 */
12756 size: ('small' | 'large' | 'flexible');
12757 }
12758
12759 interface TraceCategoriesAndOptions {
12760
12761 // Docs: https://electronjs.org/docs/api/structures/trace-categories-and-options
12762
12763 /**
12764 * A filter to control what category groups should be traced. A filter can have an
12765 * optional '-' prefix to exclude category groups that contain a matching category.
12766 * Having both included and excluded category patterns in the same list is not
12767 * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
12768 * `-excluded_category1,-excluded_category2`.
12769 */
12770 categoryFilter: string;
12771 /**
12772 * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
12773 * the following strings: `record-until-full`, `record-continuously`,
12774 * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
12775 * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
12776 * modes and hence mutually exclusive. If more than one trace recording modes
12777 * appear in the `traceOptions` string, the last one takes precedence. If none of
12778 * the trace recording modes are specified, recording mode is `record-until-full`.
12779 * The trace option will first be reset to the default option (`record_mode` set to
12780 * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
12781 * before options parsed from `traceOptions` are applied on it.
12782 */
12783 traceOptions: string;
12784 }
12785
12786 interface TraceConfig {
12787
12788 // Docs: https://electronjs.org/docs/api/structures/trace-config
12789
12790 /**
12791 * if true, filter event data according to a specific list of events that have been
12792 * manually vetted to not include any PII. See the implementation in Chromium for
12793 * specifics.
12794 */
12795 enable_argument_filter?: boolean;
12796 /**
12797 * a list of tracing categories to exclude. Can include glob-like patterns using
12798 * `*` at the end of the category name. See tracing categories for the list of
12799 * categories.
12800 */
12801 excluded_categories?: string[];
12802 /**
12803 * a list of histogram names to report with the trace.
12804 */
12805 histogram_names?: string[];
12806 /**
12807 * a list of tracing categories to include. Can include glob-like patterns using
12808 * `*` at the end of the category name. See tracing categories for the list of
12809 * categories.
12810 */
12811 included_categories?: string[];
12812 /**
12813 * a list of process IDs to include in the trace. If not specified, trace all
12814 * processes.
12815 */
12816 included_process_ids?: number[];
12817 /**
12818 * if the `disabled-by-default-memory-infra` category is enabled, this contains
12819 * optional additional configuration for data collection. See the Chromium
12820 * memory-infra docs for more information.
12821 */
12822 memory_dump_config?: Record<string, any>;
12823 /**
12824 * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
12825 * or `trace-to-console`. Defaults to `record-until-full`.
12826 */
12827 recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
12828 /**
12829 * maximum size of the trace recording buffer in events.
12830 */
12831 trace_buffer_size_in_events?: number;
12832 /**
12833 * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
12834 */
12835 trace_buffer_size_in_kb?: number;
12836 }
12837
12838 interface Transaction {
12839
12840 // Docs: https://electronjs.org/docs/api/structures/transaction
12841
12842 /**
12843 * The error code if an error occurred while processing the transaction.
12844 */
12845 errorCode: number;
12846 /**
12847 * The error message if an error occurred while processing the transaction.
12848 */
12849 errorMessage: string;
12850 /**
12851 * The identifier of the restored transaction by the App Store.
12852 */
12853 originalTransactionIdentifier: string;
12854 payment: Payment;
12855 /**
12856 * The date the transaction was added to the App Store’s payment queue.
12857 */
12858 transactionDate: string;
12859 /**
12860 * A string that uniquely identifies a successful payment transaction.
12861 */
12862 transactionIdentifier: string;
12863 /**
12864 * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
12865 * `deferred`.
12866 */
12867 transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
12868 }
12869
12870 class Tray extends NodeEventEmitter {
12871
12872 // Docs: https://electronjs.org/docs/api/tray
12873
12874 /**
12875 * Emitted when the tray balloon is clicked.
12876 *
12877 * @platform win32
12878 */
12879 on(event: 'balloon-click', listener: Function): this;
12880 /**
12881 * @platform win32
12882 */
12883 off(event: 'balloon-click', listener: Function): this;
12884 /**
12885 * @platform win32
12886 */
12887 once(event: 'balloon-click', listener: Function): this;
12888 /**
12889 * @platform win32
12890 */
12891 addListener(event: 'balloon-click', listener: Function): this;
12892 /**
12893 * @platform win32
12894 */
12895 removeListener(event: 'balloon-click', listener: Function): this;
12896 /**
12897 * Emitted when the tray balloon is closed because of timeout or user manually
12898 * closes it.
12899 *
12900 * @platform win32
12901 */
12902 on(event: 'balloon-closed', listener: Function): this;
12903 /**
12904 * @platform win32
12905 */
12906 off(event: 'balloon-closed', listener: Function): this;
12907 /**
12908 * @platform win32
12909 */
12910 once(event: 'balloon-closed', listener: Function): this;
12911 /**
12912 * @platform win32
12913 */
12914 addListener(event: 'balloon-closed', listener: Function): this;
12915 /**
12916 * @platform win32
12917 */
12918 removeListener(event: 'balloon-closed', listener: Function): this;
12919 /**
12920 * Emitted when the tray balloon shows.
12921 *
12922 * @platform win32
12923 */
12924 on(event: 'balloon-show', listener: Function): this;
12925 /**
12926 * @platform win32
12927 */
12928 off(event: 'balloon-show', listener: Function): this;
12929 /**
12930 * @platform win32
12931 */
12932 once(event: 'balloon-show', listener: Function): this;
12933 /**
12934 * @platform win32
12935 */
12936 addListener(event: 'balloon-show', listener: Function): this;
12937 /**
12938 * @platform win32
12939 */
12940 removeListener(event: 'balloon-show', listener: Function): this;
12941 /**
12942 * Emitted when the tray icon is clicked.
12943 *
12944 * Note that on Linux this event is emitted when the tray icon receives an
12945 * activation, which might not necessarily be left mouse click.
12946 */
12947 on(event: 'click', listener: (event: KeyboardEvent,
12948 /**
12949 * The bounds of tray icon.
12950 */
12951 bounds: Rectangle,
12952 /**
12953 * The position of the event.
12954 */
12955 position: Point) => void): this;
12956 off(event: 'click', listener: (event: KeyboardEvent,
12957 /**
12958 * The bounds of tray icon.
12959 */
12960 bounds: Rectangle,
12961 /**
12962 * The position of the event.
12963 */
12964 position: Point) => void): this;
12965 once(event: 'click', listener: (event: KeyboardEvent,
12966 /**
12967 * The bounds of tray icon.
12968 */
12969 bounds: Rectangle,
12970 /**
12971 * The position of the event.
12972 */
12973 position: Point) => void): this;
12974 addListener(event: 'click', listener: (event: KeyboardEvent,
12975 /**
12976 * The bounds of tray icon.
12977 */
12978 bounds: Rectangle,
12979 /**
12980 * The position of the event.
12981 */
12982 position: Point) => void): this;
12983 removeListener(event: 'click', listener: (event: KeyboardEvent,
12984 /**
12985 * The bounds of tray icon.
12986 */
12987 bounds: Rectangle,
12988 /**
12989 * The position of the event.
12990 */
12991 position: Point) => void): this;
12992 /**
12993 * Emitted when the tray icon is double clicked.
12994 *
12995 * @platform darwin,win32
12996 */
12997 on(event: 'double-click', listener: (event: KeyboardEvent,
12998 /**
12999 * The bounds of tray icon.
13000 */
13001 bounds: Rectangle) => void): this;
13002 /**
13003 * @platform darwin,win32
13004 */
13005 off(event: 'double-click', listener: (event: KeyboardEvent,
13006 /**
13007 * The bounds of tray icon.
13008 */
13009 bounds: Rectangle) => void): this;
13010 /**
13011 * @platform darwin,win32
13012 */
13013 once(event: 'double-click', listener: (event: KeyboardEvent,
13014 /**
13015 * The bounds of tray icon.
13016 */
13017 bounds: Rectangle) => void): this;
13018 /**
13019 * @platform darwin,win32
13020 */
13021 addListener(event: 'double-click', listener: (event: KeyboardEvent,
13022 /**
13023 * The bounds of tray icon.
13024 */
13025 bounds: Rectangle) => void): this;
13026 /**
13027 * @platform darwin,win32
13028 */
13029 removeListener(event: 'double-click', listener: (event: KeyboardEvent,
13030 /**
13031 * The bounds of tray icon.
13032 */
13033 bounds: Rectangle) => void): this;
13034 /**
13035 * Emitted when a drag operation ends on the tray or ends at another location.
13036 *
13037 * @platform darwin
13038 */
13039 on(event: 'drag-end', listener: Function): this;
13040 /**
13041 * @platform darwin
13042 */
13043 off(event: 'drag-end', listener: Function): this;
13044 /**
13045 * @platform darwin
13046 */
13047 once(event: 'drag-end', listener: Function): this;
13048 /**
13049 * @platform darwin
13050 */
13051 addListener(event: 'drag-end', listener: Function): this;
13052 /**
13053 * @platform darwin
13054 */
13055 removeListener(event: 'drag-end', listener: Function): this;
13056 /**
13057 * Emitted when a drag operation enters the tray icon.
13058 *
13059 * @platform darwin
13060 */
13061 on(event: 'drag-enter', listener: Function): this;
13062 /**
13063 * @platform darwin
13064 */
13065 off(event: 'drag-enter', listener: Function): this;
13066 /**
13067 * @platform darwin
13068 */
13069 once(event: 'drag-enter', listener: Function): this;
13070 /**
13071 * @platform darwin
13072 */
13073 addListener(event: 'drag-enter', listener: Function): this;
13074 /**
13075 * @platform darwin
13076 */
13077 removeListener(event: 'drag-enter', listener: Function): this;
13078 /**
13079 * Emitted when a drag operation exits the tray icon.
13080 *
13081 * @platform darwin
13082 */
13083 on(event: 'drag-leave', listener: Function): this;
13084 /**
13085 * @platform darwin
13086 */
13087 off(event: 'drag-leave', listener: Function): this;
13088 /**
13089 * @platform darwin
13090 */
13091 once(event: 'drag-leave', listener: Function): this;
13092 /**
13093 * @platform darwin
13094 */
13095 addListener(event: 'drag-leave', listener: Function): this;
13096 /**
13097 * @platform darwin
13098 */
13099 removeListener(event: 'drag-leave', listener: Function): this;
13100 /**
13101 * Emitted when any dragged items are dropped on the tray icon.
13102 *
13103 * @platform darwin
13104 */
13105 on(event: 'drop', listener: Function): this;
13106 /**
13107 * @platform darwin
13108 */
13109 off(event: 'drop', listener: Function): this;
13110 /**
13111 * @platform darwin
13112 */
13113 once(event: 'drop', listener: Function): this;
13114 /**
13115 * @platform darwin
13116 */
13117 addListener(event: 'drop', listener: Function): this;
13118 /**
13119 * @platform darwin
13120 */
13121 removeListener(event: 'drop', listener: Function): this;
13122 /**
13123 * Emitted when dragged files are dropped in the tray icon.
13124 *
13125 * @platform darwin
13126 */
13127 on(event: 'drop-files', listener: (event: Event,
13128 /**
13129 * The paths of the dropped files.
13130 */
13131 files: string[]) => void): this;
13132 /**
13133 * @platform darwin
13134 */
13135 off(event: 'drop-files', listener: (event: Event,
13136 /**
13137 * The paths of the dropped files.
13138 */
13139 files: string[]) => void): this;
13140 /**
13141 * @platform darwin
13142 */
13143 once(event: 'drop-files', listener: (event: Event,
13144 /**
13145 * The paths of the dropped files.
13146 */
13147 files: string[]) => void): this;
13148 /**
13149 * @platform darwin
13150 */
13151 addListener(event: 'drop-files', listener: (event: Event,
13152 /**
13153 * The paths of the dropped files.
13154 */
13155 files: string[]) => void): this;
13156 /**
13157 * @platform darwin
13158 */
13159 removeListener(event: 'drop-files', listener: (event: Event,
13160 /**
13161 * The paths of the dropped files.
13162 */
13163 files: string[]) => void): this;
13164 /**
13165 * Emitted when dragged text is dropped in the tray icon.
13166 *
13167 * @platform darwin
13168 */
13169 on(event: 'drop-text', listener: (event: Event,
13170 /**
13171 * the dropped text string.
13172 */
13173 text: string) => void): this;
13174 /**
13175 * @platform darwin
13176 */
13177 off(event: 'drop-text', listener: (event: Event,
13178 /**
13179 * the dropped text string.
13180 */
13181 text: string) => void): this;
13182 /**
13183 * @platform darwin
13184 */
13185 once(event: 'drop-text', listener: (event: Event,
13186 /**
13187 * the dropped text string.
13188 */
13189 text: string) => void): this;
13190 /**
13191 * @platform darwin
13192 */
13193 addListener(event: 'drop-text', listener: (event: Event,
13194 /**
13195 * the dropped text string.
13196 */
13197 text: string) => void): this;
13198 /**
13199 * @platform darwin
13200 */
13201 removeListener(event: 'drop-text', listener: (event: Event,
13202 /**
13203 * the dropped text string.
13204 */
13205 text: string) => void): this;
13206 /**
13207 * Emitted when the tray icon is middle clicked.
13208 *
13209 * @platform win32
13210 */
13211 on(event: 'middle-click', listener: (event: KeyboardEvent,
13212 /**
13213 * The bounds of tray icon.
13214 */
13215 bounds: Rectangle) => void): this;
13216 /**
13217 * @platform win32
13218 */
13219 off(event: 'middle-click', listener: (event: KeyboardEvent,
13220 /**
13221 * The bounds of tray icon.
13222 */
13223 bounds: Rectangle) => void): this;
13224 /**
13225 * @platform win32
13226 */
13227 once(event: 'middle-click', listener: (event: KeyboardEvent,
13228 /**
13229 * The bounds of tray icon.
13230 */
13231 bounds: Rectangle) => void): this;
13232 /**
13233 * @platform win32
13234 */
13235 addListener(event: 'middle-click', listener: (event: KeyboardEvent,
13236 /**
13237 * The bounds of tray icon.
13238 */
13239 bounds: Rectangle) => void): this;
13240 /**
13241 * @platform win32
13242 */
13243 removeListener(event: 'middle-click', listener: (event: KeyboardEvent,
13244 /**
13245 * The bounds of tray icon.
13246 */
13247 bounds: Rectangle) => void): this;
13248 /**
13249 * Emitted when the mouse clicks the tray icon.
13250 *
13251 * @platform darwin
13252 */
13253 on(event: 'mouse-down', listener: (event: KeyboardEvent,
13254 /**
13255 * The position of the event.
13256 */
13257 position: Point) => void): this;
13258 /**
13259 * @platform darwin
13260 */
13261 off(event: 'mouse-down', listener: (event: KeyboardEvent,
13262 /**
13263 * The position of the event.
13264 */
13265 position: Point) => void): this;
13266 /**
13267 * @platform darwin
13268 */
13269 once(event: 'mouse-down', listener: (event: KeyboardEvent,
13270 /**
13271 * The position of the event.
13272 */
13273 position: Point) => void): this;
13274 /**
13275 * @platform darwin
13276 */
13277 addListener(event: 'mouse-down', listener: (event: KeyboardEvent,
13278 /**
13279 * The position of the event.
13280 */
13281 position: Point) => void): this;
13282 /**
13283 * @platform darwin
13284 */
13285 removeListener(event: 'mouse-down', listener: (event: KeyboardEvent,
13286 /**
13287 * The position of the event.
13288 */
13289 position: Point) => void): this;
13290 /**
13291 * Emitted when the mouse enters the tray icon.
13292 *
13293 * @platform darwin,win32
13294 */
13295 on(event: 'mouse-enter', listener: (event: KeyboardEvent,
13296 /**
13297 * The position of the event.
13298 */
13299 position: Point) => void): this;
13300 /**
13301 * @platform darwin,win32
13302 */
13303 off(event: 'mouse-enter', listener: (event: KeyboardEvent,
13304 /**
13305 * The position of the event.
13306 */
13307 position: Point) => void): this;
13308 /**
13309 * @platform darwin,win32
13310 */
13311 once(event: 'mouse-enter', listener: (event: KeyboardEvent,
13312 /**
13313 * The position of the event.
13314 */
13315 position: Point) => void): this;
13316 /**
13317 * @platform darwin,win32
13318 */
13319 addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
13320 /**
13321 * The position of the event.
13322 */
13323 position: Point) => void): this;
13324 /**
13325 * @platform darwin,win32
13326 */
13327 removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
13328 /**
13329 * The position of the event.
13330 */
13331 position: Point) => void): this;
13332 /**
13333 * Emitted when the mouse exits the tray icon.
13334 *
13335 * @platform darwin,win32
13336 */
13337 on(event: 'mouse-leave', listener: (event: KeyboardEvent,
13338 /**
13339 * The position of the event.
13340 */
13341 position: Point) => void): this;
13342 /**
13343 * @platform darwin,win32
13344 */
13345 off(event: 'mouse-leave', listener: (event: KeyboardEvent,
13346 /**
13347 * The position of the event.
13348 */
13349 position: Point) => void): this;
13350 /**
13351 * @platform darwin,win32
13352 */
13353 once(event: 'mouse-leave', listener: (event: KeyboardEvent,
13354 /**
13355 * The position of the event.
13356 */
13357 position: Point) => void): this;
13358 /**
13359 * @platform darwin,win32
13360 */
13361 addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
13362 /**
13363 * The position of the event.
13364 */
13365 position: Point) => void): this;
13366 /**
13367 * @platform darwin,win32
13368 */
13369 removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
13370 /**
13371 * The position of the event.
13372 */
13373 position: Point) => void): this;
13374 /**
13375 * Emitted when the mouse moves in the tray icon.
13376 *
13377 * @platform darwin,win32
13378 */
13379 on(event: 'mouse-move', listener: (event: KeyboardEvent,
13380 /**
13381 * The position of the event.
13382 */
13383 position: Point) => void): this;
13384 /**
13385 * @platform darwin,win32
13386 */
13387 off(event: 'mouse-move', listener: (event: KeyboardEvent,
13388 /**
13389 * The position of the event.
13390 */
13391 position: Point) => void): this;
13392 /**
13393 * @platform darwin,win32
13394 */
13395 once(event: 'mouse-move', listener: (event: KeyboardEvent,
13396 /**
13397 * The position of the event.
13398 */
13399 position: Point) => void): this;
13400 /**
13401 * @platform darwin,win32
13402 */
13403 addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
13404 /**
13405 * The position of the event.
13406 */
13407 position: Point) => void): this;
13408 /**
13409 * @platform darwin,win32
13410 */
13411 removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
13412 /**
13413 * The position of the event.
13414 */
13415 position: Point) => void): this;
13416 /**
13417 * Emitted when the mouse is released from clicking the tray icon.
13418 *
13419 * Note: This will not be emitted if you have set a context menu for your Tray
13420 * using `tray.setContextMenu`, as a result of macOS-level constraints.
13421 *
13422 * @platform darwin
13423 */
13424 on(event: 'mouse-up', listener: (event: KeyboardEvent,
13425 /**
13426 * The position of the event.
13427 */
13428 position: Point) => void): this;
13429 /**
13430 * @platform darwin
13431 */
13432 off(event: 'mouse-up', listener: (event: KeyboardEvent,
13433 /**
13434 * The position of the event.
13435 */
13436 position: Point) => void): this;
13437 /**
13438 * @platform darwin
13439 */
13440 once(event: 'mouse-up', listener: (event: KeyboardEvent,
13441 /**
13442 * The position of the event.
13443 */
13444 position: Point) => void): this;
13445 /**
13446 * @platform darwin
13447 */
13448 addListener(event: 'mouse-up', listener: (event: KeyboardEvent,
13449 /**
13450 * The position of the event.
13451 */
13452 position: Point) => void): this;
13453 /**
13454 * @platform darwin
13455 */
13456 removeListener(event: 'mouse-up', listener: (event: KeyboardEvent,
13457 /**
13458 * The position of the event.
13459 */
13460 position: Point) => void): this;
13461 /**
13462 * Emitted when the tray icon is right clicked.
13463 *
13464 * @platform darwin,win32
13465 */
13466 on(event: 'right-click', listener: (event: KeyboardEvent,
13467 /**
13468 * The bounds of tray icon.
13469 */
13470 bounds: Rectangle) => void): this;
13471 /**
13472 * @platform darwin,win32
13473 */
13474 off(event: 'right-click', listener: (event: KeyboardEvent,
13475 /**
13476 * The bounds of tray icon.
13477 */
13478 bounds: Rectangle) => void): this;
13479 /**
13480 * @platform darwin,win32
13481 */
13482 once(event: 'right-click', listener: (event: KeyboardEvent,
13483 /**
13484 * The bounds of tray icon.
13485 */
13486 bounds: Rectangle) => void): this;
13487 /**
13488 * @platform darwin,win32
13489 */
13490 addListener(event: 'right-click', listener: (event: KeyboardEvent,
13491 /**
13492 * The bounds of tray icon.
13493 */
13494 bounds: Rectangle) => void): this;
13495 /**
13496 * @platform darwin,win32
13497 */
13498 removeListener(event: 'right-click', listener: (event: KeyboardEvent,
13499 /**
13500 * The bounds of tray icon.
13501 */
13502 bounds: Rectangle) => void): this;
13503 /**
13504 * Tray
13505 */
13506 constructor(image: (NativeImage) | (string), guid?: string);
13507 /**
13508 * Closes an open context menu, as set by `tray.setContextMenu()`.
13509 *
13510 * @platform darwin,win32
13511 */
13512 closeContextMenu(): void;
13513 /**
13514 * Destroys the tray icon immediately.
13515 */
13516 destroy(): void;
13517 /**
13518 * Displays a tray balloon.
13519 *
13520 * @platform win32
13521 */
13522 displayBalloon(options: DisplayBalloonOptions): void;
13523 /**
13524 * Returns focus to the taskbar notification area. Notification area icons should
13525 * use this message when they have completed their UI operation. For example, if
13526 * the icon displays a shortcut menu, but the user presses ESC to cancel it, use
13527 * `tray.focus()` to return focus to the notification area.
13528 *
13529 * @platform win32
13530 */
13531 focus(): void;
13532 /**
13533 * The `bounds` of this tray icon as `Object`.
13534 *
13535 * @platform darwin,win32
13536 */
13537 getBounds(): Rectangle;
13538 /**
13539 * Whether double click events will be ignored.
13540 *
13541 * @platform darwin
13542 */
13543 getIgnoreDoubleClickEvents(): boolean;
13544 /**
13545 * the title displayed next to the tray icon in the status bar
13546 *
13547 * @platform darwin
13548 */
13549 getTitle(): string;
13550 /**
13551 * Whether the tray icon is destroyed.
13552 */
13553 isDestroyed(): boolean;
13554 /**
13555 * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
13556 * will be shown instead of the tray icon's context menu.
13557 *
13558 * The `position` is only available on Windows, and it is (0, 0) by default.
13559 *
13560 * @platform darwin,win32
13561 */
13562 popUpContextMenu(menu?: Menu, position?: Point): void;
13563 /**
13564 * Removes a tray balloon.
13565 *
13566 * @platform win32
13567 */
13568 removeBalloon(): void;
13569 /**
13570 * Sets the context menu for this icon.
13571 */
13572 setContextMenu(menu: (Menu) | (null)): void;
13573 /**
13574 * Sets the option to ignore double click events. Ignoring these events allows you
13575 * to detect every individual click of the tray icon.
13576 *
13577 * This value is set to false by default.
13578 *
13579 * @platform darwin
13580 */
13581 setIgnoreDoubleClickEvents(ignore: boolean): void;
13582 /**
13583 * Sets the `image` associated with this tray icon.
13584 */
13585 setImage(image: (NativeImage) | (string)): void;
13586 /**
13587 * Sets the `image` associated with this tray icon when pressed on macOS.
13588 *
13589 * @platform darwin
13590 */
13591 setPressedImage(image: (NativeImage) | (string)): void;
13592 /**
13593 * Sets the title displayed next to the tray icon in the status bar (Support ANSI
13594 * colors).
13595 *
13596 * @platform darwin
13597 */
13598 setTitle(title: string, options?: TitleOptions): void;
13599 /**
13600 * Sets the hover text for this tray icon.
13601 */
13602 setToolTip(toolTip: string): void;
13603 }
13604
13605 interface UploadData {
13606
13607 // Docs: https://electronjs.org/docs/api/structures/upload-data
13608
13609 /**
13610 * UUID of blob data. Use ses.getBlobData method to retrieve the data.
13611 */
13612 blobUUID?: string;
13613 /**
13614 * Content being sent.
13615 */
13616 bytes: Buffer;
13617 /**
13618 * Path of file being uploaded.
13619 */
13620 file?: string;
13621 }
13622
13623 interface UploadFile {
13624
13625 // Docs: https://electronjs.org/docs/api/structures/upload-file
13626
13627 /**
13628 * Path of file to be uploaded.
13629 */
13630 filePath: string;
13631 /**
13632 * Number of bytes to read from `offset`. Defaults to `0`.
13633 */
13634 length?: number;
13635 /**
13636 * Last Modification time in number of seconds since the UNIX epoch. Defaults to
13637 * `0`.
13638 */
13639 modificationTime?: number;
13640 /**
13641 * Defaults to `0`.
13642 */
13643 offset?: number;
13644 /**
13645 * `file`.
13646 */
13647 type: 'file';
13648 }
13649
13650 interface UploadRawData {
13651
13652 // Docs: https://electronjs.org/docs/api/structures/upload-raw-data
13653
13654 /**
13655 * Data to be uploaded.
13656 */
13657 bytes: Buffer;
13658 /**
13659 * `rawData`.
13660 */
13661 type: 'rawData';
13662 }
13663
13664 interface USBDevice {
13665
13666 // Docs: https://electronjs.org/docs/api/structures/usb-device
13667
13668 /**
13669 * The device class for the communication interface supported by the device
13670 */
13671 deviceClass: number;
13672 /**
13673 * Unique identifier for the device.
13674 */
13675 deviceId: string;
13676 /**
13677 * The device protocol for the communication interface supported by the device
13678 */
13679 deviceProtocol: number;
13680 /**
13681 * The device subclass for the communication interface supported by the device
13682 */
13683 deviceSubclass: number;
13684 /**
13685 * The major version number of the device as defined by the device manufacturer.
13686 */
13687 deviceVersionMajor: number;
13688 /**
13689 * The minor version number of the device as defined by the device manufacturer.
13690 */
13691 deviceVersionMinor: number;
13692 /**
13693 * The subminor version number of the device as defined by the device manufacturer.
13694 */
13695 deviceVersionSubminor: number;
13696 /**
13697 * The manufacturer name of the device.
13698 */
13699 manufacturerName?: string;
13700 /**
13701 * The USB product ID.
13702 */
13703 productId: number;
13704 /**
13705 * Name of the device.
13706 */
13707 productName?: string;
13708 /**
13709 * The USB device serial number.
13710 */
13711 serialNumber?: string;
13712 /**
13713 * The USB protocol major version supported by the device
13714 */
13715 usbVersionMajor: number;
13716 /**
13717 * The USB protocol minor version supported by the device
13718 */
13719 usbVersionMinor: number;
13720 /**
13721 * The USB protocol subminor version supported by the device
13722 */
13723 usbVersionSubminor: number;
13724 /**
13725 * The USB vendor ID.
13726 */
13727 vendorId: number;
13728 }
13729
13730 interface UserDefaultTypes {
13731
13732 // Docs: https://electronjs.org/docs/api/structures/user-default-types
13733
13734 array: Array<unknown>;
13735 boolean: boolean;
13736 dictionary: Record<string, unknown>;
13737 double: number;
13738 float: number;
13739 integer: number;
13740 string: string;
13741 url: string;
13742 }
13743
13744 class UtilityProcess extends NodeEventEmitter {
13745
13746 // Docs: https://electronjs.org/docs/api/utility-process
13747
13748 static fork(modulePath: string, args?: string[], options?: ForkOptions): UtilityProcess;
13749 /**
13750 * Emitted after the child process ends.
13751 */
13752 on(event: 'exit', listener: (
13753 /**
13754 * Contains the exit code for the process obtained from waitpid on posix, or
13755 * GetExitCodeProcess on windows.
13756 */
13757 code: number) => void): this;
13758 off(event: 'exit', listener: (
13759 /**
13760 * Contains the exit code for the process obtained from waitpid on posix, or
13761 * GetExitCodeProcess on windows.
13762 */
13763 code: number) => void): this;
13764 once(event: 'exit', listener: (
13765 /**
13766 * Contains the exit code for the process obtained from waitpid on posix, or
13767 * GetExitCodeProcess on windows.
13768 */
13769 code: number) => void): this;
13770 addListener(event: 'exit', listener: (
13771 /**
13772 * Contains the exit code for the process obtained from waitpid on posix, or
13773 * GetExitCodeProcess on windows.
13774 */
13775 code: number) => void): this;
13776 removeListener(event: 'exit', listener: (
13777 /**
13778 * Contains the exit code for the process obtained from waitpid on posix, or
13779 * GetExitCodeProcess on windows.
13780 */
13781 code: number) => void): this;
13782 /**
13783 * Emitted when the child process sends a message using
13784 * `process.parentPort.postMessage()`.
13785 */
13786 on(event: 'message', listener: (message: any) => void): this;
13787 off(event: 'message', listener: (message: any) => void): this;
13788 once(event: 'message', listener: (message: any) => void): this;
13789 addListener(event: 'message', listener: (message: any) => void): this;
13790 removeListener(event: 'message', listener: (message: any) => void): this;
13791 /**
13792 * Emitted once the child process has spawned successfully.
13793 */
13794 on(event: 'spawn', listener: Function): this;
13795 off(event: 'spawn', listener: Function): this;
13796 once(event: 'spawn', listener: Function): this;
13797 addListener(event: 'spawn', listener: Function): this;
13798 removeListener(event: 'spawn', listener: Function): this;
13799 /**
13800 * Terminates the process gracefully. On POSIX, it uses SIGTERM but will ensure the
13801 * process is reaped on exit. This function returns true if the kill is successful,
13802 * and false otherwise.
13803 */
13804 kill(): boolean;
13805 /**
13806 * Send a message to the child process, optionally transferring ownership of zero
13807 * or more `MessagePortMain` objects.
13808 *
13809 * For example:
13810 */
13811 postMessage(message: any, transfer?: MessagePortMain[]): void;
13812 /**
13813 * A `Integer | undefined` representing the process identifier (PID) of the child
13814 * process. If the child process fails to spawn due to errors, then the value is
13815 * `undefined`. When the child process exits, then the value is `undefined` after
13816 * the `exit` event is emitted.
13817 */
13818 pid: (number) | (undefined);
13819 /**
13820 * A `NodeJS.ReadableStream | null` that represents the child process's stderr. If
13821 * the child was spawned with options.stdio[2] set to anything other than 'pipe',
13822 * then this will be `null`. When the child process exits, then the value is `null`
13823 * after the `exit` event is emitted.
13824 */
13825 stderr: (NodeJS.ReadableStream) | (null);
13826 /**
13827 * A `NodeJS.ReadableStream | null` that represents the child process's stdout. If
13828 * the child was spawned with options.stdio[1] set to anything other than 'pipe',
13829 * then this will be `null`. When the child process exits, then the value is `null`
13830 * after the `exit` event is emitted.
13831 */
13832 stdout: (NodeJS.ReadableStream) | (null);
13833 }
13834
13835 class View extends NodeEventEmitter {
13836
13837 // Docs: https://electronjs.org/docs/api/view
13838
13839 /**
13840 * Emitted when the view's bounds have changed in response to being laid out. The
13841 * new bounds can be retrieved with `view.getBounds()`.
13842 */
13843 on(event: 'bounds-changed', listener: Function): this;
13844 off(event: 'bounds-changed', listener: Function): this;
13845 once(event: 'bounds-changed', listener: Function): this;
13846 addListener(event: 'bounds-changed', listener: Function): this;
13847 removeListener(event: 'bounds-changed', listener: Function): this;
13848 /**
13849 * View
13850 */
13851 constructor();
13852 /**
13853 * If the same View is added to a parent which already contains it, it will be
13854 * reordered such that it becomes the topmost view.
13855 */
13856 addChildView(view: View, index?: number): void;
13857 /**
13858 * The bounds of this View, relative to its parent.
13859 */
13860 getBounds(): Rectangle;
13861 removeChildView(view: View): void;
13862 /**
13863 * Examples of valid `color` values:
13864 *
13865 * * Hex
13866 * * `#fff` (RGB)
13867 * * `#ffff` (ARGB)
13868 * * `#ffffff` (RRGGBB)
13869 * * `#ffffffff` (AARRGGBB)
13870 * * RGB
13871 * * `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)`
13872 * * e.g. `rgb(255, 255, 255)`
13873 * * RGBA
13874 * * `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)`
13875 * * e.g. `rgba(255, 255, 255, 1.0)`
13876 * * HSL
13877 * * `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)`
13878 * * e.g. `hsl(200, 20%, 50%)`
13879 * * HSLA
13880 * * `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)`
13881 * * e.g. `hsla(200, 20%, 50%, 0.5)`
13882 * * Color name
13883 * * Options are listed in SkParseColor.cpp
13884 * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
13885 * * e.g. `blueviolet` or `red`
13886 *
13887 * **Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or
13888 * `RGB`.
13889 */
13890 setBackgroundColor(color: string): void;
13891 setBounds(bounds: Rectangle): void;
13892 setVisible(visible: boolean): void;
13893 /**
13894 * A `View[]` property representing the child views of this view.
13895 *
13896 */
13897 readonly children: View[];
13898 }
13899
13900 class WebContents extends NodeEventEmitter {
13901
13902 // Docs: https://electronjs.org/docs/api/web-contents
13903
13904 /**
13905 * A WebContents instance with the given TargetID, or `undefined` if there is no
13906 * WebContents associated with the given TargetID.
13907 *
13908 * When communicating with the Chrome DevTools Protocol, it can be useful to lookup
13909 * a WebContents instance based on its assigned TargetID.
13910 */
13911 static fromDevToolsTargetId(targetId: string): (WebContents) | (undefined);
13912 /**
13913 * A WebContents instance with the given WebFrameMain, or `undefined` if there is
13914 * no WebContents associated with the given WebFrameMain.
13915 */
13916 static fromFrame(frame: WebFrameMain): (WebContents) | (undefined);
13917 /**
13918 * A WebContents instance with the given ID, or `undefined` if there is no
13919 * WebContents associated with the given ID.
13920 */
13921 static fromId(id: number): (WebContents) | (undefined);
13922 /**
13923 * An array of all `WebContents` instances. This will contain web contents for all
13924 * windows, webviews, opened devtools, and devtools extension background pages.
13925 */
13926 static getAllWebContents(): WebContents[];
13927 /**
13928 * The web contents that is focused in this application, otherwise returns `null`.
13929 */
13930 static getFocusedWebContents(): (WebContents) | (null);
13931 /**
13932 * Emitted when media becomes audible or inaudible.
13933 */
13934 on(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
13935 off(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
13936 once(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
13937 addListener(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
13938 removeListener(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
13939 /**
13940 * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
13941 * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
13942 * menu shortcuts.
13943 *
13944 * To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
13945 */
13946 on(event: 'before-input-event', listener: (event: Event,
13947 /**
13948 * Input properties.
13949 */
13950 input: Input) => void): this;
13951 off(event: 'before-input-event', listener: (event: Event,
13952 /**
13953 * Input properties.
13954 */
13955 input: Input) => void): this;
13956 once(event: 'before-input-event', listener: (event: Event,
13957 /**
13958 * Input properties.
13959 */
13960 input: Input) => void): this;
13961 addListener(event: 'before-input-event', listener: (event: Event,
13962 /**
13963 * Input properties.
13964 */
13965 input: Input) => void): this;
13966 removeListener(event: 'before-input-event', listener: (event: Event,
13967 /**
13968 * Input properties.
13969 */
13970 input: Input) => void): this;
13971 /**
13972 * Emitted when the `WebContents` loses focus.
13973 */
13974 on(event: 'blur', listener: Function): this;
13975 off(event: 'blur', listener: Function): this;
13976 once(event: 'blur', listener: Function): this;
13977 addListener(event: 'blur', listener: Function): this;
13978 removeListener(event: 'blur', listener: Function): this;
13979 /**
13980 * Emitted when failed to verify the `certificate` for `url`.
13981 *
13982 * The usage is the same with the `certificate-error` event of `app`.
13983 */
13984 on(event: 'certificate-error', listener: (event: Event,
13985 url: string,
13986 /**
13987 * The error code.
13988 */
13989 error: string,
13990 certificate: Certificate,
13991 callback: (isTrusted: boolean) => void,
13992 isMainFrame: boolean) => void): this;
13993 off(event: 'certificate-error', listener: (event: Event,
13994 url: string,
13995 /**
13996 * The error code.
13997 */
13998 error: string,
13999 certificate: Certificate,
14000 callback: (isTrusted: boolean) => void,
14001 isMainFrame: boolean) => void): this;
14002 once(event: 'certificate-error', listener: (event: Event,
14003 url: string,
14004 /**
14005 * The error code.
14006 */
14007 error: string,
14008 certificate: Certificate,
14009 callback: (isTrusted: boolean) => void,
14010 isMainFrame: boolean) => void): this;
14011 addListener(event: 'certificate-error', listener: (event: Event,
14012 url: string,
14013 /**
14014 * The error code.
14015 */
14016 error: string,
14017 certificate: Certificate,
14018 callback: (isTrusted: boolean) => void,
14019 isMainFrame: boolean) => void): this;
14020 removeListener(event: 'certificate-error', listener: (event: Event,
14021 url: string,
14022 /**
14023 * The error code.
14024 */
14025 error: string,
14026 certificate: Certificate,
14027 callback: (isTrusted: boolean) => void,
14028 isMainFrame: boolean) => void): this;
14029 /**
14030 * Emitted when the associated window logs a console message.
14031 */
14032 on(event: 'console-message', listener: (event: Event,
14033 /**
14034 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
14035 * `error`.
14036 */
14037 level: number,
14038 /**
14039 * The actual console message
14040 */
14041 message: string,
14042 /**
14043 * The line number of the source that triggered this console message
14044 */
14045 line: number,
14046 sourceId: string) => void): this;
14047 off(event: 'console-message', listener: (event: Event,
14048 /**
14049 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
14050 * `error`.
14051 */
14052 level: number,
14053 /**
14054 * The actual console message
14055 */
14056 message: string,
14057 /**
14058 * The line number of the source that triggered this console message
14059 */
14060 line: number,
14061 sourceId: string) => void): this;
14062 once(event: 'console-message', listener: (event: Event,
14063 /**
14064 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
14065 * `error`.
14066 */
14067 level: number,
14068 /**
14069 * The actual console message
14070 */
14071 message: string,
14072 /**
14073 * The line number of the source that triggered this console message
14074 */
14075 line: number,
14076 sourceId: string) => void): this;
14077 addListener(event: 'console-message', listener: (event: Event,
14078 /**
14079 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
14080 * `error`.
14081 */
14082 level: number,
14083 /**
14084 * The actual console message
14085 */
14086 message: string,
14087 /**
14088 * The line number of the source that triggered this console message
14089 */
14090 line: number,
14091 sourceId: string) => void): this;
14092 removeListener(event: 'console-message', listener: (event: Event,
14093 /**
14094 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
14095 * `error`.
14096 */
14097 level: number,
14098 /**
14099 * The actual console message
14100 */
14101 message: string,
14102 /**
14103 * The line number of the source that triggered this console message
14104 */
14105 line: number,
14106 sourceId: string) => void): this;
14107 /**
14108 * Emitted when the page calls `window.moveTo`, `window.resizeTo` or related APIs.
14109 *
14110 * By default, this will move the window. To prevent that behavior, call
14111 * `event.preventDefault()`.
14112 */
14113 on(event: 'content-bounds-updated', listener: (event: Event,
14114 /**
14115 * requested new content bounds
14116 */
14117 bounds: Rectangle) => void): this;
14118 off(event: 'content-bounds-updated', listener: (event: Event,
14119 /**
14120 * requested new content bounds
14121 */
14122 bounds: Rectangle) => void): this;
14123 once(event: 'content-bounds-updated', listener: (event: Event,
14124 /**
14125 * requested new content bounds
14126 */
14127 bounds: Rectangle) => void): this;
14128 addListener(event: 'content-bounds-updated', listener: (event: Event,
14129 /**
14130 * requested new content bounds
14131 */
14132 bounds: Rectangle) => void): this;
14133 removeListener(event: 'content-bounds-updated', listener: (event: Event,
14134 /**
14135 * requested new content bounds
14136 */
14137 bounds: Rectangle) => void): this;
14138 /**
14139 * Emitted when there is a new context menu that needs to be handled.
14140 */
14141 on(event: 'context-menu', listener: (event: Event,
14142 params: ContextMenuParams) => void): this;
14143 off(event: 'context-menu', listener: (event: Event,
14144 params: ContextMenuParams) => void): this;
14145 once(event: 'context-menu', listener: (event: Event,
14146 params: ContextMenuParams) => void): this;
14147 addListener(event: 'context-menu', listener: (event: Event,
14148 params: ContextMenuParams) => void): this;
14149 removeListener(event: 'context-menu', listener: (event: Event,
14150 params: ContextMenuParams) => void): this;
14151 /**
14152 * Emitted when the cursor's type changes. The `type` parameter can be `pointer`,
14153 * `crosshair`, `hand`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
14154 * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
14155 * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
14156 * `row-resize`, `m-panning`, `m-panning-vertical`, `m-panning-horizontal`,
14157 * `e-panning`, `n-panning`, `ne-panning`, `nw-panning`, `s-panning`, `se-panning`,
14158 * `sw-panning`, `w-panning`, `move`, `vertical-text`, `cell`, `context-menu`,
14159 * `alias`, `progress`, `nodrop`, `copy`, `none`, `not-allowed`, `zoom-in`,
14160 * `zoom-out`, `grab`, `grabbing`, `custom`, `null`, `drag-drop-none`,
14161 * `drag-drop-move`, `drag-drop-copy`, `drag-drop-link`, `ns-no-resize`,
14162 * `ew-no-resize`, `nesw-no-resize`, `nwse-no-resize`, or `default`.
14163 *
14164 * If the `type` parameter is `custom`, the `image` parameter will hold the custom
14165 * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
14166 * additional information about the custom cursor.
14167 */
14168 on(event: 'cursor-changed', listener: (event: Event,
14169 type: string,
14170 image: NativeImage,
14171 /**
14172 * scaling factor for the custom cursor.
14173 */
14174 scale: number,
14175 /**
14176 * the size of the `image`.
14177 */
14178 size: Size,
14179 /**
14180 * coordinates of the custom cursor's hotspot.
14181 */
14182 hotspot: Point) => void): this;
14183 off(event: 'cursor-changed', listener: (event: Event,
14184 type: string,
14185 image: NativeImage,
14186 /**
14187 * scaling factor for the custom cursor.
14188 */
14189 scale: number,
14190 /**
14191 * the size of the `image`.
14192 */
14193 size: Size,
14194 /**
14195 * coordinates of the custom cursor's hotspot.
14196 */
14197 hotspot: Point) => void): this;
14198 once(event: 'cursor-changed', listener: (event: Event,
14199 type: string,
14200 image: NativeImage,
14201 /**
14202 * scaling factor for the custom cursor.
14203 */
14204 scale: number,
14205 /**
14206 * the size of the `image`.
14207 */
14208 size: Size,
14209 /**
14210 * coordinates of the custom cursor's hotspot.
14211 */
14212 hotspot: Point) => void): this;
14213 addListener(event: 'cursor-changed', listener: (event: Event,
14214 type: string,
14215 image: NativeImage,
14216 /**
14217 * scaling factor for the custom cursor.
14218 */
14219 scale: number,
14220 /**
14221 * the size of the `image`.
14222 */
14223 size: Size,
14224 /**
14225 * coordinates of the custom cursor's hotspot.
14226 */
14227 hotspot: Point) => void): this;
14228 removeListener(event: 'cursor-changed', listener: (event: Event,
14229 type: string,
14230 image: NativeImage,
14231 /**
14232 * scaling factor for the custom cursor.
14233 */
14234 scale: number,
14235 /**
14236 * the size of the `image`.
14237 */
14238 size: Size,
14239 /**
14240 * coordinates of the custom cursor's hotspot.
14241 */
14242 hotspot: Point) => void): this;
14243 /**
14244 * Emitted when `webContents` is destroyed.
14245 */
14246 on(event: 'destroyed', listener: Function): this;
14247 off(event: 'destroyed', listener: Function): this;
14248 once(event: 'destroyed', listener: Function): this;
14249 addListener(event: 'destroyed', listener: Function): this;
14250 removeListener(event: 'destroyed', listener: Function): this;
14251 /**
14252 * Emitted when DevTools is closed.
14253 */
14254 on(event: 'devtools-closed', listener: Function): this;
14255 off(event: 'devtools-closed', listener: Function): this;
14256 once(event: 'devtools-closed', listener: Function): this;
14257 addListener(event: 'devtools-closed', listener: Function): this;
14258 removeListener(event: 'devtools-closed', listener: Function): this;
14259 /**
14260 * Emitted when DevTools is focused / opened.
14261 */
14262 on(event: 'devtools-focused', listener: Function): this;
14263 off(event: 'devtools-focused', listener: Function): this;
14264 once(event: 'devtools-focused', listener: Function): this;
14265 addListener(event: 'devtools-focused', listener: Function): this;
14266 removeListener(event: 'devtools-focused', listener: Function): this;
14267 /**
14268 * Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for
14269 * a link in its context menu.
14270 */
14271 on(event: 'devtools-open-url', listener: (event: Event,
14272 /**
14273 * URL of the link that was clicked or selected.
14274 */
14275 url: string) => void): this;
14276 off(event: 'devtools-open-url', listener: (event: Event,
14277 /**
14278 * URL of the link that was clicked or selected.
14279 */
14280 url: string) => void): this;
14281 once(event: 'devtools-open-url', listener: (event: Event,
14282 /**
14283 * URL of the link that was clicked or selected.
14284 */
14285 url: string) => void): this;
14286 addListener(event: 'devtools-open-url', listener: (event: Event,
14287 /**
14288 * URL of the link that was clicked or selected.
14289 */
14290 url: string) => void): this;
14291 removeListener(event: 'devtools-open-url', listener: (event: Event,
14292 /**
14293 * URL of the link that was clicked or selected.
14294 */
14295 url: string) => void): this;
14296 /**
14297 * Emitted when DevTools is opened.
14298 */
14299 on(event: 'devtools-opened', listener: Function): this;
14300 off(event: 'devtools-opened', listener: Function): this;
14301 once(event: 'devtools-opened', listener: Function): this;
14302 addListener(event: 'devtools-opened', listener: Function): this;
14303 removeListener(event: 'devtools-opened', listener: Function): this;
14304 /**
14305 * Emitted when the devtools window instructs the webContents to reload
14306 */
14307 on(event: 'devtools-reload-page', listener: Function): this;
14308 off(event: 'devtools-reload-page', listener: Function): this;
14309 once(event: 'devtools-reload-page', listener: Function): this;
14310 addListener(event: 'devtools-reload-page', listener: Function): this;
14311 removeListener(event: 'devtools-reload-page', listener: Function): this;
14312 /**
14313 * Emitted when 'Search' is selected for text in its context menu.
14314 */
14315 on(event: 'devtools-search-query', listener: (event: Event,
14316 /**
14317 * text to query for.
14318 */
14319 query: string) => void): this;
14320 off(event: 'devtools-search-query', listener: (event: Event,
14321 /**
14322 * text to query for.
14323 */
14324 query: string) => void): this;
14325 once(event: 'devtools-search-query', listener: (event: Event,
14326 /**
14327 * text to query for.
14328 */
14329 query: string) => void): this;
14330 addListener(event: 'devtools-search-query', listener: (event: Event,
14331 /**
14332 * text to query for.
14333 */
14334 query: string) => void): this;
14335 removeListener(event: 'devtools-search-query', listener: (event: Event,
14336 /**
14337 * text to query for.
14338 */
14339 query: string) => void): this;
14340 /**
14341 * Emitted when a `<webview>` has been attached to this web contents.
14342 */
14343 on(event: 'did-attach-webview', listener: (event: Event,
14344 /**
14345 * The guest web contents that is used by the `<webview>`.
14346 */
14347 webContents: WebContents) => void): this;
14348 off(event: 'did-attach-webview', listener: (event: Event,
14349 /**
14350 * The guest web contents that is used by the `<webview>`.
14351 */
14352 webContents: WebContents) => void): this;
14353 once(event: 'did-attach-webview', listener: (event: Event,
14354 /**
14355 * The guest web contents that is used by the `<webview>`.
14356 */
14357 webContents: WebContents) => void): this;
14358 addListener(event: 'did-attach-webview', listener: (event: Event,
14359 /**
14360 * The guest web contents that is used by the `<webview>`.
14361 */
14362 webContents: WebContents) => void): this;
14363 removeListener(event: 'did-attach-webview', listener: (event: Event,
14364 /**
14365 * The guest web contents that is used by the `<webview>`.
14366 */
14367 webContents: WebContents) => void): this;
14368 /**
14369 * Emitted when a page's theme color changes. This is usually due to encountering a
14370 * meta tag:
14371 */
14372 on(event: 'did-change-theme-color', listener: (event: Event,
14373 /**
14374 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
14375 */
14376 color: (string) | (null)) => void): this;
14377 off(event: 'did-change-theme-color', listener: (event: Event,
14378 /**
14379 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
14380 */
14381 color: (string) | (null)) => void): this;
14382 once(event: 'did-change-theme-color', listener: (event: Event,
14383 /**
14384 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
14385 */
14386 color: (string) | (null)) => void): this;
14387 addListener(event: 'did-change-theme-color', listener: (event: Event,
14388 /**
14389 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
14390 */
14391 color: (string) | (null)) => void): this;
14392 removeListener(event: 'did-change-theme-color', listener: (event: Event,
14393 /**
14394 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
14395 */
14396 color: (string) | (null)) => void): this;
14397 /**
14398 * Emitted _after_ successful creation of a window via `window.open` in the
14399 * renderer. Not emitted if the creation of the window is canceled from
14400 * `webContents.setWindowOpenHandler`.
14401 *
14402 * See `window.open()` for more details and how to use this in conjunction with
14403 * `webContents.setWindowOpenHandler`.
14404 */
14405 on(event: 'did-create-window', listener: (window: BrowserWindow,
14406 details: DidCreateWindowDetails) => void): this;
14407 off(event: 'did-create-window', listener: (window: BrowserWindow,
14408 details: DidCreateWindowDetails) => void): this;
14409 once(event: 'did-create-window', listener: (window: BrowserWindow,
14410 details: DidCreateWindowDetails) => void): this;
14411 addListener(event: 'did-create-window', listener: (window: BrowserWindow,
14412 details: DidCreateWindowDetails) => void): this;
14413 removeListener(event: 'did-create-window', listener: (window: BrowserWindow,
14414 details: DidCreateWindowDetails) => void): this;
14415 /**
14416 * This event is like `did-finish-load` but emitted when the load failed. The full
14417 * list of error codes and their meaning is available here.
14418 */
14419 on(event: 'did-fail-load', listener: (event: Event,
14420 errorCode: number,
14421 errorDescription: string,
14422 validatedURL: string,
14423 isMainFrame: boolean,
14424 frameProcessId: number,
14425 frameRoutingId: number) => void): this;
14426 off(event: 'did-fail-load', listener: (event: Event,
14427 errorCode: number,
14428 errorDescription: string,
14429 validatedURL: string,
14430 isMainFrame: boolean,
14431 frameProcessId: number,
14432 frameRoutingId: number) => void): this;
14433 once(event: 'did-fail-load', listener: (event: Event,
14434 errorCode: number,
14435 errorDescription: string,
14436 validatedURL: string,
14437 isMainFrame: boolean,
14438 frameProcessId: number,
14439 frameRoutingId: number) => void): this;
14440 addListener(event: 'did-fail-load', listener: (event: Event,
14441 errorCode: number,
14442 errorDescription: string,
14443 validatedURL: string,
14444 isMainFrame: boolean,
14445 frameProcessId: number,
14446 frameRoutingId: number) => void): this;
14447 removeListener(event: 'did-fail-load', listener: (event: Event,
14448 errorCode: number,
14449 errorDescription: string,
14450 validatedURL: string,
14451 isMainFrame: boolean,
14452 frameProcessId: number,
14453 frameRoutingId: number) => void): this;
14454 /**
14455 * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
14456 * `window.stop()` was invoked).
14457 */
14458 on(event: 'did-fail-provisional-load', listener: (event: Event,
14459 errorCode: number,
14460 errorDescription: string,
14461 validatedURL: string,
14462 isMainFrame: boolean,
14463 frameProcessId: number,
14464 frameRoutingId: number) => void): this;
14465 off(event: 'did-fail-provisional-load', listener: (event: Event,
14466 errorCode: number,
14467 errorDescription: string,
14468 validatedURL: string,
14469 isMainFrame: boolean,
14470 frameProcessId: number,
14471 frameRoutingId: number) => void): this;
14472 once(event: 'did-fail-provisional-load', listener: (event: Event,
14473 errorCode: number,
14474 errorDescription: string,
14475 validatedURL: string,
14476 isMainFrame: boolean,
14477 frameProcessId: number,
14478 frameRoutingId: number) => void): this;
14479 addListener(event: 'did-fail-provisional-load', listener: (event: Event,
14480 errorCode: number,
14481 errorDescription: string,
14482 validatedURL: string,
14483 isMainFrame: boolean,
14484 frameProcessId: number,
14485 frameRoutingId: number) => void): this;
14486 removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
14487 errorCode: number,
14488 errorDescription: string,
14489 validatedURL: string,
14490 isMainFrame: boolean,
14491 frameProcessId: number,
14492 frameRoutingId: number) => void): this;
14493 /**
14494 * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
14495 * spinning, and the `onload` event was dispatched.
14496 */
14497 on(event: 'did-finish-load', listener: Function): this;
14498 off(event: 'did-finish-load', listener: Function): this;
14499 once(event: 'did-finish-load', listener: Function): this;
14500 addListener(event: 'did-finish-load', listener: Function): this;
14501 removeListener(event: 'did-finish-load', listener: Function): this;
14502 /**
14503 * Emitted when a frame has done navigation.
14504 */
14505 on(event: 'did-frame-finish-load', listener: (event: Event,
14506 isMainFrame: boolean,
14507 frameProcessId: number,
14508 frameRoutingId: number) => void): this;
14509 off(event: 'did-frame-finish-load', listener: (event: Event,
14510 isMainFrame: boolean,
14511 frameProcessId: number,
14512 frameRoutingId: number) => void): this;
14513 once(event: 'did-frame-finish-load', listener: (event: Event,
14514 isMainFrame: boolean,
14515 frameProcessId: number,
14516 frameRoutingId: number) => void): this;
14517 addListener(event: 'did-frame-finish-load', listener: (event: Event,
14518 isMainFrame: boolean,
14519 frameProcessId: number,
14520 frameRoutingId: number) => void): this;
14521 removeListener(event: 'did-frame-finish-load', listener: (event: Event,
14522 isMainFrame: boolean,
14523 frameProcessId: number,
14524 frameRoutingId: number) => void): this;
14525 /**
14526 * Emitted when any frame navigation is done.
14527 *
14528 * This event is not emitted for in-page navigations, such as clicking anchor links
14529 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
14530 * this purpose.
14531 */
14532 on(event: 'did-frame-navigate', listener: (event: Event,
14533 url: string,
14534 /**
14535 * -1 for non HTTP navigations
14536 */
14537 httpResponseCode: number,
14538 /**
14539 * empty for non HTTP navigations,
14540 */
14541 httpStatusText: string,
14542 isMainFrame: boolean,
14543 frameProcessId: number,
14544 frameRoutingId: number) => void): this;
14545 off(event: 'did-frame-navigate', listener: (event: Event,
14546 url: string,
14547 /**
14548 * -1 for non HTTP navigations
14549 */
14550 httpResponseCode: number,
14551 /**
14552 * empty for non HTTP navigations,
14553 */
14554 httpStatusText: string,
14555 isMainFrame: boolean,
14556 frameProcessId: number,
14557 frameRoutingId: number) => void): this;
14558 once(event: 'did-frame-navigate', listener: (event: Event,
14559 url: string,
14560 /**
14561 * -1 for non HTTP navigations
14562 */
14563 httpResponseCode: number,
14564 /**
14565 * empty for non HTTP navigations,
14566 */
14567 httpStatusText: string,
14568 isMainFrame: boolean,
14569 frameProcessId: number,
14570 frameRoutingId: number) => void): this;
14571 addListener(event: 'did-frame-navigate', listener: (event: Event,
14572 url: string,
14573 /**
14574 * -1 for non HTTP navigations
14575 */
14576 httpResponseCode: number,
14577 /**
14578 * empty for non HTTP navigations,
14579 */
14580 httpStatusText: string,
14581 isMainFrame: boolean,
14582 frameProcessId: number,
14583 frameRoutingId: number) => void): this;
14584 removeListener(event: 'did-frame-navigate', listener: (event: Event,
14585 url: string,
14586 /**
14587 * -1 for non HTTP navigations
14588 */
14589 httpResponseCode: number,
14590 /**
14591 * empty for non HTTP navigations,
14592 */
14593 httpStatusText: string,
14594 isMainFrame: boolean,
14595 frameProcessId: number,
14596 frameRoutingId: number) => void): this;
14597 /**
14598 * Emitted when a main frame navigation is done.
14599 *
14600 * This event is not emitted for in-page navigations, such as clicking anchor links
14601 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
14602 * this purpose.
14603 */
14604 on(event: 'did-navigate', listener: (event: Event,
14605 url: string,
14606 /**
14607 * -1 for non HTTP navigations
14608 */
14609 httpResponseCode: number,
14610 /**
14611 * empty for non HTTP navigations
14612 */
14613 httpStatusText: string) => void): this;
14614 off(event: 'did-navigate', listener: (event: Event,
14615 url: string,
14616 /**
14617 * -1 for non HTTP navigations
14618 */
14619 httpResponseCode: number,
14620 /**
14621 * empty for non HTTP navigations
14622 */
14623 httpStatusText: string) => void): this;
14624 once(event: 'did-navigate', listener: (event: Event,
14625 url: string,
14626 /**
14627 * -1 for non HTTP navigations
14628 */
14629 httpResponseCode: number,
14630 /**
14631 * empty for non HTTP navigations
14632 */
14633 httpStatusText: string) => void): this;
14634 addListener(event: 'did-navigate', listener: (event: Event,
14635 url: string,
14636 /**
14637 * -1 for non HTTP navigations
14638 */
14639 httpResponseCode: number,
14640 /**
14641 * empty for non HTTP navigations
14642 */
14643 httpStatusText: string) => void): this;
14644 removeListener(event: 'did-navigate', listener: (event: Event,
14645 url: string,
14646 /**
14647 * -1 for non HTTP navigations
14648 */
14649 httpResponseCode: number,
14650 /**
14651 * empty for non HTTP navigations
14652 */
14653 httpStatusText: string) => void): this;
14654 /**
14655 * Emitted when an in-page navigation happened in any frame.
14656 *
14657 * When in-page navigation happens, the page URL changes but does not cause
14658 * navigation outside of the page. Examples of this occurring are when anchor links
14659 * are clicked or when the DOM `hashchange` event is triggered.
14660 */
14661 on(event: 'did-navigate-in-page', listener: (event: Event,
14662 url: string,
14663 isMainFrame: boolean,
14664 frameProcessId: number,
14665 frameRoutingId: number) => void): this;
14666 off(event: 'did-navigate-in-page', listener: (event: Event,
14667 url: string,
14668 isMainFrame: boolean,
14669 frameProcessId: number,
14670 frameRoutingId: number) => void): this;
14671 once(event: 'did-navigate-in-page', listener: (event: Event,
14672 url: string,
14673 isMainFrame: boolean,
14674 frameProcessId: number,
14675 frameRoutingId: number) => void): this;
14676 addListener(event: 'did-navigate-in-page', listener: (event: Event,
14677 url: string,
14678 isMainFrame: boolean,
14679 frameProcessId: number,
14680 frameRoutingId: number) => void): this;
14681 removeListener(event: 'did-navigate-in-page', listener: (event: Event,
14682 url: string,
14683 isMainFrame: boolean,
14684 frameProcessId: number,
14685 frameRoutingId: number) => void): this;
14686 /**
14687 * Emitted after a server side redirect occurs during navigation. For example a
14688 * 302 redirect.
14689 *
14690 * This event cannot be prevented, if you want to prevent redirects you should
14691 * checkout out the `will-redirect` event above.
14692 */
14693 on(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
14694 /**
14695 * @deprecated
14696 */
14697 url: string,
14698 /**
14699 * @deprecated
14700 */
14701 isInPlace: boolean,
14702 /**
14703 * @deprecated
14704 */
14705 isMainFrame: boolean,
14706 /**
14707 * @deprecated
14708 */
14709 frameProcessId: number,
14710 /**
14711 * @deprecated
14712 */
14713 frameRoutingId: number) => void): this;
14714 off(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
14715 /**
14716 * @deprecated
14717 */
14718 url: string,
14719 /**
14720 * @deprecated
14721 */
14722 isInPlace: boolean,
14723 /**
14724 * @deprecated
14725 */
14726 isMainFrame: boolean,
14727 /**
14728 * @deprecated
14729 */
14730 frameProcessId: number,
14731 /**
14732 * @deprecated
14733 */
14734 frameRoutingId: number) => void): this;
14735 once(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
14736 /**
14737 * @deprecated
14738 */
14739 url: string,
14740 /**
14741 * @deprecated
14742 */
14743 isInPlace: boolean,
14744 /**
14745 * @deprecated
14746 */
14747 isMainFrame: boolean,
14748 /**
14749 * @deprecated
14750 */
14751 frameProcessId: number,
14752 /**
14753 * @deprecated
14754 */
14755 frameRoutingId: number) => void): this;
14756 addListener(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
14757 /**
14758 * @deprecated
14759 */
14760 url: string,
14761 /**
14762 * @deprecated
14763 */
14764 isInPlace: boolean,
14765 /**
14766 * @deprecated
14767 */
14768 isMainFrame: boolean,
14769 /**
14770 * @deprecated
14771 */
14772 frameProcessId: number,
14773 /**
14774 * @deprecated
14775 */
14776 frameRoutingId: number) => void): this;
14777 removeListener(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
14778 /**
14779 * @deprecated
14780 */
14781 url: string,
14782 /**
14783 * @deprecated
14784 */
14785 isInPlace: boolean,
14786 /**
14787 * @deprecated
14788 */
14789 isMainFrame: boolean,
14790 /**
14791 * @deprecated
14792 */
14793 frameProcessId: number,
14794 /**
14795 * @deprecated
14796 */
14797 frameRoutingId: number) => void): this;
14798 /**
14799 * Corresponds to the points in time when the spinner of the tab started spinning.
14800 */
14801 on(event: 'did-start-loading', listener: Function): this;
14802 off(event: 'did-start-loading', listener: Function): this;
14803 once(event: 'did-start-loading', listener: Function): this;
14804 addListener(event: 'did-start-loading', listener: Function): this;
14805 removeListener(event: 'did-start-loading', listener: Function): this;
14806 /**
14807 * Emitted when any frame (including main) starts navigating.
14808 */
14809 on(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
14810 /**
14811 * @deprecated
14812 */
14813 url: string,
14814 /**
14815 * @deprecated
14816 */
14817 isInPlace: boolean,
14818 /**
14819 * @deprecated
14820 */
14821 isMainFrame: boolean,
14822 /**
14823 * @deprecated
14824 */
14825 frameProcessId: number,
14826 /**
14827 * @deprecated
14828 */
14829 frameRoutingId: number) => void): this;
14830 off(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
14831 /**
14832 * @deprecated
14833 */
14834 url: string,
14835 /**
14836 * @deprecated
14837 */
14838 isInPlace: boolean,
14839 /**
14840 * @deprecated
14841 */
14842 isMainFrame: boolean,
14843 /**
14844 * @deprecated
14845 */
14846 frameProcessId: number,
14847 /**
14848 * @deprecated
14849 */
14850 frameRoutingId: number) => void): this;
14851 once(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
14852 /**
14853 * @deprecated
14854 */
14855 url: string,
14856 /**
14857 * @deprecated
14858 */
14859 isInPlace: boolean,
14860 /**
14861 * @deprecated
14862 */
14863 isMainFrame: boolean,
14864 /**
14865 * @deprecated
14866 */
14867 frameProcessId: number,
14868 /**
14869 * @deprecated
14870 */
14871 frameRoutingId: number) => void): this;
14872 addListener(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
14873 /**
14874 * @deprecated
14875 */
14876 url: string,
14877 /**
14878 * @deprecated
14879 */
14880 isInPlace: boolean,
14881 /**
14882 * @deprecated
14883 */
14884 isMainFrame: boolean,
14885 /**
14886 * @deprecated
14887 */
14888 frameProcessId: number,
14889 /**
14890 * @deprecated
14891 */
14892 frameRoutingId: number) => void): this;
14893 removeListener(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
14894 /**
14895 * @deprecated
14896 */
14897 url: string,
14898 /**
14899 * @deprecated
14900 */
14901 isInPlace: boolean,
14902 /**
14903 * @deprecated
14904 */
14905 isMainFrame: boolean,
14906 /**
14907 * @deprecated
14908 */
14909 frameProcessId: number,
14910 /**
14911 * @deprecated
14912 */
14913 frameRoutingId: number) => void): this;
14914 /**
14915 * Corresponds to the points in time when the spinner of the tab stopped spinning.
14916 */
14917 on(event: 'did-stop-loading', listener: Function): this;
14918 off(event: 'did-stop-loading', listener: Function): this;
14919 once(event: 'did-stop-loading', listener: Function): this;
14920 addListener(event: 'did-stop-loading', listener: Function): this;
14921 removeListener(event: 'did-stop-loading', listener: Function): this;
14922 /**
14923 * Emitted when the document in the top-level frame is loaded.
14924 */
14925 on(event: 'dom-ready', listener: Function): this;
14926 off(event: 'dom-ready', listener: Function): this;
14927 once(event: 'dom-ready', listener: Function): this;
14928 addListener(event: 'dom-ready', listener: Function): this;
14929 removeListener(event: 'dom-ready', listener: Function): this;
14930 /**
14931 * Emitted when the window enters a full-screen state triggered by HTML API.
14932 */
14933 on(event: 'enter-html-full-screen', listener: Function): this;
14934 off(event: 'enter-html-full-screen', listener: Function): this;
14935 once(event: 'enter-html-full-screen', listener: Function): this;
14936 addListener(event: 'enter-html-full-screen', listener: Function): this;
14937 removeListener(event: 'enter-html-full-screen', listener: Function): this;
14938 /**
14939 * Emitted when the `WebContents` gains focus.
14940 *
14941 * Note that on macOS, having focus means the `WebContents` is the first responder
14942 * of window, so switching focus between windows would not trigger the `focus` and
14943 * `blur` events of `WebContents`, as the first responder of each window is not
14944 * changed.
14945 *
14946 * The `focus` and `blur` events of `WebContents` should only be used to detect
14947 * focus change between different `WebContents` and `BrowserView` in the same
14948 * window.
14949 */
14950 on(event: 'focus', listener: Function): this;
14951 off(event: 'focus', listener: Function): this;
14952 once(event: 'focus', listener: Function): this;
14953 addListener(event: 'focus', listener: Function): this;
14954 removeListener(event: 'focus', listener: Function): this;
14955 /**
14956 * Emitted when a result is available for `webContents.findInPage` request.
14957 */
14958 on(event: 'found-in-page', listener: (event: Event,
14959 result: Result) => void): this;
14960 off(event: 'found-in-page', listener: (event: Event,
14961 result: Result) => void): this;
14962 once(event: 'found-in-page', listener: (event: Event,
14963 result: Result) => void): this;
14964 addListener(event: 'found-in-page', listener: (event: Event,
14965 result: Result) => void): this;
14966 removeListener(event: 'found-in-page', listener: (event: Event,
14967 result: Result) => void): this;
14968 /**
14969 * Emitted when the mainFrame, an `<iframe>`, or a nested `<iframe>` is loaded
14970 * within the page.
14971 */
14972 on(event: 'frame-created', listener: (event: Event,
14973 details: FrameCreatedDetails) => void): this;
14974 off(event: 'frame-created', listener: (event: Event,
14975 details: FrameCreatedDetails) => void): this;
14976 once(event: 'frame-created', listener: (event: Event,
14977 details: FrameCreatedDetails) => void): this;
14978 addListener(event: 'frame-created', listener: (event: Event,
14979 details: FrameCreatedDetails) => void): this;
14980 removeListener(event: 'frame-created', listener: (event: Event,
14981 details: FrameCreatedDetails) => void): this;
14982 /**
14983 * Emitted when an input event is sent to the WebContents. See InputEvent for
14984 * details.
14985 */
14986 on(event: 'input-event', listener: (event: Event,
14987 inputEvent: InputEvent) => void): this;
14988 off(event: 'input-event', listener: (event: Event,
14989 inputEvent: InputEvent) => void): this;
14990 once(event: 'input-event', listener: (event: Event,
14991 inputEvent: InputEvent) => void): this;
14992 addListener(event: 'input-event', listener: (event: Event,
14993 inputEvent: InputEvent) => void): this;
14994 removeListener(event: 'input-event', listener: (event: Event,
14995 inputEvent: InputEvent) => void): this;
14996 /**
14997 * Emitted when the renderer process sends an asynchronous message via
14998 * `ipcRenderer.send()`.
14999 *
15000 * See also `webContents.ipc`, which provides an `IpcMain`-like interface for
15001 * responding to IPC messages specifically from this WebContents.
15002 */
15003 on(event: 'ipc-message', listener: (event: IpcMainEvent,
15004 channel: string,
15005 ...args: any[]) => void): this;
15006 off(event: 'ipc-message', listener: (event: IpcMainEvent,
15007 channel: string,
15008 ...args: any[]) => void): this;
15009 once(event: 'ipc-message', listener: (event: IpcMainEvent,
15010 channel: string,
15011 ...args: any[]) => void): this;
15012 addListener(event: 'ipc-message', listener: (event: IpcMainEvent,
15013 channel: string,
15014 ...args: any[]) => void): this;
15015 removeListener(event: 'ipc-message', listener: (event: IpcMainEvent,
15016 channel: string,
15017 ...args: any[]) => void): this;
15018 /**
15019 * Emitted when the renderer process sends a synchronous message via
15020 * `ipcRenderer.sendSync()`.
15021 *
15022 * See also `webContents.ipc`, which provides an `IpcMain`-like interface for
15023 * responding to IPC messages specifically from this WebContents.
15024 */
15025 on(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
15026 channel: string,
15027 ...args: any[]) => void): this;
15028 off(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
15029 channel: string,
15030 ...args: any[]) => void): this;
15031 once(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
15032 channel: string,
15033 ...args: any[]) => void): this;
15034 addListener(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
15035 channel: string,
15036 ...args: any[]) => void): this;
15037 removeListener(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
15038 channel: string,
15039 ...args: any[]) => void): this;
15040 /**
15041 * Emitted when the window leaves a full-screen state triggered by HTML API.
15042 */
15043 on(event: 'leave-html-full-screen', listener: Function): this;
15044 off(event: 'leave-html-full-screen', listener: Function): this;
15045 once(event: 'leave-html-full-screen', listener: Function): this;
15046 addListener(event: 'leave-html-full-screen', listener: Function): this;
15047 removeListener(event: 'leave-html-full-screen', listener: Function): this;
15048 /**
15049 * Emitted when `webContents` wants to do basic auth.
15050 *
15051 * The usage is the same with the `login` event of `app`.
15052 */
15053 on(event: 'login', listener: (event: Event,
15054 authenticationResponseDetails: AuthenticationResponseDetails,
15055 authInfo: AuthInfo,
15056 callback: (username?: string, password?: string) => void) => void): this;
15057 off(event: 'login', listener: (event: Event,
15058 authenticationResponseDetails: AuthenticationResponseDetails,
15059 authInfo: AuthInfo,
15060 callback: (username?: string, password?: string) => void) => void): this;
15061 once(event: 'login', listener: (event: Event,
15062 authenticationResponseDetails: AuthenticationResponseDetails,
15063 authInfo: AuthInfo,
15064 callback: (username?: string, password?: string) => void) => void): this;
15065 addListener(event: 'login', listener: (event: Event,
15066 authenticationResponseDetails: AuthenticationResponseDetails,
15067 authInfo: AuthInfo,
15068 callback: (username?: string, password?: string) => void) => void): this;
15069 removeListener(event: 'login', listener: (event: Event,
15070 authenticationResponseDetails: AuthenticationResponseDetails,
15071 authInfo: AuthInfo,
15072 callback: (username?: string, password?: string) => void) => void): this;
15073 /**
15074 * Emitted when media is paused or done playing.
15075 */
15076 on(event: 'media-paused', listener: Function): this;
15077 off(event: 'media-paused', listener: Function): this;
15078 once(event: 'media-paused', listener: Function): this;
15079 addListener(event: 'media-paused', listener: Function): this;
15080 removeListener(event: 'media-paused', listener: Function): this;
15081 /**
15082 * Emitted when media starts playing.
15083 */
15084 on(event: 'media-started-playing', listener: Function): this;
15085 off(event: 'media-started-playing', listener: Function): this;
15086 once(event: 'media-started-playing', listener: Function): this;
15087 addListener(event: 'media-started-playing', listener: Function): this;
15088 removeListener(event: 'media-started-playing', listener: Function): this;
15089 /**
15090 * Emitted when page receives favicon urls.
15091 */
15092 on(event: 'page-favicon-updated', listener: (event: Event,
15093 /**
15094 * Array of URLs.
15095 */
15096 favicons: string[]) => void): this;
15097 off(event: 'page-favicon-updated', listener: (event: Event,
15098 /**
15099 * Array of URLs.
15100 */
15101 favicons: string[]) => void): this;
15102 once(event: 'page-favicon-updated', listener: (event: Event,
15103 /**
15104 * Array of URLs.
15105 */
15106 favicons: string[]) => void): this;
15107 addListener(event: 'page-favicon-updated', listener: (event: Event,
15108 /**
15109 * Array of URLs.
15110 */
15111 favicons: string[]) => void): this;
15112 removeListener(event: 'page-favicon-updated', listener: (event: Event,
15113 /**
15114 * Array of URLs.
15115 */
15116 favicons: string[]) => void): this;
15117 /**
15118 * Fired when page title is set during navigation. `explicitSet` is false when
15119 * title is synthesized from file url.
15120 */
15121 on(event: 'page-title-updated', listener: (event: Event,
15122 title: string,
15123 explicitSet: boolean) => void): this;
15124 off(event: 'page-title-updated', listener: (event: Event,
15125 title: string,
15126 explicitSet: boolean) => void): this;
15127 once(event: 'page-title-updated', listener: (event: Event,
15128 title: string,
15129 explicitSet: boolean) => void): this;
15130 addListener(event: 'page-title-updated', listener: (event: Event,
15131 title: string,
15132 explicitSet: boolean) => void): this;
15133 removeListener(event: 'page-title-updated', listener: (event: Event,
15134 title: string,
15135 explicitSet: boolean) => void): this;
15136 /**
15137 * Emitted when a new frame is generated. Only the dirty area is passed in the
15138 * buffer.
15139 */
15140 on(event: 'paint', listener: (event: Event,
15141 dirtyRect: Rectangle,
15142 /**
15143 * The image data of the whole frame.
15144 */
15145 image: NativeImage) => void): this;
15146 off(event: 'paint', listener: (event: Event,
15147 dirtyRect: Rectangle,
15148 /**
15149 * The image data of the whole frame.
15150 */
15151 image: NativeImage) => void): this;
15152 once(event: 'paint', listener: (event: Event,
15153 dirtyRect: Rectangle,
15154 /**
15155 * The image data of the whole frame.
15156 */
15157 image: NativeImage) => void): this;
15158 addListener(event: 'paint', listener: (event: Event,
15159 dirtyRect: Rectangle,
15160 /**
15161 * The image data of the whole frame.
15162 */
15163 image: NativeImage) => void): this;
15164 removeListener(event: 'paint', listener: (event: Event,
15165 dirtyRect: Rectangle,
15166 /**
15167 * The image data of the whole frame.
15168 */
15169 image: NativeImage) => void): this;
15170 /**
15171 * Emitted when a plugin process has crashed.
15172 */
15173 on(event: 'plugin-crashed', listener: (event: Event,
15174 name: string,
15175 version: string) => void): this;
15176 off(event: 'plugin-crashed', listener: (event: Event,
15177 name: string,
15178 version: string) => void): this;
15179 once(event: 'plugin-crashed', listener: (event: Event,
15180 name: string,
15181 version: string) => void): this;
15182 addListener(event: 'plugin-crashed', listener: (event: Event,
15183 name: string,
15184 version: string) => void): this;
15185 removeListener(event: 'plugin-crashed', listener: (event: Event,
15186 name: string,
15187 version: string) => void): this;
15188 /**
15189 * Emitted when the `WebContents` preferred size has changed.
15190 *
15191 * This event will only be emitted when `enablePreferredSizeMode` is set to `true`
15192 * in `webPreferences`.
15193 */
15194 on(event: 'preferred-size-changed', listener: (event: Event,
15195 /**
15196 * The minimum size needed to contain the layout of the document—without requiring
15197 * scrolling.
15198 */
15199 preferredSize: Size) => void): this;
15200 off(event: 'preferred-size-changed', listener: (event: Event,
15201 /**
15202 * The minimum size needed to contain the layout of the document—without requiring
15203 * scrolling.
15204 */
15205 preferredSize: Size) => void): this;
15206 once(event: 'preferred-size-changed', listener: (event: Event,
15207 /**
15208 * The minimum size needed to contain the layout of the document—without requiring
15209 * scrolling.
15210 */
15211 preferredSize: Size) => void): this;
15212 addListener(event: 'preferred-size-changed', listener: (event: Event,
15213 /**
15214 * The minimum size needed to contain the layout of the document—without requiring
15215 * scrolling.
15216 */
15217 preferredSize: Size) => void): this;
15218 removeListener(event: 'preferred-size-changed', listener: (event: Event,
15219 /**
15220 * The minimum size needed to contain the layout of the document—without requiring
15221 * scrolling.
15222 */
15223 preferredSize: Size) => void): this;
15224 /**
15225 * Emitted when the preload script `preloadPath` throws an unhandled exception
15226 * `error`.
15227 */
15228 on(event: 'preload-error', listener: (event: Event,
15229 preloadPath: string,
15230 error: Error) => void): this;
15231 off(event: 'preload-error', listener: (event: Event,
15232 preloadPath: string,
15233 error: Error) => void): this;
15234 once(event: 'preload-error', listener: (event: Event,
15235 preloadPath: string,
15236 error: Error) => void): this;
15237 addListener(event: 'preload-error', listener: (event: Event,
15238 preloadPath: string,
15239 error: Error) => void): this;
15240 removeListener(event: 'preload-error', listener: (event: Event,
15241 preloadPath: string,
15242 error: Error) => void): this;
15243 /**
15244 * Emitted when the renderer process unexpectedly disappears. This is normally
15245 * because it was crashed or killed.
15246 */
15247 on(event: 'render-process-gone', listener: (event: Event,
15248 details: RenderProcessGoneDetails) => void): this;
15249 off(event: 'render-process-gone', listener: (event: Event,
15250 details: RenderProcessGoneDetails) => void): this;
15251 once(event: 'render-process-gone', listener: (event: Event,
15252 details: RenderProcessGoneDetails) => void): this;
15253 addListener(event: 'render-process-gone', listener: (event: Event,
15254 details: RenderProcessGoneDetails) => void): this;
15255 removeListener(event: 'render-process-gone', listener: (event: Event,
15256 details: RenderProcessGoneDetails) => void): this;
15257 /**
15258 * Emitted when the unresponsive web page becomes responsive again.
15259 */
15260 on(event: 'responsive', listener: Function): this;
15261 off(event: 'responsive', listener: Function): this;
15262 once(event: 'responsive', listener: Function): this;
15263 addListener(event: 'responsive', listener: Function): this;
15264 removeListener(event: 'responsive', listener: Function): this;
15265 /**
15266 * Emitted when a bluetooth device needs to be selected when a call to
15267 * `navigator.bluetooth.requestDevice` is made. `callback` should be called with
15268 * the `deviceId` of the device to be selected. Passing an empty string to
15269 * `callback` will cancel the request.
15270 *
15271 * If an event listener is not added for this event, or if `event.preventDefault`
15272 * is not called when handling this event, the first available device will be
15273 * automatically selected.
15274 *
15275 * Due to the nature of bluetooth, scanning for devices when
15276 * `navigator.bluetooth.requestDevice` is called may take time and will cause
15277 * `select-bluetooth-device` to fire multiple times until `callback` is called with
15278 * either a device id or an empty string to cancel the request.
15279 */
15280 on(event: 'select-bluetooth-device', listener: (event: Event,
15281 devices: BluetoothDevice[],
15282 callback: (deviceId: string) => void) => void): this;
15283 off(event: 'select-bluetooth-device', listener: (event: Event,
15284 devices: BluetoothDevice[],
15285 callback: (deviceId: string) => void) => void): this;
15286 once(event: 'select-bluetooth-device', listener: (event: Event,
15287 devices: BluetoothDevice[],
15288 callback: (deviceId: string) => void) => void): this;
15289 addListener(event: 'select-bluetooth-device', listener: (event: Event,
15290 devices: BluetoothDevice[],
15291 callback: (deviceId: string) => void) => void): this;
15292 removeListener(event: 'select-bluetooth-device', listener: (event: Event,
15293 devices: BluetoothDevice[],
15294 callback: (deviceId: string) => void) => void): this;
15295 /**
15296 * Emitted when a client certificate is requested.
15297 *
15298 * The usage is the same with the `select-client-certificate` event of `app`.
15299 */
15300 on(event: 'select-client-certificate', listener: (event: Event,
15301 url: string,
15302 certificateList: Certificate[],
15303 callback: (certificate: Certificate) => void) => void): this;
15304 off(event: 'select-client-certificate', listener: (event: Event,
15305 url: string,
15306 certificateList: Certificate[],
15307 callback: (certificate: Certificate) => void) => void): this;
15308 once(event: 'select-client-certificate', listener: (event: Event,
15309 url: string,
15310 certificateList: Certificate[],
15311 callback: (certificate: Certificate) => void) => void): this;
15312 addListener(event: 'select-client-certificate', listener: (event: Event,
15313 url: string,
15314 certificateList: Certificate[],
15315 callback: (certificate: Certificate) => void) => void): this;
15316 removeListener(event: 'select-client-certificate', listener: (event: Event,
15317 url: string,
15318 certificateList: Certificate[],
15319 callback: (certificate: Certificate) => void) => void): this;
15320 /**
15321 * Emitted when the web page becomes unresponsive.
15322 */
15323 on(event: 'unresponsive', listener: Function): this;
15324 off(event: 'unresponsive', listener: Function): this;
15325 once(event: 'unresponsive', listener: Function): this;
15326 addListener(event: 'unresponsive', listener: Function): this;
15327 removeListener(event: 'unresponsive', listener: Function): this;
15328 /**
15329 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
15330 */
15331 on(event: 'update-target-url', listener: (event: Event,
15332 url: string) => void): this;
15333 off(event: 'update-target-url', listener: (event: Event,
15334 url: string) => void): this;
15335 once(event: 'update-target-url', listener: (event: Event,
15336 url: string) => void): this;
15337 addListener(event: 'update-target-url', listener: (event: Event,
15338 url: string) => void): this;
15339 removeListener(event: 'update-target-url', listener: (event: Event,
15340 url: string) => void): this;
15341 /**
15342 * Emitted when a `<webview>`'s web contents is being attached to this web
15343 * contents. Calling `event.preventDefault()` will destroy the guest page.
15344 *
15345 * This event can be used to configure `webPreferences` for the `webContents` of a
15346 * `<webview>` before it's loaded, and provides the ability to set settings that
15347 * can't be set via `<webview>` attributes.
15348 */
15349 on(event: 'will-attach-webview', listener: (event: Event,
15350 /**
15351 * The web preferences that will be used by the guest page. This object can be
15352 * modified to adjust the preferences for the guest page.
15353 */
15354 webPreferences: WebPreferences,
15355 /**
15356 * The other `<webview>` parameters such as the `src` URL. This object can be
15357 * modified to adjust the parameters of the guest page.
15358 */
15359 params: Record<string, string>) => void): this;
15360 off(event: 'will-attach-webview', listener: (event: Event,
15361 /**
15362 * The web preferences that will be used by the guest page. This object can be
15363 * modified to adjust the preferences for the guest page.
15364 */
15365 webPreferences: WebPreferences,
15366 /**
15367 * The other `<webview>` parameters such as the `src` URL. This object can be
15368 * modified to adjust the parameters of the guest page.
15369 */
15370 params: Record<string, string>) => void): this;
15371 once(event: 'will-attach-webview', listener: (event: Event,
15372 /**
15373 * The web preferences that will be used by the guest page. This object can be
15374 * modified to adjust the preferences for the guest page.
15375 */
15376 webPreferences: WebPreferences,
15377 /**
15378 * The other `<webview>` parameters such as the `src` URL. This object can be
15379 * modified to adjust the parameters of the guest page.
15380 */
15381 params: Record<string, string>) => void): this;
15382 addListener(event: 'will-attach-webview', listener: (event: Event,
15383 /**
15384 * The web preferences that will be used by the guest page. This object can be
15385 * modified to adjust the preferences for the guest page.
15386 */
15387 webPreferences: WebPreferences,
15388 /**
15389 * The other `<webview>` parameters such as the `src` URL. This object can be
15390 * modified to adjust the parameters of the guest page.
15391 */
15392 params: Record<string, string>) => void): this;
15393 removeListener(event: 'will-attach-webview', listener: (event: Event,
15394 /**
15395 * The web preferences that will be used by the guest page. This object can be
15396 * modified to adjust the preferences for the guest page.
15397 */
15398 webPreferences: WebPreferences,
15399 /**
15400 * The other `<webview>` parameters such as the `src` URL. This object can be
15401 * modified to adjust the parameters of the guest page.
15402 */
15403 params: Record<string, string>) => void): this;
15404 /**
15405 * Emitted when a user or the page wants to start navigation in any frame. It can
15406 * happen when the `window.location` object is changed or a user clicks a link in
15407 * the page.
15408 *
15409 * Unlike `will-navigate`, `will-frame-navigate` is fired when the main frame or
15410 * any of its subframes attempts to navigate. When the navigation event comes from
15411 * the main frame, `isMainFrame` will be `true`.
15412 *
15413 * This event will not emit when the navigation is started programmatically with
15414 * APIs like `webContents.loadURL` and `webContents.back`.
15415 *
15416 * It is also not emitted for in-page navigations, such as clicking anchor links or
15417 * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
15418 * purpose.
15419 *
15420 * Calling `event.preventDefault()` will prevent the navigation.
15421 */
15422 on(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
15423 off(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
15424 once(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
15425 addListener(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
15426 removeListener(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
15427 /**
15428 * Emitted when a user or the page wants to start navigation on the main frame. It
15429 * can happen when the `window.location` object is changed or a user clicks a link
15430 * in the page.
15431 *
15432 * This event will not emit when the navigation is started programmatically with
15433 * APIs like `webContents.loadURL` and `webContents.back`.
15434 *
15435 * It is also not emitted for in-page navigations, such as clicking anchor links or
15436 * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
15437 * purpose.
15438 *
15439 * Calling `event.preventDefault()` will prevent the navigation.
15440 */
15441 on(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
15442 /**
15443 * @deprecated
15444 */
15445 url: string,
15446 /**
15447 * @deprecated
15448 */
15449 isInPlace: boolean,
15450 /**
15451 * @deprecated
15452 */
15453 isMainFrame: boolean,
15454 /**
15455 * @deprecated
15456 */
15457 frameProcessId: number,
15458 /**
15459 * @deprecated
15460 */
15461 frameRoutingId: number) => void): this;
15462 off(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
15463 /**
15464 * @deprecated
15465 */
15466 url: string,
15467 /**
15468 * @deprecated
15469 */
15470 isInPlace: boolean,
15471 /**
15472 * @deprecated
15473 */
15474 isMainFrame: boolean,
15475 /**
15476 * @deprecated
15477 */
15478 frameProcessId: number,
15479 /**
15480 * @deprecated
15481 */
15482 frameRoutingId: number) => void): this;
15483 once(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
15484 /**
15485 * @deprecated
15486 */
15487 url: string,
15488 /**
15489 * @deprecated
15490 */
15491 isInPlace: boolean,
15492 /**
15493 * @deprecated
15494 */
15495 isMainFrame: boolean,
15496 /**
15497 * @deprecated
15498 */
15499 frameProcessId: number,
15500 /**
15501 * @deprecated
15502 */
15503 frameRoutingId: number) => void): this;
15504 addListener(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
15505 /**
15506 * @deprecated
15507 */
15508 url: string,
15509 /**
15510 * @deprecated
15511 */
15512 isInPlace: boolean,
15513 /**
15514 * @deprecated
15515 */
15516 isMainFrame: boolean,
15517 /**
15518 * @deprecated
15519 */
15520 frameProcessId: number,
15521 /**
15522 * @deprecated
15523 */
15524 frameRoutingId: number) => void): this;
15525 removeListener(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
15526 /**
15527 * @deprecated
15528 */
15529 url: string,
15530 /**
15531 * @deprecated
15532 */
15533 isInPlace: boolean,
15534 /**
15535 * @deprecated
15536 */
15537 isMainFrame: boolean,
15538 /**
15539 * @deprecated
15540 */
15541 frameProcessId: number,
15542 /**
15543 * @deprecated
15544 */
15545 frameRoutingId: number) => void): this;
15546 /**
15547 * Emitted when a `beforeunload` event handler is attempting to cancel a page
15548 * unload.
15549 *
15550 * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
15551 * and allow the page to be unloaded.
15552 *
15553 * **Note:** This will be emitted for `BrowserViews` but will _not_ be respected -
15554 * this is because we have chosen not to tie the `BrowserView` lifecycle to its
15555 * owning BrowserWindow should one exist per the specification.
15556 */
15557 on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
15558 off(event: 'will-prevent-unload', listener: (event: Event) => void): this;
15559 once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
15560 addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
15561 removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
15562 /**
15563 * Emitted when a server side redirect occurs during navigation. For example a 302
15564 * redirect.
15565 *
15566 * This event will be emitted after `did-start-navigation` and always before the
15567 * `did-redirect-navigation` event for the same navigation.
15568 *
15569 * Calling `event.preventDefault()` will prevent the navigation (not just the
15570 * redirect).
15571 */
15572 on(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
15573 /**
15574 * @deprecated
15575 */
15576 url: string,
15577 /**
15578 * @deprecated
15579 */
15580 isInPlace: boolean,
15581 /**
15582 * @deprecated
15583 */
15584 isMainFrame: boolean,
15585 /**
15586 * @deprecated
15587 */
15588 frameProcessId: number,
15589 /**
15590 * @deprecated
15591 */
15592 frameRoutingId: number) => void): this;
15593 off(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
15594 /**
15595 * @deprecated
15596 */
15597 url: string,
15598 /**
15599 * @deprecated
15600 */
15601 isInPlace: boolean,
15602 /**
15603 * @deprecated
15604 */
15605 isMainFrame: boolean,
15606 /**
15607 * @deprecated
15608 */
15609 frameProcessId: number,
15610 /**
15611 * @deprecated
15612 */
15613 frameRoutingId: number) => void): this;
15614 once(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
15615 /**
15616 * @deprecated
15617 */
15618 url: string,
15619 /**
15620 * @deprecated
15621 */
15622 isInPlace: boolean,
15623 /**
15624 * @deprecated
15625 */
15626 isMainFrame: boolean,
15627 /**
15628 * @deprecated
15629 */
15630 frameProcessId: number,
15631 /**
15632 * @deprecated
15633 */
15634 frameRoutingId: number) => void): this;
15635 addListener(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
15636 /**
15637 * @deprecated
15638 */
15639 url: string,
15640 /**
15641 * @deprecated
15642 */
15643 isInPlace: boolean,
15644 /**
15645 * @deprecated
15646 */
15647 isMainFrame: boolean,
15648 /**
15649 * @deprecated
15650 */
15651 frameProcessId: number,
15652 /**
15653 * @deprecated
15654 */
15655 frameRoutingId: number) => void): this;
15656 removeListener(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
15657 /**
15658 * @deprecated
15659 */
15660 url: string,
15661 /**
15662 * @deprecated
15663 */
15664 isInPlace: boolean,
15665 /**
15666 * @deprecated
15667 */
15668 isMainFrame: boolean,
15669 /**
15670 * @deprecated
15671 */
15672 frameProcessId: number,
15673 /**
15674 * @deprecated
15675 */
15676 frameRoutingId: number) => void): this;
15677 /**
15678 * Emitted when the user is requesting to change the zoom level using the mouse
15679 * wheel.
15680 */
15681 on(event: 'zoom-changed', listener: (event: Event,
15682 /**
15683 * Can be `in` or `out`.
15684 */
15685 zoomDirection: ('in' | 'out')) => void): this;
15686 off(event: 'zoom-changed', listener: (event: Event,
15687 /**
15688 * Can be `in` or `out`.
15689 */
15690 zoomDirection: ('in' | 'out')) => void): this;
15691 once(event: 'zoom-changed', listener: (event: Event,
15692 /**
15693 * Can be `in` or `out`.
15694 */
15695 zoomDirection: ('in' | 'out')) => void): this;
15696 addListener(event: 'zoom-changed', listener: (event: Event,
15697 /**
15698 * Can be `in` or `out`.
15699 */
15700 zoomDirection: ('in' | 'out')) => void): this;
15701 removeListener(event: 'zoom-changed', listener: (event: Event,
15702 /**
15703 * Can be `in` or `out`.
15704 */
15705 zoomDirection: ('in' | 'out')) => void): this;
15706 /**
15707 * Adds the specified path to DevTools workspace. Must be used after DevTools
15708 * creation:
15709 */
15710 addWorkSpace(path: string): void;
15711 /**
15712 * Adjusts the current text selection starting and ending points in the focused
15713 * frame by the given amounts. A negative amount moves the selection towards the
15714 * beginning of the document, and a positive amount moves the selection towards the
15715 * end of the document.
15716 *
15717 * Example:
15718 *
15719 * For a call of `win.webContents.adjustSelection({ start: 1, end: 5 })`
15720 *
15721 * Before:
15722 *
15723 * <img width="487" alt="Image Before Text Selection Adjustment"
15724 * src="../images/web-contents-text-selection-before.png"/>
15725 *
15726 * After:
15727 *
15728 * <img width="487" alt="Image After Text Selection Adjustment"
15729 * src="../images/web-contents-text-selection-after.png"/>
15730 */
15731 adjustSelection(options: AdjustSelectionOptions): void;
15732 /**
15733 * Begin subscribing for presentation events and captured frames, the `callback`
15734 * will be called with `callback(image, dirtyRect)` when there is a presentation
15735 * event.
15736 *
15737 * The `image` is an instance of NativeImage that stores the captured frame.
15738 *
15739 * The `dirtyRect` is an object with `x, y, width, height` properties that
15740 * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
15741 * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
15742 */
15743 beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
15744 /**
15745 * Begin subscribing for presentation events and captured frames, the `callback`
15746 * will be called with `callback(image, dirtyRect)` when there is a presentation
15747 * event.
15748 *
15749 * The `image` is an instance of NativeImage that stores the captured frame.
15750 *
15751 * The `dirtyRect` is an object with `x, y, width, height` properties that
15752 * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
15753 * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
15754 */
15755 beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
15756 /**
15757 * Whether the browser can go back to previous web page.
15758 */
15759 canGoBack(): boolean;
15760 /**
15761 * Whether the browser can go forward to next web page.
15762 */
15763 canGoForward(): boolean;
15764 /**
15765 * Whether the web page can go to `offset`.
15766 */
15767 canGoToOffset(offset: number): boolean;
15768 /**
15769 * Resolves with a NativeImage
15770 *
15771 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
15772 * whole visible page. The page is considered visible when its browser window is
15773 * hidden and the capturer count is non-zero. If you would like the page to stay
15774 * hidden, you should ensure that `stayHidden` is set to true.
15775 */
15776 capturePage(rect?: Rectangle, opts?: Opts): Promise<Electron.NativeImage>;
15777 /**
15778 * Centers the current text selection in web page.
15779 */
15780 centerSelection(): void;
15781 /**
15782 * Clears the navigation history.
15783 */
15784 clearHistory(): void;
15785 /**
15786 * Closes the page, as if the web content had called `window.close()`.
15787 *
15788 * If the page is successfully closed (i.e. the unload is not prevented by the
15789 * page, or `waitForBeforeUnload` is false or unspecified), the WebContents will be
15790 * destroyed and no longer usable. The `destroyed` event will be emitted.
15791 */
15792 close(opts?: CloseOpts): void;
15793 /**
15794 * Closes the devtools.
15795 */
15796 closeDevTools(): void;
15797 /**
15798 * Executes the editing command `copy` in web page.
15799 */
15800 copy(): void;
15801 /**
15802 * Copy the image at the given position to the clipboard.
15803 */
15804 copyImageAt(x: number, y: number): void;
15805 /**
15806 * Executes the editing command `cut` in web page.
15807 */
15808 cut(): void;
15809 /**
15810 * Executes the editing command `delete` in web page.
15811 */
15812 delete(): void;
15813 /**
15814 * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
15815 */
15816 disableDeviceEmulation(): void;
15817 /**
15818 * Initiates a download of the resource at `url` without navigating. The
15819 * `will-download` event of `session` will be triggered.
15820 */
15821 downloadURL(url: string, options?: DownloadURLOptions): void;
15822 /**
15823 * Enable device emulation with the given parameters.
15824 */
15825 enableDeviceEmulation(parameters: Parameters): void;
15826 /**
15827 * End subscribing for frame presentation events.
15828 */
15829 endFrameSubscription(): void;
15830 /**
15831 * A promise that resolves with the result of the executed code or is rejected if
15832 * the result of the code is a rejected promise.
15833 *
15834 * Evaluates `code` in page.
15835 *
15836 * In the browser window some HTML APIs like `requestFullScreen` can only be
15837 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
15838 * this limitation.
15839 *
15840 * Code execution will be suspended until web page stop loading.
15841 */
15842 executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
15843 /**
15844 * A promise that resolves with the result of the executed code or is rejected if
15845 * the result of the code is a rejected promise.
15846 *
15847 * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
15848 */
15849 executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
15850 /**
15851 * The request id used for the request.
15852 *
15853 * Starts a request to find all matches for the `text` in the web page. The result
15854 * of the request can be obtained by subscribing to `found-in-page` event.
15855 */
15856 findInPage(text: string, options?: FindInPageOptions): number;
15857 /**
15858 * Focuses the web page.
15859 */
15860 focus(): void;
15861 /**
15862 * Forcefully terminates the renderer process that is currently hosting this
15863 * `webContents`. This will cause the `render-process-gone` event to be emitted
15864 * with the `reason=killed || reason=crashed`. Please note that some webContents
15865 * share renderer processes and therefore calling this method may also crash the
15866 * host process for other webContents as well.
15867 *
15868 * Calling `reload()` immediately after calling this method will force the reload
15869 * to occur in a new process. This should be used when this process is unstable or
15870 * unusable, for instance in order to recover from the `unresponsive` event.
15871 */
15872 forcefullyCrashRenderer(): void;
15873 /**
15874 * Information about all Shared Workers.
15875 */
15876 getAllSharedWorkers(): SharedWorkerInfo[];
15877 /**
15878 * whether or not this WebContents will throttle animations and timers when the
15879 * page becomes backgrounded. This also affects the Page Visibility API.
15880 */
15881 getBackgroundThrottling(): boolean;
15882 /**
15883 * the current title of the DevTools window. This will only be visible if DevTools
15884 * is opened in `undocked` or `detach` mode.
15885 */
15886 getDevToolsTitle(): string;
15887 /**
15888 * If _offscreen rendering_ is enabled returns the current frame rate.
15889 */
15890 getFrameRate(): number;
15891 /**
15892 * The identifier of a WebContents stream. This identifier can be used with
15893 * `navigator.mediaDevices.getUserMedia` using a `chromeMediaSource` of `tab`. The
15894 * identifier is restricted to the web contents that it is registered to and is
15895 * only valid for 10 seconds.
15896 */
15897 getMediaSourceId(requestWebContents: WebContents): string;
15898 /**
15899 * The operating system `pid` of the associated renderer process.
15900 */
15901 getOSProcessId(): number;
15902 /**
15903 * Get the system printer list.
15904 *
15905 * Resolves with a `PrinterInfo[]`
15906 */
15907 getPrintersAsync(): Promise<Electron.PrinterInfo[]>;
15908 /**
15909 * The Chromium internal `pid` of the associated renderer. Can be compared to the
15910 * `frameProcessId` passed by frame specific navigation events (e.g.
15911 * `did-frame-navigate`)
15912 */
15913 getProcessId(): number;
15914 /**
15915 * The title of the current web page.
15916 */
15917 getTitle(): string;
15918 /**
15919 * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
15920 * `remote`, `webview` or `offscreen`.
15921 */
15922 getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
15923 /**
15924 * The URL of the current web page.
15925 */
15926 getURL(): string;
15927 /**
15928 * The user agent for this web page.
15929 */
15930 getUserAgent(): string;
15931 /**
15932 * Returns the WebRTC IP Handling Policy.
15933 */
15934 getWebRTCIPHandlingPolicy(): string;
15935 /**
15936 * * `min` Integer - The minimum UDP port number that WebRTC should use.
15937 * * `max` Integer - The maximum UDP port number that WebRTC should use.
15938 *
15939 * By default this value is `{ min: 0, max: 0 }` , which would apply no restriction
15940 * on the udp port range.
15941 */
15942 getWebRTCUDPPortRange(): WebRTCUDPPortRange;
15943 /**
15944 * the current zoom factor.
15945 */
15946 getZoomFactor(): number;
15947 /**
15948 * the current zoom level.
15949 */
15950 getZoomLevel(): number;
15951 /**
15952 * Makes the browser go back a web page.
15953 */
15954 goBack(): void;
15955 /**
15956 * Makes the browser go forward a web page.
15957 */
15958 goForward(): void;
15959 /**
15960 * Navigates browser to the specified absolute web page index.
15961 */
15962 goToIndex(index: number): void;
15963 /**
15964 * Navigates to the specified offset from the "current entry".
15965 */
15966 goToOffset(offset: number): void;
15967 /**
15968 * A promise that resolves with a key for the inserted CSS that can later be used
15969 * to remove the CSS via `contents.removeInsertedCSS(key)`.
15970 *
15971 * Injects CSS into the current web page and returns a unique key for the inserted
15972 * stylesheet.
15973 */
15974 insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
15975 /**
15976 * Inserts `text` to the focused element.
15977 */
15978 insertText(text: string): Promise<void>;
15979 /**
15980 * Starts inspecting element at position (`x`, `y`).
15981 */
15982 inspectElement(x: number, y: number): void;
15983 /**
15984 * Opens the developer tools for the service worker context.
15985 */
15986 inspectServiceWorker(): void;
15987 /**
15988 * Opens the developer tools for the shared worker context.
15989 */
15990 inspectSharedWorker(): void;
15991 /**
15992 * Inspects the shared worker based on its ID.
15993 */
15994 inspectSharedWorkerById(workerId: string): void;
15995 /**
15996 * Schedules a full repaint of the window this web contents is in.
15997 *
15998 * If _offscreen rendering_ is enabled invalidates the frame and generates a new
15999 * one through the `'paint'` event.
16000 */
16001 invalidate(): void;
16002 /**
16003 * Whether this page has been muted.
16004 */
16005 isAudioMuted(): boolean;
16006 /**
16007 * Whether this page is being captured. It returns true when the capturer count is
16008 * large then 0.
16009 */
16010 isBeingCaptured(): boolean;
16011 /**
16012 * Whether the renderer process has crashed.
16013 */
16014 isCrashed(): boolean;
16015 /**
16016 * Whether audio is currently playing.
16017 */
16018 isCurrentlyAudible(): boolean;
16019 /**
16020 * Whether the web page is destroyed.
16021 */
16022 isDestroyed(): boolean;
16023 /**
16024 * Whether the devtools view is focused .
16025 */
16026 isDevToolsFocused(): boolean;
16027 /**
16028 * Whether the devtools is opened.
16029 */
16030 isDevToolsOpened(): boolean;
16031 /**
16032 * Whether the web page is focused.
16033 */
16034 isFocused(): boolean;
16035 /**
16036 * Whether web page is still loading resources.
16037 */
16038 isLoading(): boolean;
16039 /**
16040 * Whether the main frame (and not just iframes or frames within it) is still
16041 * loading.
16042 */
16043 isLoadingMainFrame(): boolean;
16044 /**
16045 * Indicates whether _offscreen rendering_ is enabled.
16046 */
16047 isOffscreen(): boolean;
16048 /**
16049 * If _offscreen rendering_ is enabled returns whether it is currently painting.
16050 */
16051 isPainting(): boolean;
16052 /**
16053 * Whether the web page is waiting for a first-response from the main resource of
16054 * the page.
16055 */
16056 isWaitingForResponse(): boolean;
16057 /**
16058 * the promise will resolve when the page has finished loading (see
16059 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
16060 *
16061 * Loads the given file in the window, `filePath` should be a path to an HTML file
16062 * relative to the root of your application. For instance an app structure like
16063 * this:
16064 *
16065 * Would require code like this
16066 */
16067 loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
16068 /**
16069 * the promise will resolve when the page has finished loading (see
16070 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
16071 * A noop rejection handler is already attached, which avoids unhandled rejection
16072 * errors.
16073 *
16074 * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
16075 * the `http://` or `file://`. If the load should bypass http cache then use the
16076 * `pragma` header to achieve it.
16077 */
16078 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
16079 /**
16080 * Opens the devtools.
16081 *
16082 * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
16083 * explicitly passing an empty `mode` can force using last used dock state.
16084 *
16085 * On Windows, if Windows Control Overlay is enabled, Devtools will be opened with
16086 * `mode: 'detach'`.
16087 */
16088 openDevTools(options?: OpenDevToolsOptions): void;
16089 /**
16090 * Executes the editing command `paste` in web page.
16091 */
16092 paste(): void;
16093 /**
16094 * Executes the editing command `pasteAndMatchStyle` in web page.
16095 */
16096 pasteAndMatchStyle(): void;
16097 /**
16098 * Send a message to the renderer process, optionally transferring ownership of
16099 * zero or more `MessagePortMain` objects.
16100 *
16101 * The transferred `MessagePortMain` objects will be available in the renderer
16102 * process by accessing the `ports` property of the emitted event. When they arrive
16103 * in the renderer, they will be native DOM `MessagePort` objects.
16104 *
16105 * For example:
16106 */
16107 postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
16108 /**
16109 * When a custom `pageSize` is passed, Chromium attempts to validate platform
16110 * specific minimum values for `width_microns` and `height_microns`. Width and
16111 * height must both be minimum 353 microns but may be higher on some operating
16112 * systems.
16113 *
16114 * Prints window's web page. When `silent` is set to `true`, Electron will pick the
16115 * system's default printer if `deviceName` is empty and the default settings for
16116 * printing.
16117 *
16118 * Use `page-break-before: always;` CSS style to force to print to a new page.
16119 *
16120 * Example usage:
16121 */
16122 print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void;
16123 /**
16124 * Resolves with the generated PDF data.
16125 *
16126 * Prints the window's web page as PDF.
16127 *
16128 * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
16129 *
16130 * An example of `webContents.printToPDF`:
16131 *
16132 * See Page.printToPdf for more information.
16133 */
16134 printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
16135 /**
16136 * Executes the editing command `redo` in web page.
16137 */
16138 redo(): void;
16139 /**
16140 * Reloads the current web page.
16141 */
16142 reload(): void;
16143 /**
16144 * Reloads current page and ignores cache.
16145 */
16146 reloadIgnoringCache(): void;
16147 /**
16148 * Resolves if the removal was successful.
16149 *
16150 * Removes the inserted CSS from the current web page. The stylesheet is identified
16151 * by its key, which is returned from `contents.insertCSS(css)`.
16152 */
16153 removeInsertedCSS(key: string): Promise<void>;
16154 /**
16155 * Removes the specified path from DevTools workspace.
16156 */
16157 removeWorkSpace(path: string): void;
16158 /**
16159 * Executes the editing command `replace` in web page.
16160 */
16161 replace(text: string): void;
16162 /**
16163 * Executes the editing command `replaceMisspelling` in web page.
16164 */
16165 replaceMisspelling(text: string): void;
16166 /**
16167 * resolves if the page is saved.
16168 */
16169 savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
16170 /**
16171 * Scrolls to the bottom of the current `webContents`.
16172 */
16173 scrollToBottom(): void;
16174 /**
16175 * Scrolls to the top of the current `webContents`.
16176 */
16177 scrollToTop(): void;
16178 /**
16179 * Executes the editing command `selectAll` in web page.
16180 */
16181 selectAll(): void;
16182 /**
16183 * Send an asynchronous message to the renderer process via `channel`, along with
16184 * arguments. Arguments will be serialized with the Structured Clone Algorithm,
16185 * just like `postMessage`, so prototype chains will not be included. Sending
16186 * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
16187 *
16188 * :::warning
16189 *
16190 * Sending non-standard JavaScript types such as DOM objects or special Electron
16191 * objects will throw an exception.
16192 *
16193 * :::
16194 *
16195 * For additional reading, refer to Electron's IPC guide.
16196 */
16197 send(channel: string, ...args: any[]): void;
16198 /**
16199 * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
16200 * contents needs to be focused for `sendInputEvent()` to work.
16201 */
16202 sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
16203 /**
16204 * Send an asynchronous message to a specific frame in a renderer process via
16205 * `channel`, along with arguments. Arguments will be serialized with the
16206 * Structured Clone Algorithm, just like `postMessage`, so prototype chains will
16207 * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
16208 * will throw an exception.
16209 *
16210 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
16211 * Electron objects will throw an exception.
16212 *
16213 * The renderer process can handle the message by listening to `channel` with the
16214 * `ipcRenderer` module.
16215 *
16216 * If you want to get the `frameId` of a given renderer context you should use the
16217 * `webFrame.routingId` value. E.g.
16218 *
16219 * You can also read `frameId` from all incoming IPC messages in the main process.
16220 */
16221 sendToFrame(frameId: (number) | ([number, number]), channel: string, ...args: any[]): void;
16222 /**
16223 * Mute the audio on the current web page.
16224 */
16225 setAudioMuted(muted: boolean): void;
16226 /**
16227 * Controls whether or not this WebContents will throttle animations and timers
16228 * when the page becomes backgrounded. This also affects the Page Visibility API.
16229 */
16230 setBackgroundThrottling(allowed: boolean): void;
16231 /**
16232 * Changes the title of the DevTools window to `title`. This will only be visible
16233 * if DevTools is opened in `undocked` or `detach` mode.
16234 */
16235 setDevToolsTitle(title: string): void;
16236 /**
16237 * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
16238 *
16239 * The `devToolsWebContents` must not have done any navigation, and it should not
16240 * be used for other purposes after the call.
16241 *
16242 * By default Electron manages the devtools by creating an internal `WebContents`
16243 * with native view, which developers have very limited control of. With the
16244 * `setDevToolsWebContents` method, developers can use any `WebContents` to show
16245 * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
16246 * tag.
16247 *
16248 * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
16249 * caller's responsibility to destroy `devToolsWebContents`.
16250 *
16251 * An example of showing devtools in a `<webview>` tag:
16252 *
16253 * An example of showing devtools in a `BrowserWindow`:
16254 */
16255 setDevToolsWebContents(devToolsWebContents: WebContents): void;
16256 /**
16257 * If _offscreen rendering_ is enabled sets the frame rate to the specified number.
16258 * Only values between 1 and 240 are accepted.
16259 */
16260 setFrameRate(fps: number): void;
16261 /**
16262 * Ignore application menu shortcuts while this web contents is focused.
16263 */
16264 setIgnoreMenuShortcuts(ignore: boolean): void;
16265 /**
16266 * Sets the image animation policy for this webContents. The policy only affects
16267 * _new_ images, existing images that are currently being animated are unaffected.
16268 * This is a known limitation in Chromium, you can force image animation to be
16269 * recalculated with `img.src = img.src` which will result in no network traffic
16270 * but will update the animation policy.
16271 *
16272 * This corresponds to the animationPolicy accessibility feature in Chromium.
16273 */
16274 setImageAnimationPolicy(policy: 'animate' | 'animateOnce' | 'noAnimation'): void;
16275 /**
16276 * Overrides the user agent for this web page.
16277 */
16278 setUserAgent(userAgent: string): void;
16279 /**
16280 * Sets the maximum and minimum pinch-to-zoom level.
16281 *
16282 * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
16283 * call:
16284 */
16285 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
16286 /**
16287 * Setting the WebRTC IP handling policy allows you to control which IPs are
16288 * exposed via WebRTC. See BrowserLeaks for more details.
16289 */
16290 setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
16291 /**
16292 * Setting the WebRTC UDP Port Range allows you to restrict the udp port range used
16293 * by WebRTC. By default the port range is unrestricted. **Note:** To reset to an
16294 * unrestricted port range this value should be set to `{ min: 0, max: 0 }`.
16295 */
16296 setWebRTCUDPPortRange(udpPortRange: UdpPortRange): void;
16297 /**
16298 * Called before creating a window a new window is requested by the renderer, e.g.
16299 * by `window.open()`, a link with `target="_blank"`, shift+clicking on a link, or
16300 * submitting a form with `<form target="_blank">`. See `window.open()` for more
16301 * details and how to use this in conjunction with `did-create-window`.
16302 */
16303 setWindowOpenHandler(handler: (details: HandlerDetails) => ({action: 'deny'}) | ({action: 'allow', outlivesOpener?: boolean, overrideBrowserWindowOptions?: BrowserWindowConstructorOptions})): void;
16304 /**
16305 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
16306 * divided by 100, so 300% = 3.0.
16307 *
16308 * The factor must be greater than 0.0.
16309 */
16310 setZoomFactor(factor: number): void;
16311 /**
16312 * Changes the zoom level to the specified level. The original size is 0 and each
16313 * increment above or below represents zooming 20% larger or smaller to default
16314 * limits of 300% and 50% of original size, respectively. The formula for this is
16315 * `scale := 1.2 ^ level`.
16316 *
16317 * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
16318 * the zoom level for a specific domain propagates across all instances of windows
16319 * with the same domain. Differentiating the window URLs will make zoom work
16320 * per-window.
16321 */
16322 setZoomLevel(level: number): void;
16323 /**
16324 * Shows pop-up dictionary that searches the selected word on the page.
16325 *
16326 * @platform darwin
16327 */
16328 showDefinitionForSelection(): void;
16329 /**
16330 * Sets the `item` as dragging item for current drag-drop operation, `file` is the
16331 * absolute path of the file to be dragged, and `icon` is the image showing under
16332 * the cursor when dragging.
16333 */
16334 startDrag(item: Item): void;
16335 /**
16336 * If _offscreen rendering_ is enabled and not painting, start painting.
16337 */
16338 startPainting(): void;
16339 /**
16340 * Stops any pending navigation.
16341 */
16342 stop(): void;
16343 /**
16344 * Stops any `findInPage` request for the `webContents` with the provided `action`.
16345 */
16346 stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
16347 /**
16348 * If _offscreen rendering_ is enabled and painting, stop painting.
16349 */
16350 stopPainting(): void;
16351 /**
16352 * Indicates whether the snapshot has been created successfully.
16353 *
16354 * Takes a V8 heap snapshot and saves it to `filePath`.
16355 */
16356 takeHeapSnapshot(filePath: string): Promise<void>;
16357 /**
16358 * Toggles the developer tools.
16359 */
16360 toggleDevTools(): void;
16361 /**
16362 * Executes the editing command `undo` in web page.
16363 */
16364 undo(): void;
16365 /**
16366 * Executes the editing command `unselect` in web page.
16367 */
16368 unselect(): void;
16369 /**
16370 * A `boolean` property that determines whether this page is muted.
16371 */
16372 audioMuted: boolean;
16373 /**
16374 * A `boolean` property that determines whether or not this WebContents will
16375 * throttle animations and timers when the page becomes backgrounded. This also
16376 * affects the Page Visibility API.
16377 */
16378 backgroundThrottling: boolean;
16379 /**
16380 * A `Debugger` instance for this webContents.
16381 *
16382 */
16383 readonly debugger: Debugger;
16384 /**
16385 * A `WebContents | null` property that represents the of DevTools `WebContents`
16386 * associated with a given `WebContents`.
16387 *
16388 * **Note:** Users should never store this object because it may become `null` when
16389 * the DevTools has been closed.
16390 *
16391 */
16392 readonly devToolsWebContents: (WebContents) | (null);
16393 /**
16394 * An `Integer` property that sets the frame rate of the web contents to the
16395 * specified number. Only values between 1 and 240 are accepted.
16396 *
16397 * Only applicable if _offscreen rendering_ is enabled.
16398 */
16399 frameRate: number;
16400 /**
16401 * A `WebContents` instance that might own this `WebContents`.
16402 *
16403 */
16404 readonly hostWebContents: WebContents;
16405 /**
16406 * A `Integer` representing the unique ID of this WebContents. Each ID is unique
16407 * among all `WebContents` instances of the entire Electron application.
16408 *
16409 */
16410 readonly id: number;
16411 /**
16412 * An `IpcMain` scoped to just IPC messages sent from this WebContents.
16413 *
16414 * IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
16415 * `ipcRenderer.postMessage` will be delivered in the following order:
16416 *
16417 * * `contents.on('ipc-message')`
16418 * * `contents.mainFrame.on(channel)`
16419 * * `contents.ipc.on(channel)`
16420 * * `ipcMain.on(channel)`
16421 *
16422 * Handlers registered with `invoke` will be checked in the following order. The
16423 * first one that is defined will be called, the rest will be ignored.
16424 *
16425 * * `contents.mainFrame.handle(channel)`
16426 * * `contents.handle(channel)`
16427 * * `ipcMain.handle(channel)`
16428 *
16429 * A handler or event listener registered on the WebContents will receive IPC
16430 * messages sent from any frame, including child frames. In most cases, only the
16431 * main frame can send IPC messages. However, if the `nodeIntegrationInSubFrames`
16432 * option is enabled, it is possible for child frames to send IPC messages also. In
16433 * that case, handlers should check the `senderFrame` property of the IPC event to
16434 * ensure that the message is coming from the expected frame. Alternatively,
16435 * register handlers on the appropriate frame directly using the `WebFrameMain.ipc`
16436 * interface.
16437 *
16438 */
16439 readonly ipc: IpcMain;
16440 /**
16441 * A `WebFrameMain` property that represents the top frame of the page's frame
16442 * hierarchy.
16443 *
16444 */
16445 readonly mainFrame: WebFrameMain;
16446 /**
16447 * A `NavigationHistory` used by this webContents.
16448 *
16449 */
16450 readonly navigationHistory: NavigationHistory;
16451 /**
16452 * A `WebFrameMain` property that represents the frame that opened this
16453 * WebContents, either with open(), or by navigating a link with a target
16454 * attribute.
16455 *
16456 */
16457 readonly opener: WebFrameMain;
16458 /**
16459 * A `Session` used by this webContents.
16460 *
16461 */
16462 readonly session: Session;
16463 /**
16464 * A `string` property that determines the user agent for this web page.
16465 */
16466 userAgent: string;
16467 /**
16468 * A `number` property that determines the zoom factor for this web contents.
16469 *
16470 * The zoom factor is the zoom percent divided by 100, so 300% = 3.0.
16471 */
16472 zoomFactor: number;
16473 /**
16474 * A `number` property that determines the zoom level for this web contents.
16475 *
16476 * The original size is 0 and each increment above or below represents zooming 20%
16477 * larger or smaller to default limits of 300% and 50% of original size,
16478 * respectively. The formula for this is `scale := 1.2 ^ level`.
16479 */
16480 zoomLevel: number;
16481 }
16482
16483 class WebContentsView extends View {
16484
16485 // Docs: https://electronjs.org/docs/api/web-contents-view
16486
16487 /**
16488 * Emitted when the view's bounds have changed in response to being laid out. The
16489 * new bounds can be retrieved with `view.getBounds()`.
16490 */
16491 on(event: 'bounds-changed', listener: Function): this;
16492 off(event: 'bounds-changed', listener: Function): this;
16493 once(event: 'bounds-changed', listener: Function): this;
16494 addListener(event: 'bounds-changed', listener: Function): this;
16495 removeListener(event: 'bounds-changed', listener: Function): this;
16496 /**
16497 * WebContentsView
16498 */
16499 constructor(options?: WebContentsViewConstructorOptions);
16500 /**
16501 * A `WebContents` property containing a reference to the displayed `WebContents`.
16502 * Use this to interact with the `WebContents`, for instance to load a URL.
16503 *
16504 */
16505 readonly webContents: WebContents;
16506 }
16507
16508 interface WebFrame {
16509
16510 // Docs: https://electronjs.org/docs/api/web-frame
16511
16512 /**
16513 * Attempts to free memory that is no longer being used (like images from a
16514 * previous navigation).
16515 *
16516 * Note that blindly calling this method probably makes Electron slower since it
16517 * will have to refill these emptied caches, you should only call it if an event in
16518 * your app has occurred that makes you think your page is actually using less
16519 * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
16520 * and intend to stay there).
16521 */
16522 clearCache(): void;
16523 /**
16524 * A promise that resolves with the result of the executed code or is rejected if
16525 * execution throws or results in a rejected promise.
16526 *
16527 * Evaluates `code` in page.
16528 *
16529 * In the browser window some HTML APIs like `requestFullScreen` can only be
16530 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
16531 * this limitation.
16532 */
16533 executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
16534 /**
16535 * A promise that resolves with the result of the executed code or is rejected if
16536 * execution could not start.
16537 *
16538 * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
16539 *
16540 * Note that when the execution of script fails, the returned promise will not
16541 * reject and the `result` would be `undefined`. This is because Chromium does not
16542 * dispatch errors of isolated worlds to foreign worlds.
16543 */
16544 executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
16545 /**
16546 * A child of `webFrame` with the supplied `name`, `null` would be returned if
16547 * there's no such frame or if the frame is not in the current renderer process.
16548 */
16549 findFrameByName(name: string): WebFrame;
16550 /**
16551 * that has the supplied `routingId`, `null` if not found.
16552 */
16553 findFrameByRoutingId(routingId: number): WebFrame;
16554 /**
16555 * The frame element in `webFrame's` document selected by `selector`, `null` would
16556 * be returned if `selector` does not select a frame or if the frame is not in the
16557 * current renderer process.
16558 */
16559 getFrameForSelector(selector: string): WebFrame;
16560 /**
16561 * * `images` MemoryUsageDetails
16562 * * `scripts` MemoryUsageDetails
16563 * * `cssStyleSheets` MemoryUsageDetails
16564 * * `xslStyleSheets` MemoryUsageDetails
16565 * * `fonts` MemoryUsageDetails
16566 * * `other` MemoryUsageDetails
16567 *
16568 * Returns an object describing usage information of Blink's internal memory
16569 * caches.
16570 *
16571 * This will generate:
16572 */
16573 getResourceUsage(): ResourceUsage;
16574 /**
16575 * A list of suggested words for a given word. If the word is spelled correctly,
16576 * the result will be empty.
16577 */
16578 getWordSuggestions(word: string): string[];
16579 /**
16580 * The current zoom factor.
16581 */
16582 getZoomFactor(): number;
16583 /**
16584 * The current zoom level.
16585 */
16586 getZoomLevel(): number;
16587 /**
16588 * A key for the inserted CSS that can later be used to remove the CSS via
16589 * `webFrame.removeInsertedCSS(key)`.
16590 *
16591 * Injects CSS into the current web page and returns a unique key for the inserted
16592 * stylesheet.
16593 */
16594 insertCSS(css: string, options?: InsertCSSOptions): string;
16595 /**
16596 * Inserts `text` to the focused element.
16597 */
16598 insertText(text: string): void;
16599 /**
16600 * True if the word is misspelled according to the built in spellchecker, false
16601 * otherwise. If no dictionary is loaded, always return false.
16602 */
16603 isWordMisspelled(word: string): boolean;
16604 /**
16605 * Removes the inserted CSS from the current web page. The stylesheet is identified
16606 * by its key, which is returned from `webFrame.insertCSS(css)`.
16607 */
16608 removeInsertedCSS(key: string): void;
16609 /**
16610 * Set the security origin, content security policy and name of the isolated world.
16611 * Note: If the `csp` is specified, then the `securityOrigin` also has to be
16612 * specified.
16613 */
16614 setIsolatedWorldInfo(worldId: number, info: Info): void;
16615 /**
16616 * Sets a provider for spell checking in input fields and text areas.
16617 *
16618 * If you want to use this method you must disable the builtin spellchecker when
16619 * you construct the window.
16620 *
16621 * The `provider` must be an object that has a `spellCheck` method that accepts an
16622 * array of individual words for spellchecking. The `spellCheck` function runs
16623 * asynchronously and calls the `callback` function with an array of misspelt words
16624 * when complete.
16625 *
16626 * An example of using node-spellchecker as provider:
16627 */
16628 setSpellCheckProvider(language: string, provider: Provider): void;
16629 /**
16630 * Sets the maximum and minimum pinch-to-zoom level.
16631 *
16632 * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
16633 * call:
16634 *
16635 * > **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom
16636 * shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem
16637 * roles in the application Menu. To disable shortcuts, manually define the Menu
16638 * and omit zoom roles from the definition.
16639 */
16640 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
16641 /**
16642 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
16643 * divided by 100, so 300% = 3.0.
16644 *
16645 * The factor must be greater than 0.0.
16646 */
16647 setZoomFactor(factor: number): void;
16648 /**
16649 * Changes the zoom level to the specified level. The original size is 0 and each
16650 * increment above or below represents zooming 20% larger or smaller to default
16651 * limits of 300% and 50% of original size, respectively.
16652 *
16653 * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
16654 * the zoom level for a specific domain propagates across all instances of windows
16655 * with the same domain. Differentiating the window URLs will make zoom work
16656 * per-window.
16657 */
16658 setZoomLevel(level: number): void;
16659 /**
16660 * A `WebFrame | null` representing the first child frame of `webFrame`, the
16661 * property would be `null` if `webFrame` has no children or if first child is not
16662 * in the current renderer process.
16663 *
16664 */
16665 readonly firstChild: (WebFrame) | (null);
16666 /**
16667 * A `WebFrame | null` representing next sibling frame, the property would be
16668 * `null` if `webFrame` is the last frame in its parent or if the next sibling is
16669 * not in the current renderer process.
16670 *
16671 */
16672 readonly nextSibling: (WebFrame) | (null);
16673 /**
16674 * A `WebFrame | null` representing the frame which opened `webFrame`, the property
16675 * would be `null` if there's no opener or opener is not in the current renderer
16676 * process.
16677 *
16678 */
16679 readonly opener: (WebFrame) | (null);
16680 /**
16681 * A `WebFrame | null` representing parent frame of `webFrame`, the property would
16682 * be `null` if `webFrame` is top or parent is not in the current renderer process.
16683 *
16684 */
16685 readonly parent: (WebFrame) | (null);
16686 /**
16687 * An `Integer` representing the unique frame id in the current renderer process.
16688 * Distinct WebFrame instances that refer to the same underlying frame will have
16689 * the same `routingId`.
16690 *
16691 */
16692 readonly routingId: number;
16693 /**
16694 * A `WebFrame | null` representing top frame in frame hierarchy to which
16695 * `webFrame` belongs, the property would be `null` if top frame is not in the
16696 * current renderer process.
16697 *
16698 */
16699 readonly top: (WebFrame) | (null);
16700 }
16701
16702 class WebFrameMain extends NodeEventEmitter {
16703
16704 // Docs: https://electronjs.org/docs/api/web-frame-main
16705
16706 /**
16707 * A frame with the given process and routing IDs, or `undefined` if there is no
16708 * WebFrameMain associated with the given IDs.
16709 */
16710 static fromId(processId: number, routingId: number): (WebFrameMain) | (undefined);
16711 /**
16712 * Emitted when the document is loaded.
16713 */
16714 on(event: 'dom-ready', listener: Function): this;
16715 off(event: 'dom-ready', listener: Function): this;
16716 once(event: 'dom-ready', listener: Function): this;
16717 addListener(event: 'dom-ready', listener: Function): this;
16718 removeListener(event: 'dom-ready', listener: Function): this;
16719 /**
16720 * A promise that resolves with the result of the executed code or is rejected if
16721 * execution throws or results in a rejected promise.
16722 *
16723 * Evaluates `code` in page.
16724 *
16725 * In the browser window some HTML APIs like `requestFullScreen` can only be
16726 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
16727 * this limitation.
16728 */
16729 executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>;
16730 /**
16731 * Send a message to the renderer process, optionally transferring ownership of
16732 * zero or more `MessagePortMain` objects.
16733 *
16734 * The transferred `MessagePortMain` objects will be available in the renderer
16735 * process by accessing the `ports` property of the emitted event. When they arrive
16736 * in the renderer, they will be native DOM `MessagePort` objects.
16737 *
16738 * For example:
16739 */
16740 postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
16741 /**
16742 * Whether the reload was initiated successfully. Only results in `false` when the
16743 * frame has no history.
16744 */
16745 reload(): boolean;
16746 /**
16747 * Send an asynchronous message to the renderer process via `channel`, along with
16748 * arguments. Arguments will be serialized with the Structured Clone Algorithm,
16749 * just like `postMessage`, so prototype chains will not be included. Sending
16750 * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
16751 *
16752 * The renderer process can handle the message by listening to `channel` with the
16753 * `ipcRenderer` module.
16754 */
16755 send(channel: string, ...args: any[]): void;
16756 /**
16757 * A `WebFrameMain[]` collection containing the direct descendents of `frame`.
16758 *
16759 */
16760 readonly frames: WebFrameMain[];
16761 /**
16762 * A `WebFrameMain[]` collection containing every frame in the subtree of `frame`,
16763 * including itself. This can be useful when traversing through all frames.
16764 *
16765 */
16766 readonly framesInSubtree: WebFrameMain[];
16767 /**
16768 * An `Integer` representing the id of the frame's internal FrameTreeNode instance.
16769 * This id is browser-global and uniquely identifies a frame that hosts content.
16770 * The identifier is fixed at the creation of the frame and stays constant for the
16771 * lifetime of the frame. When the frame is removed, the id is not used again.
16772 *
16773 */
16774 readonly frameTreeNodeId: number;
16775 /**
16776 * An `IpcMain` instance scoped to the frame.
16777 *
16778 * IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
16779 * `ipcRenderer.postMessage` will be delivered in the following order:
16780 *
16781 * * `contents.on('ipc-message')`
16782 * * `contents.mainFrame.on(channel)`
16783 * * `contents.ipc.on(channel)`
16784 * * `ipcMain.on(channel)`
16785 *
16786 * Handlers registered with `invoke` will be checked in the following order. The
16787 * first one that is defined will be called, the rest will be ignored.
16788 *
16789 * * `contents.mainFrame.handle(channel)`
16790 * * `contents.handle(channel)`
16791 * * `ipcMain.handle(channel)`
16792 *
16793 * In most cases, only the main frame of a WebContents can send or receive IPC
16794 * messages. However, if the `nodeIntegrationInSubFrames` option is enabled, it is
16795 * possible for child frames to send and receive IPC messages also. The
16796 * `WebContents.ipc` interface may be more convenient when
16797 * `nodeIntegrationInSubFrames` is not enabled.
16798 *
16799 */
16800 readonly ipc: IpcMain;
16801 /**
16802 * A `string` representing the frame name.
16803 *
16804 */
16805 readonly name: string;
16806 /**
16807 * A `string` representing the current origin of the frame, serialized according to
16808 * RFC 6454. This may be different from the URL. For instance, if the frame is a
16809 * child window opened to `about:blank`, then `frame.origin` will return the parent
16810 * frame's origin, while `frame.url` will return the empty string. Pages without a
16811 * scheme/host/port triple origin will have the serialized origin of `"null"` (that
16812 * is, the string containing the letters n, u, l, l).
16813 *
16814 */
16815 readonly origin: string;
16816 /**
16817 * An `Integer` representing the operating system `pid` of the process which owns
16818 * this frame.
16819 *
16820 */
16821 readonly osProcessId: number;
16822 /**
16823 * A `WebFrameMain | null` representing parent frame of `frame`, the property would
16824 * be `null` if `frame` is the top frame in the frame hierarchy.
16825 *
16826 */
16827 readonly parent: (WebFrameMain) | (null);
16828 /**
16829 * An `Integer` representing the Chromium internal `pid` of the process which owns
16830 * this frame. This is not the same as the OS process ID; to read that use
16831 * `frame.osProcessId`.
16832 *
16833 */
16834 readonly processId: number;
16835 /**
16836 * An `Integer` representing the unique frame id in the current renderer process.
16837 * Distinct `WebFrameMain` instances that refer to the same underlying frame will
16838 * have the same `routingId`.
16839 *
16840 */
16841 readonly routingId: number;
16842 /**
16843 * A `WebFrameMain | null` representing top frame in the frame hierarchy to which
16844 * `frame` belongs.
16845 *
16846 */
16847 readonly top: (WebFrameMain) | (null);
16848 /**
16849 * A `string` representing the current URL of the frame.
16850 *
16851 */
16852 readonly url: string;
16853 /**
16854 * A `string` representing the visibility state of the frame.
16855 *
16856 * See also how the Page Visibility API is affected by other Electron APIs.
16857 *
16858 */
16859 readonly visibilityState: string;
16860 }
16861
16862 interface WebPreferences {
16863
16864 // Docs: https://electronjs.org/docs/api/structures/web-preferences
16865
16866 /**
16867 * An alternative title string provided only to accessibility tools such as screen
16868 * readers. This string is not directly visible to users.
16869 */
16870 accessibleTitle?: string;
16871 /**
16872 * A list of strings that will be appended to `process.argv` in the renderer
16873 * process of this app. Useful for passing small bits of data down to renderer
16874 * process preload scripts.
16875 */
16876 additionalArguments?: string[];
16877 /**
16878 * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
16879 * `false`.
16880 */
16881 allowRunningInsecureContent?: boolean;
16882 /**
16883 * Autoplay policy to apply to content in the window, can be
16884 * `no-user-gesture-required`, `user-gesture-required`,
16885 * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
16886 */
16887 autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
16888 /**
16889 * Whether to throttle animations and timers when the page becomes background. This
16890 * also affects the Page Visibility API. When at least one webContents displayed in
16891 * a single browserWindow has disabled `backgroundThrottling` then frames will be
16892 * drawn and swapped for the whole window and other webContents displayed by it.
16893 * Defaults to `true`.
16894 */
16895 backgroundThrottling?: boolean;
16896 /**
16897 * Whether to run Electron APIs and the specified `preload` script in a separate
16898 * JavaScript context. Defaults to `true`. The context that the `preload` script
16899 * runs in will only have access to its own dedicated `document` and `window`
16900 * globals, as well as its own set of JavaScript builtins (`Array`, `Object`,
16901 * `JSON`, etc.), which are all invisible to the loaded content. The Electron API
16902 * will only be available in the `preload` script and not the loaded page. This
16903 * option should be used when loading potentially untrusted remote content to
16904 * ensure the loaded content cannot tamper with the `preload` script and any
16905 * Electron APIs being used. This option uses the same technique used by Chrome
16906 * Content Scripts. You can access this context in the dev tools by selecting the
16907 * 'Electron Isolated Context' entry in the combo box at the top of the Console
16908 * tab.
16909 */
16910 contextIsolation?: boolean;
16911 /**
16912 * Defaults to `ISO-8859-1`.
16913 */
16914 defaultEncoding?: string;
16915 /**
16916 * Sets the default font for the font-family.
16917 */
16918 defaultFontFamily?: DefaultFontFamily;
16919 /**
16920 * Defaults to `16`.
16921 */
16922 defaultFontSize?: number;
16923 /**
16924 * Defaults to `13`.
16925 */
16926 defaultMonospaceFontSize?: number;
16927 /**
16928 * Whether to enable DevTools. If it is set to `false`, can not use
16929 * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
16930 */
16931 devTools?: boolean;
16932 /**
16933 * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
16934 * to disable. The full list of supported feature strings can be found in the
16935 * RuntimeEnabledFeatures.json5 file.
16936 */
16937 disableBlinkFeatures?: string;
16938 /**
16939 * Whether to disable dialogs completely. Overrides `safeDialogs`. Default is
16940 * `false`.
16941 */
16942 disableDialogs?: boolean;
16943 /**
16944 * Whether to prevent the window from resizing when entering HTML Fullscreen.
16945 * Default is `false`.
16946 */
16947 disableHtmlFullscreenWindowResize?: boolean;
16948 /**
16949 * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
16950 * to enable. The full list of supported feature strings can be found in the
16951 * RuntimeEnabledFeatures.json5 file.
16952 */
16953 enableBlinkFeatures?: string;
16954 /**
16955 * Whether to enable preferred size mode. The preferred size is the minimum size
16956 * needed to contain the layout of the document—without requiring scrolling.
16957 * Enabling this will cause the `preferred-size-changed` event to be emitted on the
16958 * `WebContents` when the preferred size changes. Default is `false`.
16959 */
16960 enablePreferredSizeMode?: boolean;
16961 /**
16962 * Whether to enable the WebSQL api. Default is `true`.
16963 */
16964 enableWebSQL?: boolean;
16965 /**
16966 * Enables Chromium's experimental features. Default is `false`.
16967 */
16968 experimentalFeatures?: boolean;
16969 /**
16970 * Specifies how to run image animations (E.g. GIFs). Can be `animate`,
16971 * `animateOnce` or `noAnimation`. Default is `animate`.
16972 */
16973 imageAnimationPolicy?: ('animate' | 'animateOnce' | 'noAnimation');
16974 /**
16975 * Enables image support. Default is `true`.
16976 */
16977 images?: boolean;
16978 /**
16979 * Enables JavaScript support. Default is `true`.
16980 */
16981 javascript?: boolean;
16982 /**
16983 * Defaults to `0`.
16984 */
16985 minimumFontSize?: number;
16986 /**
16987 * Whether dragging and dropping a file or link onto the page causes a navigation.
16988 * Default is `false`.
16989 */
16990 navigateOnDragDrop?: boolean;
16991 /**
16992 * Whether node integration is enabled. Default is `false`.
16993 */
16994 nodeIntegration?: boolean;
16995 /**
16996 * Experimental option for enabling Node.js support in sub-frames such as iframes
16997 * and child windows. All your preloads will load for every iframe, you can use
16998 * `process.isMainFrame` to determine if you are in the main frame or not.
16999 */
17000 nodeIntegrationInSubFrames?: boolean;
17001 /**
17002 * Whether node integration is enabled in web workers. Default is `false`. More
17003 * about this can be found in Multithreading.
17004 */
17005 nodeIntegrationInWorker?: boolean;
17006 /**
17007 * Whether to enable offscreen rendering for the browser window. Defaults to
17008 * `false`. See the offscreen rendering tutorial for more details.
17009 */
17010 offscreen?: boolean;
17011 /**
17012 * Sets the session used by the page according to the session's partition string.
17013 * If `partition` starts with `persist:`, the page will use a persistent session
17014 * available to all pages in the app with the same `partition`. If there is no
17015 * `persist:` prefix, the page will use an in-memory session. By assigning the same
17016 * `partition`, multiple pages can share the same session. Default is the default
17017 * session.
17018 */
17019 partition?: string;
17020 /**
17021 * Whether plugins should be enabled. Default is `false`.
17022 */
17023 plugins?: boolean;
17024 /**
17025 * Specifies a script that will be loaded before other scripts run in the page.
17026 * This script will always have access to node APIs no matter whether node
17027 * integration is turned on or off. The value should be the absolute file path to
17028 * the script. When node integration is turned off, the preload script can
17029 * reintroduce Node global symbols back to the global scope. See example here.
17030 */
17031 preload?: string;
17032 /**
17033 * Whether to enable browser style consecutive dialog protection. Default is
17034 * `false`.
17035 */
17036 safeDialogs?: boolean;
17037 /**
17038 * The message to display when consecutive dialog protection is triggered. If not
17039 * defined the default message would be used, note that currently the default
17040 * message is in English and not localized.
17041 */
17042 safeDialogsMessage?: string;
17043 /**
17044 * If set, this will sandbox the renderer associated with the window, making it
17045 * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
17046 * This is not the same as the `nodeIntegration` option and the APIs available to
17047 * the preload script are more limited. Read more about the option here.
17048 */
17049 sandbox?: boolean;
17050 /**
17051 * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
17052 *
17053 * @platform darwin
17054 */
17055 scrollBounce?: boolean;
17056 /**
17057 * Sets the session used by the page. Instead of passing the Session object
17058 * directly, you can also choose to use the `partition` option instead, which
17059 * accepts a partition string. When both `session` and `partition` are provided,
17060 * `session` will be preferred. Default is the default session.
17061 */
17062 session?: Session;
17063 /**
17064 * Whether to enable the builtin spellchecker. Default is `true`.
17065 */
17066 spellcheck?: boolean;
17067 /**
17068 * Make TextArea elements resizable. Default is `true`.
17069 */
17070 textAreasAreResizable?: boolean;
17071 /**
17072 * Enforces the v8 code caching policy used by blink. Accepted values are
17073 */
17074 v8CacheOptions?: ('none' | 'code' | 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile');
17075 /**
17076 * Enables WebGL support. Default is `true`.
17077 */
17078 webgl?: boolean;
17079 /**
17080 * When `false`, it will disable the same-origin policy (usually using testing
17081 * websites by people), and set `allowRunningInsecureContent` to `true` if this
17082 * options has not been set by user. Default is `true`.
17083 */
17084 webSecurity?: boolean;
17085 /**
17086 * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
17087 * `preload` script configured for the `<webview>` will have node integration
17088 * enabled when it is executed so you should ensure remote/untrusted content is not
17089 * able to create a `<webview>` tag with a possibly malicious `preload` script. You
17090 * can use the `will-attach-webview` event on webContents to strip away the
17091 * `preload` script and to validate or alter the `<webview>`'s initial settings.
17092 */
17093 webviewTag?: boolean;
17094 /**
17095 * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
17096 */
17097 zoomFactor?: number;
17098 }
17099
17100 class WebRequest {
17101
17102 // Docs: https://electronjs.org/docs/api/web-request
17103
17104 /**
17105 * The `listener` will be called with `listener(details)` when a server initiated
17106 * redirect is about to occur.
17107 */
17108 onBeforeRedirect(filter: WebRequestFilter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
17109 /**
17110 * The `listener` will be called with `listener(details)` when a server initiated
17111 * redirect is about to occur.
17112 */
17113 onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
17114 /**
17115 * The `listener` will be called with `listener(details, callback)` when a request
17116 * is about to occur.
17117 *
17118 * The `uploadData` is an array of `UploadData` objects.
17119 *
17120 * The `callback` has to be called with an `response` object.
17121 *
17122 * Some examples of valid `urls`:
17123 */
17124 onBeforeRequest(filter: WebRequestFilter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) => void) => void) | (null)): void;
17125 /**
17126 * The `listener` will be called with `listener(details, callback)` when a request
17127 * is about to occur.
17128 *
17129 * The `uploadData` is an array of `UploadData` objects.
17130 *
17131 * The `callback` has to be called with an `response` object.
17132 *
17133 * Some examples of valid `urls`:
17134 */
17135 onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) => void) => void) | (null)): void;
17136 /**
17137 * The `listener` will be called with `listener(details, callback)` before sending
17138 * an HTTP request, once the request headers are available. This may occur after a
17139 * TCP connection is made to the server, but before any http data is sent.
17140 *
17141 * The `callback` has to be called with a `response` object.
17142 */
17143 onBeforeSendHeaders(filter: WebRequestFilter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
17144 /**
17145 * The `listener` will be called with `listener(details, callback)` before sending
17146 * an HTTP request, once the request headers are available. This may occur after a
17147 * TCP connection is made to the server, but before any http data is sent.
17148 *
17149 * The `callback` has to be called with a `response` object.
17150 */
17151 onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
17152 /**
17153 * The `listener` will be called with `listener(details)` when a request is
17154 * completed.
17155 */
17156 onCompleted(filter: WebRequestFilter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
17157 /**
17158 * The `listener` will be called with `listener(details)` when a request is
17159 * completed.
17160 */
17161 onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
17162 /**
17163 * The `listener` will be called with `listener(details)` when an error occurs.
17164 */
17165 onErrorOccurred(filter: WebRequestFilter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
17166 /**
17167 * The `listener` will be called with `listener(details)` when an error occurs.
17168 */
17169 onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
17170 /**
17171 * The `listener` will be called with `listener(details, callback)` when HTTP
17172 * response headers of a request have been received.
17173 *
17174 * The `callback` has to be called with a `response` object.
17175 */
17176 onHeadersReceived(filter: WebRequestFilter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
17177 /**
17178 * The `listener` will be called with `listener(details, callback)` when HTTP
17179 * response headers of a request have been received.
17180 *
17181 * The `callback` has to be called with a `response` object.
17182 */
17183 onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
17184 /**
17185 * The `listener` will be called with `listener(details)` when first byte of the
17186 * response body is received. For HTTP requests, this means that the status line
17187 * and response headers are available.
17188 */
17189 onResponseStarted(filter: WebRequestFilter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
17190 /**
17191 * The `listener` will be called with `listener(details)` when first byte of the
17192 * response body is received. For HTTP requests, this means that the status line
17193 * and response headers are available.
17194 */
17195 onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
17196 /**
17197 * The `listener` will be called with `listener(details)` just before a request is
17198 * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
17199 * response are visible by the time this listener is fired.
17200 */
17201 onSendHeaders(filter: WebRequestFilter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
17202 /**
17203 * The `listener` will be called with `listener(details)` just before a request is
17204 * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
17205 * response are visible by the time this listener is fired.
17206 */
17207 onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
17208 }
17209
17210 interface WebRequestFilter {
17211
17212 // Docs: https://electronjs.org/docs/api/structures/web-request-filter
17213
17214 /**
17215 * Array of types that will be used to filter out the requests that do not match
17216 * the types. When not specified, all types will be matched. Can be `mainFrame`,
17217 * `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`,
17218 * `cspReport`, `media` or `webSocket`.
17219 */
17220 types?: Array<'mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket'>;
17221 /**
17222 * Array of URL patterns that will be used to filter out the requests that do not
17223 * match the URL patterns.
17224 */
17225 urls: string[];
17226 }
17227
17228 interface WebSource {
17229
17230 // Docs: https://electronjs.org/docs/api/structures/web-source
17231
17232 code: string;
17233 url?: string;
17234 }
17235
17236 interface WebUtils extends NodeJS.EventEmitter {
17237
17238 // Docs: https://electronjs.org/docs/api/web-utils
17239
17240 /**
17241 * The file system path that this `File` object points to. In the case where the
17242 * object passed in is not a `File` object an exception is thrown. In the case
17243 * where the File object passed in was constructed in JS and is not backed by a
17244 * file on disk an empty string is returned.
17245 *
17246 * This method superceded the previous augmentation to the `File` object with the
17247 * `path` property. An example is included below.
17248 */
17249 getPathForFile(file: File): string;
17250 }
17251
17252 interface WebviewTag extends HTMLElement {
17253
17254 // Docs: https://electronjs.org/docs/api/webview-tag
17255
17256 /**
17257 * Fired when a load has committed. This includes navigation within the current
17258 * document as well as subframe document-level loads, but does not include
17259 * asynchronous resource loads.
17260 */
17261 addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
17262 removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
17263 /**
17264 * Fired when the navigation is done, i.e. the spinner of the tab will stop
17265 * spinning, and the `onload` event is dispatched.
17266 */
17267 addEventListener(event: 'did-finish-load', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17268 removeEventListener(event: 'did-finish-load', listener: (event: DOMEvent) => void): this;
17269 /**
17270 * This event is like `did-finish-load`, but fired when the load failed or was
17271 * cancelled, e.g. `window.stop()` is invoked.
17272 */
17273 addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
17274 removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
17275 /**
17276 * Fired when a frame has done navigation.
17277 */
17278 addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
17279 removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
17280 /**
17281 * Corresponds to the points in time when the spinner of the tab starts spinning.
17282 */
17283 addEventListener(event: 'did-start-loading', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17284 removeEventListener(event: 'did-start-loading', listener: (event: DOMEvent) => void): this;
17285 /**
17286 * Corresponds to the points in time when the spinner of the tab stops spinning.
17287 */
17288 addEventListener(event: 'did-stop-loading', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17289 removeEventListener(event: 'did-stop-loading', listener: (event: DOMEvent) => void): this;
17290 /**
17291 * Fired when attached to the embedder web contents.
17292 */
17293 addEventListener(event: 'did-attach', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17294 removeEventListener(event: 'did-attach', listener: (event: DOMEvent) => void): this;
17295 /**
17296 * Fired when document in the given frame is loaded.
17297 */
17298 addEventListener(event: 'dom-ready', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17299 removeEventListener(event: 'dom-ready', listener: (event: DOMEvent) => void): this;
17300 /**
17301 * Fired when page title is set during navigation. `explicitSet` is false when
17302 * title is synthesized from file url.
17303 */
17304 addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
17305 removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
17306 /**
17307 * Fired when page receives favicon urls.
17308 */
17309 addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
17310 removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
17311 /**
17312 * Fired when page enters fullscreen triggered by HTML API.
17313 */
17314 addEventListener(event: 'enter-html-full-screen', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17315 removeEventListener(event: 'enter-html-full-screen', listener: (event: DOMEvent) => void): this;
17316 /**
17317 * Fired when page leaves fullscreen triggered by HTML API.
17318 */
17319 addEventListener(event: 'leave-html-full-screen', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17320 removeEventListener(event: 'leave-html-full-screen', listener: (event: DOMEvent) => void): this;
17321 /**
17322 * Fired when the guest window logs a console message.
17323 *
17324 * The following example code forwards all log messages to the embedder's console
17325 * without regard for log level or other properties.
17326 */
17327 addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
17328 removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
17329 /**
17330 * Fired when a result is available for `webview.findInPage` request.
17331 */
17332 addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
17333 removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
17334 /**
17335 * Emitted when a user or the page wants to start navigation. It can happen when
17336 * the `window.location` object is changed or a user clicks a link in the page.
17337 *
17338 * This event will not emit when the navigation is started programmatically with
17339 * APIs like `<webview>.loadURL` and `<webview>.back`.
17340 *
17341 * It is also not emitted during in-page navigation, such as clicking anchor links
17342 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
17343 * this purpose.
17344 *
17345 * Calling `event.preventDefault()` does **NOT** have any effect.
17346 */
17347 addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
17348 removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
17349 /**
17350 * Emitted when a user or the page wants to start navigation anywhere in the
17351 * `<webview>` or any frames embedded within. It can happen when the
17352 * `window.location` object is changed or a user clicks a link in the page.
17353 *
17354 * This event will not emit when the navigation is started programmatically with
17355 * APIs like `<webview>.loadURL` and `<webview>.back`.
17356 *
17357 * It is also not emitted during in-page navigation, such as clicking anchor links
17358 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
17359 * this purpose.
17360 *
17361 * Calling `event.preventDefault()` does **NOT** have any effect.
17362 */
17363 addEventListener(event: 'will-frame-navigate', listener: (event: WillFrameNavigateEvent) => void, useCapture?: boolean): this;
17364 removeEventListener(event: 'will-frame-navigate', listener: (event: WillFrameNavigateEvent) => void): this;
17365 /**
17366 * Emitted when any frame (including main) starts navigating. `isInPlace` will be
17367 * `true` for in-page navigations.
17368 */
17369 addEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void, useCapture?: boolean): this;
17370 removeEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void): this;
17371 /**
17372 * Emitted after a server side redirect occurs during navigation. For example a 302
17373 * redirect.
17374 */
17375 addEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void, useCapture?: boolean): this;
17376 removeEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void): this;
17377 /**
17378 * Emitted when a navigation is done.
17379 *
17380 * This event is not emitted for in-page navigations, such as clicking anchor links
17381 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
17382 * this purpose.
17383 */
17384 addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
17385 removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
17386 /**
17387 * Emitted when any frame navigation is done.
17388 *
17389 * This event is not emitted for in-page navigations, such as clicking anchor links
17390 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
17391 * this purpose.
17392 */
17393 addEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void, useCapture?: boolean): this;
17394 removeEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void): this;
17395 /**
17396 * Emitted when an in-page navigation happened.
17397 *
17398 * When in-page navigation happens, the page URL changes but does not cause
17399 * navigation outside of the page. Examples of this occurring are when anchor links
17400 * are clicked or when the DOM `hashchange` event is triggered.
17401 */
17402 addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
17403 removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
17404 /**
17405 * Fired when the guest page attempts to close itself.
17406 *
17407 * The following example code navigates the `webview` to `about:blank` when the
17408 * guest attempts to close itself.
17409 */
17410 addEventListener(event: 'close', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17411 removeEventListener(event: 'close', listener: (event: DOMEvent) => void): this;
17412 /**
17413 * Fired when the guest page has sent an asynchronous message to embedder page.
17414 *
17415 * With `sendToHost` method and `ipc-message` event you can communicate between
17416 * guest page and embedder page:
17417 */
17418 addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
17419 removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
17420 /**
17421 * Fired when the renderer process unexpectedly disappears. This is normally
17422 * because it was crashed or killed.
17423 */
17424 addEventListener(event: 'render-process-gone', listener: (event: RenderProcessGoneEvent) => void, useCapture?: boolean): this;
17425 removeEventListener(event: 'render-process-gone', listener: (event: RenderProcessGoneEvent) => void): this;
17426 /**
17427 * Fired when a plugin process is crashed.
17428 */
17429 addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
17430 removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
17431 /**
17432 * Fired when the WebContents is destroyed.
17433 */
17434 addEventListener(event: 'destroyed', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17435 removeEventListener(event: 'destroyed', listener: (event: DOMEvent) => void): this;
17436 /**
17437 * Emitted when media starts playing.
17438 */
17439 addEventListener(event: 'media-started-playing', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17440 removeEventListener(event: 'media-started-playing', listener: (event: DOMEvent) => void): this;
17441 /**
17442 * Emitted when media is paused or done playing.
17443 */
17444 addEventListener(event: 'media-paused', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17445 removeEventListener(event: 'media-paused', listener: (event: DOMEvent) => void): this;
17446 /**
17447 * Emitted when a page's theme color changes. This is usually due to encountering a
17448 * meta tag:
17449 */
17450 addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
17451 removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
17452 /**
17453 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
17454 */
17455 addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
17456 removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
17457 addEventListener(event: 'devtools-open-url', listener: (event: DevtoolsOpenUrlEvent) => void, useCapture?: boolean): this;
17458 removeEventListener(event: 'devtools-open-url', listener: (event: DevtoolsOpenUrlEvent) => void): this;
17459 /**
17460 * Emitted when 'Search' is selected for text in its context menu.
17461 */
17462 addEventListener(event: 'devtools-search-query', listener: (event: DevtoolsSearchQueryEvent) => void, useCapture?: boolean): this;
17463 removeEventListener(event: 'devtools-search-query', listener: (event: DevtoolsSearchQueryEvent) => void): this;
17464 /**
17465 * Emitted when DevTools is opened.
17466 */
17467 addEventListener(event: 'devtools-opened', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17468 removeEventListener(event: 'devtools-opened', listener: (event: DOMEvent) => void): this;
17469 /**
17470 * Emitted when DevTools is closed.
17471 */
17472 addEventListener(event: 'devtools-closed', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17473 removeEventListener(event: 'devtools-closed', listener: (event: DOMEvent) => void): this;
17474 /**
17475 * Emitted when DevTools is focused / opened.
17476 */
17477 addEventListener(event: 'devtools-focused', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
17478 removeEventListener(event: 'devtools-focused', listener: (event: DOMEvent) => void): this;
17479 /**
17480 * Emitted when there is a new context menu that needs to be handled.
17481 */
17482 addEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void, useCapture?: boolean): this;
17483 removeEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void): this;
17484 addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
17485 addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
17486 removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
17487 removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
17488 /**
17489 * Adjusts the current text selection starting and ending points in the focused
17490 * frame by the given amounts. A negative amount moves the selection towards the
17491 * beginning of the document, and a positive amount moves the selection towards the
17492 * end of the document.
17493 *
17494 * See `webContents.adjustSelection` for examples.
17495 */
17496 adjustSelection(options: AdjustSelectionOptions): void;
17497 /**
17498 * Whether the guest page can go back.
17499 */
17500 canGoBack(): boolean;
17501 /**
17502 * Whether the guest page can go forward.
17503 */
17504 canGoForward(): boolean;
17505 /**
17506 * Whether the guest page can go to `offset`.
17507 */
17508 canGoToOffset(offset: number): boolean;
17509 /**
17510 * Resolves with a NativeImage
17511 *
17512 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
17513 * whole visible page.
17514 */
17515 capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
17516 /**
17517 * Centers the current text selection in page.
17518 */
17519 centerSelection(): void;
17520 /**
17521 * Clears the navigation history.
17522 */
17523 clearHistory(): void;
17524 /**
17525 * Closes the DevTools window of guest page.
17526 */
17527 closeDevTools(): void;
17528 /**
17529 * Executes editing command `copy` in page.
17530 */
17531 copy(): void;
17532 /**
17533 * Executes editing command `cut` in page.
17534 */
17535 cut(): void;
17536 /**
17537 * Executes editing command `delete` in page.
17538 */
17539 delete(): void;
17540 /**
17541 * Initiates a download of the resource at `url` without navigating.
17542 */
17543 downloadURL(url: string, options?: DownloadURLOptions): void;
17544 /**
17545 * A promise that resolves with the result of the executed code or is rejected if
17546 * the result of the code is a rejected promise.
17547 *
17548 * Evaluates `code` in page. If `userGesture` is set, it will create the user
17549 * gesture context in the page. HTML APIs like `requestFullScreen`, which require
17550 * user action, can take advantage of this option for automation.
17551 */
17552 executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
17553 /**
17554 * The request id used for the request.
17555 *
17556 * Starts a request to find all matches for the `text` in the web page. The result
17557 * of the request can be obtained by subscribing to `found-in-page` event.
17558 */
17559 findInPage(text: string, options?: FindInPageOptions): number;
17560 /**
17561 * The title of guest page.
17562 */
17563 getTitle(): string;
17564 /**
17565 * The URL of guest page.
17566 */
17567 getURL(): string;
17568 /**
17569 * The user agent for guest page.
17570 */
17571 getUserAgent(): string;
17572 /**
17573 * The WebContents ID of this `webview`.
17574 */
17575 getWebContentsId(): number;
17576 /**
17577 * the current zoom factor.
17578 */
17579 getZoomFactor(): number;
17580 /**
17581 * the current zoom level.
17582 */
17583 getZoomLevel(): number;
17584 /**
17585 * Makes the guest page go back.
17586 */
17587 goBack(): void;
17588 /**
17589 * Makes the guest page go forward.
17590 */
17591 goForward(): void;
17592 /**
17593 * Navigates to the specified absolute index.
17594 */
17595 goToIndex(index: number): void;
17596 /**
17597 * Navigates to the specified offset from the "current entry".
17598 */
17599 goToOffset(offset: number): void;
17600 /**
17601 * A promise that resolves with a key for the inserted CSS that can later be used
17602 * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
17603 *
17604 * Injects CSS into the current web page and returns a unique key for the inserted
17605 * stylesheet.
17606 */
17607 insertCSS(css: string): Promise<string>;
17608 /**
17609 * Inserts `text` to the focused element.
17610 */
17611 insertText(text: string): Promise<void>;
17612 /**
17613 * Starts inspecting element at position (`x`, `y`) of guest page.
17614 */
17615 inspectElement(x: number, y: number): void;
17616 /**
17617 * Opens the DevTools for the service worker context present in the guest page.
17618 */
17619 inspectServiceWorker(): void;
17620 /**
17621 * Opens the DevTools for the shared worker context present in the guest page.
17622 */
17623 inspectSharedWorker(): void;
17624 /**
17625 * Whether guest page has been muted.
17626 */
17627 isAudioMuted(): boolean;
17628 /**
17629 * Whether the renderer process has crashed.
17630 */
17631 isCrashed(): boolean;
17632 /**
17633 * Whether audio is currently playing.
17634 */
17635 isCurrentlyAudible(): boolean;
17636 /**
17637 * Whether DevTools window of guest page is focused.
17638 */
17639 isDevToolsFocused(): boolean;
17640 /**
17641 * Whether guest page has a DevTools window attached.
17642 */
17643 isDevToolsOpened(): boolean;
17644 /**
17645 * Whether guest page is still loading resources.
17646 */
17647 isLoading(): boolean;
17648 /**
17649 * Whether the main frame (and not just iframes or frames within it) is still
17650 * loading.
17651 */
17652 isLoadingMainFrame(): boolean;
17653 /**
17654 * Whether the guest page is waiting for a first-response for the main resource of
17655 * the page.
17656 */
17657 isWaitingForResponse(): boolean;
17658 /**
17659 * The promise will resolve when the page has finished loading (see
17660 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
17661 *
17662 * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
17663 * the `http://` or `file://`.
17664 */
17665 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
17666 /**
17667 * Opens a DevTools window for guest page.
17668 */
17669 openDevTools(): void;
17670 /**
17671 * Executes editing command `paste` in page.
17672 */
17673 paste(): void;
17674 /**
17675 * Executes editing command `pasteAndMatchStyle` in page.
17676 */
17677 pasteAndMatchStyle(): void;
17678 /**
17679 * Prints `webview`'s web page. Same as `webContents.print([options])`.
17680 */
17681 print(options?: WebviewTagPrintOptions): Promise<void>;
17682 /**
17683 * Resolves with the generated PDF data.
17684 *
17685 * Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
17686 */
17687 printToPDF(options: PrintToPDFOptions): Promise<Uint8Array>;
17688 /**
17689 * Executes editing command `redo` in page.
17690 */
17691 redo(): void;
17692 /**
17693 * Reloads the guest page.
17694 */
17695 reload(): void;
17696 /**
17697 * Reloads the guest page and ignores cache.
17698 */
17699 reloadIgnoringCache(): void;
17700 /**
17701 * Resolves if the removal was successful.
17702 *
17703 * Removes the inserted CSS from the current web page. The stylesheet is identified
17704 * by its key, which is returned from `<webview>.insertCSS(css)`.
17705 */
17706 removeInsertedCSS(key: string): Promise<void>;
17707 /**
17708 * Executes editing command `replace` in page.
17709 */
17710 replace(text: string): void;
17711 /**
17712 * Executes editing command `replaceMisspelling` in page.
17713 */
17714 replaceMisspelling(text: string): void;
17715 /**
17716 * Scrolls to the bottom of the current `<webview>`.
17717 */
17718 scrollToBottom(): void;
17719 /**
17720 * Scrolls to the top of the current `<webview>`.
17721 */
17722 scrollToTop(): void;
17723 /**
17724 * Executes editing command `selectAll` in page.
17725 */
17726 selectAll(): void;
17727 /**
17728 * Send an asynchronous message to renderer process via `channel`, you can also
17729 * send arbitrary arguments. The renderer process can handle the message by
17730 * listening to the `channel` event with the `ipcRenderer` module.
17731 *
17732 * See webContents.send for examples.
17733 */
17734 send(channel: string, ...args: any[]): Promise<void>;
17735 /**
17736 * Sends an input `event` to the page.
17737 *
17738 * See webContents.sendInputEvent for detailed description of `event` object.
17739 */
17740 sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
17741 /**
17742 * Send an asynchronous message to renderer process via `channel`, you can also
17743 * send arbitrary arguments. The renderer process can handle the message by
17744 * listening to the `channel` event with the `ipcRenderer` module.
17745 *
17746 * See webContents.sendToFrame for examples.
17747 */
17748 sendToFrame(frameId: [number, number], channel: string, ...args: any[]): Promise<void>;
17749 /**
17750 * Set guest page muted.
17751 */
17752 setAudioMuted(muted: boolean): void;
17753 /**
17754 * Overrides the user agent for the guest page.
17755 */
17756 setUserAgent(userAgent: string): void;
17757 /**
17758 * Sets the maximum and minimum pinch-to-zoom level.
17759 */
17760 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
17761 /**
17762 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
17763 * divided by 100, so 300% = 3.0.
17764 */
17765 setZoomFactor(factor: number): void;
17766 /**
17767 * Changes the zoom level to the specified level. The original size is 0 and each
17768 * increment above or below represents zooming 20% larger or smaller to default
17769 * limits of 300% and 50% of original size, respectively. The formula for this is
17770 * `scale := 1.2 ^ level`.
17771 *
17772 * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
17773 * the zoom level for a specific domain propagates across all instances of windows
17774 * with the same domain. Differentiating the window URLs will make zoom work
17775 * per-window.
17776 */
17777 setZoomLevel(level: number): void;
17778 /**
17779 * Shows pop-up dictionary that searches the selected word on the page.
17780 *
17781 * @platform darwin
17782 */
17783 showDefinitionForSelection(): void;
17784 /**
17785 * Stops any pending navigation.
17786 */
17787 stop(): void;
17788 /**
17789 * Stops any `findInPage` request for the `webview` with the provided `action`.
17790 */
17791 stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
17792 /**
17793 * Executes editing command `undo` in page.
17794 */
17795 undo(): void;
17796 /**
17797 * Executes editing command `unselect` in page.
17798 */
17799 unselect(): void;
17800 /**
17801 * A `boolean`. When this attribute is present the guest page will be allowed to
17802 * open new windows. Popups are disabled by default.
17803 */
17804 allowpopups: boolean;
17805 /**
17806 * A `string` which is a list of strings which specifies the blink features to be
17807 * disabled separated by `,`. The full list of supported feature strings can be
17808 * found in the RuntimeEnabledFeatures.json5 file.
17809 */
17810 disableblinkfeatures: string;
17811 /**
17812 * A `boolean`. When this attribute is present the guest page will have web
17813 * security disabled. Web security is enabled by default.
17814 *
17815 * This value can only be modified before the first navigation.
17816 */
17817 disablewebsecurity: boolean;
17818 /**
17819 * A `string` which is a list of strings which specifies the blink features to be
17820 * enabled separated by `,`. The full list of supported feature strings can be
17821 * found in the RuntimeEnabledFeatures.json5 file.
17822 */
17823 enableblinkfeatures: string;
17824 /**
17825 * A `string` that sets the referrer URL for the guest page.
17826 */
17827 httpreferrer: string;
17828 /**
17829 * A `boolean`. When this attribute is present the guest page in `webview` will
17830 * have node integration and can use node APIs like `require` and `process` to
17831 * access low level system resources. Node integration is disabled by default in
17832 * the guest page.
17833 */
17834 nodeintegration: boolean;
17835 /**
17836 * A `boolean` for the experimental option for enabling NodeJS support in
17837 * sub-frames such as iframes inside the `webview`. All your preloads will load for
17838 * every iframe, you can use `process.isMainFrame` to determine if you are in the
17839 * main frame or not. This option is disabled by default in the guest page.
17840 */
17841 nodeintegrationinsubframes: boolean;
17842 /**
17843 * A `string` that sets the session used by the page. If `partition` starts with
17844 * `persist:`, the page will use a persistent session available to all pages in the
17845 * app with the same `partition`. if there is no `persist:` prefix, the page will
17846 * use an in-memory session. By assigning the same `partition`, multiple pages can
17847 * share the same session. If the `partition` is unset then default session of the
17848 * app will be used.
17849 *
17850 * This value can only be modified before the first navigation, since the session
17851 * of an active renderer process cannot change. Subsequent attempts to modify the
17852 * value will fail with a DOM exception.
17853 */
17854 partition: string;
17855 /**
17856 * A `boolean`. When this attribute is present the guest page in `webview` will be
17857 * able to use browser plugins. Plugins are disabled by default.
17858 */
17859 plugins: boolean;
17860 /**
17861 * A `string` that specifies a script that will be loaded before other scripts run
17862 * in the guest page. The protocol of script's URL must be `file:` (even when using
17863 * `asar:` archives) because it will be loaded by Node's `require` under the hood,
17864 * which treats `asar:` archives as virtual directories.
17865 *
17866 * When the guest page doesn't have node integration this script will still have
17867 * access to all Node APIs, but global objects injected by Node will be deleted
17868 * after this script has finished executing.
17869 */
17870 preload: string;
17871 /**
17872 * A `string` representing the visible URL. Writing to this attribute initiates
17873 * top-level navigation.
17874 *
17875 * Assigning `src` its own value will reload the current page.
17876 *
17877 * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
17878 * world!`.
17879 */
17880 src: string;
17881 /**
17882 * A `string` that sets the user agent for the guest page before the page is
17883 * navigated to. Once the page is loaded, use the `setUserAgent` method to change
17884 * the user agent.
17885 */
17886 useragent: string;
17887 /**
17888 * A `string` which is a comma separated list of strings which specifies the web
17889 * preferences to be set on the webview. The full list of supported preference
17890 * strings can be found in BrowserWindow. In addition, webview supports the
17891 * following preferences:
17892 *
17893 * * `transparent` boolean (optional) - Whether to enable background transparency
17894 * for the guest page. Default is `true`. **Note:** The guest page's text and
17895 * background colors are derived from the color scheme of its root element. When
17896 * transparency is enabled, the text color will still change accordingly but the
17897 * background will remain transparent.
17898 *
17899 * The string follows the same format as the features string in `window.open`. A
17900 * name by itself is given a `true` boolean value. A preference can be set to
17901 * another value by including an `=`, followed by the value. Special values `yes`
17902 * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
17903 * `false`.
17904 */
17905 webpreferences?: ('transparent');
17906 }
17907
17908 interface AboutPanelOptionsOptions {
17909 /**
17910 * The app's name.
17911 */
17912 applicationName?: string;
17913 /**
17914 * The app's version.
17915 */
17916 applicationVersion?: string;
17917 /**
17918 * Copyright information.
17919 */
17920 copyright?: string;
17921 /**
17922 * The app's build version number.
17923 *
17924 * @platform darwin
17925 */
17926 version?: string;
17927 /**
17928 * Credit information.
17929 *
17930 * @platform darwin,win32
17931 */
17932 credits?: string;
17933 /**
17934 * List of app authors.
17935 *
17936 * @platform linux
17937 */
17938 authors?: string[];
17939 /**
17940 * The app's website.
17941 *
17942 * @platform linux
17943 */
17944 website?: string;
17945 /**
17946 * Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as
17947 * 64x64 pixels while retaining aspect ratio.
17948 *
17949 * @platform linux,win32
17950 */
17951 iconPath?: string;
17952 }
17953
17954 interface AddRepresentationOptions {
17955 /**
17956 * The scale factor to add the image representation for.
17957 */
17958 scaleFactor?: number;
17959 /**
17960 * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
17961 */
17962 width?: number;
17963 /**
17964 * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
17965 */
17966 height?: number;
17967 /**
17968 * The buffer containing the raw image data.
17969 */
17970 buffer?: Buffer;
17971 /**
17972 * The data URL containing either a base 64 encoded PNG or JPEG image.
17973 */
17974 dataURL?: string;
17975 }
17976
17977 interface AdjustSelectionOptions {
17978 /**
17979 * Amount to shift the start index of the current selection.
17980 */
17981 start?: number;
17982 /**
17983 * Amount to shift the end index of the current selection.
17984 */
17985 end?: number;
17986 }
17987
17988 interface AnimationSettings {
17989 /**
17990 * Returns true if rich animations should be rendered. Looks at session type (e.g.
17991 * remote desktop) and accessibility settings to give guidance for heavy
17992 * animations.
17993 */
17994 shouldRenderRichAnimation: boolean;
17995 /**
17996 * Determines on a per-platform basis whether scroll animations (e.g. produced by
17997 * home/end key) should be enabled.
17998 */
17999 scrollAnimationsEnabledBySystem: boolean;
18000 /**
18001 * Determines whether the user desires reduced motion based on platform APIs.
18002 */
18003 prefersReducedMotion: boolean;
18004 }
18005
18006 interface AppDetailsOptions {
18007 /**
18008 * Window's App User Model ID. It has to be set, otherwise the other options will
18009 * have no effect.
18010 */
18011 appId?: string;
18012 /**
18013 * Window's Relaunch Icon.
18014 */
18015 appIconPath?: string;
18016 /**
18017 * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
18018 * Default is `0`.
18019 */
18020 appIconIndex?: number;
18021 /**
18022 * Window's Relaunch Command.
18023 */
18024 relaunchCommand?: string;
18025 /**
18026 * Window's Relaunch Display Name.
18027 */
18028 relaunchDisplayName?: string;
18029 }
18030
18031 interface ApplicationInfoForProtocolReturnValue {
18032 /**
18033 * the display icon of the app handling the protocol.
18034 */
18035 icon: NativeImage;
18036 /**
18037 * installation path of the app handling the protocol.
18038 */
18039 path: string;
18040 /**
18041 * display name of the app handling the protocol.
18042 */
18043 name: string;
18044 }
18045
18046 interface AuthenticationResponseDetails {
18047 url: string;
18048 }
18049
18050 interface AuthInfo {
18051 isProxy: boolean;
18052 scheme: string;
18053 host: string;
18054 port: number;
18055 realm: string;
18056 }
18057
18058 interface AutoResizeOptions {
18059 /**
18060 * If `true`, the view's width will grow and shrink together with the window.
18061 * `false` by default.
18062 */
18063 width?: boolean;
18064 /**
18065 * If `true`, the view's height will grow and shrink together with the window.
18066 * `false` by default.
18067 */
18068 height?: boolean;
18069 /**
18070 * If `true`, the view's x position and width will grow and shrink proportionally
18071 * with the window. `false` by default.
18072 */
18073 horizontal?: boolean;
18074 /**
18075 * If `true`, the view's y position and height will grow and shrink proportionally
18076 * with the window. `false` by default.
18077 */
18078 vertical?: boolean;
18079 }
18080
18081 interface BeforeSendResponse {
18082 cancel?: boolean;
18083 /**
18084 * When provided, request will be made with these headers.
18085 */
18086 requestHeaders?: Record<string, (string) | (string[])>;
18087 }
18088
18089 interface BitmapOptions {
18090 /**
18091 * Defaults to 1.0.
18092 */
18093 scaleFactor?: number;
18094 }
18095
18096 interface BlinkMemoryInfo {
18097 /**
18098 * Size of all allocated objects in Kilobytes.
18099 */
18100 allocated: number;
18101 /**
18102 * Total allocated space in Kilobytes.
18103 */
18104 total: number;
18105 }
18106
18107 interface BluetoothPairingHandlerHandlerDetails {
18108 deviceId: string;
18109 /**
18110 * The type of pairing prompt being requested. One of the following values:
18111 */
18112 pairingKind: ('confirm' | 'confirmPin' | 'providePin');
18113 frame: WebFrameMain;
18114 /**
18115 * The pin value to verify if `pairingKind` is `confirmPin`.
18116 */
18117 pin?: string;
18118 }
18119
18120 interface BrowserViewConstructorOptions {
18121 /**
18122 * Settings of web page's features.
18123 */
18124 webPreferences?: WebPreferences;
18125 }
18126
18127 interface CallbackResponse {
18128 cancel?: boolean;
18129 /**
18130 * The original request is prevented from being sent or completed and is instead
18131 * redirected to the given URL.
18132 */
18133 redirectURL?: string;
18134 }
18135
18136 interface CertificateTrustDialogOptions {
18137 /**
18138 * The certificate to trust/import.
18139 */
18140 certificate: Certificate;
18141 /**
18142 * The message to display to the user.
18143 */
18144 message: string;
18145 }
18146
18147 interface ClearCodeCachesOptions {
18148 /**
18149 * An array of url corresponding to the resource whose generated code cache needs
18150 * to be removed. If the list is empty then all entries in the cache directory will
18151 * be removed.
18152 */
18153 urls?: string[];
18154 }
18155
18156 interface ClearStorageDataOptions {
18157 /**
18158 * Should follow `window.location.origin`’s representation `scheme://host:port`.
18159 */
18160 origin?: string;
18161 /**
18162 * The types of storages to clear, can be `cookies`, `filesystem`, `indexdb`,
18163 * `localstorage`, `shadercache`, `websql`, `serviceworkers`, `cachestorage`. If
18164 * not specified, clear all storage types.
18165 */
18166 storages?: Array<'cookies' | 'filesystem' | 'indexdb' | 'localstorage' | 'shadercache' | 'websql' | 'serviceworkers' | 'cachestorage'>;
18167 /**
18168 * The types of quotas to clear, can be `temporary`, `syncable`. If not specified,
18169 * clear all quotas.
18170 */
18171 quotas?: Array<'temporary' | 'syncable'>;
18172 }
18173
18174 interface ClientRequestConstructorOptions {
18175 /**
18176 * The HTTP request method. Defaults to the GET method.
18177 */
18178 method?: string;
18179 /**
18180 * The request URL. Must be provided in the absolute form with the protocol scheme
18181 * specified as http or https.
18182 */
18183 url?: string;
18184 /**
18185 * Headers to be sent with the request.
18186 */
18187 headers?: Record<string, (string) | (string[])>;
18188 /**
18189 * The `Session` instance with which the request is associated.
18190 */
18191 session?: Session;
18192 /**
18193 * The name of the `partition` with which the request is associated. Defaults to
18194 * the empty string. The `session` option supersedes `partition`. Thus if a
18195 * `session` is explicitly specified, `partition` is ignored.
18196 */
18197 partition?: string;
18198 /**
18199 * Can be `include`, `omit` or `same-origin`. Whether to send credentials with this
18200 * request. If set to `include`, credentials from the session associated with the
18201 * request will be used. If set to `omit`, credentials will not be sent with the
18202 * request (and the `'login'` event will not be triggered in the event of a 401).
18203 * If set to `same-origin`, `origin` must also be specified. This matches the
18204 * behavior of the fetch option of the same name. If this option is not specified,
18205 * authentication data from the session will be sent, and cookies will not be sent
18206 * (unless `useSessionCookies` is set).
18207 */
18208 credentials?: ('include' | 'omit' | 'same-origin');
18209 /**
18210 * Whether to send cookies with this request from the provided session. If
18211 * `credentials` is specified, this option has no effect. Default is `false`.
18212 */
18213 useSessionCookies?: boolean;
18214 /**
18215 * Can be `http:` or `https:`. The protocol scheme in the form 'scheme:'. Defaults
18216 * to 'http:'.
18217 */
18218 protocol?: ('http:' | 'https:');
18219 /**
18220 * The server host provided as a concatenation of the hostname and the port number
18221 * 'hostname:port'.
18222 */
18223 host?: string;
18224 /**
18225 * The server host name.
18226 */
18227 hostname?: string;
18228 /**
18229 * The server's listening port number.
18230 */
18231 port?: number;
18232 /**
18233 * The path part of the request URL.
18234 */
18235 path?: string;
18236 /**
18237 * Can be `follow`, `error` or `manual`. The redirect mode for this request. When
18238 * mode is `error`, any redirection will be aborted. When mode is `manual` the
18239 * redirection will be cancelled unless `request.followRedirect` is invoked
18240 * synchronously during the `redirect` event. Defaults to `follow`.
18241 */
18242 redirect?: ('follow' | 'error' | 'manual');
18243 /**
18244 * The origin URL of the request.
18245 */
18246 origin?: string;
18247 /**
18248 * can be `""`, `no-referrer`, `no-referrer-when-downgrade`, `origin`,
18249 * `origin-when-cross-origin`, `unsafe-url`, `same-origin`, `strict-origin`, or
18250 * `strict-origin-when-cross-origin`. Defaults to
18251 * `strict-origin-when-cross-origin`.
18252 */
18253 referrerPolicy?: string;
18254 /**
18255 * can be `default`, `no-store`, `reload`, `no-cache`, `force-cache` or
18256 * `only-if-cached`.
18257 */
18258 cache?: ('default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached');
18259 }
18260
18261 interface CloseOpts {
18262 /**
18263 * if true, fire the `beforeunload` event before closing the page. If the page
18264 * prevents the unload, the WebContents will not be closed. The
18265 * `will-prevent-unload` will be fired if the page requests prevention of unload.
18266 */
18267 waitForBeforeUnload: boolean;
18268 }
18269
18270 interface Config {
18271 /**
18272 * Can be `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. The minimum SSL version to allow
18273 * when connecting to remote servers. Defaults to `tls1`.
18274 */
18275 minVersion?: ('tls1' | 'tls1.1' | 'tls1.2' | 'tls1.3');
18276 /**
18277 * Can be `tls1.2` or `tls1.3`. The maximum SSL version to allow when connecting to
18278 * remote servers. Defaults to `tls1.3`.
18279 */
18280 maxVersion?: ('tls1.2' | 'tls1.3');
18281 /**
18282 * List of cipher suites which should be explicitly prevented from being used in
18283 * addition to those disabled by the net built-in policy. Supported literal forms:
18284 * 0xAABB, where AA is `cipher_suite[0]` and BB is `cipher_suite[1]`, as defined in
18285 * RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form
18286 * will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify
18287 * 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note
18288 * that TLSv1.3 ciphers cannot be disabled using this mechanism.
18289 */
18290 disabledCipherSuites?: number[];
18291 }
18292
18293 interface ConfigureHostResolverOptions {
18294 /**
18295 * Whether the built-in host resolver is used in preference to getaddrinfo. When
18296 * enabled, the built-in resolver will attempt to use the system's DNS settings to
18297 * do DNS lookups itself. Enabled by default on macOS, disabled by default on
18298 * Windows and Linux.
18299 */
18300 enableBuiltInResolver?: boolean;
18301 /**
18302 * Can be 'off', 'automatic' or 'secure'. Configures the DNS-over-HTTP mode. When
18303 * 'off', no DoH lookups will be performed. When 'automatic', DoH lookups will be
18304 * performed first if DoH is available, and insecure DNS lookups will be performed
18305 * as a fallback. When 'secure', only DoH lookups will be performed. Defaults to
18306 * 'automatic'.
18307 */
18308 secureDnsMode?: ('off' | 'automatic' | 'secure');
18309 /**
18310 * A list of DNS-over-HTTP server templates. See RFC8484 § 3 for details on the
18311 * template format. Most servers support the POST method; the template for such
18312 * servers is simply a URI. Note that for some DNS providers, the resolver will
18313 * automatically upgrade to DoH unless DoH is explicitly disabled, even if there
18314 * are no DoH servers provided in this list.
18315 */
18316 secureDnsServers?: string[];
18317 /**
18318 * Controls whether additional DNS query types, e.g. HTTPS (DNS type 65) will be
18319 * allowed besides the traditional A and AAAA queries when a request is being made
18320 * via insecure DNS. Has no effect on Secure DNS which always allows additional
18321 * types. Defaults to true.
18322 */
18323 enableAdditionalDnsQueryTypes?: boolean;
18324 }
18325
18326 interface ConsoleMessageEvent extends DOMEvent {
18327 /**
18328 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
18329 * `error`.
18330 */
18331 level: number;
18332 /**
18333 * The actual console message
18334 */
18335 message: string;
18336 /**
18337 * The line number of the source that triggered this console message
18338 */
18339 line: number;
18340 sourceId: string;
18341 }
18342
18343 interface ContextMenuEvent extends DOMEvent {
18344 params: Params;
18345 }
18346
18347 interface ContextMenuParams {
18348 /**
18349 * x coordinate.
18350 */
18351 x: number;
18352 /**
18353 * y coordinate.
18354 */
18355 y: number;
18356 /**
18357 * Frame from which the context menu was invoked.
18358 */
18359 frame: WebFrameMain;
18360 /**
18361 * URL of the link that encloses the node the context menu was invoked on.
18362 */
18363 linkURL: string;
18364 /**
18365 * Text associated with the link. May be an empty string if the contents of the
18366 * link are an image.
18367 */
18368 linkText: string;
18369 /**
18370 * URL of the top level page that the context menu was invoked on.
18371 */
18372 pageURL: string;
18373 /**
18374 * URL of the subframe that the context menu was invoked on.
18375 */
18376 frameURL: string;
18377 /**
18378 * Source URL for the element that the context menu was invoked on. Elements with
18379 * source URLs are images, audio and video.
18380 */
18381 srcURL: string;
18382 /**
18383 * Type of the node the context menu was invoked on. Can be `none`, `image`,
18384 * `audio`, `video`, `canvas`, `file` or `plugin`.
18385 */
18386 mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
18387 /**
18388 * Whether the context menu was invoked on an image which has non-empty contents.
18389 */
18390 hasImageContents: boolean;
18391 /**
18392 * Whether the context is editable.
18393 */
18394 isEditable: boolean;
18395 /**
18396 * Text of the selection that the context menu was invoked on.
18397 */
18398 selectionText: string;
18399 /**
18400 * Title text of the selection that the context menu was invoked on.
18401 */
18402 titleText: string;
18403 /**
18404 * Alt text of the selection that the context menu was invoked on.
18405 */
18406 altText: string;
18407 /**
18408 * Suggested filename to be used when saving file through 'Save Link As' option of
18409 * context menu.
18410 */
18411 suggestedFilename: string;
18412 /**
18413 * Rect representing the coordinates in the document space of the selection.
18414 */
18415 selectionRect: Rectangle;
18416 /**
18417 * Start position of the selection text.
18418 */
18419 selectionStartOffset: number;
18420 /**
18421 * The referrer policy of the frame on which the menu is invoked.
18422 */
18423 referrerPolicy: Referrer;
18424 /**
18425 * The misspelled word under the cursor, if any.
18426 */
18427 misspelledWord: string;
18428 /**
18429 * An array of suggested words to show the user to replace the `misspelledWord`.
18430 * Only available if there is a misspelled word and spellchecker is enabled.
18431 */
18432 dictionarySuggestions: string[];
18433 /**
18434 * The character encoding of the frame on which the menu was invoked.
18435 */
18436 frameCharset: string;
18437 /**
18438 * The source that the context menu was invoked on. Possible values include `none`,
18439 * `button-button`, `field-set`, `input-button`, `input-checkbox`, `input-color`,
18440 * `input-date`, `input-datetime-local`, `input-email`, `input-file`,
18441 * `input-hidden`, `input-image`, `input-month`, `input-number`, `input-password`,
18442 * `input-radio`, `input-range`, `input-reset`, `input-search`, `input-submit`,
18443 * `input-telephone`, `input-text`, `input-time`, `input-url`, `input-week`,
18444 * `output`, `reset-button`, `select-list`, `select-list`, `select-multiple`,
18445 * `select-one`, `submit-button`, and `text-area`,
18446 */
18447 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');
18448 /**
18449 * If the context is editable, whether or not spellchecking is enabled.
18450 */
18451 spellcheckEnabled: boolean;
18452 /**
18453 * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
18454 * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
18455 * `adjustSelection`, or `adjustSelectionReset`.
18456 */
18457 menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
18458 /**
18459 * The flags for the media element the context menu was invoked on.
18460 */
18461 mediaFlags: MediaFlags;
18462 /**
18463 * These flags indicate whether the renderer believes it is able to perform the
18464 * corresponding action.
18465 */
18466 editFlags: EditFlags;
18467 }
18468
18469 interface ContinueActivityDetails {
18470 /**
18471 * A string identifying the URL of the webpage accessed by the activity on another
18472 * device, if available.
18473 */
18474 webpageURL?: string;
18475 }
18476
18477 interface CookiesGetFilter {
18478 /**
18479 * Retrieves cookies which are associated with `url`. Empty implies retrieving
18480 * cookies of all URLs.
18481 */
18482 url?: string;
18483 /**
18484 * Filters cookies by name.
18485 */
18486 name?: string;
18487 /**
18488 * Retrieves cookies whose domains match or are subdomains of `domains`.
18489 */
18490 domain?: string;
18491 /**
18492 * Retrieves cookies whose path matches `path`.
18493 */
18494 path?: string;
18495 /**
18496 * Filters cookies by their Secure property.
18497 */
18498 secure?: boolean;
18499 /**
18500 * Filters out session or persistent cookies.
18501 */
18502 session?: boolean;
18503 /**
18504 * Filters cookies by httpOnly.
18505 */
18506 httpOnly?: boolean;
18507 }
18508
18509 interface CookiesSetDetails {
18510 /**
18511 * The URL to associate the cookie with. The promise will be rejected if the URL is
18512 * invalid.
18513 */
18514 url: string;
18515 /**
18516 * The name of the cookie. Empty by default if omitted.
18517 */
18518 name?: string;
18519 /**
18520 * The value of the cookie. Empty by default if omitted.
18521 */
18522 value?: string;
18523 /**
18524 * The domain of the cookie; this will be normalized with a preceding dot so that
18525 * it's also valid for subdomains. Empty by default if omitted.
18526 */
18527 domain?: string;
18528 /**
18529 * The path of the cookie. Empty by default if omitted.
18530 */
18531 path?: string;
18532 /**
18533 * Whether the cookie should be marked as Secure. Defaults to false unless Same
18534 * Site=None attribute is used.
18535 */
18536 secure?: boolean;
18537 /**
18538 * Whether the cookie should be marked as HTTP only. Defaults to false.
18539 */
18540 httpOnly?: boolean;
18541 /**
18542 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
18543 * If omitted then the cookie becomes a session cookie and will not be retained
18544 * between sessions.
18545 */
18546 expirationDate?: number;
18547 /**
18548 * The Same Site policy to apply to this cookie. Can be `unspecified`,
18549 * `no_restriction`, `lax` or `strict`. Default is `lax`.
18550 */
18551 sameSite?: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
18552 }
18553
18554 interface CrashReporterStartOptions {
18555 /**
18556 * URL that crash reports will be sent to as POST. Required unless `uploadToServer`
18557 * is `false`.
18558 */
18559 submitURL?: string;
18560 /**
18561 * Defaults to `app.name`.
18562 */
18563 productName?: string;
18564 /**
18565 * Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
18566 *
18567 * @deprecated
18568 */
18569 companyName?: string;
18570 /**
18571 * Whether crash reports should be sent to the server. If false, crash reports will
18572 * be collected and stored in the crashes directory, but not uploaded. Default is
18573 * `true`.
18574 */
18575 uploadToServer?: boolean;
18576 /**
18577 * If true, crashes generated in the main process will not be forwarded to the
18578 * system crash handler. Default is `false`.
18579 */
18580 ignoreSystemCrashHandler?: boolean;
18581 /**
18582 * If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
18583 *
18584 * @platform darwin,win32
18585 */
18586 rateLimit?: boolean;
18587 /**
18588 * If true, crash reports will be compressed and uploaded with `Content-Encoding:
18589 * gzip`. Default is `true`.
18590 */
18591 compress?: boolean;
18592 /**
18593 * Extra string key/value annotations that will be sent along with crash reports
18594 * that are generated in the main process. Only string values are supported.
18595 * Crashes generated in child processes will not contain these extra parameters to
18596 * crash reports generated from child processes, call `addExtraParameter` from the
18597 * child process.
18598 */
18599 extra?: Record<string, string>;
18600 /**
18601 * Extra string key/value annotations that will be sent along with any crash
18602 * reports generated in any process. These annotations cannot be changed once the
18603 * crash reporter has been started. If a key is present in both the global extra
18604 * parameters and the process-specific extra parameters, then the global one will
18605 * take precedence. By default, `productName` and the app version are included, as
18606 * well as the Electron version.
18607 */
18608 globalExtra?: Record<string, string>;
18609 }
18610
18611 interface CreateFromBitmapOptions {
18612 width: number;
18613 height: number;
18614 /**
18615 * Defaults to 1.0.
18616 */
18617 scaleFactor?: number;
18618 }
18619
18620 interface CreateFromBufferOptions {
18621 /**
18622 * Required for bitmap buffers.
18623 */
18624 width?: number;
18625 /**
18626 * Required for bitmap buffers.
18627 */
18628 height?: number;
18629 /**
18630 * Defaults to 1.0.
18631 */
18632 scaleFactor?: number;
18633 }
18634
18635 interface CreateInterruptedDownloadOptions {
18636 /**
18637 * Absolute path of the download.
18638 */
18639 path: string;
18640 /**
18641 * Complete URL chain for the download.
18642 */
18643 urlChain: string[];
18644 mimeType?: string;
18645 /**
18646 * Start range for the download.
18647 */
18648 offset: number;
18649 /**
18650 * Total length of the download.
18651 */
18652 length: number;
18653 /**
18654 * Last-Modified header value.
18655 */
18656 lastModified?: string;
18657 /**
18658 * ETag header value.
18659 */
18660 eTag?: string;
18661 /**
18662 * Time when download was started in number of seconds since UNIX epoch.
18663 */
18664 startTime?: number;
18665 }
18666
18667 interface Data {
18668 text?: string;
18669 html?: string;
18670 image?: NativeImage;
18671 rtf?: string;
18672 /**
18673 * The title of the URL at `text`.
18674 */
18675 bookmark?: string;
18676 }
18677
18678 interface DefaultFontFamily {
18679 /**
18680 * Defaults to `Times New Roman`.
18681 */
18682 standard?: string;
18683 /**
18684 * Defaults to `Times New Roman`.
18685 */
18686 serif?: string;
18687 /**
18688 * Defaults to `Arial`.
18689 */
18690 sansSerif?: string;
18691 /**
18692 * Defaults to `Courier New`.
18693 */
18694 monospace?: string;
18695 /**
18696 * Defaults to `Script`.
18697 */
18698 cursive?: string;
18699 /**
18700 * Defaults to `Impact`.
18701 */
18702 fantasy?: string;
18703 /**
18704 * Defaults to `Latin Modern Math`.
18705 */
18706 math?: string;
18707 }
18708
18709 interface Details {
18710 /**
18711 * Process type. One of the following values:
18712 */
18713 type: ('Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
18714 /**
18715 * The reason the child process is gone. Possible values:
18716 */
18717 reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
18718 /**
18719 * The exit code for the process (e.g. status from waitpid if on posix, from
18720 * GetExitCodeProcess on Windows).
18721 */
18722 exitCode: number;
18723 /**
18724 * The non-localized name of the process.
18725 */
18726 serviceName?: string;
18727 /**
18728 * The name of the process. Examples for utility: `Audio Service`, `Content
18729 * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
18730 */
18731 name?: string;
18732 }
18733
18734 interface DevicePermissionHandlerHandlerDetails {
18735 /**
18736 * The type of device that permission is being requested on, can be `hid`,
18737 * `serial`, or `usb`.
18738 */
18739 deviceType: ('hid' | 'serial' | 'usb');
18740 /**
18741 * The origin URL of the device permission check.
18742 */
18743 origin: string;
18744 /**
18745 * the device that permission is being requested for.
18746 */
18747 device: (HIDDevice) | (SerialPort) | (USBDevice);
18748 }
18749
18750 interface DevtoolsOpenUrlEvent extends DOMEvent {
18751 /**
18752 * URL of the link that was clicked or selected.
18753 */
18754 url: string;
18755 }
18756
18757 interface DevtoolsSearchQueryEvent extends DOMEvent {
18758 event: Event;
18759 /**
18760 * text to query for.
18761 */
18762 query: string;
18763 }
18764
18765 interface DidChangeThemeColorEvent extends DOMEvent {
18766 themeColor: string;
18767 }
18768
18769 interface DidCreateWindowDetails {
18770 /**
18771 * URL for the created window.
18772 */
18773 url: string;
18774 /**
18775 * Name given to the created window in the `window.open()` call.
18776 */
18777 frameName: string;
18778 /**
18779 * The options used to create the BrowserWindow. They are merged in increasing
18780 * precedence: parsed options from the `features` string from `window.open()`,
18781 * security-related webPreferences inherited from the parent, and options given by
18782 * `webContents.setWindowOpenHandler`. Unrecognized options are not filtered out.
18783 */
18784 options: BrowserWindowConstructorOptions;
18785 /**
18786 * The referrer that will be passed to the new window. May or may not result in the
18787 * `Referer` header being sent, depending on the referrer policy.
18788 */
18789 referrer: Referrer;
18790 /**
18791 * The post data that will be sent to the new window, along with the appropriate
18792 * headers that will be set. If no post data is to be sent, the value will be
18793 * `null`. Only defined when the window is being created by a form that set
18794 * `target=_blank`.
18795 */
18796 postBody?: PostBody;
18797 /**
18798 * Can be `default`, `foreground-tab`, `background-tab`, `new-window` or `other`.
18799 */
18800 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'other');
18801 }
18802
18803 interface DidFailLoadEvent extends DOMEvent {
18804 errorCode: number;
18805 errorDescription: string;
18806 validatedURL: string;
18807 isMainFrame: boolean;
18808 }
18809
18810 interface DidFrameFinishLoadEvent extends DOMEvent {
18811 isMainFrame: boolean;
18812 }
18813
18814 interface DidFrameNavigateEvent extends DOMEvent {
18815 url: string;
18816 /**
18817 * -1 for non HTTP navigations
18818 */
18819 httpResponseCode: number;
18820 /**
18821 * empty for non HTTP navigations,
18822 */
18823 httpStatusText: string;
18824 isMainFrame: boolean;
18825 frameProcessId: number;
18826 frameRoutingId: number;
18827 }
18828
18829 interface DidNavigateEvent extends DOMEvent {
18830 url: string;
18831 }
18832
18833 interface DidNavigateInPageEvent extends DOMEvent {
18834 isMainFrame: boolean;
18835 url: string;
18836 }
18837
18838 interface DidRedirectNavigationEvent extends DOMEvent {
18839 url: string;
18840 isInPlace: boolean;
18841 isMainFrame: boolean;
18842 frameProcessId: number;
18843 frameRoutingId: number;
18844 }
18845
18846 interface DidStartNavigationEvent extends DOMEvent {
18847 url: string;
18848 isInPlace: boolean;
18849 isMainFrame: boolean;
18850 frameProcessId: number;
18851 frameRoutingId: number;
18852 }
18853
18854 interface DisplayBalloonOptions {
18855 /**
18856 * Icon to use when `iconType` is `custom`.
18857 */
18858 icon?: (NativeImage) | (string);
18859 /**
18860 * Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
18861 */
18862 iconType?: ('none' | 'info' | 'warning' | 'error' | 'custom');
18863 title: string;
18864 content: string;
18865 /**
18866 * The large version of the icon should be used. Default is `true`. Maps to
18867 * `NIIF_LARGE_ICON`.
18868 */
18869 largeIcon?: boolean;
18870 /**
18871 * Do not play the associated sound. Default is `false`. Maps to `NIIF_NOSOUND`.
18872 */
18873 noSound?: boolean;
18874 /**
18875 * Do not display the balloon notification if the current user is in "quiet time".
18876 * Default is `false`. Maps to `NIIF_RESPECT_QUIET_TIME`.
18877 */
18878 respectQuietTime?: boolean;
18879 }
18880
18881 interface DisplayMediaRequestHandlerHandlerRequest {
18882 /**
18883 * Frame that is requesting access to media.
18884 */
18885 frame: WebFrameMain;
18886 /**
18887 * Origin of the page making the request.
18888 */
18889 securityOrigin: string;
18890 /**
18891 * true if the web content requested a video stream.
18892 */
18893 videoRequested: boolean;
18894 /**
18895 * true if the web content requested an audio stream.
18896 */
18897 audioRequested: boolean;
18898 /**
18899 * Whether a user gesture was active when this request was triggered.
18900 */
18901 userGesture: boolean;
18902 }
18903
18904 interface DownloadURLOptions {
18905 /**
18906 * HTTP request headers.
18907 */
18908 headers?: Record<string, string>;
18909 }
18910
18911 interface EnableNetworkEmulationOptions {
18912 /**
18913 * Whether to emulate network outage. Defaults to false.
18914 */
18915 offline?: boolean;
18916 /**
18917 * RTT in ms. Defaults to 0 which will disable latency throttling.
18918 */
18919 latency?: number;
18920 /**
18921 * Download rate in Bps. Defaults to 0 which will disable download throttling.
18922 */
18923 downloadThroughput?: number;
18924 /**
18925 * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
18926 */
18927 uploadThroughput?: number;
18928 }
18929
18930 interface EntryAtIndex {
18931 /**
18932 * The URL of the navigation entry at the given index.
18933 */
18934 url: string;
18935 /**
18936 * The page title of the navigation entry at the given index.
18937 */
18938 title: string;
18939 }
18940
18941 interface FeedURLOptions {
18942 url: string;
18943 /**
18944 * HTTP request headers.
18945 *
18946 * @platform darwin
18947 */
18948 headers?: Record<string, string>;
18949 /**
18950 * Can be `json` or `default`, see the Squirrel.Mac README for more information.
18951 *
18952 * @platform darwin
18953 */
18954 serverType?: ('json' | 'default');
18955 }
18956
18957 interface FileIconOptions {
18958 size: ('small' | 'normal' | 'large');
18959 }
18960
18961 interface FindInPageOptions {
18962 /**
18963 * Whether to search forward or backward, defaults to `true`.
18964 */
18965 forward?: boolean;
18966 /**
18967 * Whether to begin a new text finding session with this request. Should be `true`
18968 * for initial requests, and `false` for follow-up requests. Defaults to `false`.
18969 */
18970 findNext?: boolean;
18971 /**
18972 * Whether search should be case-sensitive, defaults to `false`.
18973 */
18974 matchCase?: boolean;
18975 }
18976
18977 interface FocusOptions {
18978 /**
18979 * Make the receiver the active app even if another app is currently active.
18980 *
18981 * @platform darwin
18982 */
18983 steal: boolean;
18984 }
18985
18986 interface ForkOptions {
18987 /**
18988 * Environment key-value pairs. Default is `process.env`.
18989 */
18990 env?: Env;
18991 /**
18992 * List of string arguments passed to the executable.
18993 */
18994 execArgv?: string[];
18995 /**
18996 * Current working directory of the child process.
18997 */
18998 cwd?: string;
18999 /**
19000 * Allows configuring the mode for `stdout` and `stderr` of the child process.
19001 * Default is `inherit`. String value can be one of `pipe`, `ignore`, `inherit`,
19002 * for more details on these values you can refer to stdio documentation from
19003 * Node.js. Currently this option only supports configuring `stdout` and `stderr`
19004 * to either `pipe`, `inherit` or `ignore`. Configuring `stdin` to any property
19005 * other than `ignore` is not supported and will result in an error. For example,
19006 * the supported values will be processed as following:
19007 */
19008 stdio?: (Array<'pipe' | 'ignore' | 'inherit'>) | (string);
19009 /**
19010 * Name of the process that will appear in `name` property of `ProcessMetric`
19011 * returned by `app.getAppMetrics` and `child-process-gone` event of `app`. Default
19012 * is `Node Utility Process`.
19013 */
19014 serviceName?: string;
19015 /**
19016 * With this flag, the utility process will be launched via the `Electron Helper
19017 * (Plugin).app` helper executable on macOS, which can be codesigned with
19018 * `com.apple.security.cs.disable-library-validation` and
19019 * `com.apple.security.cs.allow-unsigned-executable-memory` entitlements. This will
19020 * allow the utility process to load unsigned libraries. Unless you specifically
19021 * need this capability, it is best to leave this disabled. Default is `false`.
19022 *
19023 * @platform darwin
19024 */
19025 allowLoadingUnsignedLibraries?: boolean;
19026 }
19027
19028 interface FoundInPageEvent extends DOMEvent {
19029 result: FoundInPageResult;
19030 }
19031
19032 interface FrameCreatedDetails {
19033 frame: WebFrameMain;
19034 }
19035
19036 interface FromPartitionOptions {
19037 /**
19038 * Whether to enable cache.
19039 */
19040 cache: boolean;
19041 }
19042
19043 interface FromPathOptions {
19044 /**
19045 * Whether to enable cache.
19046 */
19047 cache: boolean;
19048 }
19049
19050 interface HandlerDetails {
19051 /**
19052 * The _resolved_ version of the URL passed to `window.open()`. e.g. opening a
19053 * window with `window.open('foo')` will yield something like
19054 * `https://the-origin/the/current/path/foo`.
19055 */
19056 url: string;
19057 /**
19058 * Name of the window provided in `window.open()`
19059 */
19060 frameName: string;
19061 /**
19062 * Comma separated list of window features provided to `window.open()`.
19063 */
19064 features: string;
19065 /**
19066 * Can be `default`, `foreground-tab`, `background-tab`, `new-window` or `other`.
19067 */
19068 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'other');
19069 /**
19070 * The referrer that will be passed to the new window. May or may not result in the
19071 * `Referer` header being sent, depending on the referrer policy.
19072 */
19073 referrer: Referrer;
19074 /**
19075 * The post data that will be sent to the new window, along with the appropriate
19076 * headers that will be set. If no post data is to be sent, the value will be
19077 * `null`. Only defined when the window is being created by a form that set
19078 * `target=_blank`.
19079 */
19080 postBody?: PostBody;
19081 }
19082
19083 interface HeadersReceivedResponse {
19084 cancel?: boolean;
19085 /**
19086 * When provided, the server is assumed to have responded with these headers.
19087 */
19088 responseHeaders?: Record<string, (string) | (string[])>;
19089 /**
19090 * Should be provided when overriding `responseHeaders` to change header status
19091 * otherwise original response header's status will be used.
19092 */
19093 statusLine?: string;
19094 }
19095
19096 interface HeapStatistics {
19097 totalHeapSize: number;
19098 totalHeapSizeExecutable: number;
19099 totalPhysicalSize: number;
19100 totalAvailableSize: number;
19101 usedHeapSize: number;
19102 heapSizeLimit: number;
19103 mallocedMemory: number;
19104 peakMallocedMemory: number;
19105 doesZapGarbage: boolean;
19106 }
19107
19108 interface HidDeviceAddedDetails {
19109 device: HIDDevice;
19110 frame: WebFrameMain;
19111 }
19112
19113 interface HidDeviceRemovedDetails {
19114 device: HIDDevice;
19115 frame: WebFrameMain;
19116 }
19117
19118 interface HidDeviceRevokedDetails {
19119 device: HIDDevice;
19120 /**
19121 * The origin that the device has been revoked from.
19122 */
19123 origin?: string;
19124 }
19125
19126 interface IgnoreMouseEventsOptions {
19127 /**
19128 * If true, forwards mouse move messages to Chromium, enabling mouse related events
19129 * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
19130 * forwarding is always disabled regardless of this value.
19131 *
19132 * @platform darwin,win32
19133 */
19134 forward?: boolean;
19135 }
19136
19137 interface ImportCertificateOptions {
19138 /**
19139 * Path for the pkcs12 file.
19140 */
19141 certificate: string;
19142 /**
19143 * Passphrase for the certificate.
19144 */
19145 password: string;
19146 }
19147
19148 interface Info {
19149 /**
19150 * Security origin for the isolated world.
19151 */
19152 securityOrigin?: string;
19153 /**
19154 * Content Security Policy for the isolated world.
19155 */
19156 csp?: string;
19157 /**
19158 * Name for isolated world. Useful in devtools.
19159 */
19160 name?: string;
19161 }
19162
19163 interface Input {
19164 /**
19165 * Either `keyUp` or `keyDown`.
19166 */
19167 type: string;
19168 /**
19169 * Equivalent to KeyboardEvent.key.
19170 */
19171 key: string;
19172 /**
19173 * Equivalent to KeyboardEvent.code.
19174 */
19175 code: string;
19176 /**
19177 * Equivalent to KeyboardEvent.repeat.
19178 */
19179 isAutoRepeat: boolean;
19180 /**
19181 * Equivalent to KeyboardEvent.isComposing.
19182 */
19183 isComposing: boolean;
19184 /**
19185 * Equivalent to KeyboardEvent.shiftKey.
19186 */
19187 shift: boolean;
19188 /**
19189 * Equivalent to KeyboardEvent.controlKey.
19190 */
19191 control: boolean;
19192 /**
19193 * Equivalent to KeyboardEvent.altKey.
19194 */
19195 alt: boolean;
19196 /**
19197 * Equivalent to KeyboardEvent.metaKey.
19198 */
19199 meta: boolean;
19200 /**
19201 * Equivalent to KeyboardEvent.location.
19202 */
19203 location: number;
19204 /**
19205 * See InputEvent.modifiers.
19206 */
19207 modifiers: string[];
19208 }
19209
19210 interface InsertCSSOptions {
19211 /**
19212 * Can be 'user' or 'author'. Sets the cascade origin of the inserted stylesheet.
19213 * Default is 'author'.
19214 */
19215 cssOrigin?: ('user' | 'author');
19216 }
19217
19218 interface IpcMessageEvent extends DOMEvent {
19219 /**
19220 * pair of `[processId, frameId]`.
19221 */
19222 frameId: [number, number];
19223 channel: string;
19224 args: any[];
19225 }
19226
19227 interface Item {
19228 /**
19229 * The path to the file being dragged.
19230 */
19231 file: string;
19232 /**
19233 * The paths to the files being dragged. (`files` will override `file` field)
19234 */
19235 files?: string[];
19236 /**
19237 * The image must be non-empty on macOS.
19238 */
19239 icon: (NativeImage) | (string);
19240 }
19241
19242 interface JumpListSettings {
19243 /**
19244 * The minimum number of items that will be shown in the Jump List (for a more
19245 * detailed description of this value see the MSDN docs).
19246 */
19247 minItems: number;
19248 /**
19249 * Array of `JumpListItem` objects that correspond to items that the user has
19250 * explicitly removed from custom categories in the Jump List. These items must not
19251 * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
19252 * Windows will not display any custom category that contains any of the removed
19253 * items.
19254 */
19255 removedItems: JumpListItem[];
19256 }
19257
19258 interface LoadCommitEvent extends DOMEvent {
19259 url: string;
19260 isMainFrame: boolean;
19261 }
19262
19263 interface LoadExtensionOptions {
19264 /**
19265 * Whether to allow the extension to read local files over `file://` protocol and
19266 * inject content scripts into `file://` pages. This is required e.g. for loading
19267 * devtools extensions on `file://` URLs. Defaults to false.
19268 */
19269 allowFileAccess: boolean;
19270 }
19271
19272 interface LoadFileOptions {
19273 /**
19274 * Passed to `url.format()`.
19275 */
19276 query?: Record<string, string>;
19277 /**
19278 * Passed to `url.format()`.
19279 */
19280 search?: string;
19281 /**
19282 * Passed to `url.format()`.
19283 */
19284 hash?: string;
19285 }
19286
19287 interface LoadURLOptions {
19288 /**
19289 * An HTTP Referrer url.
19290 */
19291 httpReferrer?: (string) | (Referrer);
19292 /**
19293 * A user agent originating the request.
19294 */
19295 userAgent?: string;
19296 /**
19297 * Extra headers separated by "\n"
19298 */
19299 extraHeaders?: string;
19300 postData?: Array<(UploadRawData) | (UploadFile)>;
19301 /**
19302 * Base url (with trailing path separator) for files to be loaded by the data url.
19303 * This is needed only if the specified `url` is a data url and needs to load other
19304 * files.
19305 */
19306 baseURLForDataURL?: string;
19307 }
19308
19309 interface LoginItemSettings {
19310 /**
19311 * `true` if the app is set to open at login.
19312 */
19313 openAtLogin: boolean;
19314 /**
19315 * `true` if the app is set to open as hidden at login. This does not work on macOS
19316 * 13 and up.
19317 *
19318 * @deprecated
19319 * @platform darwin
19320 */
19321 openAsHidden: boolean;
19322 /**
19323 * `true` if the app was opened at login automatically. This setting is not
19324 * available on MAS builds or on macOS 13 and up.
19325 *
19326 * @deprecated
19327 * @platform darwin
19328 */
19329 wasOpenedAtLogin: boolean;
19330 /**
19331 * `true` if the app was opened as a hidden login item. This indicates that the app
19332 * should not open any windows at startup. This setting is not available on MAS
19333 * builds or on macOS 13 and up.
19334 *
19335 * @deprecated
19336 * @platform darwin
19337 */
19338 wasOpenedAsHidden: boolean;
19339 /**
19340 * `true` if the app was opened as a login item that should restore the state from
19341 * the previous session. This indicates that the app should restore the windows
19342 * that were open the last time the app was closed. This setting is not available
19343 * on MAS builds or on macOS 13 and up.
19344 *
19345 * @deprecated
19346 * @platform darwin
19347 */
19348 restoreState: boolean;
19349 /**
19350 * can be one of `not-registered`, `enabled`, `requires-approval`, or `not-found`.
19351 *
19352 * @platform darwin
19353 */
19354 status: string;
19355 /**
19356 * `true` if app is set to open at login and its run key is not deactivated. This
19357 * differs from `openAtLogin` as it ignores the `args` option, this property will
19358 * be true if the given executable would be launched at login with **any**
19359 * arguments.
19360 *
19361 * @platform win32
19362 */
19363 executableWillLaunchAtLogin: boolean;
19364 launchItems: LaunchItems[];
19365 }
19366
19367 interface LoginItemSettingsOptions {
19368 /**
19369 * Can be one of `mainAppService`, `agentService`, `daemonService`, or
19370 * `loginItemService`. Defaults to `mainAppService`. Only available on macOS 13 and
19371 * up. See app.setLoginItemSettings for more information about each type.
19372 *
19373 * @platform darwin
19374 */
19375 type?: string;
19376 /**
19377 * The name of the service. Required if `type` is non-default. Only available on
19378 * macOS 13 and up.
19379 *
19380 * @platform darwin
19381 */
19382 serviceName?: string;
19383 /**
19384 * The executable path to compare against. Defaults to `process.execPath`.
19385 *
19386 * @platform win32
19387 */
19388 path?: string;
19389 /**
19390 * The command-line arguments to compare against. Defaults to an empty array.
19391 *
19392 * @platform win32
19393 */
19394 args?: string[];
19395 }
19396
19397 interface MenuItemConstructorOptions {
19398 /**
19399 * Will be called with `click(menuItem, browserWindow, event)` when the menu item
19400 * is clicked.
19401 */
19402 click?: (menuItem: MenuItem, browserWindow: (BrowserWindow) | (undefined), event: KeyboardEvent) => void;
19403 /**
19404 * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
19405 * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
19406 * `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`,
19407 * `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`,
19408 * `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`,
19409 * `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`,
19410 * `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`,
19411 * `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `showAllTabs`,
19412 * `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
19413 * - Define the action of the menu item, when specified the `click` property will
19414 * be ignored. See roles.
19415 */
19416 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');
19417 /**
19418 * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
19419 */
19420 type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
19421 label?: string;
19422 sublabel?: string;
19423 /**
19424 * Hover text for this menu item.
19425 *
19426 * @platform darwin
19427 */
19428 toolTip?: string;
19429 accelerator?: Accelerator;
19430 icon?: (NativeImage) | (string);
19431 /**
19432 * If false, the menu item will be greyed out and unclickable.
19433 */
19434 enabled?: boolean;
19435 /**
19436 * default is `true`, and when `false` will prevent the accelerator from triggering
19437 * the item if the item is not visible.
19438 *
19439 * @platform darwin
19440 */
19441 acceleratorWorksWhenHidden?: boolean;
19442 /**
19443 * If false, the menu item will be entirely hidden.
19444 */
19445 visible?: boolean;
19446 /**
19447 * Should only be specified for `checkbox` or `radio` type menu items.
19448 */
19449 checked?: boolean;
19450 /**
19451 * If false, the accelerator won't be registered with the system, but it will still
19452 * be displayed. Defaults to true.
19453 *
19454 * @platform linux,win32
19455 */
19456 registerAccelerator?: boolean;
19457 /**
19458 * The item to share when the `role` is `shareMenu`.
19459 *
19460 * @platform darwin
19461 */
19462 sharingItem?: SharingItem;
19463 /**
19464 * Should be specified for `submenu` type menu items. If `submenu` is specified,
19465 * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
19466 * be automatically converted to one using `Menu.buildFromTemplate`.
19467 */
19468 submenu?: (MenuItemConstructorOptions[]) | (Menu);
19469 /**
19470 * Unique within a single menu. If defined then it can be used as a reference to
19471 * this item by the position attribute.
19472 */
19473 id?: string;
19474 /**
19475 * Inserts this item before the item with the specified id. If the referenced item
19476 * doesn't exist the item will be inserted at the end of the menu. Also implies
19477 * that the menu item in question should be placed in the same “group” as the item.
19478 */
19479 before?: string[];
19480 /**
19481 * Inserts this item after the item with the specified id. If the referenced item
19482 * doesn't exist the item will be inserted at the end of the menu.
19483 */
19484 after?: string[];
19485 /**
19486 * Provides a means for a single context menu to declare the placement of their
19487 * containing group before the containing group of the item with the specified id.
19488 */
19489 beforeGroupContaining?: string[];
19490 /**
19491 * Provides a means for a single context menu to declare the placement of their
19492 * containing group after the containing group of the item with the specified id.
19493 */
19494 afterGroupContaining?: string[];
19495 }
19496
19497 interface MessageBoxOptions {
19498 /**
19499 * Content of the message box.
19500 */
19501 message: string;
19502 /**
19503 * Can be `none`, `info`, `error`, `question` or `warning`. On Windows, `question`
19504 * displays the same icon as `info`, unless you set an icon using the `icon`
19505 * option. On macOS, both `warning` and `error` display the same warning icon.
19506 */
19507 type?: ('none' | 'info' | 'error' | 'question' | 'warning');
19508 /**
19509 * Array of texts for buttons. On Windows, an empty array will result in one button
19510 * labeled "OK".
19511 */
19512 buttons?: string[];
19513 /**
19514 * Index of the button in the buttons array which will be selected by default when
19515 * the message box opens.
19516 */
19517 defaultId?: number;
19518 /**
19519 * Pass an instance of AbortSignal to optionally close the message box, the message
19520 * box will behave as if it was cancelled by the user. On macOS, `signal` does not
19521 * work with message boxes that do not have a parent window, since those message
19522 * boxes run synchronously due to platform limitations.
19523 */
19524 signal?: AbortSignal;
19525 /**
19526 * Title of the message box, some platforms will not show it.
19527 */
19528 title?: string;
19529 /**
19530 * Extra information of the message.
19531 */
19532 detail?: string;
19533 /**
19534 * If provided, the message box will include a checkbox with the given label.
19535 */
19536 checkboxLabel?: string;
19537 /**
19538 * Initial checked state of the checkbox. `false` by default.
19539 */
19540 checkboxChecked?: boolean;
19541 icon?: (NativeImage) | (string);
19542 /**
19543 * Custom width of the text in the message box.
19544 *
19545 * @platform darwin
19546 */
19547 textWidth?: number;
19548 /**
19549 * The index of the button to be used to cancel the dialog, via the `Esc` key. By
19550 * default this is assigned to the first button with "cancel" or "no" as the label.
19551 * If no such labeled buttons exist and this option is not set, `0` will be used as
19552 * the return value.
19553 */
19554 cancelId?: number;
19555 /**
19556 * On Windows Electron will try to figure out which one of the `buttons` are common
19557 * buttons (like "Cancel" or "Yes"), and show the others as command links in the
19558 * dialog. This can make the dialog appear in the style of modern Windows apps. If
19559 * you don't like this behavior, you can set `noLink` to `true`.
19560 */
19561 noLink?: boolean;
19562 /**
19563 * Normalize the keyboard access keys across platforms. Default is `false`.
19564 * Enabling this assumes `&` is used in the button labels for the placement of the
19565 * keyboard shortcut access key and labels will be converted so they work correctly
19566 * on each platform, `&` characters are removed on macOS, converted to `_` on
19567 * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
19568 * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
19569 * via `Alt-W` on Windows and Linux.
19570 */
19571 normalizeAccessKeys?: boolean;
19572 }
19573
19574 interface MessageBoxReturnValue {
19575 /**
19576 * The index of the clicked button.
19577 */
19578 response: number;
19579 /**
19580 * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
19581 */
19582 checkboxChecked: boolean;
19583 }
19584
19585 interface MessageBoxSyncOptions {
19586 /**
19587 * Content of the message box.
19588 */
19589 message: string;
19590 /**
19591 * Can be `none`, `info`, `error`, `question` or `warning`. On Windows, `question`
19592 * displays the same icon as `info`, unless you set an icon using the `icon`
19593 * option. On macOS, both `warning` and `error` display the same warning icon.
19594 */
19595 type?: ('none' | 'info' | 'error' | 'question' | 'warning');
19596 /**
19597 * Array of texts for buttons. On Windows, an empty array will result in one button
19598 * labeled "OK".
19599 */
19600 buttons?: string[];
19601 /**
19602 * Index of the button in the buttons array which will be selected by default when
19603 * the message box opens.
19604 */
19605 defaultId?: number;
19606 /**
19607 * Title of the message box, some platforms will not show it.
19608 */
19609 title?: string;
19610 /**
19611 * Extra information of the message.
19612 */
19613 detail?: string;
19614 icon?: (NativeImage) | (string);
19615 /**
19616 * Custom width of the text in the message box.
19617 *
19618 * @platform darwin
19619 */
19620 textWidth?: number;
19621 /**
19622 * The index of the button to be used to cancel the dialog, via the `Esc` key. By
19623 * default this is assigned to the first button with "cancel" or "no" as the label.
19624 * If no such labeled buttons exist and this option is not set, `0` will be used as
19625 * the return value.
19626 */
19627 cancelId?: number;
19628 /**
19629 * On Windows Electron will try to figure out which one of the `buttons` are common
19630 * buttons (like "Cancel" or "Yes"), and show the others as command links in the
19631 * dialog. This can make the dialog appear in the style of modern Windows apps. If
19632 * you don't like this behavior, you can set `noLink` to `true`.
19633 */
19634 noLink?: boolean;
19635 /**
19636 * Normalize the keyboard access keys across platforms. Default is `false`.
19637 * Enabling this assumes `&` is used in the button labels for the placement of the
19638 * keyboard shortcut access key and labels will be converted so they work correctly
19639 * on each platform, `&` characters are removed on macOS, converted to `_` on
19640 * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
19641 * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
19642 * via `Alt-W` on Windows and Linux.
19643 */
19644 normalizeAccessKeys?: boolean;
19645 }
19646
19647 interface MessageDetails {
19648 /**
19649 * The actual console message
19650 */
19651 message: string;
19652 /**
19653 * The version ID of the service worker that sent the log message
19654 */
19655 versionId: number;
19656 /**
19657 * The type of source for this message. Can be `javascript`, `xml`, `network`,
19658 * `console-api`, `storage`, `rendering`, `security`, `deprecation`, `worker`,
19659 * `violation`, `intervention`, `recommendation` or `other`.
19660 */
19661 source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
19662 /**
19663 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
19664 * `error`.
19665 */
19666 level: number;
19667 /**
19668 * The URL the message came from
19669 */
19670 sourceUrl: string;
19671 /**
19672 * The line number of the source that triggered this console message
19673 */
19674 lineNumber: number;
19675 }
19676
19677 interface MessageEvent {
19678 data: any;
19679 ports: MessagePortMain[];
19680 }
19681
19682 interface MoveToApplicationsFolderOptions {
19683 /**
19684 * A handler for potential conflict in move failure.
19685 */
19686 conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
19687 }
19688
19689 interface NotificationConstructorOptions {
19690 /**
19691 * A title for the notification, which will be displayed at the top of the
19692 * notification window when it is shown.
19693 */
19694 title?: string;
19695 /**
19696 * A subtitle for the notification, which will be displayed below the title.
19697 *
19698 * @platform darwin
19699 */
19700 subtitle?: string;
19701 /**
19702 * The body text of the notification, which will be displayed below the title or
19703 * subtitle.
19704 */
19705 body?: string;
19706 /**
19707 * Whether or not to suppress the OS notification noise when showing the
19708 * notification.
19709 */
19710 silent?: boolean;
19711 /**
19712 * An icon to use in the notification.
19713 */
19714 icon?: (string) | (NativeImage);
19715 /**
19716 * Whether or not to add an inline reply option to the notification.
19717 *
19718 * @platform darwin
19719 */
19720 hasReply?: boolean;
19721 /**
19722 * The timeout duration of the notification. Can be 'default' or 'never'.
19723 *
19724 * @platform linux,win32
19725 */
19726 timeoutType?: ('default' | 'never');
19727 /**
19728 * The placeholder to write in the inline reply input field.
19729 *
19730 * @platform darwin
19731 */
19732 replyPlaceholder?: string;
19733 /**
19734 * The name of the sound file to play when the notification is shown.
19735 *
19736 * @platform darwin
19737 */
19738 sound?: string;
19739 /**
19740 * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
19741 *
19742 * @platform linux
19743 */
19744 urgency?: ('normal' | 'critical' | 'low');
19745 /**
19746 * Actions to add to the notification. Please read the available actions and
19747 * limitations in the `NotificationAction` documentation.
19748 *
19749 * @platform darwin
19750 */
19751 actions?: NotificationAction[];
19752 /**
19753 * A custom title for the close button of an alert. An empty string will cause the
19754 * default localized text to be used.
19755 *
19756 * @platform darwin
19757 */
19758 closeButtonText?: string;
19759 /**
19760 * A custom description of the Notification on Windows superseding all properties
19761 * above. Provides full customization of design and behavior of the notification.
19762 *
19763 * @platform win32
19764 */
19765 toastXml?: string;
19766 }
19767
19768 interface OnBeforeRedirectListenerDetails {
19769 id: number;
19770 url: string;
19771 method: string;
19772 webContentsId?: number;
19773 webContents?: WebContents;
19774 frame?: WebFrameMain;
19775 /**
19776 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
19777 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
19778 */
19779 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
19780 referrer: string;
19781 timestamp: number;
19782 redirectURL: string;
19783 statusCode: number;
19784 statusLine: string;
19785 /**
19786 * The server IP address that the request was actually sent to.
19787 */
19788 ip?: string;
19789 fromCache: boolean;
19790 responseHeaders?: Record<string, string[]>;
19791 }
19792
19793 interface OnBeforeRequestListenerDetails {
19794 id: number;
19795 url: string;
19796 method: string;
19797 webContentsId?: number;
19798 webContents?: WebContents;
19799 frame?: WebFrameMain;
19800 /**
19801 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
19802 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
19803 */
19804 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
19805 referrer: string;
19806 timestamp: number;
19807 uploadData: UploadData[];
19808 }
19809
19810 interface OnBeforeSendHeadersListenerDetails {
19811 id: number;
19812 url: string;
19813 method: string;
19814 webContentsId?: number;
19815 webContents?: WebContents;
19816 frame?: WebFrameMain;
19817 /**
19818 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
19819 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
19820 */
19821 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
19822 referrer: string;
19823 timestamp: number;
19824 uploadData?: UploadData[];
19825 requestHeaders: Record<string, string>;
19826 }
19827
19828 interface OnCompletedListenerDetails {
19829 id: number;
19830 url: string;
19831 method: string;
19832 webContentsId?: number;
19833 webContents?: WebContents;
19834 frame?: WebFrameMain;
19835 /**
19836 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
19837 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
19838 */
19839 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
19840 referrer: string;
19841 timestamp: number;
19842 responseHeaders?: Record<string, string[]>;
19843 fromCache: boolean;
19844 statusCode: number;
19845 statusLine: string;
19846 error: string;
19847 }
19848
19849 interface OnErrorOccurredListenerDetails {
19850 id: number;
19851 url: string;
19852 method: string;
19853 webContentsId?: number;
19854 webContents?: WebContents;
19855 frame?: WebFrameMain;
19856 /**
19857 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
19858 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
19859 */
19860 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
19861 referrer: string;
19862 timestamp: number;
19863 fromCache: boolean;
19864 /**
19865 * The error description.
19866 */
19867 error: string;
19868 }
19869
19870 interface OnHeadersReceivedListenerDetails {
19871 id: number;
19872 url: string;
19873 method: string;
19874 webContentsId?: number;
19875 webContents?: WebContents;
19876 frame?: WebFrameMain;
19877 /**
19878 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
19879 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
19880 */
19881 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
19882 referrer: string;
19883 timestamp: number;
19884 statusLine: string;
19885 statusCode: number;
19886 responseHeaders?: Record<string, string[]>;
19887 }
19888
19889 interface OnResponseStartedListenerDetails {
19890 id: number;
19891 url: string;
19892 method: string;
19893 webContentsId?: number;
19894 webContents?: WebContents;
19895 frame?: WebFrameMain;
19896 /**
19897 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
19898 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
19899 */
19900 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
19901 referrer: string;
19902 timestamp: number;
19903 responseHeaders?: Record<string, string[]>;
19904 /**
19905 * Indicates whether the response was fetched from disk cache.
19906 */
19907 fromCache: boolean;
19908 statusCode: number;
19909 statusLine: string;
19910 }
19911
19912 interface OnSendHeadersListenerDetails {
19913 id: number;
19914 url: string;
19915 method: string;
19916 webContentsId?: number;
19917 webContents?: WebContents;
19918 frame?: WebFrameMain;
19919 /**
19920 * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
19921 * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
19922 */
19923 resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
19924 referrer: string;
19925 timestamp: number;
19926 requestHeaders: Record<string, string>;
19927 }
19928
19929 interface OpenDevToolsOptions {
19930 /**
19931 * Opens the devtools with specified dock state, can be `left`, `right`, `bottom`,
19932 * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
19933 * possible to dock back. In `detach` mode it's not.
19934 */
19935 mode: ('left' | 'right' | 'bottom' | 'undocked' | 'detach');
19936 /**
19937 * Whether to bring the opened devtools window to the foreground. The default is
19938 * `true`.
19939 */
19940 activate?: boolean;
19941 /**
19942 * A title for the DevTools window (only in `undocked` or `detach` mode).
19943 */
19944 title?: string;
19945 }
19946
19947 interface OpenDialogOptions {
19948 title?: string;
19949 defaultPath?: string;
19950 /**
19951 * Custom label for the confirmation button, when left empty the default label will
19952 * be used.
19953 */
19954 buttonLabel?: string;
19955 filters?: FileFilter[];
19956 /**
19957 * Contains which features the dialog should use. The following values are
19958 * supported:
19959 */
19960 properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
19961 /**
19962 * Message to display above input boxes.
19963 *
19964 * @platform darwin
19965 */
19966 message?: string;
19967 /**
19968 * Create security scoped bookmarks when packaged for the Mac App Store.
19969 *
19970 * @platform darwin,mas
19971 */
19972 securityScopedBookmarks?: boolean;
19973 }
19974
19975 interface OpenDialogReturnValue {
19976 /**
19977 * whether or not the dialog was canceled.
19978 */
19979 canceled: boolean;
19980 /**
19981 * An array of file paths chosen by the user. If the dialog is cancelled this will
19982 * be an empty array.
19983 */
19984 filePaths: string[];
19985 /**
19986 * An array matching the `filePaths` array of base64 encoded strings which contains
19987 * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
19988 * this to be populated. (For return values, see table here.)
19989 *
19990 * @platform darwin,mas
19991 */
19992 bookmarks?: string[];
19993 }
19994
19995 interface OpenDialogSyncOptions {
19996 title?: string;
19997 defaultPath?: string;
19998 /**
19999 * Custom label for the confirmation button, when left empty the default label will
20000 * be used.
20001 */
20002 buttonLabel?: string;
20003 filters?: FileFilter[];
20004 /**
20005 * Contains which features the dialog should use. The following values are
20006 * supported:
20007 */
20008 properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
20009 /**
20010 * Message to display above input boxes.
20011 *
20012 * @platform darwin
20013 */
20014 message?: string;
20015 /**
20016 * Create security scoped bookmarks when packaged for the Mac App Store.
20017 *
20018 * @platform darwin,mas
20019 */
20020 securityScopedBookmarks?: boolean;
20021 }
20022
20023 interface OpenExternalOptions {
20024 /**
20025 * `true` to bring the opened application to the foreground. The default is `true`.
20026 *
20027 * @platform darwin
20028 */
20029 activate?: boolean;
20030 /**
20031 * The working directory.
20032 *
20033 * @platform win32
20034 */
20035 workingDirectory?: string;
20036 /**
20037 * Indicates a user initiated launch that enables tracking of frequently used
20038 * programs and other behaviors. The default is `false`.
20039 *
20040 * @platform win32
20041 */
20042 logUsage?: boolean;
20043 }
20044
20045 interface Options {
20046 }
20047
20048 interface Opts {
20049 /**
20050 * Keep the page hidden instead of visible. Default is `false`.
20051 */
20052 stayHidden?: boolean;
20053 /**
20054 * Keep the system awake instead of allowing it to sleep. Default is `false`.
20055 */
20056 stayAwake?: boolean;
20057 }
20058
20059 interface PageFaviconUpdatedEvent extends DOMEvent {
20060 /**
20061 * Array of URLs.
20062 */
20063 favicons: string[];
20064 }
20065
20066 interface PageTitleUpdatedEvent extends DOMEvent {
20067 title: string;
20068 explicitSet: boolean;
20069 }
20070
20071 interface Parameters {
20072 /**
20073 * Specify the screen type to emulate (default: `desktop`):
20074 */
20075 screenPosition: ('desktop' | 'mobile');
20076 /**
20077 * Set the emulated screen size (screenPosition == mobile).
20078 */
20079 screenSize: Size;
20080 /**
20081 * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
20082 * 0 }`).
20083 */
20084 viewPosition: Point;
20085 /**
20086 * Set the device scale factor (if zero defaults to original device scale factor)
20087 * (default: `0`).
20088 */
20089 deviceScaleFactor: number;
20090 /**
20091 * Set the emulated view size (empty means no override)
20092 */
20093 viewSize: Size;
20094 /**
20095 * Scale of emulated view inside available space (not in fit to view mode)
20096 * (default: `1`).
20097 */
20098 scale: number;
20099 }
20100
20101 interface Payment {
20102 /**
20103 * The identifier of the purchased product.
20104 */
20105 productIdentifier: string;
20106 /**
20107 * The quantity purchased.
20108 */
20109 quantity: number;
20110 /**
20111 * An opaque identifier for the user’s account on your system.
20112 */
20113 applicationUsername: string;
20114 /**
20115 * The details of the discount offer to apply to the payment.
20116 */
20117 paymentDiscount?: PaymentDiscount;
20118 }
20119
20120 interface PermissionCheckHandlerHandlerDetails {
20121 /**
20122 * The origin of the frame embedding the frame that made the permission check.
20123 * Only set for cross-origin sub frames making permission checks.
20124 */
20125 embeddingOrigin?: string;
20126 /**
20127 * The security origin of the `media` check.
20128 */
20129 securityOrigin?: string;
20130 /**
20131 * The type of media access being requested, can be `video`, `audio` or `unknown`
20132 */
20133 mediaType?: ('video' | 'audio' | 'unknown');
20134 /**
20135 * The last URL the requesting frame loaded. This is not provided for cross-origin
20136 * sub frames making permission checks.
20137 */
20138 requestingUrl?: string;
20139 /**
20140 * Whether the frame making the request is the main frame
20141 */
20142 isMainFrame: boolean;
20143 }
20144
20145 interface PluginCrashedEvent extends DOMEvent {
20146 name: string;
20147 version: string;
20148 }
20149
20150 interface PopupOptions {
20151 /**
20152 * Default is the focused window.
20153 */
20154 window?: BrowserWindow;
20155 /**
20156 * Default is the current mouse cursor position. Must be declared if `y` is
20157 * declared.
20158 */
20159 x?: number;
20160 /**
20161 * Default is the current mouse cursor position. Must be declared if `x` is
20162 * declared.
20163 */
20164 y?: number;
20165 /**
20166 * The index of the menu item to be positioned under the mouse cursor at the
20167 * specified coordinates. Default is -1.
20168 *
20169 * @platform darwin
20170 */
20171 positioningItem?: number;
20172 /**
20173 * This should map to the `menuSourceType` provided by the `context-menu` event. It
20174 * is not recommended to set this value manually, only provide values you receive
20175 * from other APIs or leave it `undefined`. Can be `none`, `mouse`, `keyboard`,
20176 * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
20177 * `adjustSelection`, or `adjustSelectionReset`.
20178 *
20179 * @platform win32,linux
20180 */
20181 sourceType?: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
20182 /**
20183 * Called when menu is closed.
20184 */
20185 callback?: () => void;
20186 }
20187
20188 interface PreconnectOptions {
20189 /**
20190 * URL for preconnect. Only the origin is relevant for opening the socket.
20191 */
20192 url: string;
20193 /**
20194 * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
20195 */
20196 numSockets?: number;
20197 }
20198
20199 interface PrintToPDFOptions {
20200 /**
20201 * Paper orientation.`true` for landscape, `false` for portrait. Defaults to false.
20202 */
20203 landscape?: boolean;
20204 /**
20205 * Whether to display header and footer. Defaults to false.
20206 */
20207 displayHeaderFooter?: boolean;
20208 /**
20209 * Whether to print background graphics. Defaults to false.
20210 */
20211 printBackground?: boolean;
20212 /**
20213 * Scale of the webpage rendering. Defaults to 1.
20214 */
20215 scale?: number;
20216 /**
20217 * Specify page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, `A4`,
20218 * `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing
20219 * `height` and `width` in inches. Defaults to `Letter`.
20220 */
20221 pageSize?: (('A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'Legal' | 'Letter' | 'Tabloid' | 'Ledger')) | (Size);
20222 margins?: Margins;
20223 /**
20224 * Page ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which
20225 * means print all pages.
20226 */
20227 pageRanges?: string;
20228 /**
20229 * HTML template for the print header. Should be valid HTML markup with following
20230 * classes used to inject printing values into them: `date` (formatted print date),
20231 * `title` (document title), `url` (document location), `pageNumber` (current page
20232 * number) and `totalPages` (total pages in the document). For example, `<span
20233 * class=title></span>` would generate span containing the title.
20234 */
20235 headerTemplate?: string;
20236 /**
20237 * HTML template for the print footer. Should use the same format as the
20238 * `headerTemplate`.
20239 */
20240 footerTemplate?: string;
20241 /**
20242 * Whether or not to prefer page size as defined by css. Defaults to false, in
20243 * which case the content will be scaled to fit the paper size.
20244 */
20245 preferCSSPageSize?: boolean;
20246 /**
20247 * Whether or not to generate a tagged (accessible) PDF. Defaults to false. As this
20248 * property is experimental, the generated PDF may not adhere fully to PDF/UA and
20249 * WCAG standards.
20250 *
20251 * @experimental
20252 */
20253 generateTaggedPDF?: boolean;
20254 /**
20255 * Whether or not to generate a PDF document outline from content headers. Defaults
20256 * to false.
20257 *
20258 * @experimental
20259 */
20260 generateDocumentOutline?: boolean;
20261 }
20262
20263 interface Privileges {
20264 /**
20265 * Default false.
20266 */
20267 standard?: boolean;
20268 /**
20269 * Default false.
20270 */
20271 secure?: boolean;
20272 /**
20273 * Default false.
20274 */
20275 bypassCSP?: boolean;
20276 /**
20277 * Default false.
20278 */
20279 allowServiceWorkers?: boolean;
20280 /**
20281 * Default false.
20282 */
20283 supportFetchAPI?: boolean;
20284 /**
20285 * Default false.
20286 */
20287 corsEnabled?: boolean;
20288 /**
20289 * Default false.
20290 */
20291 stream?: boolean;
20292 /**
20293 * Enable V8 code cache for the scheme, only works when `standard` is also set to
20294 * true. Default false.
20295 */
20296 codeCache?: boolean;
20297 }
20298
20299 interface ProgressBarOptions {
20300 /**
20301 * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
20302 * `paused`.
20303 *
20304 * @platform win32
20305 */
20306 mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
20307 }
20308
20309 interface Provider {
20310 spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
20311 }
20312
20313 interface PurchaseProductOpts {
20314 /**
20315 * The number of items the user wants to purchase.
20316 */
20317 quantity?: number;
20318 /**
20319 * The string that associates the transaction with a user account on your service
20320 * (applicationUsername).
20321 */
20322 username?: string;
20323 }
20324
20325 interface ReadBookmark {
20326 title: string;
20327 url: string;
20328 }
20329
20330 interface RegistrationCompletedDetails {
20331 /**
20332 * The base URL that a service worker is registered for
20333 */
20334 scope: string;
20335 }
20336
20337 interface RelaunchOptions {
20338 args?: string[];
20339 execPath?: string;
20340 }
20341
20342 interface RenderProcessGoneEvent extends DOMEvent {
20343 details: RenderProcessGoneDetails;
20344 }
20345
20346 interface Request {
20347 hostname: string;
20348 certificate: Certificate;
20349 validatedCertificate: Certificate;
20350 /**
20351 * `true` if Chromium recognises the root CA as a standard root. If it isn't then
20352 * it's probably the case that this certificate was generated by a MITM proxy whose
20353 * root has been installed locally (for example, by a corporate proxy). This should
20354 * not be trusted if the `verificationResult` is not `OK`.
20355 */
20356 isIssuedByKnownRoot: boolean;
20357 /**
20358 * `OK` if the certificate is trusted, otherwise an error like `CERT_REVOKED`.
20359 */
20360 verificationResult: string;
20361 /**
20362 * Error code.
20363 */
20364 errorCode: number;
20365 }
20366
20367 interface ResizeOptions {
20368 /**
20369 * Defaults to the image's width.
20370 */
20371 width?: number;
20372 /**
20373 * Defaults to the image's height.
20374 */
20375 height?: number;
20376 /**
20377 * The desired quality of the resize image. Possible values include `good`,
20378 * `better`, or `best`. The default is `best`. These values express a desired
20379 * quality/speed tradeoff. They are translated into an algorithm-specific method
20380 * that depends on the capabilities (CPU, GPU) of the underlying platform. It is
20381 * possible for all three methods to be mapped to the same algorithm on a given
20382 * platform.
20383 */
20384 quality?: ('good' | 'better' | 'best');
20385 }
20386
20387 interface ResolveHostOptions {
20388 /**
20389 * Requested DNS query type. If unspecified, resolver will pick A or AAAA (or both)
20390 * based on IPv4/IPv6 settings:
20391 */
20392 queryType?: ('A' | 'AAAA');
20393 /**
20394 * The source to use for resolved addresses. Default allows the resolver to pick an
20395 * appropriate source. Only affects use of big external sources (e.g. calling the
20396 * system for resolution or using DNS). Even if a source is specified, results can
20397 * still come from cache, resolving "localhost" or IP literals, etc. One of the
20398 * following values:
20399 */
20400 source?: ('any' | 'system' | 'dns' | 'mdns' | 'localOnly');
20401 /**
20402 * Indicates what DNS cache entries, if any, can be used to provide a response. One
20403 * of the following values:
20404 */
20405 cacheUsage?: ('allowed' | 'staleAllowed' | 'disallowed');
20406 /**
20407 * Controls the resolver's Secure DNS behavior for this request. One of the
20408 * following values:
20409 */
20410 secureDnsPolicy?: ('allow' | 'disable');
20411 }
20412
20413 interface ResourceUsage {
20414 images: MemoryUsageDetails;
20415 scripts: MemoryUsageDetails;
20416 cssStyleSheets: MemoryUsageDetails;
20417 xslStyleSheets: MemoryUsageDetails;
20418 fonts: MemoryUsageDetails;
20419 other: MemoryUsageDetails;
20420 }
20421
20422 interface Response {
20423 /**
20424 * `false` should be passed in if the dialog is canceled. If the `pairingKind` is
20425 * `confirm` or `confirmPin`, this value should indicate if the pairing is
20426 * confirmed. If the `pairingKind` is `providePin` the value should be `true` when
20427 * a value is provided.
20428 */
20429 confirmed: boolean;
20430 /**
20431 * When the `pairingKind` is `providePin` this value should be the required pin for
20432 * the Bluetooth device.
20433 */
20434 pin?: (string) | (null);
20435 }
20436
20437 interface Result {
20438 requestId: number;
20439 /**
20440 * Position of the active match.
20441 */
20442 activeMatchOrdinal: number;
20443 /**
20444 * Number of Matches.
20445 */
20446 matches: number;
20447 /**
20448 * Coordinates of first match region.
20449 */
20450 selectionArea: Rectangle;
20451 finalUpdate: boolean;
20452 }
20453
20454 interface SaveDialogOptions {
20455 /**
20456 * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
20457 */
20458 title?: string;
20459 /**
20460 * Absolute directory path, absolute file path, or file name to use by default.
20461 */
20462 defaultPath?: string;
20463 /**
20464 * Custom label for the confirmation button, when left empty the default label will
20465 * be used.
20466 */
20467 buttonLabel?: string;
20468 filters?: FileFilter[];
20469 /**
20470 * Message to display above text fields.
20471 *
20472 * @platform darwin
20473 */
20474 message?: string;
20475 /**
20476 * Custom label for the text displayed in front of the filename text field.
20477 *
20478 * @platform darwin
20479 */
20480 nameFieldLabel?: string;
20481 /**
20482 * Show the tags input box, defaults to `true`.
20483 *
20484 * @platform darwin
20485 */
20486 showsTagField?: boolean;
20487 properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
20488 /**
20489 * Create a security scoped bookmark when packaged for the Mac App Store. If this
20490 * option is enabled and the file doesn't already exist a blank file will be
20491 * created at the chosen path.
20492 *
20493 * @platform darwin,mas
20494 */
20495 securityScopedBookmarks?: boolean;
20496 }
20497
20498 interface SaveDialogReturnValue {
20499 /**
20500 * whether or not the dialog was canceled.
20501 */
20502 canceled: boolean;
20503 /**
20504 * If the dialog is canceled, this will be an empty string.
20505 */
20506 filePath: string;
20507 /**
20508 * Base64 encoded string which contains the security scoped bookmark data for the
20509 * saved file. `securityScopedBookmarks` must be enabled for this to be present.
20510 * (For return values, see table here.)
20511 *
20512 * @platform darwin,mas
20513 */
20514 bookmark?: string;
20515 }
20516
20517 interface SaveDialogSyncOptions {
20518 /**
20519 * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
20520 */
20521 title?: string;
20522 /**
20523 * Absolute directory path, absolute file path, or file name to use by default.
20524 */
20525 defaultPath?: string;
20526 /**
20527 * Custom label for the confirmation button, when left empty the default label will
20528 * be used.
20529 */
20530 buttonLabel?: string;
20531 filters?: FileFilter[];
20532 /**
20533 * Message to display above text fields.
20534 *
20535 * @platform darwin
20536 */
20537 message?: string;
20538 /**
20539 * Custom label for the text displayed in front of the filename text field.
20540 *
20541 * @platform darwin
20542 */
20543 nameFieldLabel?: string;
20544 /**
20545 * Show the tags input box, defaults to `true`.
20546 *
20547 * @platform darwin
20548 */
20549 showsTagField?: boolean;
20550 properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
20551 /**
20552 * Create a security scoped bookmark when packaged for the Mac App Store. If this
20553 * option is enabled and the file doesn't already exist a blank file will be
20554 * created at the chosen path.
20555 *
20556 * @platform darwin,mas
20557 */
20558 securityScopedBookmarks?: boolean;
20559 }
20560
20561 interface SelectHidDeviceDetails {
20562 deviceList: HIDDevice[];
20563 frame: WebFrameMain;
20564 }
20565
20566 interface SelectUsbDeviceDetails {
20567 deviceList: USBDevice[];
20568 frame: WebFrameMain;
20569 }
20570
20571 interface SerialPortRevokedDetails {
20572 port: SerialPort;
20573 frame: WebFrameMain;
20574 /**
20575 * The origin that the device has been revoked from.
20576 */
20577 origin: string;
20578 }
20579
20580 interface Settings {
20581 /**
20582 * `true` to open the app at login, `false` to remove the app as a login item.
20583 * Defaults to `false`.
20584 */
20585 openAtLogin?: boolean;
20586 /**
20587 * `true` to open the app as hidden. Defaults to `false`. The user can edit this
20588 * setting from the System Preferences so
20589 * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
20590 * opened to know the current value. This setting is not available on MAS build s
20591 * or on macOS 13 and up.
20592 *
20593 * @deprecated
20594 * @platform darwin
20595 */
20596 openAsHidden?: boolean;
20597 /**
20598 * The type of service to add as a login item. Defaults to `mainAppService`. Only
20599 * available on macOS 13 and up.
20600 *
20601 * @platform darwin
20602 */
20603 type?: ('mainAppService' | 'agentService' | 'daemonService' | 'loginItemService');
20604 /**
20605 * The name of the service. Required if `type` is non-default. Only available on
20606 * macOS 13 and up.
20607 *
20608 * @platform darwin
20609 */
20610 serviceName?: string;
20611 /**
20612 * The executable to launch at login. Defaults to `process.execPath`.
20613 *
20614 * @platform win32
20615 */
20616 path?: string;
20617 /**
20618 * The command-line arguments to pass to the executable. Defaults to an empty
20619 * array. Take care to wrap paths in quotes.
20620 *
20621 * @platform win32
20622 */
20623 args?: string[];
20624 /**
20625 * `true` will change the startup approved registry key and `enable / disable` the
20626 * App in Task Manager and Windows Settings. Defaults to `true`.
20627 *
20628 * @platform win32
20629 */
20630 enabled?: boolean;
20631 /**
20632 * value name to write into registry. Defaults to the app's AppUserModelId().
20633 *
20634 * @platform win32
20635 */
20636 name?: string;
20637 }
20638
20639 interface SourcesOptions {
20640 /**
20641 * An array of strings that lists the types of desktop sources to be captured,
20642 * available types can be `screen` and `window`.
20643 */
20644 types: Array<'screen' | 'window'>;
20645 /**
20646 * The size that the media source thumbnail should be scaled to. Default is `150` x
20647 * `150`. Set width or height to 0 when you do not need the thumbnails. This will
20648 * save the processing time required for capturing the content of each window and
20649 * screen.
20650 */
20651 thumbnailSize?: Size;
20652 /**
20653 * Set to true to enable fetching window icons. The default value is false. When
20654 * false the appIcon property of the sources return null. Same if a source has the
20655 * type screen.
20656 */
20657 fetchWindowIcons?: boolean;
20658 }
20659
20660 interface StartLoggingOptions {
20661 /**
20662 * What kinds of data should be captured. By default, only metadata about requests
20663 * will be captured. Setting this to `includeSensitive` will include cookies and
20664 * authentication data. Setting it to `everything` will include all bytes
20665 * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
20666 */
20667 captureMode?: ('default' | 'includeSensitive' | 'everything');
20668 /**
20669 * When the log grows beyond this size, logging will automatically stop. Defaults
20670 * to unlimited.
20671 */
20672 maxFileSize?: number;
20673 }
20674
20675 interface Streams {
20676 video?: (Video) | (WebFrameMain);
20677 /**
20678 * If a string is specified, can be `loopback` or `loopbackWithMute`. Specifying a
20679 * loopback device will capture system audio, and is currently only supported on
20680 * Windows. If a WebFrameMain is specified, will capture audio from that frame.
20681 */
20682 audio?: (('loopback' | 'loopbackWithMute')) | (WebFrameMain);
20683 /**
20684 * If `audio` is a WebFrameMain and this is set to `true`, then local playback of
20685 * audio will not be muted (e.g. using `MediaRecorder` to record `WebFrameMain`
20686 * with this flag set to `true` will allow audio to pass through to the speakers
20687 * while recording). Default is `false`.
20688 */
20689 enableLocalEcho?: boolean;
20690 }
20691
20692 interface SystemMemoryInfo {
20693 /**
20694 * The total amount of physical memory in Kilobytes available to the system.
20695 */
20696 total: number;
20697 /**
20698 * The total amount of memory not being used by applications or disk cache.
20699 */
20700 free: number;
20701 /**
20702 * The total amount of swap memory in Kilobytes available to the system.
20703 *
20704 * @platform win32,linux
20705 */
20706 swapTotal: number;
20707 /**
20708 * The free amount of swap memory in Kilobytes available to the system.
20709 *
20710 * @platform win32,linux
20711 */
20712 swapFree: number;
20713 }
20714
20715 interface TitleBarOverlay {
20716 /**
20717 * The CSS color of the Window Controls Overlay when enabled. Default is the system
20718 * color.
20719 *
20720 * @platform win32
20721 */
20722 color?: string;
20723 /**
20724 * The CSS color of the symbols on the Window Controls Overlay when enabled.
20725 * Default is the system color.
20726 *
20727 * @platform win32
20728 */
20729 symbolColor?: string;
20730 /**
20731 * The height of the title bar and Window Controls Overlay in pixels. Default is
20732 * system height.
20733 *
20734 * @platform darwin,win32
20735 */
20736 height?: number;
20737 }
20738
20739 interface TitleBarOverlayOptions {
20740 /**
20741 * The CSS color of the Window Controls Overlay when enabled.
20742 *
20743 * @platform win32
20744 */
20745 color?: string;
20746 /**
20747 * The CSS color of the symbols on the Window Controls Overlay when enabled.
20748 *
20749 * @platform win32
20750 */
20751 symbolColor?: string;
20752 /**
20753 * The height of the title bar and Window Controls Overlay in pixels.
20754 *
20755 * @platform win32
20756 */
20757 height?: number;
20758 }
20759
20760 interface TitleOptions {
20761 /**
20762 * The font family variant to display, can be `monospaced` or `monospacedDigit`.
20763 * `monospaced` is available in macOS 10.15+ When left blank, the title uses the
20764 * default system font.
20765 */
20766 fontType?: ('monospaced' | 'monospacedDigit');
20767 }
20768
20769 interface ToBitmapOptions {
20770 /**
20771 * Defaults to 1.0.
20772 */
20773 scaleFactor?: number;
20774 }
20775
20776 interface ToDataURLOptions {
20777 /**
20778 * Defaults to 1.0.
20779 */
20780 scaleFactor?: number;
20781 }
20782
20783 interface ToPNGOptions {
20784 /**
20785 * Defaults to 1.0.
20786 */
20787 scaleFactor?: number;
20788 }
20789
20790 interface TouchBarButtonConstructorOptions {
20791 /**
20792 * Button text.
20793 */
20794 label?: string;
20795 /**
20796 * A short description of the button for use by screenreaders like VoiceOver.
20797 */
20798 accessibilityLabel?: string;
20799 /**
20800 * Button background color in hex format, i.e `#ABCDEF`.
20801 */
20802 backgroundColor?: string;
20803 /**
20804 * Button icon.
20805 */
20806 icon?: (NativeImage) | (string);
20807 /**
20808 * Can be `left`, `right` or `overlay`. Defaults to `overlay`.
20809 */
20810 iconPosition?: ('left' | 'right' | 'overlay');
20811 /**
20812 * Function to call when the button is clicked.
20813 */
20814 click?: () => void;
20815 /**
20816 * Whether the button is in an enabled state. Default is `true`.
20817 */
20818 enabled?: boolean;
20819 }
20820
20821 interface TouchBarColorPickerConstructorOptions {
20822 /**
20823 * Array of hex color strings to appear as possible colors to select.
20824 */
20825 availableColors?: string[];
20826 /**
20827 * The selected hex color in the picker, i.e `#ABCDEF`.
20828 */
20829 selectedColor?: string;
20830 /**
20831 * Function to call when a color is selected.
20832 */
20833 change?: (color: string) => void;
20834 }
20835
20836 interface TouchBarConstructorOptions {
20837 items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
20838 escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
20839 }
20840
20841 interface TouchBarGroupConstructorOptions {
20842 /**
20843 * Items to display as a group.
20844 */
20845 items: TouchBar;
20846 }
20847
20848 interface TouchBarLabelConstructorOptions {
20849 /**
20850 * Text to display.
20851 */
20852 label?: string;
20853 /**
20854 * A short description of the button for use by screenreaders like VoiceOver.
20855 */
20856 accessibilityLabel?: string;
20857 /**
20858 * Hex color of text, i.e `#ABCDEF`.
20859 */
20860 textColor?: string;
20861 }
20862
20863 interface TouchBarPopoverConstructorOptions {
20864 /**
20865 * Popover button text.
20866 */
20867 label?: string;
20868 /**
20869 * Popover button icon.
20870 */
20871 icon?: NativeImage;
20872 /**
20873 * Items to display in the popover.
20874 */
20875 items: TouchBar;
20876 /**
20877 * `true` to display a close button on the left of the popover, `false` to not show
20878 * it. Default is `true`.
20879 */
20880 showCloseButton?: boolean;
20881 }
20882
20883 interface TouchBarScrubberConstructorOptions {
20884 /**
20885 * An array of items to place in this scrubber.
20886 */
20887 items: ScrubberItem[];
20888 /**
20889 * Called when the user taps an item that was not the last tapped item.
20890 */
20891 select?: (selectedIndex: number) => void;
20892 /**
20893 * Called when the user taps any item.
20894 */
20895 highlight?: (highlightedIndex: number) => void;
20896 /**
20897 * Selected item style. Can be `background`, `outline` or `none`. Defaults to
20898 * `none`.
20899 */
20900 selectedStyle?: ('background' | 'outline' | 'none');
20901 /**
20902 * Selected overlay item style. Can be `background`, `outline` or `none`. Defaults
20903 * to `none`.
20904 */
20905 overlayStyle?: ('background' | 'outline' | 'none');
20906 /**
20907 * Whether to show arrow buttons. Defaults to `false` and is only shown if `items`
20908 * is non-empty.
20909 */
20910 showArrowButtons?: boolean;
20911 /**
20912 * Can be `fixed` or `free`. The default is `free`.
20913 */
20914 mode?: ('fixed' | 'free');
20915 /**
20916 * Defaults to `true`.
20917 */
20918 continuous?: boolean;
20919 }
20920
20921 interface TouchBarSegmentedControlConstructorOptions {
20922 /**
20923 * Style of the segments:
20924 */
20925 segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
20926 /**
20927 * The selection mode of the control:
20928 */
20929 mode?: ('single' | 'multiple' | 'buttons');
20930 /**
20931 * An array of segments to place in this control.
20932 */
20933 segments: SegmentedControlSegment[];
20934 /**
20935 * The index of the currently selected segment, will update automatically with user
20936 * interaction. When the mode is `multiple` it will be the last selected item.
20937 */
20938 selectedIndex?: number;
20939 /**
20940 * Called when the user selects a new segment.
20941 */
20942 change?: (selectedIndex: number, isSelected: boolean) => void;
20943 }
20944
20945 interface TouchBarSliderConstructorOptions {
20946 /**
20947 * Label text.
20948 */
20949 label?: string;
20950 /**
20951 * Selected value.
20952 */
20953 value?: number;
20954 /**
20955 * Minimum value.
20956 */
20957 minValue?: number;
20958 /**
20959 * Maximum value.
20960 */
20961 maxValue?: number;
20962 /**
20963 * Function to call when the slider is changed.
20964 */
20965 change?: (newValue: number) => void;
20966 }
20967
20968 interface TouchBarSpacerConstructorOptions {
20969 /**
20970 * Size of spacer, possible values are:
20971 */
20972 size?: ('small' | 'large' | 'flexible');
20973 }
20974
20975 interface TraceBufferUsageReturnValue {
20976 value: number;
20977 percentage: number;
20978 }
20979
20980 interface UdpPortRange {
20981 /**
20982 * The minimum UDP port number that WebRTC should use.
20983 */
20984 min: number;
20985 /**
20986 * The maximum UDP port number that WebRTC should use.
20987 */
20988 max: number;
20989 }
20990
20991 interface UpdateTargetUrlEvent extends DOMEvent {
20992 url: string;
20993 }
20994
20995 interface UploadProgress {
20996 /**
20997 * Whether the request is currently active. If this is false no other properties
20998 * will be set
20999 */
21000 active: boolean;
21001 /**
21002 * Whether the upload has started. If this is false both `current` and `total` will
21003 * be set to 0.
21004 */
21005 started: boolean;
21006 /**
21007 * The number of bytes that have been uploaded so far
21008 */
21009 current: number;
21010 /**
21011 * The number of bytes that will be uploaded this request
21012 */
21013 total: number;
21014 }
21015
21016 interface UsbDeviceRevokedDetails {
21017 device: USBDevice;
21018 /**
21019 * The origin that the device has been revoked from.
21020 */
21021 origin?: string;
21022 }
21023
21024 interface USBProtectedClassesHandlerHandlerDetails {
21025 /**
21026 * The current list of protected USB classes. Possible class values include:
21027 */
21028 protectedClasses: Array<'audio' | 'audio-video' | 'hid' | 'mass-storage' | 'smart-card' | 'video' | 'wireless'>;
21029 }
21030
21031 interface VisibleOnAllWorkspacesOptions {
21032 /**
21033 * Sets whether the window should be visible above fullscreen windows.
21034 *
21035 * @platform darwin
21036 */
21037 visibleOnFullScreen?: boolean;
21038 /**
21039 * Calling setVisibleOnAllWorkspaces will by default transform the process type
21040 * between UIElementApplication and ForegroundApplication to ensure the correct
21041 * behavior. However, this will hide the window and dock for a short time every
21042 * time it is called. If your window is already of type UIElementApplication, you
21043 * can bypass this transformation by passing true to skipTransformProcessType.
21044 *
21045 * @platform darwin
21046 */
21047 skipTransformProcessType?: boolean;
21048 }
21049
21050 interface WebContentsAudioStateChangedEventParams {
21051 /**
21052 * True if one or more frames or child `webContents` are emitting audio.
21053 */
21054 audible: boolean;
21055 }
21056
21057 interface WebContentsDidRedirectNavigationEventParams {
21058 /**
21059 * The URL the frame is navigating to.
21060 */
21061 url: string;
21062 /**
21063 * Whether the navigation happened without changing document. Examples of same
21064 * document navigations are reference fragment navigations, pushState/replaceState,
21065 * and same page history navigation.
21066 */
21067 isSameDocument: boolean;
21068 /**
21069 * True if the navigation is taking place in a main frame.
21070 */
21071 isMainFrame: boolean;
21072 /**
21073 * The frame to be navigated.
21074 */
21075 frame: WebFrameMain;
21076 /**
21077 * The frame which initiated the navigation, which can be a parent frame (e.g. via
21078 * `window.open` with a frame's name), or null if the navigation was not initiated
21079 * by a frame. This can also be null if the initiating frame was deleted before the
21080 * event was emitted.
21081 */
21082 initiator?: WebFrameMain;
21083 }
21084
21085 interface WebContentsDidStartNavigationEventParams {
21086 /**
21087 * The URL the frame is navigating to.
21088 */
21089 url: string;
21090 /**
21091 * Whether the navigation happened without changing document. Examples of same
21092 * document navigations are reference fragment navigations, pushState/replaceState,
21093 * and same page history navigation.
21094 */
21095 isSameDocument: boolean;
21096 /**
21097 * True if the navigation is taking place in a main frame.
21098 */
21099 isMainFrame: boolean;
21100 /**
21101 * The frame to be navigated.
21102 */
21103 frame: WebFrameMain;
21104 /**
21105 * The frame which initiated the navigation, which can be a parent frame (e.g. via
21106 * `window.open` with a frame's name), or null if the navigation was not initiated
21107 * by a frame. This can also be null if the initiating frame was deleted before the
21108 * event was emitted.
21109 */
21110 initiator?: WebFrameMain;
21111 }
21112
21113 interface WebContentsPrintOptions {
21114 /**
21115 * Don't ask user for print settings. Default is `false`.
21116 */
21117 silent?: boolean;
21118 /**
21119 * Prints the background color and image of the web page. Default is `false`.
21120 */
21121 printBackground?: boolean;
21122 /**
21123 * Set the printer device name to use. Must be the system-defined name and not the
21124 * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
21125 */
21126 deviceName?: string;
21127 /**
21128 * Set whether the printed web page will be in color or grayscale. Default is
21129 * `true`.
21130 */
21131 color?: boolean;
21132 margins?: Margins;
21133 /**
21134 * Whether the web page should be printed in landscape mode. Default is `false`.
21135 */
21136 landscape?: boolean;
21137 /**
21138 * The scale factor of the web page.
21139 */
21140 scaleFactor?: number;
21141 /**
21142 * The number of pages to print per page sheet.
21143 */
21144 pagesPerSheet?: number;
21145 /**
21146 * Whether the web page should be collated.
21147 */
21148 collate?: boolean;
21149 /**
21150 * The number of copies of the web page to print.
21151 */
21152 copies?: number;
21153 /**
21154 * The page range to print. On macOS, only one range is honored.
21155 */
21156 pageRanges?: PageRanges[];
21157 /**
21158 * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
21159 * `longEdge`.
21160 */
21161 duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
21162 dpi?: Record<string, number>;
21163 /**
21164 * string to be printed as page header.
21165 */
21166 header?: string;
21167 /**
21168 * string to be printed as page footer.
21169 */
21170 footer?: string;
21171 /**
21172 * Specify page size of the printed document. Can be `A0`, `A1`, `A2`, `A3`, `A4`,
21173 * `A5`, `A6`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and
21174 * `width`.
21175 */
21176 pageSize?: (('A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'Legal' | 'Letter' | 'Tabloid')) | (Size);
21177 }
21178
21179 interface WebContentsViewConstructorOptions {
21180 /**
21181 * Settings of web page's features.
21182 */
21183 webPreferences?: WebPreferences;
21184 }
21185
21186 interface WebContentsWillFrameNavigateEventParams {
21187 /**
21188 * The URL the frame is navigating to.
21189 */
21190 url: string;
21191 /**
21192 * This event does not fire for same document navigations using window.history api
21193 * and reference fragment navigations. This property is always set to `false` for
21194 * this event.
21195 */
21196 isSameDocument: boolean;
21197 /**
21198 * True if the navigation is taking place in a main frame.
21199 */
21200 isMainFrame: boolean;
21201 /**
21202 * The frame to be navigated.
21203 */
21204 frame: WebFrameMain;
21205 /**
21206 * The frame which initiated the navigation, which can be a parent frame (e.g. via
21207 * `window.open` with a frame's name), or null if the navigation was not initiated
21208 * by a frame. This can also be null if the initiating frame was deleted before the
21209 * event was emitted.
21210 */
21211 initiator?: WebFrameMain;
21212 }
21213
21214 interface WebContentsWillNavigateEventParams {
21215 /**
21216 * The URL the frame is navigating to.
21217 */
21218 url: string;
21219 /**
21220 * This event does not fire for same document navigations using window.history api
21221 * and reference fragment navigations. This property is always set to `false` for
21222 * this event.
21223 */
21224 isSameDocument: boolean;
21225 /**
21226 * True if the navigation is taking place in a main frame.
21227 */
21228 isMainFrame: boolean;
21229 /**
21230 * The frame to be navigated.
21231 */
21232 frame: WebFrameMain;
21233 /**
21234 * The frame which initiated the navigation, which can be a parent frame (e.g. via
21235 * `window.open` with a frame's name), or null if the navigation was not initiated
21236 * by a frame. This can also be null if the initiating frame was deleted before the
21237 * event was emitted.
21238 */
21239 initiator?: WebFrameMain;
21240 }
21241
21242 interface WebContentsWillRedirectEventParams {
21243 /**
21244 * The URL the frame is navigating to.
21245 */
21246 url: string;
21247 /**
21248 * Whether the navigation happened without changing document. Examples of same
21249 * document navigations are reference fragment navigations, pushState/replaceState,
21250 * and same page history navigation.
21251 */
21252 isSameDocument: boolean;
21253 /**
21254 * True if the navigation is taking place in a main frame.
21255 */
21256 isMainFrame: boolean;
21257 /**
21258 * The frame to be navigated.
21259 */
21260 frame: WebFrameMain;
21261 /**
21262 * The frame which initiated the navigation, which can be a parent frame (e.g. via
21263 * `window.open` with a frame's name), or null if the navigation was not initiated
21264 * by a frame. This can also be null if the initiating frame was deleted before the
21265 * event was emitted.
21266 */
21267 initiator?: WebFrameMain;
21268 }
21269
21270 interface WebRTCUDPPortRange {
21271 /**
21272 * The minimum UDP port number that WebRTC should use.
21273 */
21274 min: number;
21275 /**
21276 * The maximum UDP port number that WebRTC should use.
21277 */
21278 max: number;
21279 }
21280
21281 interface WebviewTagPrintOptions {
21282 /**
21283 * Don't ask user for print settings. Default is `false`.
21284 */
21285 silent?: boolean;
21286 /**
21287 * Prints the background color and image of the web page. Default is `false`.
21288 */
21289 printBackground?: boolean;
21290 /**
21291 * Set the printer device name to use. Must be the system-defined name and not the
21292 * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
21293 */
21294 deviceName?: string;
21295 /**
21296 * Set whether the printed web page will be in color or grayscale. Default is
21297 * `true`.
21298 */
21299 color?: boolean;
21300 margins?: Margins;
21301 /**
21302 * Whether the web page should be printed in landscape mode. Default is `false`.
21303 */
21304 landscape?: boolean;
21305 /**
21306 * The scale factor of the web page.
21307 */
21308 scaleFactor?: number;
21309 /**
21310 * The number of pages to print per page sheet.
21311 */
21312 pagesPerSheet?: number;
21313 /**
21314 * Whether the web page should be collated.
21315 */
21316 collate?: boolean;
21317 /**
21318 * The number of copies of the web page to print.
21319 */
21320 copies?: number;
21321 /**
21322 * The page range to print.
21323 */
21324 pageRanges?: PageRanges[];
21325 /**
21326 * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
21327 * `longEdge`.
21328 */
21329 duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
21330 dpi?: Record<string, number>;
21331 /**
21332 * string to be printed as page header.
21333 */
21334 header?: string;
21335 /**
21336 * string to be printed as page footer.
21337 */
21338 footer?: string;
21339 /**
21340 * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
21341 * `Letter`, `Tabloid` or an Object containing `height` in microns.
21342 */
21343 pageSize?: (('A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid')) | (Size);
21344 }
21345
21346 interface WillFrameNavigateEvent extends DOMEvent {
21347 url: string;
21348 isMainFrame: boolean;
21349 frameProcessId: number;
21350 frameRoutingId: number;
21351 }
21352
21353 interface WillNavigateEvent extends DOMEvent {
21354 url: string;
21355 }
21356
21357 interface WillResizeDetails {
21358 /**
21359 * The edge of the window being dragged for resizing. Can be `bottom`, `left`,
21360 * `right`, `top-left`, `top-right`, `bottom-left` or `bottom-right`.
21361 */
21362 edge: ('bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right');
21363 }
21364
21365 interface EditFlags {
21366 /**
21367 * Whether the renderer believes it can undo.
21368 */
21369 canUndo: boolean;
21370 /**
21371 * Whether the renderer believes it can redo.
21372 */
21373 canRedo: boolean;
21374 /**
21375 * Whether the renderer believes it can cut.
21376 */
21377 canCut: boolean;
21378 /**
21379 * Whether the renderer believes it can copy.
21380 */
21381 canCopy: boolean;
21382 /**
21383 * Whether the renderer believes it can paste.
21384 */
21385 canPaste: boolean;
21386 /**
21387 * Whether the renderer believes it can delete.
21388 */
21389 canDelete: boolean;
21390 /**
21391 * Whether the renderer believes it can select all.
21392 */
21393 canSelectAll: boolean;
21394 /**
21395 * Whether the renderer believes it can edit text richly.
21396 */
21397 canEditRichly: boolean;
21398 }
21399
21400 interface Env {
21401 }
21402
21403 interface FoundInPageResult {
21404 requestId: number;
21405 /**
21406 * Position of the active match.
21407 */
21408 activeMatchOrdinal: number;
21409 /**
21410 * Number of Matches.
21411 */
21412 matches: number;
21413 /**
21414 * Coordinates of first match region.
21415 */
21416 selectionArea: Rectangle;
21417 finalUpdate: boolean;
21418 }
21419
21420 interface LaunchItems {
21421 /**
21422 * name value of a registry entry.
21423 *
21424 * @platform win32
21425 */
21426 name: string;
21427 /**
21428 * The executable to an app that corresponds to a registry entry.
21429 *
21430 * @platform win32
21431 */
21432 path: string;
21433 /**
21434 * the command-line arguments to pass to the executable.
21435 *
21436 * @platform win32
21437 */
21438 args: string[];
21439 /**
21440 * one of `user` or `machine`. Indicates whether the registry entry is under
21441 * `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
21442 *
21443 * @platform win32
21444 */
21445 scope: string;
21446 /**
21447 * `true` if the app registry key is startup approved and therefore shows as
21448 * `enabled` in Task Manager and Windows settings.
21449 *
21450 * @platform win32
21451 */
21452 enabled: boolean;
21453 }
21454
21455 interface Margins {
21456 /**
21457 * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
21458 * you will also need to specify `top`, `bottom`, `left`, and `right`.
21459 */
21460 marginType?: ('default' | 'none' | 'printableArea' | 'custom');
21461 /**
21462 * The top margin of the printed web page, in pixels.
21463 */
21464 top?: number;
21465 /**
21466 * The bottom margin of the printed web page, in pixels.
21467 */
21468 bottom?: number;
21469 /**
21470 * The left margin of the printed web page, in pixels.
21471 */
21472 left?: number;
21473 /**
21474 * The right margin of the printed web page, in pixels.
21475 */
21476 right?: number;
21477 }
21478
21479 interface MediaFlags {
21480 /**
21481 * Whether the media element has crashed.
21482 */
21483 inError: boolean;
21484 /**
21485 * Whether the media element is paused.
21486 */
21487 isPaused: boolean;
21488 /**
21489 * Whether the media element is muted.
21490 */
21491 isMuted: boolean;
21492 /**
21493 * Whether the media element has audio.
21494 */
21495 hasAudio: boolean;
21496 /**
21497 * Whether the media element is looping.
21498 */
21499 isLooping: boolean;
21500 /**
21501 * Whether the media element's controls are visible.
21502 */
21503 isControlsVisible: boolean;
21504 /**
21505 * Whether the media element's controls are toggleable.
21506 */
21507 canToggleControls: boolean;
21508 /**
21509 * Whether the media element can be printed.
21510 */
21511 canPrint: boolean;
21512 /**
21513 * Whether or not the media element can be downloaded.
21514 */
21515 canSave: boolean;
21516 /**
21517 * Whether the media element can show picture-in-picture.
21518 */
21519 canShowPictureInPicture: boolean;
21520 /**
21521 * Whether the media element is currently showing picture-in-picture.
21522 */
21523 isShowingPictureInPicture: boolean;
21524 /**
21525 * Whether the media element can be rotated.
21526 */
21527 canRotate: boolean;
21528 /**
21529 * Whether the media element can be looped.
21530 */
21531 canLoop: boolean;
21532 }
21533
21534 interface PageRanges {
21535 /**
21536 * Index of the first page to print (0-based).
21537 */
21538 from: number;
21539 /**
21540 * Index of the last page to print (inclusive) (0-based).
21541 */
21542 to: number;
21543 }
21544
21545 interface Params {
21546 /**
21547 * x coordinate.
21548 */
21549 x: number;
21550 /**
21551 * y coordinate.
21552 */
21553 y: number;
21554 /**
21555 * URL of the link that encloses the node the context menu was invoked on.
21556 */
21557 linkURL: string;
21558 /**
21559 * Text associated with the link. May be an empty string if the contents of the
21560 * link are an image.
21561 */
21562 linkText: string;
21563 /**
21564 * URL of the top level page that the context menu was invoked on.
21565 */
21566 pageURL: string;
21567 /**
21568 * URL of the subframe that the context menu was invoked on.
21569 */
21570 frameURL: string;
21571 /**
21572 * Source URL for the element that the context menu was invoked on. Elements with
21573 * source URLs are images, audio and video.
21574 */
21575 srcURL: string;
21576 /**
21577 * Type of the node the context menu was invoked on. Can be `none`, `image`,
21578 * `audio`, `video`, `canvas`, `file` or `plugin`.
21579 */
21580 mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
21581 /**
21582 * Whether the context menu was invoked on an image which has non-empty contents.
21583 */
21584 hasImageContents: boolean;
21585 /**
21586 * Whether the context is editable.
21587 */
21588 isEditable: boolean;
21589 /**
21590 * Text of the selection that the context menu was invoked on.
21591 */
21592 selectionText: string;
21593 /**
21594 * Title text of the selection that the context menu was invoked on.
21595 */
21596 titleText: string;
21597 /**
21598 * Alt text of the selection that the context menu was invoked on.
21599 */
21600 altText: string;
21601 /**
21602 * Suggested filename to be used when saving file through 'Save Link As' option of
21603 * context menu.
21604 */
21605 suggestedFilename: string;
21606 /**
21607 * Rect representing the coordinates in the document space of the selection.
21608 */
21609 selectionRect: Rectangle;
21610 /**
21611 * Start position of the selection text.
21612 */
21613 selectionStartOffset: number;
21614 /**
21615 * The referrer policy of the frame on which the menu is invoked.
21616 */
21617 referrerPolicy: Referrer;
21618 /**
21619 * The misspelled word under the cursor, if any.
21620 */
21621 misspelledWord: string;
21622 /**
21623 * An array of suggested words to show the user to replace the `misspelledWord`.
21624 * Only available if there is a misspelled word and spellchecker is enabled.
21625 */
21626 dictionarySuggestions: string[];
21627 /**
21628 * The character encoding of the frame on which the menu was invoked.
21629 */
21630 frameCharset: string;
21631 /**
21632 * The source that the context menu was invoked on. Possible values include `none`,
21633 * `button-button`, `field-set`, `input-button`, `input-checkbox`, `input-color`,
21634 * `input-date`, `input-datetime-local`, `input-email`, `input-file`,
21635 * `input-hidden`, `input-image`, `input-month`, `input-number`, `input-password`,
21636 * `input-radio`, `input-range`, `input-reset`, `input-search`, `input-submit`,
21637 * `input-telephone`, `input-text`, `input-time`, `input-url`, `input-week`,
21638 * `output`, `reset-button`, `select-list`, `select-list`, `select-multiple`,
21639 * `select-one`, `submit-button`, and `text-area`,
21640 */
21641 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');
21642 /**
21643 * If the context is editable, whether or not spellchecking is enabled.
21644 */
21645 spellcheckEnabled: boolean;
21646 /**
21647 * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
21648 * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
21649 * `adjustSelection`, or `adjustSelectionReset`.
21650 */
21651 menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
21652 /**
21653 * The flags for the media element the context menu was invoked on.
21654 */
21655 mediaFlags: MediaFlags;
21656 /**
21657 * These flags indicate whether the renderer believes it is able to perform the
21658 * corresponding action.
21659 */
21660 editFlags: EditFlags;
21661 }
21662
21663 interface Video {
21664 /**
21665 * The id of the stream being granted. This will usually come from a
21666 * DesktopCapturerSource object.
21667 */
21668 id: string;
21669 /**
21670 * The name of the stream being granted. This will usually come from a
21671 * DesktopCapturerSource object.
21672 */
21673 name: string;
21674 }
21675
21676
21677
21678 namespace Common {
21679 type Event<Params extends object = {}> = Electron.Event<Params>;
21680 const clipboard: Clipboard;
21681 type Clipboard = Electron.Clipboard;
21682 const crashReporter: CrashReporter;
21683 type CrashReporter = Electron.CrashReporter;
21684 const nativeImage: typeof NativeImage;
21685 type NativeImage = Electron.NativeImage;
21686 const shell: Shell;
21687 type Shell = Electron.Shell;
21688 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
21689 type AddRepresentationOptions = Electron.AddRepresentationOptions;
21690 type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
21691 type AnimationSettings = Electron.AnimationSettings;
21692 type AppDetailsOptions = Electron.AppDetailsOptions;
21693 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
21694 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
21695 type AuthInfo = Electron.AuthInfo;
21696 type AutoResizeOptions = Electron.AutoResizeOptions;
21697 type BeforeSendResponse = Electron.BeforeSendResponse;
21698 type BitmapOptions = Electron.BitmapOptions;
21699 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
21700 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
21701 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
21702 type CallbackResponse = Electron.CallbackResponse;
21703 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
21704 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
21705 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
21706 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
21707 type CloseOpts = Electron.CloseOpts;
21708 type Config = Electron.Config;
21709 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
21710 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
21711 type ContextMenuEvent = Electron.ContextMenuEvent;
21712 type ContextMenuParams = Electron.ContextMenuParams;
21713 type ContinueActivityDetails = Electron.ContinueActivityDetails;
21714 type CookiesGetFilter = Electron.CookiesGetFilter;
21715 type CookiesSetDetails = Electron.CookiesSetDetails;
21716 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
21717 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
21718 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
21719 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
21720 type Data = Electron.Data;
21721 type DefaultFontFamily = Electron.DefaultFontFamily;
21722 type Details = Electron.Details;
21723 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
21724 type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
21725 type DevtoolsSearchQueryEvent = Electron.DevtoolsSearchQueryEvent;
21726 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
21727 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
21728 type DidFailLoadEvent = Electron.DidFailLoadEvent;
21729 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
21730 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
21731 type DidNavigateEvent = Electron.DidNavigateEvent;
21732 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
21733 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
21734 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
21735 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
21736 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
21737 type DownloadURLOptions = Electron.DownloadURLOptions;
21738 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
21739 type EntryAtIndex = Electron.EntryAtIndex;
21740 type FeedURLOptions = Electron.FeedURLOptions;
21741 type FileIconOptions = Electron.FileIconOptions;
21742 type FindInPageOptions = Electron.FindInPageOptions;
21743 type FocusOptions = Electron.FocusOptions;
21744 type ForkOptions = Electron.ForkOptions;
21745 type FoundInPageEvent = Electron.FoundInPageEvent;
21746 type FrameCreatedDetails = Electron.FrameCreatedDetails;
21747 type FromPartitionOptions = Electron.FromPartitionOptions;
21748 type FromPathOptions = Electron.FromPathOptions;
21749 type HandlerDetails = Electron.HandlerDetails;
21750 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
21751 type HeapStatistics = Electron.HeapStatistics;
21752 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
21753 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
21754 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
21755 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
21756 type ImportCertificateOptions = Electron.ImportCertificateOptions;
21757 type Info = Electron.Info;
21758 type Input = Electron.Input;
21759 type InsertCSSOptions = Electron.InsertCSSOptions;
21760 type IpcMessageEvent = Electron.IpcMessageEvent;
21761 type Item = Electron.Item;
21762 type JumpListSettings = Electron.JumpListSettings;
21763 type LoadCommitEvent = Electron.LoadCommitEvent;
21764 type LoadExtensionOptions = Electron.LoadExtensionOptions;
21765 type LoadFileOptions = Electron.LoadFileOptions;
21766 type LoadURLOptions = Electron.LoadURLOptions;
21767 type LoginItemSettings = Electron.LoginItemSettings;
21768 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
21769 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
21770 type MessageBoxOptions = Electron.MessageBoxOptions;
21771 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
21772 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
21773 type MessageDetails = Electron.MessageDetails;
21774 type MessageEvent = Electron.MessageEvent;
21775 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
21776 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
21777 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
21778 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
21779 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
21780 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
21781 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
21782 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
21783 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
21784 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
21785 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
21786 type OpenDialogOptions = Electron.OpenDialogOptions;
21787 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
21788 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
21789 type OpenExternalOptions = Electron.OpenExternalOptions;
21790 type Options = Electron.Options;
21791 type Opts = Electron.Opts;
21792 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
21793 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
21794 type Parameters = Electron.Parameters;
21795 type Payment = Electron.Payment;
21796 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
21797 type PluginCrashedEvent = Electron.PluginCrashedEvent;
21798 type PopupOptions = Electron.PopupOptions;
21799 type PreconnectOptions = Electron.PreconnectOptions;
21800 type PrintToPDFOptions = Electron.PrintToPDFOptions;
21801 type Privileges = Electron.Privileges;
21802 type ProgressBarOptions = Electron.ProgressBarOptions;
21803 type Provider = Electron.Provider;
21804 type PurchaseProductOpts = Electron.PurchaseProductOpts;
21805 type ReadBookmark = Electron.ReadBookmark;
21806 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
21807 type RelaunchOptions = Electron.RelaunchOptions;
21808 type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
21809 type Request = Electron.Request;
21810 type ResizeOptions = Electron.ResizeOptions;
21811 type ResolveHostOptions = Electron.ResolveHostOptions;
21812 type ResourceUsage = Electron.ResourceUsage;
21813 type Response = Electron.Response;
21814 type Result = Electron.Result;
21815 type SaveDialogOptions = Electron.SaveDialogOptions;
21816 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
21817 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
21818 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
21819 type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
21820 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
21821 type Settings = Electron.Settings;
21822 type SourcesOptions = Electron.SourcesOptions;
21823 type StartLoggingOptions = Electron.StartLoggingOptions;
21824 type Streams = Electron.Streams;
21825 type SystemMemoryInfo = Electron.SystemMemoryInfo;
21826 type TitleBarOverlay = Electron.TitleBarOverlay;
21827 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
21828 type TitleOptions = Electron.TitleOptions;
21829 type ToBitmapOptions = Electron.ToBitmapOptions;
21830 type ToDataURLOptions = Electron.ToDataURLOptions;
21831 type ToPNGOptions = Electron.ToPNGOptions;
21832 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
21833 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
21834 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
21835 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
21836 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
21837 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
21838 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
21839 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
21840 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
21841 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
21842 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
21843 type UdpPortRange = Electron.UdpPortRange;
21844 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
21845 type UploadProgress = Electron.UploadProgress;
21846 type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
21847 type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
21848 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
21849 type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
21850 type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
21851 type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
21852 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
21853 type WebContentsViewConstructorOptions = Electron.WebContentsViewConstructorOptions;
21854 type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
21855 type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
21856 type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
21857 type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
21858 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
21859 type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
21860 type WillNavigateEvent = Electron.WillNavigateEvent;
21861 type WillResizeDetails = Electron.WillResizeDetails;
21862 type EditFlags = Electron.EditFlags;
21863 type Env = Electron.Env;
21864 type FoundInPageResult = Electron.FoundInPageResult;
21865 type LaunchItems = Electron.LaunchItems;
21866 type Margins = Electron.Margins;
21867 type MediaFlags = Electron.MediaFlags;
21868 type PageRanges = Electron.PageRanges;
21869 type Params = Electron.Params;
21870 type Video = Electron.Video;
21871 type BaseWindowConstructorOptions = Electron.BaseWindowConstructorOptions;
21872 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
21873 type BluetoothDevice = Electron.BluetoothDevice;
21874 type Certificate = Electron.Certificate;
21875 type CertificatePrincipal = Electron.CertificatePrincipal;
21876 type Cookie = Electron.Cookie;
21877 type CPUUsage = Electron.CPUUsage;
21878 type CrashReport = Electron.CrashReport;
21879 type CustomScheme = Electron.CustomScheme;
21880 type DesktopCapturerSource = Electron.DesktopCapturerSource;
21881 type Display = Electron.Display;
21882 type Extension = Electron.Extension;
21883 type ExtensionInfo = Electron.ExtensionInfo;
21884 type FileFilter = Electron.FileFilter;
21885 type FilePathWithHeaders = Electron.FilePathWithHeaders;
21886 type FilesystemPermissionRequest = Electron.FilesystemPermissionRequest;
21887 type GPUFeatureStatus = Electron.GPUFeatureStatus;
21888 type HIDDevice = Electron.HIDDevice;
21889 type InputEvent = Electron.InputEvent;
21890 type IpcMainEvent = Electron.IpcMainEvent;
21891 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
21892 type IpcRendererEvent = Electron.IpcRendererEvent;
21893 type JumpListCategory = Electron.JumpListCategory;
21894 type JumpListItem = Electron.JumpListItem;
21895 type KeyboardEvent = Electron.KeyboardEvent;
21896 type KeyboardInputEvent = Electron.KeyboardInputEvent;
21897 type MediaAccessPermissionRequest = Electron.MediaAccessPermissionRequest;
21898 type MemoryInfo = Electron.MemoryInfo;
21899 type MemoryUsageDetails = Electron.MemoryUsageDetails;
21900 type MimeTypedBuffer = Electron.MimeTypedBuffer;
21901 type MouseInputEvent = Electron.MouseInputEvent;
21902 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
21903 type NotificationAction = Electron.NotificationAction;
21904 type NotificationResponse = Electron.NotificationResponse;
21905 type OpenExternalPermissionRequest = Electron.OpenExternalPermissionRequest;
21906 type PaymentDiscount = Electron.PaymentDiscount;
21907 type PermissionRequest = Electron.PermissionRequest;
21908 type Point = Electron.Point;
21909 type PostBody = Electron.PostBody;
21910 type PrinterInfo = Electron.PrinterInfo;
21911 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
21912 type ProcessMetric = Electron.ProcessMetric;
21913 type Product = Electron.Product;
21914 type ProductDiscount = Electron.ProductDiscount;
21915 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
21916 type ProtocolRequest = Electron.ProtocolRequest;
21917 type ProtocolResponse = Electron.ProtocolResponse;
21918 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
21919 type ProxyConfig = Electron.ProxyConfig;
21920 type Rectangle = Electron.Rectangle;
21921 type Referrer = Electron.Referrer;
21922 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
21923 type ResolvedEndpoint = Electron.ResolvedEndpoint;
21924 type ResolvedHost = Electron.ResolvedHost;
21925 type ScrubberItem = Electron.ScrubberItem;
21926 type SegmentedControlSegment = Electron.SegmentedControlSegment;
21927 type SerialPort = Electron.SerialPort;
21928 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
21929 type SharedWorkerInfo = Electron.SharedWorkerInfo;
21930 type SharingItem = Electron.SharingItem;
21931 type ShortcutDetails = Electron.ShortcutDetails;
21932 type Size = Electron.Size;
21933 type Task = Electron.Task;
21934 type ThumbarButton = Electron.ThumbarButton;
21935 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
21936 type TraceConfig = Electron.TraceConfig;
21937 type Transaction = Electron.Transaction;
21938 type UploadData = Electron.UploadData;
21939 type UploadFile = Electron.UploadFile;
21940 type UploadRawData = Electron.UploadRawData;
21941 type USBDevice = Electron.USBDevice;
21942 type UserDefaultTypes = Electron.UserDefaultTypes;
21943 type WebPreferences = Electron.WebPreferences;
21944 type WebRequestFilter = Electron.WebRequestFilter;
21945 type WebSource = Electron.WebSource;
21946 }
21947
21948 namespace Main {
21949 type Event<Params extends object = {}> = Electron.Event<Params>;
21950 const app: App;
21951 type App = Electron.App;
21952 const autoUpdater: AutoUpdater;
21953 type AutoUpdater = Electron.AutoUpdater;
21954 class BaseWindow extends Electron.BaseWindow {}
21955 class BrowserView extends Electron.BrowserView {}
21956 class BrowserWindow extends Electron.BrowserWindow {}
21957 type ClientRequest = Electron.ClientRequest;
21958 type CommandLine = Electron.CommandLine;
21959 const contentTracing: ContentTracing;
21960 type ContentTracing = Electron.ContentTracing;
21961 type Cookies = Electron.Cookies;
21962 type Debugger = Electron.Debugger;
21963 const desktopCapturer: DesktopCapturer;
21964 type DesktopCapturer = Electron.DesktopCapturer;
21965 const dialog: Dialog;
21966 type Dialog = Electron.Dialog;
21967 type Dock = Electron.Dock;
21968 type DownloadItem = Electron.DownloadItem;
21969 const globalShortcut: GlobalShortcut;
21970 type GlobalShortcut = Electron.GlobalShortcut;
21971 const inAppPurchase: InAppPurchase;
21972 type InAppPurchase = Electron.InAppPurchase;
21973 type IncomingMessage = Electron.IncomingMessage;
21974 const ipcMain: IpcMain;
21975 type IpcMain = Electron.IpcMain;
21976 class Menu extends Electron.Menu {}
21977 class MenuItem extends Electron.MenuItem {}
21978 class MessageChannelMain extends Electron.MessageChannelMain {}
21979 type MessagePortMain = Electron.MessagePortMain;
21980 const nativeTheme: NativeTheme;
21981 type NativeTheme = Electron.NativeTheme;
21982 type NavigationHistory = Electron.NavigationHistory;
21983 const net: Net;
21984 type Net = Electron.Net;
21985 const netLog: NetLog;
21986 type NetLog = Electron.NetLog;
21987 class Notification extends Electron.Notification {}
21988 const powerMonitor: PowerMonitor;
21989 type PowerMonitor = Electron.PowerMonitor;
21990 const powerSaveBlocker: PowerSaveBlocker;
21991 type PowerSaveBlocker = Electron.PowerSaveBlocker;
21992 const protocol: Protocol;
21993 type Protocol = Electron.Protocol;
21994 const pushNotifications: PushNotifications;
21995 type PushNotifications = Electron.PushNotifications;
21996 const safeStorage: SafeStorage;
21997 type SafeStorage = Electron.SafeStorage;
21998 const screen: Screen;
21999 type Screen = Electron.Screen;
22000 type ServiceWorkers = Electron.ServiceWorkers;
22001 const session: typeof Session;
22002 type Session = Electron.Session;
22003 class ShareMenu extends Electron.ShareMenu {}
22004 const systemPreferences: SystemPreferences;
22005 type SystemPreferences = Electron.SystemPreferences;
22006 class TouchBar extends Electron.TouchBar {}
22007 type TouchBarButton = Electron.TouchBarButton;
22008 type TouchBarColorPicker = Electron.TouchBarColorPicker;
22009 type TouchBarGroup = Electron.TouchBarGroup;
22010 type TouchBarLabel = Electron.TouchBarLabel;
22011 type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
22012 type TouchBarPopover = Electron.TouchBarPopover;
22013 type TouchBarScrubber = Electron.TouchBarScrubber;
22014 type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
22015 type TouchBarSlider = Electron.TouchBarSlider;
22016 type TouchBarSpacer = Electron.TouchBarSpacer;
22017 class Tray extends Electron.Tray {}
22018 const utilityProcess: typeof UtilityProcess;
22019 type UtilityProcess = Electron.UtilityProcess;
22020 class View extends Electron.View {}
22021 const webContents: typeof WebContents;
22022 type WebContents = Electron.WebContents;
22023 class WebContentsView extends Electron.WebContentsView {}
22024 const webFrameMain: typeof WebFrameMain;
22025 type WebFrameMain = Electron.WebFrameMain;
22026 type WebRequest = Electron.WebRequest;
22027 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
22028 type AddRepresentationOptions = Electron.AddRepresentationOptions;
22029 type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
22030 type AnimationSettings = Electron.AnimationSettings;
22031 type AppDetailsOptions = Electron.AppDetailsOptions;
22032 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
22033 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
22034 type AuthInfo = Electron.AuthInfo;
22035 type AutoResizeOptions = Electron.AutoResizeOptions;
22036 type BeforeSendResponse = Electron.BeforeSendResponse;
22037 type BitmapOptions = Electron.BitmapOptions;
22038 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
22039 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
22040 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
22041 type CallbackResponse = Electron.CallbackResponse;
22042 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
22043 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
22044 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
22045 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
22046 type CloseOpts = Electron.CloseOpts;
22047 type Config = Electron.Config;
22048 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
22049 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
22050 type ContextMenuEvent = Electron.ContextMenuEvent;
22051 type ContextMenuParams = Electron.ContextMenuParams;
22052 type ContinueActivityDetails = Electron.ContinueActivityDetails;
22053 type CookiesGetFilter = Electron.CookiesGetFilter;
22054 type CookiesSetDetails = Electron.CookiesSetDetails;
22055 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
22056 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
22057 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
22058 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
22059 type Data = Electron.Data;
22060 type DefaultFontFamily = Electron.DefaultFontFamily;
22061 type Details = Electron.Details;
22062 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
22063 type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
22064 type DevtoolsSearchQueryEvent = Electron.DevtoolsSearchQueryEvent;
22065 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
22066 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
22067 type DidFailLoadEvent = Electron.DidFailLoadEvent;
22068 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
22069 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
22070 type DidNavigateEvent = Electron.DidNavigateEvent;
22071 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
22072 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
22073 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
22074 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
22075 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
22076 type DownloadURLOptions = Electron.DownloadURLOptions;
22077 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
22078 type EntryAtIndex = Electron.EntryAtIndex;
22079 type FeedURLOptions = Electron.FeedURLOptions;
22080 type FileIconOptions = Electron.FileIconOptions;
22081 type FindInPageOptions = Electron.FindInPageOptions;
22082 type FocusOptions = Electron.FocusOptions;
22083 type ForkOptions = Electron.ForkOptions;
22084 type FoundInPageEvent = Electron.FoundInPageEvent;
22085 type FrameCreatedDetails = Electron.FrameCreatedDetails;
22086 type FromPartitionOptions = Electron.FromPartitionOptions;
22087 type FromPathOptions = Electron.FromPathOptions;
22088 type HandlerDetails = Electron.HandlerDetails;
22089 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
22090 type HeapStatistics = Electron.HeapStatistics;
22091 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
22092 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
22093 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
22094 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
22095 type ImportCertificateOptions = Electron.ImportCertificateOptions;
22096 type Info = Electron.Info;
22097 type Input = Electron.Input;
22098 type InsertCSSOptions = Electron.InsertCSSOptions;
22099 type IpcMessageEvent = Electron.IpcMessageEvent;
22100 type Item = Electron.Item;
22101 type JumpListSettings = Electron.JumpListSettings;
22102 type LoadCommitEvent = Electron.LoadCommitEvent;
22103 type LoadExtensionOptions = Electron.LoadExtensionOptions;
22104 type LoadFileOptions = Electron.LoadFileOptions;
22105 type LoadURLOptions = Electron.LoadURLOptions;
22106 type LoginItemSettings = Electron.LoginItemSettings;
22107 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
22108 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
22109 type MessageBoxOptions = Electron.MessageBoxOptions;
22110 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
22111 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
22112 type MessageDetails = Electron.MessageDetails;
22113 type MessageEvent = Electron.MessageEvent;
22114 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
22115 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
22116 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
22117 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
22118 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
22119 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
22120 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
22121 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
22122 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
22123 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
22124 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
22125 type OpenDialogOptions = Electron.OpenDialogOptions;
22126 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
22127 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
22128 type OpenExternalOptions = Electron.OpenExternalOptions;
22129 type Options = Electron.Options;
22130 type Opts = Electron.Opts;
22131 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
22132 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
22133 type Parameters = Electron.Parameters;
22134 type Payment = Electron.Payment;
22135 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
22136 type PluginCrashedEvent = Electron.PluginCrashedEvent;
22137 type PopupOptions = Electron.PopupOptions;
22138 type PreconnectOptions = Electron.PreconnectOptions;
22139 type PrintToPDFOptions = Electron.PrintToPDFOptions;
22140 type Privileges = Electron.Privileges;
22141 type ProgressBarOptions = Electron.ProgressBarOptions;
22142 type Provider = Electron.Provider;
22143 type PurchaseProductOpts = Electron.PurchaseProductOpts;
22144 type ReadBookmark = Electron.ReadBookmark;
22145 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
22146 type RelaunchOptions = Electron.RelaunchOptions;
22147 type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
22148 type Request = Electron.Request;
22149 type ResizeOptions = Electron.ResizeOptions;
22150 type ResolveHostOptions = Electron.ResolveHostOptions;
22151 type ResourceUsage = Electron.ResourceUsage;
22152 type Response = Electron.Response;
22153 type Result = Electron.Result;
22154 type SaveDialogOptions = Electron.SaveDialogOptions;
22155 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
22156 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
22157 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
22158 type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
22159 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
22160 type Settings = Electron.Settings;
22161 type SourcesOptions = Electron.SourcesOptions;
22162 type StartLoggingOptions = Electron.StartLoggingOptions;
22163 type Streams = Electron.Streams;
22164 type SystemMemoryInfo = Electron.SystemMemoryInfo;
22165 type TitleBarOverlay = Electron.TitleBarOverlay;
22166 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
22167 type TitleOptions = Electron.TitleOptions;
22168 type ToBitmapOptions = Electron.ToBitmapOptions;
22169 type ToDataURLOptions = Electron.ToDataURLOptions;
22170 type ToPNGOptions = Electron.ToPNGOptions;
22171 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
22172 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
22173 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
22174 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
22175 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
22176 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
22177 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
22178 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
22179 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
22180 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
22181 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
22182 type UdpPortRange = Electron.UdpPortRange;
22183 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
22184 type UploadProgress = Electron.UploadProgress;
22185 type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
22186 type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
22187 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
22188 type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
22189 type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
22190 type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
22191 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
22192 type WebContentsViewConstructorOptions = Electron.WebContentsViewConstructorOptions;
22193 type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
22194 type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
22195 type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
22196 type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
22197 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
22198 type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
22199 type WillNavigateEvent = Electron.WillNavigateEvent;
22200 type WillResizeDetails = Electron.WillResizeDetails;
22201 type EditFlags = Electron.EditFlags;
22202 type Env = Electron.Env;
22203 type FoundInPageResult = Electron.FoundInPageResult;
22204 type LaunchItems = Electron.LaunchItems;
22205 type Margins = Electron.Margins;
22206 type MediaFlags = Electron.MediaFlags;
22207 type PageRanges = Electron.PageRanges;
22208 type Params = Electron.Params;
22209 type Video = Electron.Video;
22210 type BaseWindowConstructorOptions = Electron.BaseWindowConstructorOptions;
22211 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
22212 type BluetoothDevice = Electron.BluetoothDevice;
22213 type Certificate = Electron.Certificate;
22214 type CertificatePrincipal = Electron.CertificatePrincipal;
22215 type Cookie = Electron.Cookie;
22216 type CPUUsage = Electron.CPUUsage;
22217 type CrashReport = Electron.CrashReport;
22218 type CustomScheme = Electron.CustomScheme;
22219 type DesktopCapturerSource = Electron.DesktopCapturerSource;
22220 type Display = Electron.Display;
22221 type Extension = Electron.Extension;
22222 type ExtensionInfo = Electron.ExtensionInfo;
22223 type FileFilter = Electron.FileFilter;
22224 type FilePathWithHeaders = Electron.FilePathWithHeaders;
22225 type FilesystemPermissionRequest = Electron.FilesystemPermissionRequest;
22226 type GPUFeatureStatus = Electron.GPUFeatureStatus;
22227 type HIDDevice = Electron.HIDDevice;
22228 type InputEvent = Electron.InputEvent;
22229 type IpcMainEvent = Electron.IpcMainEvent;
22230 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
22231 type IpcRendererEvent = Electron.IpcRendererEvent;
22232 type JumpListCategory = Electron.JumpListCategory;
22233 type JumpListItem = Electron.JumpListItem;
22234 type KeyboardEvent = Electron.KeyboardEvent;
22235 type KeyboardInputEvent = Electron.KeyboardInputEvent;
22236 type MediaAccessPermissionRequest = Electron.MediaAccessPermissionRequest;
22237 type MemoryInfo = Electron.MemoryInfo;
22238 type MemoryUsageDetails = Electron.MemoryUsageDetails;
22239 type MimeTypedBuffer = Electron.MimeTypedBuffer;
22240 type MouseInputEvent = Electron.MouseInputEvent;
22241 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
22242 type NotificationAction = Electron.NotificationAction;
22243 type NotificationResponse = Electron.NotificationResponse;
22244 type OpenExternalPermissionRequest = Electron.OpenExternalPermissionRequest;
22245 type PaymentDiscount = Electron.PaymentDiscount;
22246 type PermissionRequest = Electron.PermissionRequest;
22247 type Point = Electron.Point;
22248 type PostBody = Electron.PostBody;
22249 type PrinterInfo = Electron.PrinterInfo;
22250 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
22251 type ProcessMetric = Electron.ProcessMetric;
22252 type Product = Electron.Product;
22253 type ProductDiscount = Electron.ProductDiscount;
22254 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
22255 type ProtocolRequest = Electron.ProtocolRequest;
22256 type ProtocolResponse = Electron.ProtocolResponse;
22257 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
22258 type ProxyConfig = Electron.ProxyConfig;
22259 type Rectangle = Electron.Rectangle;
22260 type Referrer = Electron.Referrer;
22261 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
22262 type ResolvedEndpoint = Electron.ResolvedEndpoint;
22263 type ResolvedHost = Electron.ResolvedHost;
22264 type ScrubberItem = Electron.ScrubberItem;
22265 type SegmentedControlSegment = Electron.SegmentedControlSegment;
22266 type SerialPort = Electron.SerialPort;
22267 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
22268 type SharedWorkerInfo = Electron.SharedWorkerInfo;
22269 type SharingItem = Electron.SharingItem;
22270 type ShortcutDetails = Electron.ShortcutDetails;
22271 type Size = Electron.Size;
22272 type Task = Electron.Task;
22273 type ThumbarButton = Electron.ThumbarButton;
22274 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
22275 type TraceConfig = Electron.TraceConfig;
22276 type Transaction = Electron.Transaction;
22277 type UploadData = Electron.UploadData;
22278 type UploadFile = Electron.UploadFile;
22279 type UploadRawData = Electron.UploadRawData;
22280 type USBDevice = Electron.USBDevice;
22281 type UserDefaultTypes = Electron.UserDefaultTypes;
22282 type WebPreferences = Electron.WebPreferences;
22283 type WebRequestFilter = Electron.WebRequestFilter;
22284 type WebSource = Electron.WebSource;
22285 }
22286
22287 namespace Renderer {
22288 type Event<Params extends object = {}> = Electron.Event<Params>;
22289 const contextBridge: ContextBridge;
22290 type ContextBridge = Electron.ContextBridge;
22291 const ipcRenderer: IpcRenderer;
22292 type IpcRenderer = Electron.IpcRenderer;
22293 const webFrame: WebFrame;
22294 type WebFrame = Electron.WebFrame;
22295 const webUtils: WebUtils;
22296 type WebUtils = Electron.WebUtils;
22297 type WebviewTag = Electron.WebviewTag;
22298 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
22299 type AddRepresentationOptions = Electron.AddRepresentationOptions;
22300 type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
22301 type AnimationSettings = Electron.AnimationSettings;
22302 type AppDetailsOptions = Electron.AppDetailsOptions;
22303 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
22304 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
22305 type AuthInfo = Electron.AuthInfo;
22306 type AutoResizeOptions = Electron.AutoResizeOptions;
22307 type BeforeSendResponse = Electron.BeforeSendResponse;
22308 type BitmapOptions = Electron.BitmapOptions;
22309 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
22310 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
22311 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
22312 type CallbackResponse = Electron.CallbackResponse;
22313 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
22314 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
22315 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
22316 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
22317 type CloseOpts = Electron.CloseOpts;
22318 type Config = Electron.Config;
22319 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
22320 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
22321 type ContextMenuEvent = Electron.ContextMenuEvent;
22322 type ContextMenuParams = Electron.ContextMenuParams;
22323 type ContinueActivityDetails = Electron.ContinueActivityDetails;
22324 type CookiesGetFilter = Electron.CookiesGetFilter;
22325 type CookiesSetDetails = Electron.CookiesSetDetails;
22326 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
22327 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
22328 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
22329 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
22330 type Data = Electron.Data;
22331 type DefaultFontFamily = Electron.DefaultFontFamily;
22332 type Details = Electron.Details;
22333 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
22334 type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
22335 type DevtoolsSearchQueryEvent = Electron.DevtoolsSearchQueryEvent;
22336 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
22337 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
22338 type DidFailLoadEvent = Electron.DidFailLoadEvent;
22339 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
22340 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
22341 type DidNavigateEvent = Electron.DidNavigateEvent;
22342 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
22343 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
22344 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
22345 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
22346 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
22347 type DownloadURLOptions = Electron.DownloadURLOptions;
22348 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
22349 type EntryAtIndex = Electron.EntryAtIndex;
22350 type FeedURLOptions = Electron.FeedURLOptions;
22351 type FileIconOptions = Electron.FileIconOptions;
22352 type FindInPageOptions = Electron.FindInPageOptions;
22353 type FocusOptions = Electron.FocusOptions;
22354 type ForkOptions = Electron.ForkOptions;
22355 type FoundInPageEvent = Electron.FoundInPageEvent;
22356 type FrameCreatedDetails = Electron.FrameCreatedDetails;
22357 type FromPartitionOptions = Electron.FromPartitionOptions;
22358 type FromPathOptions = Electron.FromPathOptions;
22359 type HandlerDetails = Electron.HandlerDetails;
22360 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
22361 type HeapStatistics = Electron.HeapStatistics;
22362 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
22363 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
22364 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
22365 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
22366 type ImportCertificateOptions = Electron.ImportCertificateOptions;
22367 type Info = Electron.Info;
22368 type Input = Electron.Input;
22369 type InsertCSSOptions = Electron.InsertCSSOptions;
22370 type IpcMessageEvent = Electron.IpcMessageEvent;
22371 type Item = Electron.Item;
22372 type JumpListSettings = Electron.JumpListSettings;
22373 type LoadCommitEvent = Electron.LoadCommitEvent;
22374 type LoadExtensionOptions = Electron.LoadExtensionOptions;
22375 type LoadFileOptions = Electron.LoadFileOptions;
22376 type LoadURLOptions = Electron.LoadURLOptions;
22377 type LoginItemSettings = Electron.LoginItemSettings;
22378 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
22379 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
22380 type MessageBoxOptions = Electron.MessageBoxOptions;
22381 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
22382 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
22383 type MessageDetails = Electron.MessageDetails;
22384 type MessageEvent = Electron.MessageEvent;
22385 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
22386 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
22387 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
22388 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
22389 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
22390 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
22391 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
22392 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
22393 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
22394 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
22395 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
22396 type OpenDialogOptions = Electron.OpenDialogOptions;
22397 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
22398 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
22399 type OpenExternalOptions = Electron.OpenExternalOptions;
22400 type Options = Electron.Options;
22401 type Opts = Electron.Opts;
22402 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
22403 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
22404 type Parameters = Electron.Parameters;
22405 type Payment = Electron.Payment;
22406 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
22407 type PluginCrashedEvent = Electron.PluginCrashedEvent;
22408 type PopupOptions = Electron.PopupOptions;
22409 type PreconnectOptions = Electron.PreconnectOptions;
22410 type PrintToPDFOptions = Electron.PrintToPDFOptions;
22411 type Privileges = Electron.Privileges;
22412 type ProgressBarOptions = Electron.ProgressBarOptions;
22413 type Provider = Electron.Provider;
22414 type PurchaseProductOpts = Electron.PurchaseProductOpts;
22415 type ReadBookmark = Electron.ReadBookmark;
22416 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
22417 type RelaunchOptions = Electron.RelaunchOptions;
22418 type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
22419 type Request = Electron.Request;
22420 type ResizeOptions = Electron.ResizeOptions;
22421 type ResolveHostOptions = Electron.ResolveHostOptions;
22422 type ResourceUsage = Electron.ResourceUsage;
22423 type Response = Electron.Response;
22424 type Result = Electron.Result;
22425 type SaveDialogOptions = Electron.SaveDialogOptions;
22426 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
22427 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
22428 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
22429 type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
22430 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
22431 type Settings = Electron.Settings;
22432 type SourcesOptions = Electron.SourcesOptions;
22433 type StartLoggingOptions = Electron.StartLoggingOptions;
22434 type Streams = Electron.Streams;
22435 type SystemMemoryInfo = Electron.SystemMemoryInfo;
22436 type TitleBarOverlay = Electron.TitleBarOverlay;
22437 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
22438 type TitleOptions = Electron.TitleOptions;
22439 type ToBitmapOptions = Electron.ToBitmapOptions;
22440 type ToDataURLOptions = Electron.ToDataURLOptions;
22441 type ToPNGOptions = Electron.ToPNGOptions;
22442 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
22443 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
22444 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
22445 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
22446 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
22447 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
22448 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
22449 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
22450 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
22451 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
22452 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
22453 type UdpPortRange = Electron.UdpPortRange;
22454 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
22455 type UploadProgress = Electron.UploadProgress;
22456 type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
22457 type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
22458 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
22459 type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
22460 type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
22461 type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
22462 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
22463 type WebContentsViewConstructorOptions = Electron.WebContentsViewConstructorOptions;
22464 type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
22465 type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
22466 type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
22467 type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
22468 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
22469 type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
22470 type WillNavigateEvent = Electron.WillNavigateEvent;
22471 type WillResizeDetails = Electron.WillResizeDetails;
22472 type EditFlags = Electron.EditFlags;
22473 type Env = Electron.Env;
22474 type FoundInPageResult = Electron.FoundInPageResult;
22475 type LaunchItems = Electron.LaunchItems;
22476 type Margins = Electron.Margins;
22477 type MediaFlags = Electron.MediaFlags;
22478 type PageRanges = Electron.PageRanges;
22479 type Params = Electron.Params;
22480 type Video = Electron.Video;
22481 type BaseWindowConstructorOptions = Electron.BaseWindowConstructorOptions;
22482 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
22483 type BluetoothDevice = Electron.BluetoothDevice;
22484 type Certificate = Electron.Certificate;
22485 type CertificatePrincipal = Electron.CertificatePrincipal;
22486 type Cookie = Electron.Cookie;
22487 type CPUUsage = Electron.CPUUsage;
22488 type CrashReport = Electron.CrashReport;
22489 type CustomScheme = Electron.CustomScheme;
22490 type DesktopCapturerSource = Electron.DesktopCapturerSource;
22491 type Display = Electron.Display;
22492 type Extension = Electron.Extension;
22493 type ExtensionInfo = Electron.ExtensionInfo;
22494 type FileFilter = Electron.FileFilter;
22495 type FilePathWithHeaders = Electron.FilePathWithHeaders;
22496 type FilesystemPermissionRequest = Electron.FilesystemPermissionRequest;
22497 type GPUFeatureStatus = Electron.GPUFeatureStatus;
22498 type HIDDevice = Electron.HIDDevice;
22499 type InputEvent = Electron.InputEvent;
22500 type IpcMainEvent = Electron.IpcMainEvent;
22501 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
22502 type IpcRendererEvent = Electron.IpcRendererEvent;
22503 type JumpListCategory = Electron.JumpListCategory;
22504 type JumpListItem = Electron.JumpListItem;
22505 type KeyboardEvent = Electron.KeyboardEvent;
22506 type KeyboardInputEvent = Electron.KeyboardInputEvent;
22507 type MediaAccessPermissionRequest = Electron.MediaAccessPermissionRequest;
22508 type MemoryInfo = Electron.MemoryInfo;
22509 type MemoryUsageDetails = Electron.MemoryUsageDetails;
22510 type MimeTypedBuffer = Electron.MimeTypedBuffer;
22511 type MouseInputEvent = Electron.MouseInputEvent;
22512 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
22513 type NotificationAction = Electron.NotificationAction;
22514 type NotificationResponse = Electron.NotificationResponse;
22515 type OpenExternalPermissionRequest = Electron.OpenExternalPermissionRequest;
22516 type PaymentDiscount = Electron.PaymentDiscount;
22517 type PermissionRequest = Electron.PermissionRequest;
22518 type Point = Electron.Point;
22519 type PostBody = Electron.PostBody;
22520 type PrinterInfo = Electron.PrinterInfo;
22521 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
22522 type ProcessMetric = Electron.ProcessMetric;
22523 type Product = Electron.Product;
22524 type ProductDiscount = Electron.ProductDiscount;
22525 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
22526 type ProtocolRequest = Electron.ProtocolRequest;
22527 type ProtocolResponse = Electron.ProtocolResponse;
22528 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
22529 type ProxyConfig = Electron.ProxyConfig;
22530 type Rectangle = Electron.Rectangle;
22531 type Referrer = Electron.Referrer;
22532 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
22533 type ResolvedEndpoint = Electron.ResolvedEndpoint;
22534 type ResolvedHost = Electron.ResolvedHost;
22535 type ScrubberItem = Electron.ScrubberItem;
22536 type SegmentedControlSegment = Electron.SegmentedControlSegment;
22537 type SerialPort = Electron.SerialPort;
22538 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
22539 type SharedWorkerInfo = Electron.SharedWorkerInfo;
22540 type SharingItem = Electron.SharingItem;
22541 type ShortcutDetails = Electron.ShortcutDetails;
22542 type Size = Electron.Size;
22543 type Task = Electron.Task;
22544 type ThumbarButton = Electron.ThumbarButton;
22545 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
22546 type TraceConfig = Electron.TraceConfig;
22547 type Transaction = Electron.Transaction;
22548 type UploadData = Electron.UploadData;
22549 type UploadFile = Electron.UploadFile;
22550 type UploadRawData = Electron.UploadRawData;
22551 type USBDevice = Electron.USBDevice;
22552 type UserDefaultTypes = Electron.UserDefaultTypes;
22553 type WebPreferences = Electron.WebPreferences;
22554 type WebRequestFilter = Electron.WebRequestFilter;
22555 type WebSource = Electron.WebSource;
22556 }
22557
22558 namespace Utility {
22559 type Event<Params extends object = {}> = Electron.Event<Params>;
22560 type ClientRequest = Electron.ClientRequest;
22561 type IncomingMessage = Electron.IncomingMessage;
22562 const net: Net;
22563 type Net = Electron.Net;
22564 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
22565 type AddRepresentationOptions = Electron.AddRepresentationOptions;
22566 type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
22567 type AnimationSettings = Electron.AnimationSettings;
22568 type AppDetailsOptions = Electron.AppDetailsOptions;
22569 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
22570 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
22571 type AuthInfo = Electron.AuthInfo;
22572 type AutoResizeOptions = Electron.AutoResizeOptions;
22573 type BeforeSendResponse = Electron.BeforeSendResponse;
22574 type BitmapOptions = Electron.BitmapOptions;
22575 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
22576 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
22577 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
22578 type CallbackResponse = Electron.CallbackResponse;
22579 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
22580 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
22581 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
22582 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
22583 type CloseOpts = Electron.CloseOpts;
22584 type Config = Electron.Config;
22585 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
22586 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
22587 type ContextMenuEvent = Electron.ContextMenuEvent;
22588 type ContextMenuParams = Electron.ContextMenuParams;
22589 type ContinueActivityDetails = Electron.ContinueActivityDetails;
22590 type CookiesGetFilter = Electron.CookiesGetFilter;
22591 type CookiesSetDetails = Electron.CookiesSetDetails;
22592 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
22593 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
22594 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
22595 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
22596 type Data = Electron.Data;
22597 type DefaultFontFamily = Electron.DefaultFontFamily;
22598 type Details = Electron.Details;
22599 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
22600 type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
22601 type DevtoolsSearchQueryEvent = Electron.DevtoolsSearchQueryEvent;
22602 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
22603 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
22604 type DidFailLoadEvent = Electron.DidFailLoadEvent;
22605 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
22606 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
22607 type DidNavigateEvent = Electron.DidNavigateEvent;
22608 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
22609 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
22610 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
22611 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
22612 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
22613 type DownloadURLOptions = Electron.DownloadURLOptions;
22614 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
22615 type EntryAtIndex = Electron.EntryAtIndex;
22616 type FeedURLOptions = Electron.FeedURLOptions;
22617 type FileIconOptions = Electron.FileIconOptions;
22618 type FindInPageOptions = Electron.FindInPageOptions;
22619 type FocusOptions = Electron.FocusOptions;
22620 type ForkOptions = Electron.ForkOptions;
22621 type FoundInPageEvent = Electron.FoundInPageEvent;
22622 type FrameCreatedDetails = Electron.FrameCreatedDetails;
22623 type FromPartitionOptions = Electron.FromPartitionOptions;
22624 type FromPathOptions = Electron.FromPathOptions;
22625 type HandlerDetails = Electron.HandlerDetails;
22626 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
22627 type HeapStatistics = Electron.HeapStatistics;
22628 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
22629 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
22630 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
22631 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
22632 type ImportCertificateOptions = Electron.ImportCertificateOptions;
22633 type Info = Electron.Info;
22634 type Input = Electron.Input;
22635 type InsertCSSOptions = Electron.InsertCSSOptions;
22636 type IpcMessageEvent = Electron.IpcMessageEvent;
22637 type Item = Electron.Item;
22638 type JumpListSettings = Electron.JumpListSettings;
22639 type LoadCommitEvent = Electron.LoadCommitEvent;
22640 type LoadExtensionOptions = Electron.LoadExtensionOptions;
22641 type LoadFileOptions = Electron.LoadFileOptions;
22642 type LoadURLOptions = Electron.LoadURLOptions;
22643 type LoginItemSettings = Electron.LoginItemSettings;
22644 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
22645 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
22646 type MessageBoxOptions = Electron.MessageBoxOptions;
22647 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
22648 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
22649 type MessageDetails = Electron.MessageDetails;
22650 type MessageEvent = Electron.MessageEvent;
22651 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
22652 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
22653 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
22654 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
22655 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
22656 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
22657 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
22658 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
22659 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
22660 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
22661 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
22662 type OpenDialogOptions = Electron.OpenDialogOptions;
22663 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
22664 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
22665 type OpenExternalOptions = Electron.OpenExternalOptions;
22666 type Options = Electron.Options;
22667 type Opts = Electron.Opts;
22668 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
22669 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
22670 type Parameters = Electron.Parameters;
22671 type Payment = Electron.Payment;
22672 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
22673 type PluginCrashedEvent = Electron.PluginCrashedEvent;
22674 type PopupOptions = Electron.PopupOptions;
22675 type PreconnectOptions = Electron.PreconnectOptions;
22676 type PrintToPDFOptions = Electron.PrintToPDFOptions;
22677 type Privileges = Electron.Privileges;
22678 type ProgressBarOptions = Electron.ProgressBarOptions;
22679 type Provider = Electron.Provider;
22680 type PurchaseProductOpts = Electron.PurchaseProductOpts;
22681 type ReadBookmark = Electron.ReadBookmark;
22682 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
22683 type RelaunchOptions = Electron.RelaunchOptions;
22684 type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
22685 type Request = Electron.Request;
22686 type ResizeOptions = Electron.ResizeOptions;
22687 type ResolveHostOptions = Electron.ResolveHostOptions;
22688 type ResourceUsage = Electron.ResourceUsage;
22689 type Response = Electron.Response;
22690 type Result = Electron.Result;
22691 type SaveDialogOptions = Electron.SaveDialogOptions;
22692 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
22693 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
22694 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
22695 type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
22696 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
22697 type Settings = Electron.Settings;
22698 type SourcesOptions = Electron.SourcesOptions;
22699 type StartLoggingOptions = Electron.StartLoggingOptions;
22700 type Streams = Electron.Streams;
22701 type SystemMemoryInfo = Electron.SystemMemoryInfo;
22702 type TitleBarOverlay = Electron.TitleBarOverlay;
22703 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
22704 type TitleOptions = Electron.TitleOptions;
22705 type ToBitmapOptions = Electron.ToBitmapOptions;
22706 type ToDataURLOptions = Electron.ToDataURLOptions;
22707 type ToPNGOptions = Electron.ToPNGOptions;
22708 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
22709 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
22710 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
22711 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
22712 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
22713 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
22714 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
22715 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
22716 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
22717 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
22718 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
22719 type UdpPortRange = Electron.UdpPortRange;
22720 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
22721 type UploadProgress = Electron.UploadProgress;
22722 type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
22723 type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
22724 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
22725 type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
22726 type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
22727 type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
22728 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
22729 type WebContentsViewConstructorOptions = Electron.WebContentsViewConstructorOptions;
22730 type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
22731 type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
22732 type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
22733 type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
22734 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
22735 type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
22736 type WillNavigateEvent = Electron.WillNavigateEvent;
22737 type WillResizeDetails = Electron.WillResizeDetails;
22738 type EditFlags = Electron.EditFlags;
22739 type Env = Electron.Env;
22740 type FoundInPageResult = Electron.FoundInPageResult;
22741 type LaunchItems = Electron.LaunchItems;
22742 type Margins = Electron.Margins;
22743 type MediaFlags = Electron.MediaFlags;
22744 type PageRanges = Electron.PageRanges;
22745 type Params = Electron.Params;
22746 type Video = Electron.Video;
22747 type BaseWindowConstructorOptions = Electron.BaseWindowConstructorOptions;
22748 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
22749 type BluetoothDevice = Electron.BluetoothDevice;
22750 type Certificate = Electron.Certificate;
22751 type CertificatePrincipal = Electron.CertificatePrincipal;
22752 type Cookie = Electron.Cookie;
22753 type CPUUsage = Electron.CPUUsage;
22754 type CrashReport = Electron.CrashReport;
22755 type CustomScheme = Electron.CustomScheme;
22756 type DesktopCapturerSource = Electron.DesktopCapturerSource;
22757 type Display = Electron.Display;
22758 type Extension = Electron.Extension;
22759 type ExtensionInfo = Electron.ExtensionInfo;
22760 type FileFilter = Electron.FileFilter;
22761 type FilePathWithHeaders = Electron.FilePathWithHeaders;
22762 type FilesystemPermissionRequest = Electron.FilesystemPermissionRequest;
22763 type GPUFeatureStatus = Electron.GPUFeatureStatus;
22764 type HIDDevice = Electron.HIDDevice;
22765 type InputEvent = Electron.InputEvent;
22766 type IpcMainEvent = Electron.IpcMainEvent;
22767 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
22768 type IpcRendererEvent = Electron.IpcRendererEvent;
22769 type JumpListCategory = Electron.JumpListCategory;
22770 type JumpListItem = Electron.JumpListItem;
22771 type KeyboardEvent = Electron.KeyboardEvent;
22772 type KeyboardInputEvent = Electron.KeyboardInputEvent;
22773 type MediaAccessPermissionRequest = Electron.MediaAccessPermissionRequest;
22774 type MemoryInfo = Electron.MemoryInfo;
22775 type MemoryUsageDetails = Electron.MemoryUsageDetails;
22776 type MimeTypedBuffer = Electron.MimeTypedBuffer;
22777 type MouseInputEvent = Electron.MouseInputEvent;
22778 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
22779 type NotificationAction = Electron.NotificationAction;
22780 type NotificationResponse = Electron.NotificationResponse;
22781 type OpenExternalPermissionRequest = Electron.OpenExternalPermissionRequest;
22782 type PaymentDiscount = Electron.PaymentDiscount;
22783 type PermissionRequest = Electron.PermissionRequest;
22784 type Point = Electron.Point;
22785 type PostBody = Electron.PostBody;
22786 type PrinterInfo = Electron.PrinterInfo;
22787 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
22788 type ProcessMetric = Electron.ProcessMetric;
22789 type Product = Electron.Product;
22790 type ProductDiscount = Electron.ProductDiscount;
22791 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
22792 type ProtocolRequest = Electron.ProtocolRequest;
22793 type ProtocolResponse = Electron.ProtocolResponse;
22794 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
22795 type ProxyConfig = Electron.ProxyConfig;
22796 type Rectangle = Electron.Rectangle;
22797 type Referrer = Electron.Referrer;
22798 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
22799 type ResolvedEndpoint = Electron.ResolvedEndpoint;
22800 type ResolvedHost = Electron.ResolvedHost;
22801 type ScrubberItem = Electron.ScrubberItem;
22802 type SegmentedControlSegment = Electron.SegmentedControlSegment;
22803 type SerialPort = Electron.SerialPort;
22804 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
22805 type SharedWorkerInfo = Electron.SharedWorkerInfo;
22806 type SharingItem = Electron.SharingItem;
22807 type ShortcutDetails = Electron.ShortcutDetails;
22808 type Size = Electron.Size;
22809 type Task = Electron.Task;
22810 type ThumbarButton = Electron.ThumbarButton;
22811 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
22812 type TraceConfig = Electron.TraceConfig;
22813 type Transaction = Electron.Transaction;
22814 type UploadData = Electron.UploadData;
22815 type UploadFile = Electron.UploadFile;
22816 type UploadRawData = Electron.UploadRawData;
22817 type USBDevice = Electron.USBDevice;
22818 type UserDefaultTypes = Electron.UserDefaultTypes;
22819 type WebPreferences = Electron.WebPreferences;
22820 type WebRequestFilter = Electron.WebRequestFilter;
22821 type WebSource = Electron.WebSource;
22822 }
22823
22824 namespace CrossProcessExports {
22825 type Event<Params extends object = {}> = Electron.Event<Params>;
22826 const app: App;
22827 type App = Electron.App;
22828 const autoUpdater: AutoUpdater;
22829 type AutoUpdater = Electron.AutoUpdater;
22830 class BaseWindow extends Electron.BaseWindow {}
22831 class BrowserView extends Electron.BrowserView {}
22832 class BrowserWindow extends Electron.BrowserWindow {}
22833 type ClientRequest = Electron.ClientRequest;
22834 const clipboard: Clipboard;
22835 type Clipboard = Electron.Clipboard;
22836 type CommandLine = Electron.CommandLine;
22837 const contentTracing: ContentTracing;
22838 type ContentTracing = Electron.ContentTracing;
22839 const contextBridge: ContextBridge;
22840 type ContextBridge = Electron.ContextBridge;
22841 type Cookies = Electron.Cookies;
22842 const crashReporter: CrashReporter;
22843 type CrashReporter = Electron.CrashReporter;
22844 type Debugger = Electron.Debugger;
22845 const desktopCapturer: DesktopCapturer;
22846 type DesktopCapturer = Electron.DesktopCapturer;
22847 const dialog: Dialog;
22848 type Dialog = Electron.Dialog;
22849 type Dock = Electron.Dock;
22850 type DownloadItem = Electron.DownloadItem;
22851 const globalShortcut: GlobalShortcut;
22852 type GlobalShortcut = Electron.GlobalShortcut;
22853 const inAppPurchase: InAppPurchase;
22854 type InAppPurchase = Electron.InAppPurchase;
22855 type IncomingMessage = Electron.IncomingMessage;
22856 const ipcMain: IpcMain;
22857 type IpcMain = Electron.IpcMain;
22858 const ipcRenderer: IpcRenderer;
22859 type IpcRenderer = Electron.IpcRenderer;
22860 class Menu extends Electron.Menu {}
22861 class MenuItem extends Electron.MenuItem {}
22862 class MessageChannelMain extends Electron.MessageChannelMain {}
22863 type MessagePortMain = Electron.MessagePortMain;
22864 const nativeImage: typeof NativeImage;
22865 type NativeImage = Electron.NativeImage;
22866 const nativeTheme: NativeTheme;
22867 type NativeTheme = Electron.NativeTheme;
22868 type NavigationHistory = Electron.NavigationHistory;
22869 const net: Net;
22870 type Net = Electron.Net;
22871 const netLog: NetLog;
22872 type NetLog = Electron.NetLog;
22873 class Notification extends Electron.Notification {}
22874 const powerMonitor: PowerMonitor;
22875 type PowerMonitor = Electron.PowerMonitor;
22876 const powerSaveBlocker: PowerSaveBlocker;
22877 type PowerSaveBlocker = Electron.PowerSaveBlocker;
22878 const protocol: Protocol;
22879 type Protocol = Electron.Protocol;
22880 const pushNotifications: PushNotifications;
22881 type PushNotifications = Electron.PushNotifications;
22882 const safeStorage: SafeStorage;
22883 type SafeStorage = Electron.SafeStorage;
22884 const screen: Screen;
22885 type Screen = Electron.Screen;
22886 type ServiceWorkers = Electron.ServiceWorkers;
22887 const session: typeof Session;
22888 type Session = Electron.Session;
22889 class ShareMenu extends Electron.ShareMenu {}
22890 const shell: Shell;
22891 type Shell = Electron.Shell;
22892 const systemPreferences: SystemPreferences;
22893 type SystemPreferences = Electron.SystemPreferences;
22894 class TouchBar extends Electron.TouchBar {}
22895 type TouchBarButton = Electron.TouchBarButton;
22896 type TouchBarColorPicker = Electron.TouchBarColorPicker;
22897 type TouchBarGroup = Electron.TouchBarGroup;
22898 type TouchBarLabel = Electron.TouchBarLabel;
22899 type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
22900 type TouchBarPopover = Electron.TouchBarPopover;
22901 type TouchBarScrubber = Electron.TouchBarScrubber;
22902 type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
22903 type TouchBarSlider = Electron.TouchBarSlider;
22904 type TouchBarSpacer = Electron.TouchBarSpacer;
22905 class Tray extends Electron.Tray {}
22906 const utilityProcess: typeof UtilityProcess;
22907 type UtilityProcess = Electron.UtilityProcess;
22908 class View extends Electron.View {}
22909 const webContents: typeof WebContents;
22910 type WebContents = Electron.WebContents;
22911 class WebContentsView extends Electron.WebContentsView {}
22912 const webFrame: WebFrame;
22913 type WebFrame = Electron.WebFrame;
22914 const webFrameMain: typeof WebFrameMain;
22915 type WebFrameMain = Electron.WebFrameMain;
22916 type WebRequest = Electron.WebRequest;
22917 const webUtils: WebUtils;
22918 type WebUtils = Electron.WebUtils;
22919 type WebviewTag = Electron.WebviewTag;
22920 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
22921 type AddRepresentationOptions = Electron.AddRepresentationOptions;
22922 type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
22923 type AnimationSettings = Electron.AnimationSettings;
22924 type AppDetailsOptions = Electron.AppDetailsOptions;
22925 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
22926 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
22927 type AuthInfo = Electron.AuthInfo;
22928 type AutoResizeOptions = Electron.AutoResizeOptions;
22929 type BeforeSendResponse = Electron.BeforeSendResponse;
22930 type BitmapOptions = Electron.BitmapOptions;
22931 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
22932 type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
22933 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
22934 type CallbackResponse = Electron.CallbackResponse;
22935 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
22936 type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
22937 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
22938 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
22939 type CloseOpts = Electron.CloseOpts;
22940 type Config = Electron.Config;
22941 type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
22942 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
22943 type ContextMenuEvent = Electron.ContextMenuEvent;
22944 type ContextMenuParams = Electron.ContextMenuParams;
22945 type ContinueActivityDetails = Electron.ContinueActivityDetails;
22946 type CookiesGetFilter = Electron.CookiesGetFilter;
22947 type CookiesSetDetails = Electron.CookiesSetDetails;
22948 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
22949 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
22950 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
22951 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
22952 type Data = Electron.Data;
22953 type DefaultFontFamily = Electron.DefaultFontFamily;
22954 type Details = Electron.Details;
22955 type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
22956 type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
22957 type DevtoolsSearchQueryEvent = Electron.DevtoolsSearchQueryEvent;
22958 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
22959 type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
22960 type DidFailLoadEvent = Electron.DidFailLoadEvent;
22961 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
22962 type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
22963 type DidNavigateEvent = Electron.DidNavigateEvent;
22964 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
22965 type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
22966 type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
22967 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
22968 type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
22969 type DownloadURLOptions = Electron.DownloadURLOptions;
22970 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
22971 type EntryAtIndex = Electron.EntryAtIndex;
22972 type FeedURLOptions = Electron.FeedURLOptions;
22973 type FileIconOptions = Electron.FileIconOptions;
22974 type FindInPageOptions = Electron.FindInPageOptions;
22975 type FocusOptions = Electron.FocusOptions;
22976 type ForkOptions = Electron.ForkOptions;
22977 type FoundInPageEvent = Electron.FoundInPageEvent;
22978 type FrameCreatedDetails = Electron.FrameCreatedDetails;
22979 type FromPartitionOptions = Electron.FromPartitionOptions;
22980 type FromPathOptions = Electron.FromPathOptions;
22981 type HandlerDetails = Electron.HandlerDetails;
22982 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
22983 type HeapStatistics = Electron.HeapStatistics;
22984 type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
22985 type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
22986 type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
22987 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
22988 type ImportCertificateOptions = Electron.ImportCertificateOptions;
22989 type Info = Electron.Info;
22990 type Input = Electron.Input;
22991 type InsertCSSOptions = Electron.InsertCSSOptions;
22992 type IpcMessageEvent = Electron.IpcMessageEvent;
22993 type Item = Electron.Item;
22994 type JumpListSettings = Electron.JumpListSettings;
22995 type LoadCommitEvent = Electron.LoadCommitEvent;
22996 type LoadExtensionOptions = Electron.LoadExtensionOptions;
22997 type LoadFileOptions = Electron.LoadFileOptions;
22998 type LoadURLOptions = Electron.LoadURLOptions;
22999 type LoginItemSettings = Electron.LoginItemSettings;
23000 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
23001 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
23002 type MessageBoxOptions = Electron.MessageBoxOptions;
23003 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
23004 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
23005 type MessageDetails = Electron.MessageDetails;
23006 type MessageEvent = Electron.MessageEvent;
23007 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
23008 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
23009 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
23010 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
23011 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
23012 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
23013 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
23014 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
23015 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
23016 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
23017 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
23018 type OpenDialogOptions = Electron.OpenDialogOptions;
23019 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
23020 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
23021 type OpenExternalOptions = Electron.OpenExternalOptions;
23022 type Options = Electron.Options;
23023 type Opts = Electron.Opts;
23024 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
23025 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
23026 type Parameters = Electron.Parameters;
23027 type Payment = Electron.Payment;
23028 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
23029 type PluginCrashedEvent = Electron.PluginCrashedEvent;
23030 type PopupOptions = Electron.PopupOptions;
23031 type PreconnectOptions = Electron.PreconnectOptions;
23032 type PrintToPDFOptions = Electron.PrintToPDFOptions;
23033 type Privileges = Electron.Privileges;
23034 type ProgressBarOptions = Electron.ProgressBarOptions;
23035 type Provider = Electron.Provider;
23036 type PurchaseProductOpts = Electron.PurchaseProductOpts;
23037 type ReadBookmark = Electron.ReadBookmark;
23038 type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
23039 type RelaunchOptions = Electron.RelaunchOptions;
23040 type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
23041 type Request = Electron.Request;
23042 type ResizeOptions = Electron.ResizeOptions;
23043 type ResolveHostOptions = Electron.ResolveHostOptions;
23044 type ResourceUsage = Electron.ResourceUsage;
23045 type Response = Electron.Response;
23046 type Result = Electron.Result;
23047 type SaveDialogOptions = Electron.SaveDialogOptions;
23048 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
23049 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
23050 type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
23051 type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
23052 type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
23053 type Settings = Electron.Settings;
23054 type SourcesOptions = Electron.SourcesOptions;
23055 type StartLoggingOptions = Electron.StartLoggingOptions;
23056 type Streams = Electron.Streams;
23057 type SystemMemoryInfo = Electron.SystemMemoryInfo;
23058 type TitleBarOverlay = Electron.TitleBarOverlay;
23059 type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
23060 type TitleOptions = Electron.TitleOptions;
23061 type ToBitmapOptions = Electron.ToBitmapOptions;
23062 type ToDataURLOptions = Electron.ToDataURLOptions;
23063 type ToPNGOptions = Electron.ToPNGOptions;
23064 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
23065 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
23066 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
23067 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
23068 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
23069 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
23070 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
23071 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
23072 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
23073 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
23074 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
23075 type UdpPortRange = Electron.UdpPortRange;
23076 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
23077 type UploadProgress = Electron.UploadProgress;
23078 type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
23079 type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
23080 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
23081 type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
23082 type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
23083 type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
23084 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
23085 type WebContentsViewConstructorOptions = Electron.WebContentsViewConstructorOptions;
23086 type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
23087 type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
23088 type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
23089 type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
23090 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
23091 type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
23092 type WillNavigateEvent = Electron.WillNavigateEvent;
23093 type WillResizeDetails = Electron.WillResizeDetails;
23094 type EditFlags = Electron.EditFlags;
23095 type Env = Electron.Env;
23096 type FoundInPageResult = Electron.FoundInPageResult;
23097 type LaunchItems = Electron.LaunchItems;
23098 type Margins = Electron.Margins;
23099 type MediaFlags = Electron.MediaFlags;
23100 type PageRanges = Electron.PageRanges;
23101 type Params = Electron.Params;
23102 type Video = Electron.Video;
23103 type BaseWindowConstructorOptions = Electron.BaseWindowConstructorOptions;
23104 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
23105 type BluetoothDevice = Electron.BluetoothDevice;
23106 type Certificate = Electron.Certificate;
23107 type CertificatePrincipal = Electron.CertificatePrincipal;
23108 type Cookie = Electron.Cookie;
23109 type CPUUsage = Electron.CPUUsage;
23110 type CrashReport = Electron.CrashReport;
23111 type CustomScheme = Electron.CustomScheme;
23112 type DesktopCapturerSource = Electron.DesktopCapturerSource;
23113 type Display = Electron.Display;
23114 type Extension = Electron.Extension;
23115 type ExtensionInfo = Electron.ExtensionInfo;
23116 type FileFilter = Electron.FileFilter;
23117 type FilePathWithHeaders = Electron.FilePathWithHeaders;
23118 type FilesystemPermissionRequest = Electron.FilesystemPermissionRequest;
23119 type GPUFeatureStatus = Electron.GPUFeatureStatus;
23120 type HIDDevice = Electron.HIDDevice;
23121 type InputEvent = Electron.InputEvent;
23122 type IpcMainEvent = Electron.IpcMainEvent;
23123 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
23124 type IpcRendererEvent = Electron.IpcRendererEvent;
23125 type JumpListCategory = Electron.JumpListCategory;
23126 type JumpListItem = Electron.JumpListItem;
23127 type KeyboardEvent = Electron.KeyboardEvent;
23128 type KeyboardInputEvent = Electron.KeyboardInputEvent;
23129 type MediaAccessPermissionRequest = Electron.MediaAccessPermissionRequest;
23130 type MemoryInfo = Electron.MemoryInfo;
23131 type MemoryUsageDetails = Electron.MemoryUsageDetails;
23132 type MimeTypedBuffer = Electron.MimeTypedBuffer;
23133 type MouseInputEvent = Electron.MouseInputEvent;
23134 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
23135 type NotificationAction = Electron.NotificationAction;
23136 type NotificationResponse = Electron.NotificationResponse;
23137 type OpenExternalPermissionRequest = Electron.OpenExternalPermissionRequest;
23138 type PaymentDiscount = Electron.PaymentDiscount;
23139 type PermissionRequest = Electron.PermissionRequest;
23140 type Point = Electron.Point;
23141 type PostBody = Electron.PostBody;
23142 type PrinterInfo = Electron.PrinterInfo;
23143 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
23144 type ProcessMetric = Electron.ProcessMetric;
23145 type Product = Electron.Product;
23146 type ProductDiscount = Electron.ProductDiscount;
23147 type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
23148 type ProtocolRequest = Electron.ProtocolRequest;
23149 type ProtocolResponse = Electron.ProtocolResponse;
23150 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
23151 type ProxyConfig = Electron.ProxyConfig;
23152 type Rectangle = Electron.Rectangle;
23153 type Referrer = Electron.Referrer;
23154 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
23155 type ResolvedEndpoint = Electron.ResolvedEndpoint;
23156 type ResolvedHost = Electron.ResolvedHost;
23157 type ScrubberItem = Electron.ScrubberItem;
23158 type SegmentedControlSegment = Electron.SegmentedControlSegment;
23159 type SerialPort = Electron.SerialPort;
23160 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
23161 type SharedWorkerInfo = Electron.SharedWorkerInfo;
23162 type SharingItem = Electron.SharingItem;
23163 type ShortcutDetails = Electron.ShortcutDetails;
23164 type Size = Electron.Size;
23165 type Task = Electron.Task;
23166 type ThumbarButton = Electron.ThumbarButton;
23167 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
23168 type TraceConfig = Electron.TraceConfig;
23169 type Transaction = Electron.Transaction;
23170 type UploadData = Electron.UploadData;
23171 type UploadFile = Electron.UploadFile;
23172 type UploadRawData = Electron.UploadRawData;
23173 type USBDevice = Electron.USBDevice;
23174 type UserDefaultTypes = Electron.UserDefaultTypes;
23175 type WebPreferences = Electron.WebPreferences;
23176 type WebRequestFilter = Electron.WebRequestFilter;
23177 type WebSource = Electron.WebSource;
23178 }
23179
23180 const app: App;
23181 const autoUpdater: AutoUpdater;
23182 const clipboard: Clipboard;
23183 const contentTracing: ContentTracing;
23184 const contextBridge: ContextBridge;
23185 const crashReporter: CrashReporter;
23186 const desktopCapturer: DesktopCapturer;
23187 const dialog: Dialog;
23188 const globalShortcut: GlobalShortcut;
23189 const inAppPurchase: InAppPurchase;
23190 const ipcMain: IpcMain;
23191 const ipcRenderer: IpcRenderer;
23192 const nativeImage: typeof NativeImage;
23193 const nativeTheme: NativeTheme;
23194 const net: Net;
23195 const netLog: NetLog;
23196 const parentPort: ParentPort;
23197 const powerMonitor: PowerMonitor;
23198 const powerSaveBlocker: PowerSaveBlocker;
23199 const protocol: Protocol;
23200 const pushNotifications: PushNotifications;
23201 const safeStorage: SafeStorage;
23202 const screen: Screen;
23203 const session: typeof Session;
23204 const shell: Shell;
23205 const systemPreferences: SystemPreferences;
23206 const utilityProcess: typeof UtilityProcess;
23207 const webContents: typeof WebContents;
23208 const webFrame: WebFrame;
23209 const webFrameMain: typeof WebFrameMain;
23210 const webUtils: WebUtils;
23211
23212}
23213
23214declare module 'electron' {
23215 export = Electron.CrossProcessExports;
23216}
23217
23218declare module 'electron/main' {
23219 export = Electron.Main;
23220}
23221
23222declare module 'electron/common' {
23223 export = Electron.Common;
23224}
23225
23226declare module 'electron/renderer' {
23227 export = Electron.Renderer;
23228}
23229
23230declare module 'electron/utility' {
23231 export = Electron.Utility;
23232}
23233
23234interface NodeRequireFunction {
23235 (moduleName: 'electron'): typeof Electron.CrossProcessExports;
23236 (moduleName: 'electron/main'): typeof Electron.Main;
23237 (moduleName: 'electron/common'): typeof Electron.Common;
23238 (moduleName: 'electron/renderer'): typeof Electron.Renderer;
23239 (moduleName: 'electron/utility'): typeof Electron.Utility;
23240}
23241
23242interface NodeRequire {
23243 (moduleName: 'electron'): typeof Electron.CrossProcessExports;
23244 (moduleName: 'electron/main'): typeof Electron.Main;
23245 (moduleName: 'electron/common'): typeof Electron.Common;
23246 (moduleName: 'electron/renderer'): typeof Electron.Renderer;
23247 (moduleName: 'electron/utility'): typeof Electron.Utility;
23248}
23249
23250interface File {
23251 /**
23252 * The real path to the file on the users filesystem
23253 */
23254 path: string;
23255}
23256
23257declare module 'original-fs' {
23258 import * as fs from 'fs';
23259 export = fs;
23260}
23261
23262declare module 'node:original-fs' {
23263 import * as fs from 'fs';
23264 export = fs;
23265}
23266
23267interface Document {
23268 createElement(tagName: 'webview'): Electron.WebviewTag;
23269}
23270
23271
23272declare namespace NodeJS {
23273 interface Process extends NodeJS.EventEmitter {
23274
23275 // Docs: https://electronjs.org/docs/api/process
23276
23277 /**
23278 * Emitted when Electron has loaded its internal initialization script and is
23279 * beginning to load the web page or the main script.
23280 */
23281 on(event: 'loaded', listener: Function): this;
23282 off(event: 'loaded', listener: Function): this;
23283 once(event: 'loaded', listener: Function): this;
23284 addListener(event: 'loaded', listener: Function): this;
23285 removeListener(event: 'loaded', listener: Function): this;
23286 /**
23287 * Causes the main thread of the current process crash.
23288 */
23289 crash(): void;
23290 /**
23291 * * `allocated` Integer - Size of all allocated objects in Kilobytes.
23292 * * `total` Integer - Total allocated space in Kilobytes.
23293 *
23294 * Returns an object with Blink memory information. It can be useful for debugging
23295 * rendering / DOM related memory issues. Note that all values are reported in
23296 * Kilobytes.
23297 */
23298 getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
23299 getCPUUsage(): Electron.CPUUsage;
23300 /**
23301 * The number of milliseconds since epoch, or `null` if the information is
23302 * unavailable
23303 *
23304 * Indicates the creation time of the application. The time is represented as
23305 * number of milliseconds since epoch. It returns null if it is unable to get the
23306 * process creation time.
23307 */
23308 getCreationTime(): (number) | (null);
23309 /**
23310 * * `totalHeapSize` Integer
23311 * * `totalHeapSizeExecutable` Integer
23312 * * `totalPhysicalSize` Integer
23313 * * `totalAvailableSize` Integer
23314 * * `usedHeapSize` Integer
23315 * * `heapSizeLimit` Integer
23316 * * `mallocedMemory` Integer
23317 * * `peakMallocedMemory` Integer
23318 * * `doesZapGarbage` boolean
23319 *
23320 * Returns an object with V8 heap statistics. Note that all statistics are reported
23321 * in Kilobytes.
23322 */
23323 getHeapStatistics(): Electron.HeapStatistics;
23324 /**
23325 * Resolves with a ProcessMemoryInfo
23326 *
23327 * Returns an object giving memory usage statistics about the current process. Note
23328 * that all statistics are reported in Kilobytes. This api should be called after
23329 * app ready.
23330 *
23331 * Chromium does not provide `residentSet` value for macOS. This is because macOS
23332 * performs in-memory compression of pages that haven't been recently used. As a
23333 * result the resident set size value is not what one would expect. `private`
23334 * memory is more representative of the actual pre-compression memory usage of the
23335 * process on macOS.
23336 */
23337 getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
23338 /**
23339 * * `total` Integer - The total amount of physical memory in Kilobytes available
23340 * to the system.
23341 * * `free` Integer - The total amount of memory not being used by applications or
23342 * disk cache.
23343 * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
23344 * Kilobytes available to the system.
23345 * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
23346 * Kilobytes available to the system.
23347 *
23348 * Returns an object giving memory usage statistics about the entire system. Note
23349 * that all statistics are reported in Kilobytes.
23350 */
23351 getSystemMemoryInfo(): Electron.SystemMemoryInfo;
23352 /**
23353 * The version of the host operating system.
23354 *
23355 * Example:
23356 *
23357 * **Note:** It returns the actual operating system version instead of kernel
23358 * version on macOS unlike `os.release()`.
23359 */
23360 getSystemVersion(): string;
23361 /**
23362 * Causes the main thread of the current process hang.
23363 */
23364 hang(): void;
23365 /**
23366 * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
23367 * whichever is lower for the current process.
23368 *
23369 * @platform darwin,linux
23370 */
23371 setFdLimit(maxDescriptors: number): void;
23372 /**
23373 * Indicates whether the snapshot has been created successfully.
23374 *
23375 * Takes a V8 heap snapshot and saves it to `filePath`.
23376 */
23377 takeHeapSnapshot(filePath: string): boolean;
23378 /**
23379 * A `string` representing Chrome's version string.
23380 *
23381 */
23382 readonly chrome: string;
23383 /**
23384 * A `string` (optional) representing a globally unique ID of the current
23385 * JavaScript context. Each frame has its own JavaScript context. When
23386 * contextIsolation is enabled, the isolated world also has a separate JavaScript
23387 * context. This property is only available in the renderer process.
23388 *
23389 */
23390 readonly contextId?: string;
23391 /**
23392 * A `boolean` that indicates whether the current renderer context has
23393 * `contextIsolation` enabled. It is `undefined` in the main process.
23394 *
23395 */
23396 readonly contextIsolated: boolean;
23397 /**
23398 * A `boolean`. When the app is started by being passed as parameter to the default
23399 * Electron executable, this property is `true` in the main process, otherwise it
23400 * is `undefined`. For example when running the app with `electron .`, it is
23401 * `true`, even if the app is packaged (`isPackaged`) is `true`. This can be useful
23402 * to determine how many arguments will need to be sliced off from `process.argv`.
23403 *
23404 */
23405 readonly defaultApp: boolean;
23406 /**
23407 * A `string` representing Electron's version string.
23408 *
23409 */
23410 readonly electron: string;
23411 /**
23412 * A `boolean`, `true` when the current renderer context is the "main" renderer
23413 * frame. If you want the ID of the current frame you should use
23414 * `webFrame.routingId`.
23415 *
23416 */
23417 readonly isMainFrame: boolean;
23418 /**
23419 * A `boolean`. For Mac App Store build, this property is `true`, for other builds
23420 * it is `undefined`.
23421 *
23422 */
23423 readonly mas: boolean;
23424 /**
23425 * A `boolean` that controls ASAR support inside your application. Setting this to
23426 * `true` will disable the support for `asar` archives in Node's built-in modules.
23427 */
23428 noAsar: boolean;
23429 /**
23430 * A `boolean` that controls whether or not deprecation warnings are printed to
23431 * `stderr`. Setting this to `true` will silence deprecation warnings. This
23432 * property is used instead of the `--no-deprecation` command line flag.
23433 */
23434 noDeprecation: boolean;
23435 /**
23436 * A `Electron.ParentPort` property if this is a `UtilityProcess` (or `null`
23437 * otherwise) allowing communication with the parent process.
23438 */
23439 parentPort: Electron.ParentPort;
23440 /**
23441 * A `string` representing the path to the resources directory.
23442 *
23443 */
23444 readonly resourcesPath: string;
23445 /**
23446 * A `boolean`. When the renderer process is sandboxed, this property is `true`,
23447 * otherwise it is `undefined`.
23448 *
23449 */
23450 readonly sandboxed: boolean;
23451 /**
23452 * A `boolean` that controls whether or not deprecation warnings will be thrown as
23453 * exceptions. Setting this to `true` will throw errors for deprecations. This
23454 * property is used instead of the `--throw-deprecation` command line flag.
23455 */
23456 throwDeprecation: boolean;
23457 /**
23458 * A `boolean` that controls whether or not deprecations printed to `stderr`
23459 * include their stack trace. Setting this to `true` will print stack traces for
23460 * deprecations. This property is instead of the `--trace-deprecation` command line
23461 * flag.
23462 */
23463 traceDeprecation: boolean;
23464 /**
23465 * A `boolean` that controls whether or not process warnings printed to `stderr`
23466 * include their stack trace. Setting this to `true` will print stack traces for
23467 * process warnings (including deprecations). This property is instead of the
23468 * `--trace-warnings` command line flag.
23469 */
23470 traceProcessWarnings: boolean;
23471 /**
23472 * A `string` representing the current process's type, can be:
23473 *
23474 * * `browser` - The main process
23475 * * `renderer` - A renderer process
23476 * * `worker` - In a web worker
23477 * * `utility` - In a node process launched as a service
23478 *
23479 */
23480 readonly type: ('browser' | 'renderer' | 'worker' | 'utility');
23481 /**
23482 * A `boolean`. If the app is running as a Windows Store app (appx), this property
23483 * is `true`, for otherwise it is `undefined`.
23484 *
23485 */
23486 readonly windowsStore: boolean;
23487 }
23488 interface ProcessVersions {
23489 readonly electron: string;
23490 readonly chrome: string;
23491 }
23492}
\No newline at end of file