UNPKG

629 kBTypeScriptView Raw
1// Type definitions for Electron 11.3.0
2// Project: http://electronjs.org/
3// Definitions by: The Electron Team <https://github.com/electron/electron>
4// Definitions: https://github.com/electron/electron-typescript-definitions
5
6/// <reference types="node" />
7
8type GlobalEvent = Event;
9
10declare namespace Electron {
11 const NodeEventEmitter: typeof import('events').EventEmitter;
12
13 class Accelerator extends String {
14
15 }
16 interface App extends NodeJS.EventEmitter {
17
18 // Docs: https://electronjs.org/docs/api/app
19
20 /**
21 * Emitted when Chrome's accessibility support changes. This event fires when
22 * assistive technologies, such as screen readers, are enabled or disabled. See
23 * https://www.chromium.org/developers/design-documents/accessibility for more
24 * details.
25 *
26 * @platform darwin,win32
27 */
28 on(event: 'accessibility-support-changed', listener: (event: Event,
29 /**
30 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
31 */
32 accessibilitySupportEnabled: boolean) => void): this;
33 once(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 addListener(event: 'accessibility-support-changed', listener: (event: Event,
39 /**
40 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
41 */
42 accessibilitySupportEnabled: boolean) => void): this;
43 removeListener(event: 'accessibility-support-changed', listener: (event: Event,
44 /**
45 * `true` when Chrome's accessibility support is enabled, `false` otherwise.
46 */
47 accessibilitySupportEnabled: boolean) => void): this;
48 /**
49 * Emitted when the application is activated. Various actions can trigger this
50 * event, such as launching the application for the first time, attempting to
51 * re-launch the application when it's already running, or clicking on the
52 * application's dock or taskbar icon.
53 *
54 * @platform darwin
55 */
56 on(event: 'activate', listener: (event: Event,
57 hasVisibleWindows: boolean) => void): this;
58 once(event: 'activate', listener: (event: Event,
59 hasVisibleWindows: boolean) => void): this;
60 addListener(event: 'activate', listener: (event: Event,
61 hasVisibleWindows: boolean) => void): this;
62 removeListener(event: 'activate', listener: (event: Event,
63 hasVisibleWindows: boolean) => void): this;
64 /**
65 * Emitted during Handoff after an activity from this device was successfully
66 * resumed on another one.
67 *
68 * @platform darwin
69 */
70 on(event: 'activity-was-continued', listener: (event: Event,
71 /**
72 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
73 */
74 type: string,
75 /**
76 * Contains app-specific state stored by the activity.
77 */
78 userInfo: unknown) => void): this;
79 once(event: 'activity-was-continued', listener: (event: Event,
80 /**
81 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
82 */
83 type: string,
84 /**
85 * Contains app-specific state stored by the activity.
86 */
87 userInfo: unknown) => void): this;
88 addListener(event: 'activity-was-continued', listener: (event: Event,
89 /**
90 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
91 */
92 type: string,
93 /**
94 * Contains app-specific state stored by the activity.
95 */
96 userInfo: unknown) => void): this;
97 removeListener(event: 'activity-was-continued', listener: (event: Event,
98 /**
99 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
100 */
101 type: string,
102 /**
103 * Contains app-specific state stored by the activity.
104 */
105 userInfo: unknown) => void): this;
106 /**
107 * Emitted before the application starts closing its windows. Calling
108 * `event.preventDefault()` will prevent the default behavior, which is terminating
109 * the application.
110 *
111 * **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
112 * then `before-quit` is emitted *after* emitting `close` event on all windows and
113 * closing them.
114 *
115 * **Note:** On Windows, this event will not be emitted if the app is closed due to
116 * a shutdown/restart of the system or a user logout.
117 */
118 on(event: 'before-quit', listener: (event: Event) => void): this;
119 once(event: 'before-quit', listener: (event: Event) => void): this;
120 addListener(event: 'before-quit', listener: (event: Event) => void): this;
121 removeListener(event: 'before-quit', listener: (event: Event) => void): this;
122 /**
123 * Emitted when a browserWindow gets blurred.
124 */
125 on(event: 'browser-window-blur', listener: (event: Event,
126 window: BrowserWindow) => void): this;
127 once(event: 'browser-window-blur', listener: (event: Event,
128 window: BrowserWindow) => void): this;
129 addListener(event: 'browser-window-blur', listener: (event: Event,
130 window: BrowserWindow) => void): this;
131 removeListener(event: 'browser-window-blur', listener: (event: Event,
132 window: BrowserWindow) => void): this;
133 /**
134 * Emitted when a new browserWindow is created.
135 */
136 on(event: 'browser-window-created', listener: (event: Event,
137 window: BrowserWindow) => void): this;
138 once(event: 'browser-window-created', listener: (event: Event,
139 window: BrowserWindow) => void): this;
140 addListener(event: 'browser-window-created', listener: (event: Event,
141 window: BrowserWindow) => void): this;
142 removeListener(event: 'browser-window-created', listener: (event: Event,
143 window: BrowserWindow) => void): this;
144 /**
145 * Emitted when a browserWindow gets focused.
146 */
147 on(event: 'browser-window-focus', listener: (event: Event,
148 window: BrowserWindow) => void): this;
149 once(event: 'browser-window-focus', listener: (event: Event,
150 window: BrowserWindow) => void): this;
151 addListener(event: 'browser-window-focus', listener: (event: Event,
152 window: BrowserWindow) => void): this;
153 removeListener(event: 'browser-window-focus', listener: (event: Event,
154 window: BrowserWindow) => void): this;
155 /**
156 * Emitted when failed to verify the `certificate` for `url`, to trust the
157 * certificate you should prevent the default behavior with
158 * `event.preventDefault()` and call `callback(true)`.
159 */
160 on(event: 'certificate-error', listener: (event: Event,
161 webContents: WebContents,
162 url: string,
163 /**
164 * The error code
165 */
166 error: string,
167 certificate: Certificate,
168 callback: (isTrusted: boolean) => void) => void): this;
169 once(event: 'certificate-error', listener: (event: Event,
170 webContents: WebContents,
171 url: string,
172 /**
173 * The error code
174 */
175 error: string,
176 certificate: Certificate,
177 callback: (isTrusted: boolean) => void) => void): this;
178 addListener(event: 'certificate-error', listener: (event: Event,
179 webContents: WebContents,
180 url: string,
181 /**
182 * The error code
183 */
184 error: string,
185 certificate: Certificate,
186 callback: (isTrusted: boolean) => void) => void): this;
187 removeListener(event: 'certificate-error', listener: (event: Event,
188 webContents: WebContents,
189 url: string,
190 /**
191 * The error code
192 */
193 error: string,
194 certificate: Certificate,
195 callback: (isTrusted: boolean) => void) => void): this;
196 /**
197 * Emitted when the child process unexpectedly disappears. This is normally because
198 * it was crashed or killed. It does not include renderer processes.
199 */
200 on(event: 'child-process-gone', listener: (event: Event,
201 details: Details) => void): this;
202 once(event: 'child-process-gone', listener: (event: Event,
203 details: Details) => void): this;
204 addListener(event: 'child-process-gone', listener: (event: Event,
205 details: Details) => void): this;
206 removeListener(event: 'child-process-gone', listener: (event: Event,
207 details: Details) => void): this;
208 /**
209 * Emitted during Handoff when an activity from a different device wants to be
210 * resumed. You should call `event.preventDefault()` if you want to handle this
211 * event.
212 *
213 * A user activity can be continued only in an app that has the same developer Team
214 * ID as the activity's source app and that supports the activity's type. Supported
215 * activity types are specified in the app's `Info.plist` under the
216 * `NSUserActivityTypes` key.
217 *
218 * @platform darwin
219 */
220 on(event: 'continue-activity', listener: (event: Event,
221 /**
222 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
223 */
224 type: string,
225 /**
226 * Contains app-specific state stored by the activity on another device.
227 */
228 userInfo: unknown) => void): this;
229 once(event: 'continue-activity', listener: (event: Event,
230 /**
231 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
232 */
233 type: string,
234 /**
235 * Contains app-specific state stored by the activity on another device.
236 */
237 userInfo: unknown) => void): this;
238 addListener(event: 'continue-activity', listener: (event: Event,
239 /**
240 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
241 */
242 type: string,
243 /**
244 * Contains app-specific state stored by the activity on another device.
245 */
246 userInfo: unknown) => void): this;
247 removeListener(event: 'continue-activity', listener: (event: Event,
248 /**
249 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
250 */
251 type: string,
252 /**
253 * Contains app-specific state stored by the activity on another device.
254 */
255 userInfo: unknown) => void): this;
256 /**
257 * Emitted during Handoff when an activity from a different device fails to be
258 * resumed.
259 *
260 * @platform darwin
261 */
262 on(event: 'continue-activity-error', listener: (event: Event,
263 /**
264 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
265 */
266 type: string,
267 /**
268 * A string with the error's localized description.
269 */
270 error: string) => void): this;
271 once(event: 'continue-activity-error', listener: (event: Event,
272 /**
273 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
274 */
275 type: string,
276 /**
277 * A string with the error's localized description.
278 */
279 error: string) => void): this;
280 addListener(event: 'continue-activity-error', listener: (event: Event,
281 /**
282 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
283 */
284 type: string,
285 /**
286 * A string with the error's localized description.
287 */
288 error: string) => void): this;
289 removeListener(event: 'continue-activity-error', listener: (event: Event,
290 /**
291 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
292 */
293 type: string,
294 /**
295 * A string with the error's localized description.
296 */
297 error: string) => void): this;
298 /**
299 * Emitted when `desktopCapturer.getSources()` is called in the renderer process of
300 * `webContents`. Calling `event.preventDefault()` will make it return empty
301 * sources.
302 */
303 on(event: 'desktop-capturer-get-sources', listener: (event: Event,
304 webContents: WebContents) => void): this;
305 once(event: 'desktop-capturer-get-sources', listener: (event: Event,
306 webContents: WebContents) => void): this;
307 addListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
308 webContents: WebContents) => void): this;
309 removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
310 webContents: WebContents) => void): this;
311 /**
312 * Emitted when mac application become active. Difference from `activate` event is
313 * that `did-become-active` is emitted every time the app becomes active, not only
314 * when Dock icon is clicked or application is re-launched.
315 *
316 * @platform darwin
317 */
318 on(event: 'did-become-active', listener: (event: Event) => void): this;
319 once(event: 'did-become-active', listener: (event: Event) => void): this;
320 addListener(event: 'did-become-active', listener: (event: Event) => void): this;
321 removeListener(event: 'did-become-active', listener: (event: Event) => void): this;
322 /**
323 * Emitted whenever there is a GPU info update.
324 */
325 on(event: 'gpu-info-update', listener: Function): this;
326 once(event: 'gpu-info-update', listener: Function): this;
327 addListener(event: 'gpu-info-update', listener: Function): this;
328 removeListener(event: 'gpu-info-update', listener: Function): this;
329 /**
330 * Emitted when the GPU process crashes or is killed.
331 *
332 * **Deprecated:** This event is superceded by the `child-process-gone` event which
333 * contains more information about why the child process disappeared. It isn't
334 * always because it crashed. The `killed` boolean can be replaced by checking
335 * `reason === 'killed'` when you switch to that event.
336 *
337 * @deprecated
338 */
339 on(event: 'gpu-process-crashed', listener: (event: Event,
340 killed: boolean) => void): this;
341 once(event: 'gpu-process-crashed', listener: (event: Event,
342 killed: boolean) => void): this;
343 addListener(event: 'gpu-process-crashed', listener: (event: Event,
344 killed: boolean) => void): this;
345 removeListener(event: 'gpu-process-crashed', listener: (event: Event,
346 killed: boolean) => void): this;
347 /**
348 * Emitted when `webContents` wants to do basic auth.
349 *
350 * The default behavior is to cancel all authentications. To override this you
351 * should prevent the default behavior with `event.preventDefault()` and call
352 * `callback(username, password)` with the credentials.
353 *
354 * If `callback` is called without a username or password, the authentication
355 * request will be cancelled and the authentication error will be returned to the
356 * page.
357 */
358 on(event: 'login', listener: (event: Event,
359 webContents: WebContents,
360 authenticationResponseDetails: AuthenticationResponseDetails,
361 authInfo: AuthInfo,
362 callback: (username?: string, password?: string) => void) => void): this;
363 once(event: 'login', listener: (event: Event,
364 webContents: WebContents,
365 authenticationResponseDetails: AuthenticationResponseDetails,
366 authInfo: AuthInfo,
367 callback: (username?: string, password?: string) => void) => void): this;
368 addListener(event: 'login', listener: (event: Event,
369 webContents: WebContents,
370 authenticationResponseDetails: AuthenticationResponseDetails,
371 authInfo: AuthInfo,
372 callback: (username?: string, password?: string) => void) => void): this;
373 removeListener(event: 'login', listener: (event: Event,
374 webContents: WebContents,
375 authenticationResponseDetails: AuthenticationResponseDetails,
376 authInfo: AuthInfo,
377 callback: (username?: string, password?: string) => void) => void): this;
378 /**
379 * Emitted when the user clicks the native macOS new tab button. The new tab button
380 * is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
381 *
382 * @platform darwin
383 */
384 on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
385 once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
386 addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
387 removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
388 /**
389 * Emitted when the user wants to open a file with the application. The `open-file`
390 * event is usually emitted when the application is already open and the OS wants
391 * to reuse the application to open the file. `open-file` is also emitted when a
392 * file is dropped onto the dock and the application is not yet running. Make sure
393 * to listen for the `open-file` event very early in your application startup to
394 * handle this case (even before the `ready` event is emitted).
395 *
396 * You should call `event.preventDefault()` if you want to handle this event.
397 *
398 * On Windows, you have to parse `process.argv` (in the main process) to get the
399 * filepath.
400 *
401 * @platform darwin
402 */
403 on(event: 'open-file', listener: (event: Event,
404 path: string) => void): this;
405 once(event: 'open-file', listener: (event: Event,
406 path: string) => void): this;
407 addListener(event: 'open-file', listener: (event: Event,
408 path: string) => void): this;
409 removeListener(event: 'open-file', listener: (event: Event,
410 path: string) => void): this;
411 /**
412 * Emitted when the user wants to open a URL with the application. Your
413 * application's `Info.plist` file must define the URL scheme within the
414 * `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
415 *
416You should call `event.preventDefault()` if you want to handle this event.
417 *
418 * @platform darwin
419 */
420 on(event: 'open-url', listener: (event: Event,
421 url: string) => void): this;
422 once(event: 'open-url', listener: (event: Event,
423 url: string) => void): this;
424 addListener(event: 'open-url', listener: (event: Event,
425 url: string) => void): this;
426 removeListener(event: 'open-url', listener: (event: Event,
427 url: string) => void): this;
428 /**
429 * Emitted when the application is quitting.
430 *
431 * **Note:** On Windows, this event will not be emitted if the app is closed due to
432 * a shutdown/restart of the system or a user logout.
433 */
434 on(event: 'quit', listener: (event: Event,
435 exitCode: number) => void): this;
436 once(event: 'quit', listener: (event: Event,
437 exitCode: number) => void): this;
438 addListener(event: 'quit', listener: (event: Event,
439 exitCode: number) => void): this;
440 removeListener(event: 'quit', listener: (event: Event,
441 exitCode: number) => void): this;
442 /**
443 * Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
444 * holds the `userInfo` of the `NSUserNotification` that was used to open the
445 * application, if it was launched from Notification Center. You can also call
446 * `app.isReady()` to check if this event has already fired and `app.whenReady()`
447 * to get a Promise that is fulfilled when Electron is initialized.
448 */
449 on(event: 'ready', listener: (event: Event,
450 launchInfo: Record<string, any>) => void): this;
451 once(event: 'ready', listener: (event: Event,
452 launchInfo: Record<string, any>) => void): this;
453 addListener(event: 'ready', listener: (event: Event,
454 launchInfo: Record<string, any>) => void): this;
455 removeListener(event: 'ready', listener: (event: Event,
456 launchInfo: Record<string, any>) => void): this;
457 /**
458 * Emitted when `remote.getBuiltin()` is called in the renderer process of
459 * `webContents`. Calling `event.preventDefault()` will prevent the module from
460 * being returned. Custom value can be returned by setting `event.returnValue`.
461 *
462 * @deprecated
463 */
464 on(event: 'remote-get-builtin', listener: (event: Event,
465 webContents: WebContents,
466 moduleName: string) => void): this;
467 once(event: 'remote-get-builtin', listener: (event: Event,
468 webContents: WebContents,
469 moduleName: string) => void): this;
470 addListener(event: 'remote-get-builtin', listener: (event: Event,
471 webContents: WebContents,
472 moduleName: string) => void): this;
473 removeListener(event: 'remote-get-builtin', listener: (event: Event,
474 webContents: WebContents,
475 moduleName: string) => void): this;
476 /**
477 * Emitted when `remote.getCurrentWebContents()` is called in the renderer process
478 * of `webContents`. Calling `event.preventDefault()` will prevent the object from
479 * being returned. Custom value can be returned by setting `event.returnValue`.
480 *
481 * @deprecated
482 */
483 on(event: 'remote-get-current-web-contents', listener: (event: Event,
484 webContents: WebContents) => void): this;
485 once(event: 'remote-get-current-web-contents', listener: (event: Event,
486 webContents: WebContents) => void): this;
487 addListener(event: 'remote-get-current-web-contents', listener: (event: Event,
488 webContents: WebContents) => void): this;
489 removeListener(event: 'remote-get-current-web-contents', listener: (event: Event,
490 webContents: WebContents) => void): this;
491 /**
492 * Emitted when `remote.getCurrentWindow()` is called in the renderer process of
493 * `webContents`. Calling `event.preventDefault()` will prevent the object from
494 * being returned. Custom value can be returned by setting `event.returnValue`.
495 *
496 * @deprecated
497 */
498 on(event: 'remote-get-current-window', listener: (event: Event,
499 webContents: WebContents) => void): this;
500 once(event: 'remote-get-current-window', listener: (event: Event,
501 webContents: WebContents) => void): this;
502 addListener(event: 'remote-get-current-window', listener: (event: Event,
503 webContents: WebContents) => void): this;
504 removeListener(event: 'remote-get-current-window', listener: (event: Event,
505 webContents: WebContents) => void): this;
506 /**
507 * Emitted when `remote.getGlobal()` is called in the renderer process of
508 * `webContents`. Calling `event.preventDefault()` will prevent the global from
509 * being returned. Custom value can be returned by setting `event.returnValue`.
510 *
511 * @deprecated
512 */
513 on(event: 'remote-get-global', listener: (event: Event,
514 webContents: WebContents,
515 globalName: string) => void): this;
516 once(event: 'remote-get-global', listener: (event: Event,
517 webContents: WebContents,
518 globalName: string) => void): this;
519 addListener(event: 'remote-get-global', listener: (event: Event,
520 webContents: WebContents,
521 globalName: string) => void): this;
522 removeListener(event: 'remote-get-global', listener: (event: Event,
523 webContents: WebContents,
524 globalName: string) => void): this;
525 /**
526 * Emitted when `remote.require()` is called in the renderer process of
527 * `webContents`. Calling `event.preventDefault()` will prevent the module from
528 * being returned. Custom value can be returned by setting `event.returnValue`.
529 *
530 * @deprecated
531 */
532 on(event: 'remote-require', listener: (event: Event,
533 webContents: WebContents,
534 moduleName: string) => void): this;
535 once(event: 'remote-require', listener: (event: Event,
536 webContents: WebContents,
537 moduleName: string) => void): this;
538 addListener(event: 'remote-require', listener: (event: Event,
539 webContents: WebContents,
540 moduleName: string) => void): this;
541 removeListener(event: 'remote-require', listener: (event: Event,
542 webContents: WebContents,
543 moduleName: string) => void): this;
544 /**
545 * Emitted when the renderer process unexpectedly disappears. This is normally
546 * because it was crashed or killed.
547 */
548 on(event: 'render-process-gone', listener: (event: Event,
549 webContents: WebContents,
550 details: RenderProcessGoneDetails) => void): this;
551 once(event: 'render-process-gone', listener: (event: Event,
552 webContents: WebContents,
553 details: RenderProcessGoneDetails) => void): this;
554 addListener(event: 'render-process-gone', listener: (event: Event,
555 webContents: WebContents,
556 details: RenderProcessGoneDetails) => void): this;
557 removeListener(event: 'render-process-gone', listener: (event: Event,
558 webContents: WebContents,
559 details: RenderProcessGoneDetails) => void): this;
560 on(event: 'renderer-process-crashed', listener: (event: Event,
561 webContents: WebContents,
562 killed: boolean) => void): this;
563 once(event: 'renderer-process-crashed', listener: (event: Event,
564 webContents: WebContents,
565 killed: boolean) => void): this;
566 addListener(event: 'renderer-process-crashed', listener: (event: Event,
567 webContents: WebContents,
568 killed: boolean) => void): this;
569 removeListener(event: 'renderer-process-crashed', listener: (event: Event,
570 webContents: WebContents,
571 killed: boolean) => void): this;
572 /**
573 * This event will be emitted inside the primary instance of your application when
574 * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
575 *
576 * `argv` is an Array of the second instance's command line arguments, and
577 * `workingDirectory` is its current working directory. Usually applications
578 * respond to this by making their primary window focused and non-minimized.
579 *
580 * **Note:** If the second instance is started by a different user than the first,
581 * the `argv` array will not include the arguments.
582 *
583 * This event is guaranteed to be emitted after the `ready` event of `app` gets
584 * emitted.
585 *
586 * **Note:** Extra command line arguments might be added by Chromium, such as
587 * `--original-process-start-time`.
588 */
589 on(event: 'second-instance', listener: (event: Event,
590 /**
591 * An array of the second instance's command line arguments
592 */
593 argv: string[],
594 /**
595 * The second instance's working directory
596 */
597 workingDirectory: string) => void): this;
598 once(event: 'second-instance', listener: (event: Event,
599 /**
600 * An array of the second instance's command line arguments
601 */
602 argv: string[],
603 /**
604 * The second instance's working directory
605 */
606 workingDirectory: string) => void): this;
607 addListener(event: 'second-instance', listener: (event: Event,
608 /**
609 * An array of the second instance's command line arguments
610 */
611 argv: string[],
612 /**
613 * The second instance's working directory
614 */
615 workingDirectory: string) => void): this;
616 removeListener(event: 'second-instance', listener: (event: Event,
617 /**
618 * An array of the second instance's command line arguments
619 */
620 argv: string[],
621 /**
622 * The second instance's working directory
623 */
624 workingDirectory: string) => void): this;
625 /**
626 * Emitted when a client certificate is requested.
627 *
628 * The `url` corresponds to the navigation entry requesting the client certificate
629 * and `callback` can be called with an entry filtered from the list. Using
630 * `event.preventDefault()` prevents the application from using the first
631 * certificate from the store.
632 */
633 on(event: 'select-client-certificate', listener: (event: Event,
634 webContents: WebContents,
635 url: string,
636 certificateList: Certificate[],
637 callback: (certificate?: Certificate) => void) => void): this;
638 once(event: 'select-client-certificate', listener: (event: Event,
639 webContents: WebContents,
640 url: string,
641 certificateList: Certificate[],
642 callback: (certificate?: Certificate) => void) => void): this;
643 addListener(event: 'select-client-certificate', listener: (event: Event,
644 webContents: WebContents,
645 url: string,
646 certificateList: Certificate[],
647 callback: (certificate?: Certificate) => void) => void): this;
648 removeListener(event: 'select-client-certificate', listener: (event: Event,
649 webContents: WebContents,
650 url: string,
651 certificateList: Certificate[],
652 callback: (certificate?: Certificate) => void) => void): this;
653 /**
654 * Emitted when Electron has created a new `session`.
655 */
656 on(event: 'session-created', listener: (session: Session) => void): this;
657 once(event: 'session-created', listener: (session: Session) => void): this;
658 addListener(event: 'session-created', listener: (session: Session) => void): this;
659 removeListener(event: 'session-created', listener: (session: Session) => void): this;
660 /**
661 * Emitted when Handoff is about to be resumed on another device. If you need to
662 * update the state to be transferred, you should call `event.preventDefault()`
663 * immediately, construct a new `userInfo` dictionary and call
664 * `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
665 * fail and `continue-activity-error` will be called.
666 *
667 * @platform darwin
668 */
669 on(event: 'update-activity-state', listener: (event: Event,
670 /**
671 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
672 */
673 type: string,
674 /**
675 * Contains app-specific state stored by the activity.
676 */
677 userInfo: unknown) => void): this;
678 once(event: 'update-activity-state', listener: (event: Event,
679 /**
680 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
681 */
682 type: string,
683 /**
684 * Contains app-specific state stored by the activity.
685 */
686 userInfo: unknown) => void): this;
687 addListener(event: 'update-activity-state', listener: (event: Event,
688 /**
689 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
690 */
691 type: string,
692 /**
693 * Contains app-specific state stored by the activity.
694 */
695 userInfo: unknown) => void): this;
696 removeListener(event: 'update-activity-state', listener: (event: Event,
697 /**
698 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
699 */
700 type: string,
701 /**
702 * Contains app-specific state stored by the activity.
703 */
704 userInfo: unknown) => void): this;
705 /**
706 * Emitted when a new webContents is created.
707 */
708 on(event: 'web-contents-created', listener: (event: Event,
709 webContents: WebContents) => void): this;
710 once(event: 'web-contents-created', listener: (event: Event,
711 webContents: WebContents) => void): this;
712 addListener(event: 'web-contents-created', listener: (event: Event,
713 webContents: WebContents) => void): this;
714 removeListener(event: 'web-contents-created', listener: (event: Event,
715 webContents: WebContents) => void): this;
716 /**
717 * Emitted during Handoff before an activity from a different device wants to be
718 * resumed. You should call `event.preventDefault()` if you want to handle this
719 * event.
720 *
721 * @platform darwin
722 */
723 on(event: 'will-continue-activity', listener: (event: Event,
724 /**
725 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
726 */
727 type: string) => void): this;
728 once(event: 'will-continue-activity', listener: (event: Event,
729 /**
730 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
731 */
732 type: string) => void): this;
733 addListener(event: 'will-continue-activity', listener: (event: Event,
734 /**
735 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
736 */
737 type: string) => void): this;
738 removeListener(event: 'will-continue-activity', listener: (event: Event,
739 /**
740 * A string identifying the activity. Maps to `NSUserActivity.activityType`.
741 */
742 type: string) => void): this;
743 /**
744 * Emitted when the application has finished basic startup. On Windows and Linux,
745 * the `will-finish-launching` event is the same as the `ready` event; on macOS,
746 * this event represents the `applicationWillFinishLaunching` notification of
747 * `NSApplication`. You would usually set up listeners for the `open-file` and
748 * `open-url` events here, and start the crash reporter and auto updater.
749 *
750In most cases, you should do everything in the `ready` event handler.
751 */
752 on(event: 'will-finish-launching', listener: Function): this;
753 once(event: 'will-finish-launching', listener: Function): this;
754 addListener(event: 'will-finish-launching', listener: Function): this;
755 removeListener(event: 'will-finish-launching', listener: Function): this;
756 /**
757 * Emitted when all windows have been closed and the application will quit. Calling
758 * `event.preventDefault()` will prevent the default behavior, which is terminating
759 * the application.
760 *
761 * See the description of the `window-all-closed` event for the differences between
762 * the `will-quit` and `window-all-closed` events.
763 *
764 * **Note:** On Windows, this event will not be emitted if the app is closed due to
765 * a shutdown/restart of the system or a user logout.
766 */
767 on(event: 'will-quit', listener: (event: Event) => void): this;
768 once(event: 'will-quit', listener: (event: Event) => void): this;
769 addListener(event: 'will-quit', listener: (event: Event) => void): this;
770 removeListener(event: 'will-quit', listener: (event: Event) => void): this;
771 /**
772 * Emitted when all windows have been closed.
773 *
774 * If you do not subscribe to this event and all windows are closed, the default
775 * behavior is to quit the app; however, if you subscribe, you control whether the
776 * app quits or not. If the user pressed `Cmd + Q`, or the developer called
777 * `app.quit()`, Electron will first try to close all the windows and then emit the
778 * `will-quit` event, and in this case the `window-all-closed` event would not be
779 * emitted.
780 */
781 on(event: 'window-all-closed', listener: Function): this;
782 once(event: 'window-all-closed', listener: Function): this;
783 addListener(event: 'window-all-closed', listener: Function): this;
784 removeListener(event: 'window-all-closed', listener: Function): this;
785 /**
786 * Adds `path` to the recent documents list.
787 *
788 * This list is managed by the OS. On Windows, you can visit the list from the task
789 * bar, and on macOS, you can visit it from dock menu.
790 *
791 * @platform darwin,win32
792 */
793 addRecentDocument(path: string): void;
794 /**
795 * Clears the recent documents list.
796 *
797 * @platform darwin,win32
798 */
799 clearRecentDocuments(): void;
800 /**
801 * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
802 * basis if the GPU processes crashes too frequently. This function disables that
803 * behavior.
804
805This method can only be called before app is ready.
806 */
807 disableDomainBlockingFor3DAPIs(): void;
808 /**
809 * Disables hardware acceleration for current app.
810 *
811This method can only be called before app is ready.
812 */
813 disableHardwareAcceleration(): void;
814 /**
815 * Enables full sandbox mode on the app. This means that all renderers will be
816 * launched sandboxed, regardless of the value of the `sandbox` flag in
817 * WebPreferences.
818
819This method can only be called before app is ready.
820 */
821 enableSandbox(): void;
822 /**
823 * Exits immediately with `exitCode`. `exitCode` defaults to 0.
824 *
825 * All windows will be closed immediately without asking the user, and the
826 * `before-quit` and `will-quit` events will not be emitted.
827 */
828 exit(exitCode?: number): void;
829 /**
830 * On Linux, focuses on the first visible window. On macOS, makes the application
831 * the active app. On Windows, focuses on the application's first window.
832 *
833You should seek to use the `steal` option as sparingly as possible.
834 */
835 focus(options?: FocusOptions): void;
836 /**
837 * Resolve with an object containing the following:
838 *
839 * * `icon` NativeImage - the display icon of the app handling the protocol.
840 * * `path` String - installation path of the app handling the protocol.
841 * * `name` String - display name of the app handling the protocol.
842 *
843 * This method returns a promise that contains the application name, icon and path
844 * of the default handler for the protocol (aka URI scheme) of a URL.
845 *
846 * @platform darwin,win32
847 */
848 getApplicationInfoForProtocol(url: string): Promise<Electron.ApplicationInfoForProtocolReturnValue>;
849 /**
850 * Name of the application handling the protocol, or an empty string if there is no
851 * handler. For instance, if Electron is the default handler of the URL, this could
852 * be `Electron` on Windows and Mac. However, don't rely on the precise format
853 * which is not guaranteed to remain unchanged. Expect a different format on Linux,
854 * possibly with a `.desktop` suffix.
855 *
856 * This method returns the application name of the default handler for the protocol
857 * (aka URI scheme) of a URL.
858 */
859 getApplicationNameForProtocol(url: string): string;
860 /**
861 * Array of `ProcessMetric` objects that correspond to memory and CPU usage
862 * statistics of all the processes associated with the app.
863 */
864 getAppMetrics(): ProcessMetric[];
865 /**
866 * The current application directory.
867 */
868 getAppPath(): string;
869 /**
870 * The current value displayed in the counter badge.
871 *
872 * @platform linux,darwin
873 */
874 getBadgeCount(): number;
875 /**
876 * The type of the currently running activity.
877 *
878 * @platform darwin
879 */
880 getCurrentActivityType(): string;
881 /**
882 * fulfilled with the app's icon, which is a NativeImage.
883 *
884 * Fetches a path's associated icon.
885 *
886 * On _Windows_, there a 2 kinds of icons:
887 *
888 * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
889 * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
890 *
891 * On _Linux_ and _macOS_, icons depend on the application associated with file
892 * mime type.
893 */
894 getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
895 /**
896 * The Graphics Feature Status from `chrome://gpu/`.
897 *
898 * **Note:** This information is only usable after the `gpu-info-update` event is
899 * emitted.
900 */
901 getGPUFeatureStatus(): GPUFeatureStatus;
902 /**
903 * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
904 * containing all the GPU Information as in chromium's GPUInfo object. This
905 * includes the version and driver information that's shown on `chrome://gpu` page.
906 *
907 * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
908 * fewer attributes than when requested with `complete`. Here's an example of basic
909 * response:
910 *
911 * Using `basic` should be preferred if only basic information like `vendorId` or
912 * `driverId` is needed.
913 */
914 getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
915 /**
916 * * `minItems` Integer - The minimum number of items that will be shown in the
917 * Jump List (for a more detailed description of this value see the MSDN docs).
918 * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
919 * correspond to items that the user has explicitly removed from custom categories
920 * in the Jump List. These items must not be re-added to the Jump List in the
921 * **next** call to `app.setJumpList()`, Windows will not display any custom
922 * category that contains any of the removed items.
923 *
924 * @platform win32
925 */
926 getJumpListSettings(): JumpListSettings;
927 /**
928 * The current application locale. Possible return values are documented here.
929 *
930 * To set the locale, you'll want to use a command line switch at app startup,
931 * which may be found here.
932 *
933 * **Note:** When distributing your packaged app, you have to also ship the
934 * `locales` folder.
935 *
936 * **Note:** On Windows, you have to call it after the `ready` events gets emitted.
937 */
938 getLocale(): string;
939 /**
940 * User operating system's locale two-letter ISO 3166 country code. The value is
941 * taken from native OS APIs.
942 *
943**Note:** When unable to detect locale country code, it returns empty string.
944 */
945 getLocaleCountryCode(): string;
946 /**
947 * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
948 * you need to pass the same arguments here for `openAtLogin` to be set correctly.
949 *
950 *
951 * * `openAtLogin` Boolean - `true` if the app is set to open at login.
952 * * `openAsHidden` Boolean _macOS_ - `true` if the app is set to open as hidden at
953 * login. This setting is not available on MAS builds.
954 * * `wasOpenedAtLogin` Boolean _macOS_ - `true` if the app was opened at login
955 * automatically. This setting is not available on MAS builds.
956 * * `wasOpenedAsHidden` Boolean _macOS_ - `true` if the app was opened as a hidden
957 * login item. This indicates that the app should not open any windows at startup.
958 * This setting is not available on MAS builds.
959 * * `restoreState` Boolean _macOS_ - `true` if the app was opened as a login item
960 * that should restore the state from the previous session. This indicates that the
961 * app should restore the windows that were open the last time the app was closed.
962 * This setting is not available on MAS builds.
963 * * `executableWillLaunchAtLogin` Boolean _Windows_ - `true` if app is set to open
964 * at login and its run key is not deactivated. This differs from `openAtLogin` as
965 * it ignores the `args` option, this property will be true if the given executable
966 * would be launched at login with **any** arguments.
967 * * `launchItems` Object[] _Windows_
968 * * `name` String _Windows_ - name value of a registry entry.
969 * * `path` String _Windows_ - The executable to an app that corresponds to a
970 * registry entry.
971 * * `args` String[] _Windows_ - the command-line arguments to pass to the
972 * executable.
973 * * `scope` String _Windows_ - one of `user` or `machine`. Indicates whether the
974 * registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
975 * * `enabled` Boolean _Windows_ - `true` if the app registry key is startup
976 * approved and therefore shows as `enabled` in Task Manager and Windows settings.
977 *
978 * @platform darwin,win32
979 */
980 getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
981 /**
982 * The current application's name, which is the name in the application's
983 * `package.json` file.
984 *
985 * Usually the `name` field of `package.json` is a short lowercase name, according
986 * to the npm modules spec. You should usually also specify a `productName` field,
987 * which is your application's full capitalized name, and which will be preferred
988 * over `name` by Electron.
989 */
990 getName(): string;
991 /**
992 * A path to a special directory or file associated with `name`. On failure, an
993 * `Error` is thrown.
994 *
995 * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
996 * called first, a default log directory will be created equivalent to calling
997 * `app.setAppLogsPath()` without a `path` parameter.
998 */
999 getPath(name: 'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'pepperFlashSystemPlugin' | 'crashDumps'): string;
1000 /**
1001 * The version of the loaded application. If no version is found in the
1002 * application's `package.json` file, the version of the current bundle or
1003 * executable is returned.
1004 */
1005 getVersion(): string;
1006 /**
1007 * This method returns whether or not this instance of your app is currently
1008 * holding the single instance lock. You can request the lock with
1009 * `app.requestSingleInstanceLock()` and release with
1010 * `app.releaseSingleInstanceLock()`
1011 */
1012 hasSingleInstanceLock(): boolean;
1013 /**
1014 * Hides all application windows without minimizing them.
1015 *
1016 * @platform darwin
1017 */
1018 hide(): void;
1019 /**
1020 * Imports the certificate in pkcs12 format into the platform certificate store.
1021 * `callback` is called with the `result` of import operation, a value of `0`
1022 * indicates success while any other value indicates failure according to Chromium
1023 * net_error_list.
1024 *
1025 * @platform linux
1026 */
1027 importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
1028 /**
1029 * Invalidates the current Handoff user activity.
1030 *
1031 * @platform darwin
1032 */
1033 invalidateCurrentActivity(): void;
1034 /**
1035 * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
1036 * will return `true` if the use of assistive technologies, such as screen readers,
1037 * has been detected. See
1038 * https://www.chromium.org/developers/design-documents/accessibility for more
1039 * details.
1040 *
1041 * @platform darwin,win32
1042 */
1043 isAccessibilitySupportEnabled(): boolean;
1044 /**
1045 * Whether the current executable is the default handler for a protocol (aka URI
1046 * scheme).
1047 *
1048 * **Note:** On macOS, you can use this method to check if the app has been
1049 * registered as the default protocol handler for a protocol. You can also verify
1050 * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
1051 * macOS machine. Please refer to Apple's documentation for details.
1052 *
1053 * The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
1054 * internally.
1055 */
1056 isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1057 /**
1058 * whether or not the current OS version allows for native emoji pickers.
1059 */
1060 isEmojiPanelSupported(): boolean;
1061 /**
1062 * Whether the application is currently running from the systems Application
1063 * folder. Use in combination with `app.moveToApplicationsFolder()`
1064 *
1065 * @platform darwin
1066 */
1067 isInApplicationsFolder(): boolean;
1068 /**
1069 * `true` if Electron has finished initializing, `false` otherwise. See also
1070 * `app.whenReady()`.
1071 */
1072 isReady(): boolean;
1073 /**
1074 * whether `Secure Keyboard Entry` is enabled.
1075 *
1076By default this API will return `false`.
1077 *
1078 * @platform darwin
1079 */
1080 isSecureKeyboardEntryEnabled(): boolean;
1081 /**
1082 * Whether the current desktop environment is Unity launcher.
1083 *
1084 * @platform linux
1085 */
1086 isUnityRunning(): boolean;
1087 /**
1088 * Whether the move was successful. Please note that if the move is successful,
1089 * your application will quit and relaunch.
1090 *
1091 * No confirmation dialog will be presented by default. If you wish to allow the
1092 * user to confirm the operation, you may do so using the `dialog` API.
1093 *
1094 * **NOTE:** This method throws errors if anything other than the user causes the
1095 * move to fail. For instance if the user cancels the authorization dialog, this
1096 * method returns false. If we fail to perform the copy, then this method will
1097 * throw an error. The message in the error should be informative and tell you
1098 * exactly what went wrong.
1099 *
1100 * By default, if an app of the same name as the one being moved exists in the
1101 * Applications directory and is _not_ running, the existing app will be trashed
1102 * and the active app moved into its place. If it _is_ running, the pre-existing
1103 * running app will assume focus and the previously active app will quit itself.
1104 * This behavior can be changed by providing the optional conflict handler, where
1105 * the boolean returned by the handler determines whether or not the move conflict
1106 * is resolved with default behavior. i.e. returning `false` will ensure no
1107 * further action is taken, returning `true` will result in the default behavior
1108 * and the method continuing.
1109 *
1110 * For example:
1111 *
1112 * Would mean that if an app already exists in the user directory, if the user
1113 * chooses to 'Continue Move' then the function would continue with its default
1114 * behavior and the existing app will be trashed and the active app moved into its
1115 * place.
1116 *
1117 * @platform darwin
1118 */
1119 moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
1120 /**
1121 * Try to close all windows. The `before-quit` event will be emitted first. If all
1122 * windows are successfully closed, the `will-quit` event will be emitted and by
1123 * default the application will terminate.
1124 *
1125 * This method guarantees that all `beforeunload` and `unload` event handlers are
1126 * correctly executed. It is possible that a window cancels the quitting by
1127 * returning `false` in the `beforeunload` event handler.
1128 */
1129 quit(): void;
1130 /**
1131 * Relaunches the app when current instance exits.
1132 *
1133 * By default, the new instance will use the same working directory and command
1134 * line arguments with current instance. When `args` is specified, the `args` will
1135 * be passed as command line arguments instead. When `execPath` is specified, the
1136 * `execPath` will be executed for relaunch instead of current app.
1137 *
1138 * Note that this method does not quit the app when executed, you have to call
1139 * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
1140 *
1141 * When `app.relaunch` is called for multiple times, multiple instances will be
1142 * started after current instance exited.
1143 *
1144 * An example of restarting current instance immediately and adding a new command
1145 * line argument to the new instance:
1146 */
1147 relaunch(options?: RelaunchOptions): void;
1148 /**
1149 * Releases all locks that were created by `requestSingleInstanceLock`. This will
1150 * allow multiple instances of the application to once again run side by side.
1151 */
1152 releaseSingleInstanceLock(): void;
1153 /**
1154 * Whether the call succeeded.
1155 *
1156 * This method checks if the current executable as the default handler for a
1157 * protocol (aka URI scheme). If so, it will remove the app as the default handler.
1158 *
1159 * @platform darwin,win32
1160 */
1161 removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1162 /**
1163 * The return value of this method indicates whether or not this instance of your
1164 * application successfully obtained the lock. If it failed to obtain the lock,
1165 * you can assume that another instance of your application is already running with
1166 * the lock and exit immediately.
1167 *
1168 * I.e. This method returns `true` if your process is the primary instance of your
1169 * application and your app should continue loading. It returns `false` if your
1170 * process should immediately quit as it has sent its parameters to another
1171 * instance that has already acquired the lock.
1172 *
1173 * On macOS, the system enforces single instance automatically when users try to
1174 * open a second instance of your app in Finder, and the `open-file` and `open-url`
1175 * events will be emitted for that. However when users start your app in command
1176 * line, the system's single instance mechanism will be bypassed, and you have to
1177 * use this method to ensure single instance.
1178 *
1179 * An example of activating the window of primary instance when a second instance
1180 * starts:
1181 */
1182 requestSingleInstanceLock(): boolean;
1183 /**
1184 * Marks the current Handoff user activity as inactive without invalidating it.
1185 *
1186 * @platform darwin
1187 */
1188 resignCurrentActivity(): void;
1189 /**
1190 * Set the about panel options. This will override the values defined in the app's
1191 * `.plist` file on macOS. See the Apple docs for more details. On Linux, values
1192 * must be set in order to be shown; there are no defaults.
1193 *
1194 * If you do not set `credits` but still wish to surface them in your app, AppKit
1195 * will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in
1196 * that order, in the bundle returned by the NSBundle class method main. The first
1197 * file found is used, and if none is found, the info area is left blank. See Apple
1198 * documentation for more information.
1199 */
1200 setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
1201 /**
1202 * Manually enables Chrome's accessibility support, allowing to expose
1203 * accessibility switch to users in application settings. See Chromium's
1204 * accessibility docs for more details. Disabled by default.
1205 *
1206 * This API must be called after the `ready` event is emitted.
1207 *
1208 * **Note:** Rendering accessibility tree can significantly affect the performance
1209 * of your app. It should not be enabled by default.
1210 *
1211 * @platform darwin,win32
1212 */
1213 setAccessibilitySupportEnabled(enabled: boolean): void;
1214 /**
1215 * Sets the activation policy for a given app.
1216 *
1217 * Activation policy types:
1218 *
1219 * * 'regular' - The application is an ordinary app that appears in the Dock and
1220 * may have a user interface.
1221 * * 'accessory' - The application doesn’t appear in the Dock and doesn’t have a
1222 * menu bar, but it may be activated programmatically or by clicking on one of its
1223 * windows.
1224 * * 'prohibited' - The application doesn’t appear in the Dock and may not create
1225 * windows or be activated.
1226 *
1227 * @platform darwin
1228 */
1229 setActivationPolicy(policy: 'regular' | 'accessory' | 'prohibited'): void;
1230 /**
1231 * Sets or creates a directory your app's logs which can then be manipulated with
1232 * `app.getPath()` or `app.setPath(pathName, newPath)`.
1233 *
1234 * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
1235 * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
1236 * `userData` directory on _Linux_ and _Windows_.
1237 */
1238 setAppLogsPath(path?: string): void;
1239 /**
1240 * Changes the Application User Model ID to `id`.
1241 *
1242 * @platform win32
1243 */
1244 setAppUserModelId(id: string): void;
1245 /**
1246 * Whether the call succeeded.
1247 *
1248 * Sets the current executable as the default handler for a protocol (aka URI
1249 * scheme). It allows you to integrate your app deeper into the operating system.
1250 * Once registered, all links with `your-protocol://` will be opened with the
1251 * current executable. The whole link, including protocol, will be passed to your
1252 * application as a parameter.
1253 *
1254 * **Note:** On macOS, you can only register protocols that have been added to your
1255 * app's `info.plist`, which cannot be modified at runtime. However, you can change
1256 * the file during build time via Electron Forge, Electron Packager, or by editing
1257 * `info.plist` with a text editor. Please refer to Apple's documentation for
1258 * details.
1259 *
1260 * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
1261 * will return `true` for all calls but the registry key it sets won't be
1262 * accessible by other applications. In order to register your Windows Store
1263 * application as a default protocol handler you must declare the protocol in your
1264 * manifest.
1265 *
1266 * The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme`
1267 * internally.
1268 */
1269 setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
1270 /**
1271 * Whether the call succeeded.
1272 *
1273 * Sets the counter badge for current app. Setting the count to `0` will hide the
1274 * badge.
1275 *
1276 * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
1277 *
1278 * **Note:** Unity launcher requires the existence of a `.desktop` file to work,
1279 * for more information please read Desktop Environment Integration.
1280 *
1281 * @platform linux,darwin
1282 */
1283 setBadgeCount(count: number): boolean;
1284 /**
1285 * Sets or removes a custom Jump List for the application, and returns one of the
1286 * following strings:
1287 *
1288 * * `ok` - Nothing went wrong.
1289 * * `error` - One or more errors occurred, enable runtime logging to figure out
1290 * the likely cause.
1291 * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
1292 * category in the Jump List. Separators are only allowed in the standard `Tasks`
1293 * category.
1294 * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
1295 * Jump List for a file type the app isn't registered to handle.
1296 * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
1297 * Jump List due to user privacy or group policy settings.
1298 *
1299 * If `categories` is `null` the previously set custom Jump List (if any) will be
1300 * replaced by the standard Jump List for the app (managed by Windows).
1301 *
1302 * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
1303 * property set then its `type` is assumed to be `tasks`. If the `name` property is
1304 * set but the `type` property is omitted then the `type` is assumed to be
1305 * `custom`.
1306 *
1307 * **Note:** Users can remove items from custom categories, and Windows will not
1308 * allow a removed item to be added back into a custom category until **after** the
1309 * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
1310 * removed item to a custom category earlier than that will result in the entire
1311 * custom category being omitted from the Jump List. The list of removed items can
1312 * be obtained using `app.getJumpListSettings()`.
1313 *
1314Here's a very simple example of creating a custom Jump List:
1315 *
1316 * @platform win32
1317 */
1318 setJumpList(categories: (JumpListCategory[]) | (null)): void;
1319 /**
1320 * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
1321 * want to set the launch path to Update.exe, and pass arguments that specify your
1322 * application name. For example:
1323 *
1324 * @platform darwin,win32
1325 */
1326 setLoginItemSettings(settings: Settings): void;
1327 /**
1328 * Overrides the current application's name.
1329 *
1330 * **Note:** This function overrides the name used internally by Electron; it does
1331 * not affect the name that the OS uses.
1332 */
1333 setName(name: string): void;
1334 /**
1335 * Overrides the `path` to a special directory or file associated with `name`. If
1336 * the path specifies a directory that does not exist, an `Error` is thrown. In
1337 * that case, the directory should be created with `fs.mkdirSync` or similar.
1338 *
1339 * You can only override paths of a `name` defined in `app.getPath`.
1340 *
1341 * By default, web pages' cookies and caches will be stored under the `userData`
1342 * directory. If you want to change this location, you have to override the
1343 * `userData` path before the `ready` event of the `app` module is emitted.
1344 */
1345 setPath(name: string, path: string): void;
1346 /**
1347 * Set the `Secure Keyboard Entry` is enabled in your application.
1348 *
1349 * By using this API, important information such as password and other sensitive
1350 * information can be prevented from being intercepted by other processes.
1351 *
1352 * See Apple's documentation for more details.
1353 *
1354 * **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it
1355 * when it is no longer needed.
1356 *
1357 * @platform darwin
1358 */
1359 setSecureKeyboardEntryEnabled(enabled: boolean): void;
1360 /**
1361 * Creates an `NSUserActivity` and sets it as the current activity. The activity is
1362 * eligible for Handoff to another device afterward.
1363 *
1364 * @platform darwin
1365 */
1366 setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
1367 /**
1368 * Adds `tasks` to the Tasks category of the Jump List on Windows.
1369 *
1370 * `tasks` is an array of `Task` objects.
1371 *
1372 * Whether the call succeeded.
1373 *
1374 * **Note:** If you'd like to customize the Jump List even more use
1375 * `app.setJumpList(categories)` instead.
1376 *
1377 * @platform win32
1378 */
1379 setUserTasks(tasks: Task[]): boolean;
1380 /**
1381 * Shows application windows after they were hidden. Does not automatically focus
1382 * them.
1383 *
1384 * @platform darwin
1385 */
1386 show(): void;
1387 /**
1388 * Show the app's about panel options. These options can be overridden with
1389 * `app.setAboutPanelOptions(options)`.
1390 */
1391 showAboutPanel(): void;
1392 /**
1393 * Show the platform's native emoji picker.
1394 *
1395 * @platform darwin,win32
1396 */
1397 showEmojiPanel(): void;
1398 /**
1399 * This function **must** be called once you have finished accessing the security
1400 * scoped file. If you do not remember to stop accessing the bookmark, kernel
1401 * resources will be leaked and your app will lose its ability to reach outside the
1402 * sandbox completely, until your app is restarted.
1403 *
1404 * Start accessing a security scoped resource. With this method Electron
1405 * applications that are packaged for the Mac App Store may reach outside their
1406 * sandbox to access files chosen by the user. See Apple's documentation for a
1407 * description of how this system works.
1408 *
1409 * @platform mas
1410 */
1411 startAccessingSecurityScopedResource(bookmarkData: string): Function;
1412 /**
1413 * Updates the current activity if its type matches `type`, merging the entries
1414 * from `userInfo` into its current `userInfo` dictionary.
1415 *
1416 * @platform darwin
1417 */
1418 updateCurrentActivity(type: string, userInfo: any): void;
1419 /**
1420 * fulfilled when Electron is initialized. May be used as a convenient alternative
1421 * to checking `app.isReady()` and subscribing to the `ready` event if the app is
1422 * not ready yet.
1423 */
1424 whenReady(): Promise<void>;
1425 /**
1426 * A `Boolean` property that's `true` if Chrome's accessibility support is enabled,
1427 * `false` otherwise. This property will be `true` if the use of assistive
1428 * technologies, such as screen readers, has been detected. Setting this property
1429 * to `true` manually enables Chrome's accessibility support, allowing developers
1430 * to expose accessibility switch to users in application settings.
1431 *
1432 * See Chromium's accessibility docs for more details. Disabled by default.
1433 *
1434 * This API must be called after the `ready` event is emitted.
1435 *
1436 * **Note:** Rendering accessibility tree can significantly affect the performance
1437 * of your app. It should not be enabled by default.
1438 *
1439 * @platform darwin,win32
1440 */
1441 accessibilitySupportEnabled: boolean;
1442 /**
1443 * A `Boolean` which when `true` disables the overrides that Electron has in place
1444 * to ensure renderer processes are restarted on every navigation. The current
1445 * default value for this property is `true`.
1446 *
1447 * The intention is for these overrides to become disabled by default and then at
1448 * some point in the future this property will be removed. This property impacts
1449 * which native modules you can use in the renderer process. For more information
1450 * on the direction Electron is going with renderer process restarts and usage of
1451 * native modules in the renderer process please check out this Tracking Issue.
1452 */
1453 allowRendererProcessReuse: boolean;
1454 /**
1455 * A `Menu | null` property that returns `Menu` if one has been set and `null`
1456 * otherwise. Users can pass a Menu to set this property.
1457 */
1458 applicationMenu: (Menu) | (null);
1459 /**
1460 * An `Integer` property that returns the badge count for current app. Setting the
1461 * count to `0` will hide the badge.
1462 *
1463 * On macOS, setting this with any nonzero integer shows on the dock icon. On
1464 * Linux, this property only works for Unity launcher.
1465 *
1466 * **Note:** Unity launcher requires the existence of a `.desktop` file to work,
1467 * for more information please read Desktop Environment Integration.
1468 *
1469 * **Note:** On macOS, you need to ensure that your application has the permission
1470 * to display notifications for this property to take effect.
1471 *
1472 * @platform linux,darwin
1473 */
1474 badgeCount: number;
1475 /**
1476 * A `CommandLine` object that allows you to read and manipulate the command line
1477 * arguments that Chromium uses.
1478 *
1479 */
1480 readonly commandLine: CommandLine;
1481 /**
1482 * A `Dock` `| undefined` object that allows you to perform actions on your app
1483 * icon in the user's dock on macOS.
1484 *
1485 * @platform darwin
1486 */
1487 readonly dock: Dock;
1488 /**
1489 * A `Boolean` property that returns `true` if the app is packaged, `false`
1490 * otherwise. For many apps, this property can be used to distinguish development
1491 * and production environments.
1492 *
1493 */
1494 readonly isPackaged: boolean;
1495 /**
1496 * A `String` property that indicates the current application's name, which is the
1497 * name in the application's `package.json` file.
1498 *
1499 * Usually the `name` field of `package.json` is a short lowercase name, according
1500 * to the npm modules spec. You should usually also specify a `productName` field,
1501 * which is your application's full capitalized name, and which will be preferred
1502 * over `name` by Electron.
1503 */
1504 name: string;
1505 /**
1506 * A `Boolean` which when `true` indicates that the app is currently running under
1507 * the Rosetta Translator Environment.
1508 *
1509 * You can use this property to prompt users to download the arm64 version of your
1510 * application when they are running the x64 version under Rosetta incorrectly.
1511 *
1512 * @platform darwin
1513 */
1514 readonly runningUnderRosettaTranslation: boolean;
1515 /**
1516 * A `String` which is the user agent string Electron will use as a global
1517 * fallback.
1518 *
1519 * This is the user agent that will be used when no user agent is set at the
1520 * `webContents` or `session` level. It is useful for ensuring that your entire
1521 * app has the same user agent. Set to a custom value as early as possible in your
1522 * app's initialization to ensure that your overridden value is used.
1523 */
1524 userAgentFallback: string;
1525 }
1526
1527 interface AutoUpdater extends NodeJS.EventEmitter {
1528
1529 // Docs: https://electronjs.org/docs/api/auto-updater
1530
1531 /**
1532 * This event is emitted after a user calls `quitAndInstall()`.
1533 *
1534 * When this API is called, the `before-quit` event is not emitted before all
1535 * windows are closed. As a result you should listen to this event if you wish to
1536 * perform actions before the windows are closed while a process is quitting, as
1537 * well as listening to `before-quit`.
1538 */
1539 on(event: 'before-quit-for-update', listener: Function): this;
1540 once(event: 'before-quit-for-update', listener: Function): this;
1541 addListener(event: 'before-quit-for-update', listener: Function): this;
1542 removeListener(event: 'before-quit-for-update', listener: Function): this;
1543 /**
1544 * Emitted when checking if an update has started.
1545 */
1546 on(event: 'checking-for-update', listener: Function): this;
1547 once(event: 'checking-for-update', listener: Function): this;
1548 addListener(event: 'checking-for-update', listener: Function): this;
1549 removeListener(event: 'checking-for-update', listener: Function): this;
1550 /**
1551 * Emitted when there is an error while updating.
1552 */
1553 on(event: 'error', listener: (error: Error) => void): this;
1554 once(event: 'error', listener: (error: Error) => void): this;
1555 addListener(event: 'error', listener: (error: Error) => void): this;
1556 removeListener(event: 'error', listener: (error: Error) => void): this;
1557 /**
1558 * Emitted when there is an available update. The update is downloaded
1559 * automatically.
1560 */
1561 on(event: 'update-available', listener: Function): this;
1562 once(event: 'update-available', listener: Function): this;
1563 addListener(event: 'update-available', listener: Function): this;
1564 removeListener(event: 'update-available', listener: Function): this;
1565 /**
1566 * Emitted when an update has been downloaded.
1567 *
1568 * On Windows only `releaseName` is available.
1569 *
1570 * **Note:** It is not strictly necessary to handle this event. A successfully
1571 * downloaded update will still be applied the next time the application starts.
1572 */
1573 on(event: 'update-downloaded', listener: (event: Event,
1574 releaseNotes: string,
1575 releaseName: string,
1576 releaseDate: Date,
1577 updateURL: string) => void): this;
1578 once(event: 'update-downloaded', listener: (event: Event,
1579 releaseNotes: string,
1580 releaseName: string,
1581 releaseDate: Date,
1582 updateURL: string) => void): this;
1583 addListener(event: 'update-downloaded', listener: (event: Event,
1584 releaseNotes: string,
1585 releaseName: string,
1586 releaseDate: Date,
1587 updateURL: string) => void): this;
1588 removeListener(event: 'update-downloaded', listener: (event: Event,
1589 releaseNotes: string,
1590 releaseName: string,
1591 releaseDate: Date,
1592 updateURL: string) => void): this;
1593 /**
1594 * Emitted when there is no available update.
1595 */
1596 on(event: 'update-not-available', listener: Function): this;
1597 once(event: 'update-not-available', listener: Function): this;
1598 addListener(event: 'update-not-available', listener: Function): this;
1599 removeListener(event: 'update-not-available', listener: Function): this;
1600 /**
1601 * Asks the server whether there is an update. You must call `setFeedURL` before
1602 * using this API.
1603 */
1604 checkForUpdates(): void;
1605 /**
1606 * The current update feed URL.
1607 */
1608 getFeedURL(): string;
1609 /**
1610 * Restarts the app and installs the update after it has been downloaded. It should
1611 * only be called after `update-downloaded` has been emitted.
1612 *
1613 * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
1614 * windows first, and automatically call `app.quit()` after all windows have been
1615 * closed.
1616 *
1617 * **Note:** It is not strictly necessary to call this function to apply an update,
1618 * as a successfully downloaded update will always be applied the next time the
1619 * application starts.
1620 */
1621 quitAndInstall(): void;
1622 /**
1623 * Sets the `url` and initialize the auto updater.
1624 */
1625 setFeedURL(options: FeedURLOptions): void;
1626 }
1627
1628 interface BluetoothDevice {
1629
1630 // Docs: https://electronjs.org/docs/api/structures/bluetooth-device
1631
1632 deviceId: string;
1633 deviceName: string;
1634 }
1635
1636 class BrowserView {
1637
1638 // Docs: https://electronjs.org/docs/api/browser-view
1639
1640 /**
1641 * BrowserView
1642 */
1643 constructor(options?: BrowserViewConstructorOptions);
1644 /**
1645 * The `bounds` of this BrowserView instance as `Object`.
1646 *
1647 * @experimental
1648 */
1649 getBounds(): Rectangle;
1650 setAutoResize(options: AutoResizeOptions): void;
1651 setBackgroundColor(color: string): void;
1652 /**
1653 * Resizes and moves the view to the supplied bounds relative to the window.
1654 *
1655 * @experimental
1656 */
1657 setBounds(bounds: Rectangle): void;
1658 webContents: WebContents;
1659 }
1660
1661 class BrowserWindow extends NodeEventEmitter {
1662
1663 // Docs: https://electronjs.org/docs/api/browser-window
1664
1665 /**
1666 * Emitted when the window is set or unset to show always on top of other windows.
1667 */
1668 on(event: 'always-on-top-changed', listener: (event: Event,
1669 isAlwaysOnTop: boolean) => void): this;
1670 once(event: 'always-on-top-changed', listener: (event: Event,
1671 isAlwaysOnTop: boolean) => void): this;
1672 addListener(event: 'always-on-top-changed', listener: (event: Event,
1673 isAlwaysOnTop: boolean) => void): this;
1674 removeListener(event: 'always-on-top-changed', listener: (event: Event,
1675 isAlwaysOnTop: boolean) => void): this;
1676 /**
1677 * Emitted when an App Command is invoked. These are typically related to keyboard
1678 * media keys or browser commands, as well as the "Back" button built into some
1679 * mice on Windows.
1680 *
1681 * Commands are lowercased, underscores are replaced with hyphens, and the
1682 * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
1683 * emitted as `browser-backward`.
1684 *
1685 * The following app commands are explicitly supported on Linux:
1686 *
1687* `browser-backward`
1688* `browser-forward`
1689 *
1690 * @platform win32,linux
1691 */
1692 on(event: 'app-command', listener: (event: Event,
1693 command: string) => void): this;
1694 once(event: 'app-command', listener: (event: Event,
1695 command: string) => void): this;
1696 addListener(event: 'app-command', listener: (event: Event,
1697 command: string) => void): this;
1698 removeListener(event: 'app-command', listener: (event: Event,
1699 command: string) => void): this;
1700 /**
1701 * Emitted when the window loses focus.
1702 */
1703 on(event: 'blur', listener: Function): this;
1704 once(event: 'blur', listener: Function): this;
1705 addListener(event: 'blur', listener: Function): this;
1706 removeListener(event: 'blur', listener: Function): this;
1707 /**
1708 * Emitted when the window is going to be closed. It's emitted before the
1709 * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
1710 * will cancel the close.
1711 *
1712 * Usually you would want to use the `beforeunload` handler to decide whether the
1713 * window should be closed, which will also be called when the window is reloaded.
1714 * In Electron, returning any value other than `undefined` would cancel the close.
1715 * For example:
1716 *
1717 * _**Note**: There is a subtle difference between the behaviors of
1718 * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
1719 * handler)`. It is recommended to always set the `event.returnValue` explicitly,
1720 * instead of only returning a value, as the former works more consistently within
1721 * Electron._
1722 */
1723 on(event: 'close', listener: (event: Event) => void): this;
1724 once(event: 'close', listener: (event: Event) => void): this;
1725 addListener(event: 'close', listener: (event: Event) => void): this;
1726 removeListener(event: 'close', listener: (event: Event) => void): this;
1727 /**
1728 * Emitted when the window is closed. After you have received this event you should
1729 * remove the reference to the window and avoid using it any more.
1730 */
1731 on(event: 'closed', listener: Function): this;
1732 once(event: 'closed', listener: Function): this;
1733 addListener(event: 'closed', listener: Function): this;
1734 removeListener(event: 'closed', listener: Function): this;
1735 /**
1736 * Emitted when the window enters a full-screen state.
1737 */
1738 on(event: 'enter-full-screen', listener: Function): this;
1739 once(event: 'enter-full-screen', listener: Function): this;
1740 addListener(event: 'enter-full-screen', listener: Function): this;
1741 removeListener(event: 'enter-full-screen', listener: Function): this;
1742 /**
1743 * Emitted when the window enters a full-screen state triggered by HTML API.
1744 */
1745 on(event: 'enter-html-full-screen', listener: Function): this;
1746 once(event: 'enter-html-full-screen', listener: Function): this;
1747 addListener(event: 'enter-html-full-screen', listener: Function): this;
1748 removeListener(event: 'enter-html-full-screen', listener: Function): this;
1749 /**
1750 * Emitted when the window gains focus.
1751 */
1752 on(event: 'focus', listener: Function): this;
1753 once(event: 'focus', listener: Function): this;
1754 addListener(event: 'focus', listener: Function): this;
1755 removeListener(event: 'focus', listener: Function): this;
1756 /**
1757 * Emitted when the window is hidden.
1758 */
1759 on(event: 'hide', listener: Function): this;
1760 once(event: 'hide', listener: Function): this;
1761 addListener(event: 'hide', listener: Function): this;
1762 removeListener(event: 'hide', listener: Function): this;
1763 /**
1764 * Emitted when the window leaves a full-screen state.
1765 */
1766 on(event: 'leave-full-screen', listener: Function): this;
1767 once(event: 'leave-full-screen', listener: Function): this;
1768 addListener(event: 'leave-full-screen', listener: Function): this;
1769 removeListener(event: 'leave-full-screen', listener: Function): this;
1770 /**
1771 * Emitted when the window leaves a full-screen state triggered by HTML API.
1772 */
1773 on(event: 'leave-html-full-screen', listener: Function): this;
1774 once(event: 'leave-html-full-screen', listener: Function): this;
1775 addListener(event: 'leave-html-full-screen', listener: Function): this;
1776 removeListener(event: 'leave-html-full-screen', listener: Function): this;
1777 /**
1778 * Emitted when window is maximized.
1779 */
1780 on(event: 'maximize', listener: Function): this;
1781 once(event: 'maximize', listener: Function): this;
1782 addListener(event: 'maximize', listener: Function): this;
1783 removeListener(event: 'maximize', listener: Function): this;
1784 /**
1785 * Emitted when the window is minimized.
1786 */
1787 on(event: 'minimize', listener: Function): this;
1788 once(event: 'minimize', listener: Function): this;
1789 addListener(event: 'minimize', listener: Function): this;
1790 removeListener(event: 'minimize', listener: Function): this;
1791 /**
1792 * Emitted when the window is being moved to a new position.
1793 */
1794 on(event: 'move', listener: Function): this;
1795 once(event: 'move', listener: Function): this;
1796 addListener(event: 'move', listener: Function): this;
1797 removeListener(event: 'move', listener: Function): this;
1798 /**
1799 * Emitted once when the window is moved to a new position.
1800 *
1801__Note__: On macOS this event is an alias of `move`.
1802 *
1803 * @platform darwin,win32
1804 */
1805 on(event: 'moved', listener: Function): this;
1806 once(event: 'moved', listener: Function): this;
1807 addListener(event: 'moved', listener: Function): this;
1808 removeListener(event: 'moved', listener: Function): this;
1809 /**
1810 * Emitted when the native new tab button is clicked.
1811 *
1812 * @platform darwin
1813 */
1814 on(event: 'new-window-for-tab', listener: Function): this;
1815 once(event: 'new-window-for-tab', listener: Function): this;
1816 addListener(event: 'new-window-for-tab', listener: Function): this;
1817 removeListener(event: 'new-window-for-tab', listener: Function): this;
1818 /**
1819 * Emitted when the document changed its title, calling `event.preventDefault()`
1820 * will prevent the native window's title from changing. `explicitSet` is false
1821 * when title is synthesized from file URL.
1822 */
1823 on(event: 'page-title-updated', listener: (event: Event,
1824 title: string,
1825 explicitSet: boolean) => void): this;
1826 once(event: 'page-title-updated', listener: (event: Event,
1827 title: string,
1828 explicitSet: boolean) => void): this;
1829 addListener(event: 'page-title-updated', listener: (event: Event,
1830 title: string,
1831 explicitSet: boolean) => void): this;
1832 removeListener(event: 'page-title-updated', listener: (event: Event,
1833 title: string,
1834 explicitSet: boolean) => void): this;
1835 /**
1836 * Emitted when the web page has been rendered (while not being shown) and window
1837 * can be displayed without a visual flash.
1838 *
1839 * Please note that using this event implies that the renderer will be considered
1840 * "visible" and paint even though `show` is false. This event will never fire if
1841 * you use `paintWhenInitiallyHidden: false`
1842 */
1843 on(event: 'ready-to-show', listener: Function): this;
1844 once(event: 'ready-to-show', listener: Function): this;
1845 addListener(event: 'ready-to-show', listener: Function): this;
1846 removeListener(event: 'ready-to-show', listener: Function): this;
1847 /**
1848 * Emitted after the window has been resized.
1849 */
1850 on(event: 'resize', listener: Function): this;
1851 once(event: 'resize', listener: Function): this;
1852 addListener(event: 'resize', listener: Function): this;
1853 removeListener(event: 'resize', listener: Function): this;
1854 /**
1855 * Emitted once when the window has finished being resized.
1856 *
1857 * This is usually emitted when the window has been resized manually. On macOS,
1858 * resizing the window with `setBounds`/`setSize` and setting the `animate`
1859 * parameter to `true` will also emit this event once resizing has finished.
1860 *
1861 * @platform darwin,win32
1862 */
1863 on(event: 'resized', listener: Function): this;
1864 once(event: 'resized', listener: Function): this;
1865 addListener(event: 'resized', listener: Function): this;
1866 removeListener(event: 'resized', listener: Function): this;
1867 /**
1868 * Emitted when the unresponsive web page becomes responsive again.
1869 */
1870 on(event: 'responsive', listener: Function): this;
1871 once(event: 'responsive', listener: Function): this;
1872 addListener(event: 'responsive', listener: Function): this;
1873 removeListener(event: 'responsive', listener: Function): this;
1874 /**
1875 * Emitted when the window is restored from a minimized state.
1876 */
1877 on(event: 'restore', listener: Function): this;
1878 once(event: 'restore', listener: Function): this;
1879 addListener(event: 'restore', listener: Function): this;
1880 removeListener(event: 'restore', listener: Function): this;
1881 /**
1882 * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
1883 * is ended. The `rotation` value on each emission is the angle in degrees rotated
1884 * since the last emission. The last emitted event upon a rotation gesture will
1885 * always be of value `0`. Counter-clockwise rotation values are positive, while
1886 * clockwise ones are negative.
1887 *
1888 * @platform darwin
1889 */
1890 on(event: 'rotate-gesture', listener: (event: Event,
1891 rotation: number) => void): this;
1892 once(event: 'rotate-gesture', listener: (event: Event,
1893 rotation: number) => void): this;
1894 addListener(event: 'rotate-gesture', listener: (event: Event,
1895 rotation: number) => void): this;
1896 removeListener(event: 'rotate-gesture', listener: (event: Event,
1897 rotation: number) => void): this;
1898 /**
1899 * Emitted when scroll wheel event phase has begun.
1900 *
1901 * @platform darwin
1902 */
1903 on(event: 'scroll-touch-begin', listener: Function): this;
1904 once(event: 'scroll-touch-begin', listener: Function): this;
1905 addListener(event: 'scroll-touch-begin', listener: Function): this;
1906 removeListener(event: 'scroll-touch-begin', listener: Function): this;
1907 /**
1908 * Emitted when scroll wheel event phase filed upon reaching the edge of element.
1909 *
1910 * @platform darwin
1911 */
1912 on(event: 'scroll-touch-edge', listener: Function): this;
1913 once(event: 'scroll-touch-edge', listener: Function): this;
1914 addListener(event: 'scroll-touch-edge', listener: Function): this;
1915 removeListener(event: 'scroll-touch-edge', listener: Function): this;
1916 /**
1917 * Emitted when scroll wheel event phase has ended.
1918 *
1919 * @platform darwin
1920 */
1921 on(event: 'scroll-touch-end', listener: Function): this;
1922 once(event: 'scroll-touch-end', listener: Function): this;
1923 addListener(event: 'scroll-touch-end', listener: Function): this;
1924 removeListener(event: 'scroll-touch-end', listener: Function): this;
1925 /**
1926 * Emitted when window session is going to end due to force shutdown or machine
1927 * restart or session log off.
1928 *
1929 * @platform win32
1930 */
1931 on(event: 'session-end', listener: Function): this;
1932 once(event: 'session-end', listener: Function): this;
1933 addListener(event: 'session-end', listener: Function): this;
1934 removeListener(event: 'session-end', listener: Function): this;
1935 /**
1936 * Emitted when the window opens a sheet.
1937 *
1938 * @platform darwin
1939 */
1940 on(event: 'sheet-begin', listener: Function): this;
1941 once(event: 'sheet-begin', listener: Function): this;
1942 addListener(event: 'sheet-begin', listener: Function): this;
1943 removeListener(event: 'sheet-begin', listener: Function): this;
1944 /**
1945 * Emitted when the window has closed a sheet.
1946 *
1947 * @platform darwin
1948 */
1949 on(event: 'sheet-end', listener: Function): this;
1950 once(event: 'sheet-end', listener: Function): this;
1951 addListener(event: 'sheet-end', listener: Function): this;
1952 removeListener(event: 'sheet-end', listener: Function): this;
1953 /**
1954 * Emitted when the window is shown.
1955 */
1956 on(event: 'show', listener: Function): this;
1957 once(event: 'show', listener: Function): this;
1958 addListener(event: 'show', listener: Function): this;
1959 removeListener(event: 'show', listener: Function): this;
1960 /**
1961 * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
1962 * `left`.
1963 *
1964 * The method underlying this event is built to handle older macOS-style trackpad
1965 * swiping, where the content on the screen doesn't move with the swipe. Most macOS
1966 * trackpads are not configured to allow this kind of swiping anymore, so in order
1967 * for it to emit properly the 'Swipe between pages' preference in `System
1968 * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
1969 * fingers'.
1970 *
1971 * @platform darwin
1972 */
1973 on(event: 'swipe', listener: (event: Event,
1974 direction: string) => void): this;
1975 once(event: 'swipe', listener: (event: Event,
1976 direction: string) => void): this;
1977 addListener(event: 'swipe', listener: (event: Event,
1978 direction: string) => void): this;
1979 removeListener(event: 'swipe', listener: (event: Event,
1980 direction: string) => void): this;
1981 /**
1982 * Emitted when the system context menu is triggered on the window, this is
1983 * normally only triggered when the user right clicks on the non-client area of
1984 * your window. This is the window titlebar or any area you have declared as
1985 * `-webkit-app-region: drag` in a frameless window.
1986 *
1987Calling `event.preventDefault()` will prevent the menu from being displayed.
1988 *
1989 * @platform win32
1990 */
1991 on(event: 'system-context-menu', listener: (event: Event,
1992 /**
1993 * The screen coordinates the context menu was triggered at
1994 */
1995 point: Point) => void): this;
1996 once(event: 'system-context-menu', listener: (event: Event,
1997 /**
1998 * The screen coordinates the context menu was triggered at
1999 */
2000 point: Point) => void): this;
2001 addListener(event: 'system-context-menu', listener: (event: Event,
2002 /**
2003 * The screen coordinates the context menu was triggered at
2004 */
2005 point: Point) => void): this;
2006 removeListener(event: 'system-context-menu', listener: (event: Event,
2007 /**
2008 * The screen coordinates the context menu was triggered at
2009 */
2010 point: Point) => void): this;
2011 /**
2012 * Emitted when the window exits from a maximized state.
2013 */
2014 on(event: 'unmaximize', listener: Function): this;
2015 once(event: 'unmaximize', listener: Function): this;
2016 addListener(event: 'unmaximize', listener: Function): this;
2017 removeListener(event: 'unmaximize', listener: Function): this;
2018 /**
2019 * Emitted when the web page becomes unresponsive.
2020 */
2021 on(event: 'unresponsive', listener: Function): this;
2022 once(event: 'unresponsive', listener: Function): this;
2023 addListener(event: 'unresponsive', listener: Function): this;
2024 removeListener(event: 'unresponsive', listener: Function): this;
2025 /**
2026 * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
2027 * will prevent the window from being moved.
2028 *
2029 * Note that this is only emitted when the window is being resized manually.
2030 * Resizing the window with `setBounds`/`setSize` will not emit this event.
2031 *
2032 * @platform darwin,win32
2033 */
2034 on(event: 'will-move', listener: (event: Event,
2035 /**
2036 * Location the window is being moved to.
2037 */
2038 newBounds: Rectangle) => void): this;
2039 once(event: 'will-move', listener: (event: Event,
2040 /**
2041 * Location the window is being moved to.
2042 */
2043 newBounds: Rectangle) => void): this;
2044 addListener(event: 'will-move', listener: (event: Event,
2045 /**
2046 * Location the window is being moved to.
2047 */
2048 newBounds: Rectangle) => void): this;
2049 removeListener(event: 'will-move', listener: (event: Event,
2050 /**
2051 * Location the window is being moved to.
2052 */
2053 newBounds: Rectangle) => void): this;
2054 /**
2055 * Emitted before the window is resized. Calling `event.preventDefault()` will
2056 * prevent the window from being resized.
2057 *
2058 * Note that this is only emitted when the window is being resized manually.
2059 * Resizing the window with `setBounds`/`setSize` will not emit this event.
2060 *
2061 * @platform darwin,win32
2062 */
2063 on(event: 'will-resize', listener: (event: Event,
2064 /**
2065 * Size the window is being resized to.
2066 */
2067 newBounds: Rectangle) => void): this;
2068 once(event: 'will-resize', listener: (event: Event,
2069 /**
2070 * Size the window is being resized to.
2071 */
2072 newBounds: Rectangle) => void): this;
2073 addListener(event: 'will-resize', listener: (event: Event,
2074 /**
2075 * Size the window is being resized to.
2076 */
2077 newBounds: Rectangle) => void): this;
2078 removeListener(event: 'will-resize', listener: (event: Event,
2079 /**
2080 * Size the window is being resized to.
2081 */
2082 newBounds: Rectangle) => void): this;
2083 /**
2084 * BrowserWindow
2085 */
2086 constructor(options?: BrowserWindowConstructorOptions);
2087 /**
2088 * Adds DevTools extension located at `path`, and returns extension's name.
2089 *
2090 * The extension will be remembered so you only need to call this API once, this
2091 * API is not for programming use. If you try to add an extension that has already
2092 * been loaded, this method will not return and instead log a warning to the
2093 * console.
2094 *
2095 * The method will also not return if the extension's manifest is missing or
2096 * incomplete.
2097 *
2098 * **Note:** This API cannot be called before the `ready` event of the `app` module
2099 * is emitted.
2100 *
2101**Note:** This method is deprecated. Instead, use `ses.loadExtension(path)`.
2102 *
2103 * @deprecated
2104 */
2105 static addDevToolsExtension(path: string): void;
2106 /**
2107 * Adds Chrome extension located at `path`, and returns extension's name.
2108 *
2109 * The method will also not return if the extension's manifest is missing or
2110 * incomplete.
2111 *
2112 * **Note:** This API cannot be called before the `ready` event of the `app` module
2113 * is emitted.
2114 *
2115**Note:** This method is deprecated. Instead, use `ses.loadExtension(path)`.
2116 *
2117 * @deprecated
2118 */
2119 static addExtension(path: string): void;
2120 /**
2121 * The window that owns the given `browserView`. If the given view is not attached
2122 * to any window, returns `null`.
2123 */
2124 static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
2125 /**
2126 * The window with the given `id`.
2127 */
2128 static fromId(id: number): (BrowserWindow) | (null);
2129 /**
2130 * The window that owns the given `webContents` or `null` if the contents are not
2131 * owned by a window.
2132 */
2133 static fromWebContents(webContents: WebContents): (BrowserWindow) | (null);
2134 /**
2135 * An array of all opened browser windows.
2136 */
2137 static getAllWindows(): BrowserWindow[];
2138 /**
2139 * The keys are the extension names and each value is an Object containing `name`
2140 * and `version` properties.
2141 *
2142 * To check if a DevTools extension is installed you can run the following:
2143 *
2144 * **Note:** This API cannot be called before the `ready` event of the `app` module
2145 * is emitted.
2146 *
2147**Note:** This method is deprecated. Instead, use `ses.getAllExtensions()`.
2148 *
2149 * @deprecated
2150 */
2151 static getDevToolsExtensions(): Record<string, ExtensionInfo>;
2152 /**
2153 * The keys are the extension names and each value is an Object containing `name`
2154 * and `version` properties.
2155 *
2156 * **Note:** This API cannot be called before the `ready` event of the `app` module
2157 * is emitted.
2158 *
2159**Note:** This method is deprecated. Instead, use `ses.getAllExtensions()`.
2160 *
2161 * @deprecated
2162 */
2163 static getExtensions(): Record<string, ExtensionInfo>;
2164 /**
2165 * The window that is focused in this application, otherwise returns `null`.
2166 */
2167 static getFocusedWindow(): (BrowserWindow) | (null);
2168 /**
2169 * Remove a DevTools extension by name.
2170 *
2171 * **Note:** This API cannot be called before the `ready` event of the `app` module
2172 * is emitted.
2173 *
2174 * **Note:** This method is deprecated. Instead, use
2175 * `ses.removeExtension(extension_id)`.
2176 *
2177 * @deprecated
2178 */
2179 static removeDevToolsExtension(name: string): void;
2180 /**
2181 * Remove a Chrome extension by name.
2182 *
2183 * **Note:** This API cannot be called before the `ready` event of the `app` module
2184 * is emitted.
2185 *
2186 * **Note:** This method is deprecated. Instead, use
2187 * `ses.removeExtension(extension_id)`.
2188 *
2189 * @deprecated
2190 */
2191 static removeExtension(name: string): void;
2192 /**
2193 * Replacement API for setBrowserView supporting work with multi browser views.
2194 *
2195 * @experimental
2196 */
2197 addBrowserView(browserView: BrowserView): void;
2198 /**
2199 * Adds a window as a tab on this window, after the tab for the window instance.
2200 *
2201 * @platform darwin
2202 */
2203 addTabbedWindow(browserWindow: BrowserWindow): void;
2204 /**
2205 * Removes focus from the window.
2206 */
2207 blur(): void;
2208 blurWebView(): void;
2209 /**
2210 * Resolves with a NativeImage
2211 *
2212 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
2213 * whole visible page.
2214 */
2215 capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
2216 /**
2217 * Moves window to the center of the screen.
2218 */
2219 center(): void;
2220 /**
2221 * Try to close the window. This has the same effect as a user manually clicking
2222 * the close button of the window. The web page may cancel the close though. See
2223 * the close event.
2224 */
2225 close(): void;
2226 /**
2227 * Closes the currently open Quick Look panel.
2228 *
2229 * @platform darwin
2230 */
2231 closeFilePreview(): void;
2232 /**
2233 * Force closing the window, the `unload` and `beforeunload` event won't be emitted
2234 * for the web page, and `close` event will also not be emitted for this window,
2235 * but it guarantees the `closed` event will be emitted.
2236 */
2237 destroy(): void;
2238 /**
2239 * Starts or stops flashing the window to attract user's attention.
2240 */
2241 flashFrame(flag: boolean): void;
2242 /**
2243 * Focuses on the window.
2244 */
2245 focus(): void;
2246 focusOnWebView(): void;
2247 /**
2248 * Gets the background color of the window. See Setting `backgroundColor`.
2249 */
2250 getBackgroundColor(): string;
2251 /**
2252 * The `bounds` of the window as `Object`.
2253 */
2254 getBounds(): Rectangle;
2255 /**
2256 * The `BrowserView` attached to `win`. Returns `null` if one is not attached.
2257 * Throws an error if multiple `BrowserView`s are attached.
2258 *
2259 * @experimental
2260 */
2261 getBrowserView(): (BrowserView) | (null);
2262 /**
2263 * an array of all BrowserViews that have been attached with `addBrowserView` or
2264 * `setBrowserView`.
2265 *
2266 * **Note:** The BrowserView API is currently experimental and may change or be
2267 * removed in future Electron releases.
2268 *
2269 * @experimental
2270 */
2271 getBrowserViews(): BrowserView[];
2272 /**
2273 * All child windows.
2274 */
2275 getChildWindows(): BrowserWindow[];
2276 /**
2277 * The `bounds` of the window's client area as `Object`.
2278 */
2279 getContentBounds(): Rectangle;
2280 /**
2281 * Contains the window's client area's width and height.
2282 */
2283 getContentSize(): number[];
2284 /**
2285 * Contains the window's maximum width and height.
2286 */
2287 getMaximumSize(): number[];
2288 /**
2289 * Window id in the format of DesktopCapturerSource's id. For example
2290 * "window:1234:0".
2291 *
2292 * More precisely the format is `window:id:other_id` where `id` is `HWND` on
2293 * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
2294 * Linux. `other_id` is used to identify web contents (tabs) so within the same top
2295 * level window.
2296 */
2297 getMediaSourceId(): string;
2298 /**
2299 * Contains the window's minimum width and height.
2300 */
2301 getMinimumSize(): number[];
2302 /**
2303 * The platform-specific handle of the window.
2304 *
2305 * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
2306 * `Window` (`unsigned long`) on Linux.
2307 */
2308 getNativeWindowHandle(): Buffer;
2309 /**
2310 * Contains the window bounds of the normal state
2311 *
2312 * **Note:** whatever the current state of the window : maximized, minimized or in
2313 * fullscreen, this function always returns the position and size of the window in
2314 * normal state. In normal state, getBounds and getNormalBounds returns the same
2315 * `Rectangle`.
2316 */
2317 getNormalBounds(): Rectangle;
2318 /**
2319 * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
2320 * 1.
2321 */
2322 getOpacity(): number;
2323 /**
2324 * The parent window.
2325 */
2326 getParentWindow(): BrowserWindow;
2327 /**
2328 * Contains the window's current position.
2329 */
2330 getPosition(): number[];
2331 /**
2332 * The pathname of the file the window represents.
2333 *
2334 * @platform darwin
2335 */
2336 getRepresentedFilename(): string;
2337 /**
2338 * Contains the window's width and height.
2339 */
2340 getSize(): number[];
2341 /**
2342 * The title of the native window.
2343 *
2344 * **Note:** The title of the web page can be different from the title of the
2345 * native window.
2346 */
2347 getTitle(): string;
2348 /**
2349 * The current position for the traffic light buttons. Can only be used with
2350 * `titleBarStyle` set to `hidden`.
2351 *
2352 * @platform darwin
2353 */
2354 getTrafficLightPosition(): Point;
2355 /**
2356 * Whether the window has a shadow.
2357 */
2358 hasShadow(): boolean;
2359 /**
2360 * Hides the window.
2361 */
2362 hide(): void;
2363 /**
2364 * Hooks a windows message. The `callback` is called when the message is received
2365 * in the WndProc.
2366 *
2367 * @platform win32
2368 */
2369 hookWindowMessage(message: number, callback: () => void): void;
2370 /**
2371 * Whether the window is always on top of other windows.
2372 */
2373 isAlwaysOnTop(): boolean;
2374 /**
2375 * Whether the window can be manually closed by user.
2376 *
2377On Linux always returns `true`.
2378 *
2379 * @platform darwin,win32
2380 */
2381 isClosable(): boolean;
2382 /**
2383 * Whether the window is destroyed.
2384 */
2385 isDestroyed(): boolean;
2386 /**
2387 * Whether the window's document has been edited.
2388 *
2389 * @platform darwin
2390 */
2391 isDocumentEdited(): boolean;
2392 /**
2393 * whether the window is enabled.
2394 */
2395 isEnabled(): boolean;
2396 /**
2397 * Whether the window is focused.
2398 */
2399 isFocused(): boolean;
2400 /**
2401 * Whether the window is in fullscreen mode.
2402 */
2403 isFullScreen(): boolean;
2404 /**
2405 * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
2406 * window.
2407 */
2408 isFullScreenable(): boolean;
2409 /**
2410 * Whether the window is in kiosk mode.
2411 */
2412 isKiosk(): boolean;
2413 /**
2414 * Whether the window can be manually maximized by user.
2415 *
2416On Linux always returns `true`.
2417 *
2418 * @platform darwin,win32
2419 */
2420 isMaximizable(): boolean;
2421 /**
2422 * Whether the window is maximized.
2423 */
2424 isMaximized(): boolean;
2425 /**
2426 * Whether menu bar automatically hides itself.
2427 */
2428 isMenuBarAutoHide(): boolean;
2429 /**
2430 * Whether the menu bar is visible.
2431 */
2432 isMenuBarVisible(): boolean;
2433 /**
2434 * Whether the window can be manually minimized by the user.
2435 *
2436On Linux always returns `true`.
2437 *
2438 * @platform darwin,win32
2439 */
2440 isMinimizable(): boolean;
2441 /**
2442 * Whether the window is minimized.
2443 */
2444 isMinimized(): boolean;
2445 /**
2446 * Whether current window is a modal window.
2447 */
2448 isModal(): boolean;
2449 /**
2450 * Whether the window can be moved by user.
2451
2452On Linux always returns `true`.
2453 *
2454 * @platform darwin,win32
2455 */
2456 isMovable(): boolean;
2457 /**
2458 * Whether the window is in normal state (not maximized, not minimized, not in
2459 * fullscreen mode).
2460 */
2461 isNormal(): boolean;
2462 /**
2463 * Whether the window can be manually resized by the user.
2464 */
2465 isResizable(): boolean;
2466 /**
2467 * Whether the window is in simple (pre-Lion) fullscreen mode.
2468 *
2469 * @platform darwin
2470 */
2471 isSimpleFullScreen(): boolean;
2472 /**
2473 * Whether the window is visible to the user.
2474 */
2475 isVisible(): boolean;
2476 /**
2477 * Whether the window is visible on all workspaces.
2478 *
2479**Note:** This API always returns false on Windows.
2480 */
2481 isVisibleOnAllWorkspaces(): boolean;
2482 /**
2483 * `true` or `false` depending on whether the message is hooked.
2484 *
2485 * @platform win32
2486 */
2487 isWindowMessageHooked(message: number): boolean;
2488 /**
2489 * the promise will resolve when the page has finished loading (see
2490 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
2491 *
2492 * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
2493 * relative to the root of your application. See the `webContents` docs for more
2494 * information.
2495 */
2496 loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
2497 /**
2498 * the promise will resolve when the page has finished loading (see
2499 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
2500 *
2501 * Same as `webContents.loadURL(url[, options])`.
2502 *
2503 * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
2504 * file using the `file://` protocol.
2505 *
2506 * To ensure that file URLs are properly formatted, it is recommended to use Node's
2507 * `url.format` method:
2508 *
2509 * You can load a URL using a `POST` request with URL-encoded data by doing the
2510 * following:
2511 */
2512 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
2513 /**
2514 * Maximizes the window. This will also show (but not focus) the window if it isn't
2515 * being displayed already.
2516 */
2517 maximize(): void;
2518 /**
2519 * Merges all windows into one window with multiple tabs when native tabs are
2520 * enabled and there is more than one open window.
2521 *
2522 * @platform darwin
2523 */
2524 mergeAllWindows(): void;
2525 /**
2526 * Minimizes the window. On some platforms the minimized window will be shown in
2527 * the Dock.
2528 */
2529 minimize(): void;
2530 /**
2531 * Moves window above the source window in the sense of z-order. If the
2532 * `mediaSourceId` is not of type window or if the window does not exist then this
2533 * method throws an error.
2534 */
2535 moveAbove(mediaSourceId: string): void;
2536 /**
2537 * Moves the current tab into a new window if native tabs are enabled and there is
2538 * more than one tab in the current window.
2539 *
2540 * @platform darwin
2541 */
2542 moveTabToNewWindow(): void;
2543 /**
2544 * Moves window to top(z-order) regardless of focus
2545 */
2546 moveTop(): void;
2547 /**
2548 * Uses Quick Look to preview a file at a given path.
2549 *
2550 * @platform darwin
2551 */
2552 previewFile(path: string, displayName?: string): void;
2553 /**
2554 * Same as `webContents.reload`.
2555 */
2556 reload(): void;
2557 removeBrowserView(browserView: BrowserView): void;
2558 /**
2559 * Remove the window's menu bar.
2560 *
2561 * @platform linux,win32
2562 */
2563 removeMenu(): void;
2564 /**
2565 * Restores the window from minimized state to its previous state.
2566 */
2567 restore(): void;
2568 /**
2569 * Selects the next tab when native tabs are enabled and there are other tabs in
2570 * the window.
2571 *
2572 * @platform darwin
2573 */
2574 selectNextTab(): void;
2575 /**
2576 * Selects the previous tab when native tabs are enabled and there are other tabs
2577 * in the window.
2578 *
2579 * @platform darwin
2580 */
2581 selectPreviousTab(): void;
2582 /**
2583 * Sets whether the window should show always on top of other windows. After
2584 * setting this, the window is still a normal window, not a toolbox window which
2585 * can not be focused on.
2586 */
2587 setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
2588 /**
2589 * Sets the properties for the window's taskbar button.
2590 *
2591 * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
2592 * together. If one of those properties is not set, then neither will be used.
2593 *
2594 * @platform win32
2595 */
2596 setAppDetails(options: AppDetailsOptions): void;
2597 /**
2598 * This will make a window maintain an aspect ratio. The extra size allows a
2599 * developer to have space, specified in pixels, not included within the aspect
2600 * ratio calculations. This API already takes into account the difference between a
2601 * window's size and its content size.
2602 *
2603 * Consider a normal window with an HD video player and associated controls.
2604 * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
2605 * on the right edge and 50 pixels of controls below the player. In order to
2606 * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
2607 * the player itself we would call this function with arguments of 16/9 and {
2608 * width: 40, height: 50 }. The second argument doesn't care where the extra width
2609 * and height are within the content view--only that they exist. Sum any extra
2610 * width and height areas you have within the overall content view.
2611 *
2612 * The aspect ratio is not respected when window is resized programmingly with APIs
2613 * like `win.setSize`.
2614 */
2615 setAspectRatio(aspectRatio: number, extraSize?: Size): void;
2616 /**
2617 * Controls whether to hide cursor when typing.
2618 *
2619 * @platform darwin
2620 */
2621 setAutoHideCursor(autoHide: boolean): void;
2622 /**
2623 * Sets whether the window menu bar should hide itself automatically. Once set the
2624 * menu bar will only show when users press the single `Alt` key.
2625 *
2626 * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
2627 * hide it immediately.
2628 */
2629 setAutoHideMenuBar(hide: boolean): void;
2630 /**
2631 * Sets the background color of the window. See Setting `backgroundColor`.
2632 */
2633 setBackgroundColor(backgroundColor: string): void;
2634 /**
2635 * Resizes and moves the window to the supplied bounds. Any properties that are not
2636 * supplied will default to their current values.
2637 */
2638 setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
2639 setBrowserView(browserView: (BrowserView) | (null)): void;
2640 /**
2641 * Sets whether the window can be manually closed by user. On Linux does nothing.
2642 *
2643 * @platform darwin,win32
2644 */
2645 setClosable(closable: boolean): void;
2646 /**
2647 * Resizes and moves the window's client area (e.g. the web page) to the supplied
2648 * bounds.
2649 */
2650 setContentBounds(bounds: Rectangle, animate?: boolean): void;
2651 /**
2652 * Prevents the window contents from being captured by other apps.
2653 *
2654 * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
2655 * it calls SetWindowDisplayAffinity with `WDA_MONITOR`.
2656 *
2657 * @platform darwin,win32
2658 */
2659 setContentProtection(enable: boolean): void;
2660 /**
2661 * Resizes the window's client area (e.g. the web page) to `width` and `height`.
2662 */
2663 setContentSize(width: number, height: number, animate?: boolean): void;
2664 /**
2665 * Specifies whether the window’s document has been edited, and the icon in title
2666 * bar will become gray when set to `true`.
2667 *
2668 * @platform darwin
2669 */
2670 setDocumentEdited(edited: boolean): void;
2671 /**
2672 * Disable or enable the window.
2673 */
2674 setEnabled(enable: boolean): void;
2675 /**
2676 * Changes whether the window can be focused.
2677 *
2678On macOS it does not remove the focus from the window.
2679 *
2680 * @platform darwin,win32
2681 */
2682 setFocusable(focusable: boolean): void;
2683 /**
2684 * Sets whether the window should be in fullscreen mode.
2685 */
2686 setFullScreen(flag: boolean): void;
2687 /**
2688 * Sets whether the maximize/zoom window button toggles fullscreen mode or
2689 * maximizes the window.
2690 */
2691 setFullScreenable(fullscreenable: boolean): void;
2692 /**
2693 * Sets whether the window should have a shadow.
2694 */
2695 setHasShadow(hasShadow: boolean): void;
2696 /**
2697 * Changes window icon.
2698 *
2699 * @platform win32,linux
2700 */
2701 setIcon(icon: (NativeImage) | (string)): void;
2702 /**
2703 * Makes the window ignore all mouse events.
2704 *
2705 * All mouse events happened in this window will be passed to the window below this
2706 * window, but if this window has focus, it will still receive keyboard events.
2707 */
2708 setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
2709 /**
2710 * Enters or leaves kiosk mode.
2711 */
2712 setKiosk(flag: boolean): void;
2713 /**
2714 * Sets whether the window can be manually maximized by user. On Linux does
2715 * nothing.
2716 *
2717 * @platform darwin,win32
2718 */
2719 setMaximizable(maximizable: boolean): void;
2720 /**
2721 * Sets the maximum size of window to `width` and `height`.
2722 */
2723 setMaximumSize(width: number, height: number): void;
2724 /**
2725 * Sets the `menu` as the window's menu bar.
2726 *
2727 * @platform linux,win32
2728 */
2729 setMenu(menu: (Menu) | (null)): void;
2730 /**
2731 * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
2732 * can still bring up the menu bar by pressing the single `Alt` key.
2733 *
2734 * @platform win32,linux
2735 */
2736 setMenuBarVisibility(visible: boolean): void;
2737 /**
2738 * Sets whether the window can be manually minimized by user. On Linux does
2739 * nothing.
2740 *
2741 * @platform darwin,win32
2742 */
2743 setMinimizable(minimizable: boolean): void;
2744 /**
2745 * Sets the minimum size of window to `width` and `height`.
2746 */
2747 setMinimumSize(width: number, height: number): void;
2748 /**
2749 * Sets whether the window can be moved by user. On Linux does nothing.
2750 *
2751 * @platform darwin,win32
2752 */
2753 setMovable(movable: boolean): void;
2754 /**
2755 * Sets the opacity of the window. On Linux, does nothing. Out of bound number
2756 * values are clamped to the [0, 1] range.
2757 *
2758 * @platform win32,darwin
2759 */
2760 setOpacity(opacity: number): void;
2761 /**
2762 * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
2763 * convey some sort of application status or to passively notify the user.
2764 *
2765 * @platform win32
2766 */
2767 setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
2768 /**
2769 * Sets `parent` as current window's parent window, passing `null` will turn
2770 * current window into a top-level window.
2771 */
2772 setParentWindow(parent: (BrowserWindow) | (null)): void;
2773 /**
2774 * Moves window to `x` and `y`.
2775 */
2776 setPosition(x: number, y: number, animate?: boolean): void;
2777 /**
2778 * Sets progress value in progress bar. Valid range is [0, 1.0].
2779 *
2780 * Remove progress bar when progress < 0; Change to indeterminate mode when
2781 * progress > 1.
2782 *
2783 * On Linux platform, only supports Unity desktop environment, you need to specify
2784 * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
2785 * it will assume `{app.name}.desktop`.
2786 *
2787 * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
2788 * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
2789 * mode set (but with a value within the valid range), `normal` will be assumed.
2790 */
2791 setProgressBar(progress: number, options?: ProgressBarOptions): void;
2792 /**
2793 * Sets the pathname of the file the window represents, and the icon of the file
2794 * will show in window's title bar.
2795 *
2796 * @platform darwin
2797 */
2798 setRepresentedFilename(filename: string): void;
2799 /**
2800 * Sets whether the window can be manually resized by the user.
2801 */
2802 setResizable(resizable: boolean): void;
2803 /**
2804 * Setting a window shape determines the area within the window where the system
2805 * permits drawing and user interaction. Outside of the given region, no pixels
2806 * will be drawn and no mouse events will be registered. Mouse events outside of
2807 * the region will not be received by that window, but will fall through to
2808 * whatever is behind the window.
2809 *
2810 * @experimental
2811 * @platform win32,linux
2812 */
2813 setShape(rects: Rectangle[]): void;
2814 /**
2815 * Changes the attachment point for sheets on macOS. By default, sheets are
2816 * attached just below the window frame, but you may want to display them beneath a
2817 * HTML-rendered toolbar. For example:
2818 *
2819 * @platform darwin
2820 */
2821 setSheetOffset(offsetY: number, offsetX?: number): void;
2822 /**
2823 * Enters or leaves simple fullscreen mode.
2824 *
2825 * Simple fullscreen mode emulates the native fullscreen behavior found in versions
2826 * of macOS prior to Lion (10.7).
2827 *
2828 * @platform darwin
2829 */
2830 setSimpleFullScreen(flag: boolean): void;
2831 /**
2832 * Resizes the window to `width` and `height`. If `width` or `height` are below any
2833 * set minimum size constraints the window will snap to its minimum size.
2834 */
2835 setSize(width: number, height: number, animate?: boolean): void;
2836 /**
2837 * Makes the window not show in the taskbar.
2838 */
2839 setSkipTaskbar(skip: boolean): void;
2840 /**
2841 * Whether the buttons were added successfully
2842 *
2843 * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
2844 * of a window in a taskbar button layout. Returns a `Boolean` object indicates
2845 * whether the thumbnail has been added successfully.
2846 *
2847 * The number of buttons in thumbnail toolbar should be no greater than 7 due to
2848 * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
2849 * removed due to the platform's limitation. But you can call the API with an empty
2850 * array to clean the buttons.
2851 *
2852 * The `buttons` is an array of `Button` objects:
2853 *
2854 * * `Button` Object
2855 * * `icon` NativeImage - The icon showing in thumbnail toolbar.
2856 * * `click` Function
2857 * * `tooltip` String (optional) - The text of the button's tooltip.
2858 * * `flags` String[] (optional) - Control specific states and behaviors of the
2859 * button. By default, it is `['enabled']`.
2860 *
2861 * The `flags` is an array that can include following `String`s:
2862 *
2863 * * `enabled` - The button is active and available to the user.
2864 * * `disabled` - The button is disabled. It is present, but has a visual state
2865 * indicating it will not respond to user action.
2866 * * `dismissonclick` - When the button is clicked, the thumbnail window closes
2867 * immediately.
2868 * * `nobackground` - Do not draw a button border, use only the image.
2869 * * `hidden` - The button is not shown to the user.
2870 * * `noninteractive` - The button is enabled but not interactive; no pressed
2871 * button state is drawn. This value is intended for instances where the button is
2872 * used in a notification.
2873 *
2874 * @platform win32
2875 */
2876 setThumbarButtons(buttons: ThumbarButton[]): boolean;
2877 /**
2878 * Sets the region of the window to show as the thumbnail image displayed when
2879 * hovering over the window in the taskbar. You can reset the thumbnail to be the
2880 * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
2881 * }`.
2882 *
2883 * @platform win32
2884 */
2885 setThumbnailClip(region: Rectangle): void;
2886 /**
2887 * Sets the toolTip that is displayed when hovering over the window thumbnail in
2888 * the taskbar.
2889 *
2890 * @platform win32
2891 */
2892 setThumbnailToolTip(toolTip: string): void;
2893 /**
2894 * Changes the title of native window to `title`.
2895 */
2896 setTitle(title: string): void;
2897 /**
2898 * Raises `browserView` above other `BrowserView`s attached to `win`. Throws an
2899 * error if `browserView` is not attached to `win`.
2900 *
2901 * @experimental
2902 */
2903 setTopBrowserView(browserView: BrowserView): void;
2904 /**
2905 * Sets the touchBar layout for the current window. Specifying `null` or
2906 * `undefined` clears the touch bar. This method only has an effect if the machine
2907 * has a touch bar and is running on macOS 10.12.1+.
2908 *
2909 * **Note:** The TouchBar API is currently experimental and may change or be
2910 * removed in future Electron releases.
2911 *
2912 * @platform darwin
2913 */
2914 setTouchBar(touchBar: (TouchBar) | (null)): void;
2915 /**
2916 * Set a custom position for the traffic light buttons. Can only be used with
2917 * `titleBarStyle` set to `hidden`.
2918 *
2919 * @platform darwin
2920 */
2921 setTrafficLightPosition(position: Point): void;
2922 /**
2923 * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
2924 * will remove the vibrancy effect on the window.
2925 *
2926 * Note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
2927 * have been deprecated and will be removed in an upcoming version of macOS.
2928 *
2929 * @platform darwin
2930 */
2931 setVibrancy(type: (('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page')) | (null)): void;
2932 /**
2933 * Sets whether the window should be visible on all workspaces.
2934 *
2935**Note:** This API does nothing on Windows.
2936 */
2937 setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
2938 /**
2939 * Sets whether the window traffic light buttons should be visible.
2940 *
2941This cannot be called when `titleBarStyle` is set to `customButtonsOnHover`.
2942 *
2943 * @platform darwin
2944 */
2945 setWindowButtonVisibility(visible: boolean): void;
2946 /**
2947 * Shows and gives focus to the window.
2948 */
2949 show(): void;
2950 /**
2951 * Same as `webContents.showDefinitionForSelection()`.
2952 *
2953 * @platform darwin
2954 */
2955 showDefinitionForSelection(): void;
2956 /**
2957 * Shows the window but doesn't focus on it.
2958 */
2959 showInactive(): void;
2960 /**
2961 * Toggles the visibility of the tab bar if native tabs are enabled and there is
2962 * only one tab in the current window.
2963 *
2964 * @platform darwin
2965 */
2966 toggleTabBar(): void;
2967 /**
2968 * Unhooks all of the window messages.
2969 *
2970 * @platform win32
2971 */
2972 unhookAllWindowMessages(): void;
2973 /**
2974 * Unhook the window message.
2975 *
2976 * @platform win32
2977 */
2978 unhookWindowMessage(message: number): void;
2979 /**
2980 * Unmaximizes the window.
2981 */
2982 unmaximize(): void;
2983 accessibleTitle: string;
2984 autoHideMenuBar: boolean;
2985 closable: boolean;
2986 documentEdited: boolean;
2987 excludedFromShownWindowsMenu: boolean;
2988 fullScreen: boolean;
2989 fullScreenable: boolean;
2990 readonly id: number;
2991 kiosk: boolean;
2992 maximizable: boolean;
2993 menuBarVisible: boolean;
2994 minimizable: boolean;
2995 movable: boolean;
2996 representedFilename: string;
2997 resizable: boolean;
2998 shadow: boolean;
2999 simpleFullScreen: boolean;
3000 title: string;
3001 visibleOnAllWorkspaces: boolean;
3002 readonly webContents: WebContents;
3003 }
3004
3005 class BrowserWindowProxy {
3006
3007 // Docs: https://electronjs.org/docs/api/browser-window-proxy
3008
3009 /**
3010 * Removes focus from the child window.
3011 */
3012 blur(): void;
3013 /**
3014 * Forcefully closes the child window without calling its unload event.
3015 */
3016 close(): void;
3017 /**
3018 * Evaluates the code in the child window.
3019 */
3020 eval(code: string): void;
3021 /**
3022 * Focuses the child window (brings the window to front).
3023 */
3024 focus(): void;
3025 /**
3026 * Sends a message to the child window with the specified origin or `*` for no
3027 * origin preference.
3028 *
3029 * In addition to these methods, the child window implements `window.opener` object
3030 * with no properties and a single method.
3031 */
3032 postMessage(message: any, targetOrigin: string): void;
3033 /**
3034 * Invokes the print dialog on the child window.
3035 */
3036 print(): void;
3037 closed: boolean;
3038 }
3039
3040 interface Certificate {
3041
3042 // Docs: https://electronjs.org/docs/api/structures/certificate
3043
3044 /**
3045 * PEM encoded data
3046 */
3047 data: string;
3048 /**
3049 * Fingerprint of the certificate
3050 */
3051 fingerprint: string;
3052 /**
3053 * Issuer principal
3054 */
3055 issuer: CertificatePrincipal;
3056 /**
3057 * Issuer certificate (if not self-signed)
3058 */
3059 issuerCert: Certificate;
3060 /**
3061 * Issuer's Common Name
3062 */
3063 issuerName: string;
3064 /**
3065 * Hex value represented string
3066 */
3067 serialNumber: string;
3068 /**
3069 * Subject principal
3070 */
3071 subject: CertificatePrincipal;
3072 /**
3073 * Subject's Common Name
3074 */
3075 subjectName: string;
3076 /**
3077 * End date of the certificate being valid in seconds
3078 */
3079 validExpiry: number;
3080 /**
3081 * Start date of the certificate being valid in seconds
3082 */
3083 validStart: number;
3084 }
3085
3086 interface CertificatePrincipal {
3087
3088 // Docs: https://electronjs.org/docs/api/structures/certificate-principal
3089
3090 /**
3091 * Common Name.
3092 */
3093 commonName: string;
3094 /**
3095 * Country or region.
3096 */
3097 country: string;
3098 /**
3099 * Locality.
3100 */
3101 locality: string;
3102 /**
3103 * Organization names.
3104 */
3105 organizations: string[];
3106 /**
3107 * Organization Unit names.
3108 */
3109 organizationUnits: string[];
3110 /**
3111 * State or province.
3112 */
3113 state: string;
3114 }
3115
3116 class ClientRequest extends NodeEventEmitter {
3117
3118 // Docs: https://electronjs.org/docs/api/client-request
3119
3120 /**
3121 * Emitted when the `request` is aborted. The `abort` event will not be fired if
3122 * the `request` is already closed.
3123 */
3124 on(event: 'abort', listener: Function): this;
3125 once(event: 'abort', listener: Function): this;
3126 addListener(event: 'abort', listener: Function): this;
3127 removeListener(event: 'abort', listener: Function): this;
3128 /**
3129 * Emitted as the last event in the HTTP request-response transaction. The `close`
3130 * event indicates that no more events will be emitted on either the `request` or
3131 * `response` objects.
3132 */
3133 on(event: 'close', listener: Function): this;
3134 once(event: 'close', listener: Function): this;
3135 addListener(event: 'close', listener: Function): this;
3136 removeListener(event: 'close', listener: Function): this;
3137 /**
3138 * Emitted when the `net` module fails to issue a network request. Typically when
3139 * the `request` object emits an `error` event, a `close` event will subsequently
3140 * follow and no response object will be provided.
3141 */
3142 on(event: 'error', listener: (
3143 /**
3144 * an error object providing some information about the failure.
3145 */
3146 error: Error) => void): this;
3147 once(event: 'error', listener: (
3148 /**
3149 * an error object providing some information about the failure.
3150 */
3151 error: Error) => void): this;
3152 addListener(event: 'error', listener: (
3153 /**
3154 * an error object providing some information about the failure.
3155 */
3156 error: Error) => void): this;
3157 removeListener(event: 'error', listener: (
3158 /**
3159 * an error object providing some information about the failure.
3160 */
3161 error: Error) => void): this;
3162 /**
3163 * Emitted just after the last chunk of the `request`'s data has been written into
3164 * the `request` object.
3165 */
3166 on(event: 'finish', listener: Function): this;
3167 once(event: 'finish', listener: Function): this;
3168 addListener(event: 'finish', listener: Function): this;
3169 removeListener(event: 'finish', listener: Function): this;
3170 /**
3171 * Emitted when an authenticating proxy is asking for user credentials.
3172 *
3173 * The `callback` function is expected to be called back with user credentials:
3174 *
3175 * * `username` String
3176 * * `password` String
3177 *
3178 * Providing empty credentials will cancel the request and report an authentication
3179 * error on the response object:
3180 */
3181 on(event: 'login', listener: (authInfo: AuthInfo,
3182 callback: (username?: string, password?: string) => void) => void): this;
3183 once(event: 'login', listener: (authInfo: AuthInfo,
3184 callback: (username?: string, password?: string) => void) => void): this;
3185 addListener(event: 'login', listener: (authInfo: AuthInfo,
3186 callback: (username?: string, password?: string) => void) => void): this;
3187 removeListener(event: 'login', listener: (authInfo: AuthInfo,
3188 callback: (username?: string, password?: string) => void) => void): this;
3189 /**
3190 * Emitted when the server returns a redirect response (e.g. 301 Moved
3191 * Permanently). Calling `request.followRedirect` will continue with the
3192 * redirection. If this event is handled, `request.followRedirect` must be called
3193 * **synchronously**, otherwise the request will be cancelled.
3194 */
3195 on(event: 'redirect', listener: (statusCode: number,
3196 method: string,
3197 redirectUrl: string,
3198 responseHeaders: Record<string, string[]>) => void): this;
3199 once(event: 'redirect', listener: (statusCode: number,
3200 method: string,
3201 redirectUrl: string,
3202 responseHeaders: Record<string, string[]>) => void): this;
3203 addListener(event: 'redirect', listener: (statusCode: number,
3204 method: string,
3205 redirectUrl: string,
3206 responseHeaders: Record<string, string[]>) => void): this;
3207 removeListener(event: 'redirect', listener: (statusCode: number,
3208 method: string,
3209 redirectUrl: string,
3210 responseHeaders: Record<string, string[]>) => void): this;
3211 on(event: 'response', listener: (
3212 /**
3213 * An object representing the HTTP response message.
3214 */
3215 response: IncomingMessage) => void): this;
3216 once(event: 'response', listener: (
3217 /**
3218 * An object representing the HTTP response message.
3219 */
3220 response: IncomingMessage) => void): this;
3221 addListener(event: 'response', listener: (
3222 /**
3223 * An object representing the HTTP response message.
3224 */
3225 response: IncomingMessage) => void): this;
3226 removeListener(event: 'response', listener: (
3227 /**
3228 * An object representing the HTTP response message.
3229 */
3230 response: IncomingMessage) => void): this;
3231 /**
3232 * ClientRequest
3233 */
3234 constructor(options: (ClientRequestConstructorOptions) | (string));
3235 /**
3236 * Cancels an ongoing HTTP transaction. If the request has already emitted the
3237 * `close` event, the abort operation will have no effect. Otherwise an ongoing
3238 * event will emit `abort` and `close` events. Additionally, if there is an ongoing
3239 * response object,it will emit the `aborted` event.
3240 */
3241 abort(): void;
3242 /**
3243 * Sends the last chunk of the request data. Subsequent write or end operations
3244 * will not be allowed. The `finish` event is emitted just after the end operation.
3245 */
3246 end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): void;
3247 /**
3248 * Continues any pending redirection. Can only be called during a `'redirect'`
3249 * event.
3250 */
3251 followRedirect(): void;
3252 /**
3253 * The value of a previously set extra header name.
3254 */
3255 getHeader(name: string): string;
3256 /**
3257 * * `active` Boolean - Whether the request is currently active. If this is false
3258 * no other properties will be set
3259 * * `started` Boolean - Whether the upload has started. If this is false both
3260 * `current` and `total` will be set to 0.
3261 * * `current` Integer - The number of bytes that have been uploaded so far
3262 * * `total` Integer - The number of bytes that will be uploaded this request
3263 *
3264 * You can use this method in conjunction with `POST` requests to get the progress
3265 * of a file upload or other data transfer.
3266 */
3267 getUploadProgress(): UploadProgress;
3268 /**
3269 * Removes a previously set extra header name. This method can be called only
3270 * before first write. Trying to call it after the first write will throw an error.
3271 */
3272 removeHeader(name: string): void;
3273 /**
3274 * Adds an extra HTTP header. The header name will be issued as-is without
3275 * lowercasing. It can be called only before first write. Calling this method after
3276 * the first write will throw an error. If the passed value is not a `String`, its
3277 * `toString()` method will be called to obtain the final value.
3278 *
3279 * Certain headers are restricted from being set by apps. These headers are listed
3280 * below. More information on restricted headers can be found in Chromium's header
3281 * utils.
3282 *
3283 * * `Content-Length`
3284 * * `Host`
3285 * * `Trailer` or `Te`
3286 * * `Upgrade`
3287 * * `Cookie2`
3288 * * `Keep-Alive`
3289 * * `Transfer-Encoding`
3290 *
3291 * Additionally, setting the `Connection` header to the value `upgrade` is also
3292 * disallowed.
3293 */
3294 setHeader(name: string, value: string): void;
3295 /**
3296 * `callback` is essentially a dummy function introduced in the purpose of keeping
3297 * similarity with the Node.js API. It is called asynchronously in the next tick
3298 * after `chunk` content have been delivered to the Chromium networking layer.
3299 * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
3300 * content have been flushed on the wire before `callback` is called.
3301 *
3302 * Adds a chunk of data to the request body. The first write operation may cause
3303 * the request headers to be issued on the wire. After the first write operation,
3304 * it is not allowed to add or remove a custom header.
3305 */
3306 write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
3307 chunkedEncoding: boolean;
3308 }
3309
3310 interface Clipboard {
3311
3312 // Docs: https://electronjs.org/docs/api/clipboard
3313
3314 /**
3315 * An array of supported formats for the clipboard `type`.
3316 */
3317 availableFormats(type?: 'selection' | 'clipboard'): string[];
3318 /**
3319 * Clears the clipboard content.
3320 */
3321 clear(type?: 'selection' | 'clipboard'): void;
3322 /**
3323 * Whether the clipboard supports the specified `format`.
3324 *
3325 * @experimental
3326 */
3327 has(format: string, type?: 'selection' | 'clipboard'): boolean;
3328 /**
3329 * Reads `format` type from the clipboard.
3330 *
3331 * @experimental
3332 */
3333 read(format: string): string;
3334 /**
3335 * * `title` String
3336 * * `url` String
3337 *
3338 * Returns an Object containing `title` and `url` keys representing the bookmark in
3339 * the clipboard. The `title` and `url` values will be empty strings when the
3340 * bookmark is unavailable.
3341 *
3342 * @platform darwin,win32
3343 */
3344 readBookmark(): ReadBookmark;
3345 /**
3346 * Reads `format` type from the clipboard.
3347 *
3348 * @experimental
3349 */
3350 readBuffer(format: string): Buffer;
3351 /**
3352 * The text on the find pasteboard, which is the pasteboard that holds information
3353 * about the current state of the active application’s find panel.
3354 *
3355 * This method uses synchronous IPC when called from the renderer process. The
3356 * cached value is reread from the find pasteboard whenever the application is
3357 * activated.
3358 *
3359 * @platform darwin
3360 */
3361 readFindText(): string;
3362 /**
3363 * The content in the clipboard as markup.
3364 */
3365 readHTML(type?: 'selection' | 'clipboard'): string;
3366 /**
3367 * The image content in the clipboard.
3368 */
3369 readImage(type?: 'selection' | 'clipboard'): NativeImage;
3370 /**
3371 * The content in the clipboard as RTF.
3372 */
3373 readRTF(type?: 'selection' | 'clipboard'): string;
3374 /**
3375 * The content in the clipboard as plain text.
3376 */
3377 readText(type?: 'selection' | 'clipboard'): string;
3378 /**
3379 * Writes `data` to the clipboard.
3380 */
3381 write(data: Data, type?: 'selection' | 'clipboard'): void;
3382 /**
3383 * Writes the `title` and `url` into the clipboard as a bookmark.
3384 *
3385 * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
3386 * can use `clipboard.write` to write both a bookmark and fallback text to the
3387 * clipboard.
3388 *
3389 * @platform darwin,win32
3390 */
3391 writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
3392 /**
3393 * Writes the `buffer` into the clipboard as `format`.
3394 *
3395 * @experimental
3396 */
3397 writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
3398 /**
3399 * Writes the `text` into the find pasteboard (the pasteboard that holds
3400 * information about the current state of the active application’s find panel) as
3401 * plain text. This method uses synchronous IPC when called from the renderer
3402 * process.
3403 *
3404 * @platform darwin
3405 */
3406 writeFindText(text: string): void;
3407 /**
3408 * Writes `markup` to the clipboard.
3409 */
3410 writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
3411 /**
3412 * Writes `image` to the clipboard.
3413 */
3414 writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
3415 /**
3416 * Writes the `text` into the clipboard in RTF.
3417 */
3418 writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
3419 /**
3420 * Writes the `text` into the clipboard as plain text.
3421 */
3422 writeText(text: string, type?: 'selection' | 'clipboard'): void;
3423 }
3424
3425 class CommandLine {
3426
3427 // Docs: https://electronjs.org/docs/api/command-line
3428
3429 /**
3430 * Append an argument to Chromium's command line. The argument will be quoted
3431 * correctly. Switches will precede arguments regardless of appending order.
3432 *
3433 * If you're appending an argument like `--switch=value`, consider using
3434 * `appendSwitch('switch', 'value')` instead.
3435 *
3436 * **Note:** This will not affect `process.argv`. The intended usage of this
3437 * function is to control Chromium's behavior.
3438 */
3439 appendArgument(value: string): void;
3440 /**
3441 * Append a switch (with optional `value`) to Chromium's command line.
3442 *
3443 * **Note:** This will not affect `process.argv`. The intended usage of this
3444 * function is to control Chromium's behavior.
3445 */
3446 appendSwitch(the_switch: string, value?: string): void;
3447 /**
3448 * The command-line switch value.
3449 *
3450 * **Note:** When the switch is not present or has no value, it returns empty
3451 * string.
3452 */
3453 getSwitchValue(the_switch: string): string;
3454 /**
3455 * Whether the command-line switch is present.
3456 */
3457 hasSwitch(the_switch: string): boolean;
3458 }
3459
3460 interface ContentTracing {
3461
3462 // Docs: https://electronjs.org/docs/api/content-tracing
3463
3464 /**
3465 * resolves with an array of category groups once all child processes have
3466 * acknowledged the `getCategories` request
3467 *
3468 * Get a set of category groups. The category groups can change as new code paths
3469 * are reached. See also the list of built-in tracing categories.
3470 *
3471 * > **NOTE:** Electron adds a non-default tracing category called `"electron"`.
3472 * This category can be used to capture Electron-specific tracing events.
3473 */
3474 getCategories(): Promise<string[]>;
3475 /**
3476 * Resolves with an object containing the `value` and `percentage` of trace buffer
3477 * maximum usage
3478 *
3479 * * `value` Number
3480 * * `percentage` Number
3481 *
3482 * Get the maximum usage across processes of trace buffer as a percentage of the
3483 * full state.
3484 */
3485 getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
3486 /**
3487 * resolved once all child processes have acknowledged the `startRecording`
3488 * request.
3489 *
3490 * Start recording on all processes.
3491 *
3492 * Recording begins immediately locally and asynchronously on child processes as
3493 * soon as they receive the EnableRecording request.
3494 *
3495 * If a recording is already running, the promise will be immediately resolved, as
3496 * only one trace operation can be in progress at a time.
3497 */
3498 startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
3499 /**
3500 * resolves with a path to a file that contains the traced data once all child
3501 * processes have acknowledged the `stopRecording` request
3502 *
3503 * Stop recording on all processes.
3504 *
3505 * Child processes typically cache trace data and only rarely flush and send trace
3506 * data back to the main process. This helps to minimize the runtime overhead of
3507 * tracing since sending trace data over IPC can be an expensive operation. So, to
3508 * end tracing, Chromium asynchronously asks all child processes to flush any
3509 * pending trace data.
3510 *
3511 * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
3512 * or not provided, trace data will be written to a temporary file, and the path
3513 * will be returned in the promise.
3514 */
3515 stopRecording(resultFilePath?: string): Promise<string>;
3516 }
3517
3518 interface ContextBridge {
3519
3520 // Docs: https://electronjs.org/docs/api/context-bridge
3521
3522 exposeInMainWorld(apiKey: string, api: Record<string, any>): void;
3523 }
3524
3525 interface Cookie {
3526
3527 // Docs: https://electronjs.org/docs/api/structures/cookie
3528
3529 /**
3530 * The domain of the cookie; this will be normalized with a preceding dot so that
3531 * it's also valid for subdomains.
3532 */
3533 domain?: string;
3534 /**
3535 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
3536 * Not provided for session cookies.
3537 */
3538 expirationDate?: number;
3539 /**
3540 * Whether the cookie is a host-only cookie; this will only be `true` if no domain
3541 * was passed.
3542 */
3543 hostOnly?: boolean;
3544 /**
3545 * Whether the cookie is marked as HTTP only.
3546 */
3547 httpOnly?: boolean;
3548 /**
3549 * The name of the cookie.
3550 */
3551 name: string;
3552 /**
3553 * The path of the cookie.
3554 */
3555 path?: string;
3556 /**
3557 * The Same Site policy applied to this cookie. Can be `unspecified`,
3558 * `no_restriction`, `lax` or `strict`.
3559 */
3560 sameSite: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
3561 /**
3562 * Whether the cookie is marked as secure.
3563 */
3564 secure?: boolean;
3565 /**
3566 * Whether the cookie is a session cookie or a persistent cookie with an expiration
3567 * date.
3568 */
3569 session?: boolean;
3570 /**
3571 * The value of the cookie.
3572 */
3573 value: string;
3574 }
3575
3576 class Cookies extends NodeEventEmitter {
3577
3578 // Docs: https://electronjs.org/docs/api/cookies
3579
3580 /**
3581 * Emitted when a cookie is changed because it was added, edited, removed, or
3582 * expired.
3583 */
3584 on(event: 'changed', listener: Function): this;
3585 once(event: 'changed', listener: Function): this;
3586 addListener(event: 'changed', listener: Function): this;
3587 removeListener(event: 'changed', listener: Function): this;
3588 /**
3589 * A promise which resolves when the cookie store has been flushed
3590 *
3591Writes any unwritten cookies data to disk.
3592 */
3593 flushStore(): Promise<void>;
3594 /**
3595 * A promise which resolves an array of cookie objects.
3596 *
3597 * Sends a request to get all cookies matching `filter`, and resolves a promise
3598 * with the response.
3599 */
3600 get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
3601 /**
3602 * A promise which resolves when the cookie has been removed
3603 *
3604Removes the cookies matching `url` and `name`
3605 */
3606 remove(url: string, name: string): Promise<void>;
3607 /**
3608 * A promise which resolves when the cookie has been set
3609 *
3610Sets a cookie with `details`.
3611 */
3612 set(details: CookiesSetDetails): Promise<void>;
3613 }
3614
3615 interface CPUUsage {
3616
3617 // Docs: https://electronjs.org/docs/api/structures/cpu-usage
3618
3619 /**
3620 * The number of average idle CPU wakeups per second since the last call to
3621 * getCPUUsage. First call returns 0. Will always return 0 on Windows.
3622 */
3623 idleWakeupsPerSecond: number;
3624 /**
3625 * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
3626 */
3627 percentCPUUsage: number;
3628 }
3629
3630 interface CrashReport {
3631
3632 // Docs: https://electronjs.org/docs/api/structures/crash-report
3633
3634 date: Date;
3635 id: string;
3636 }
3637
3638 interface CrashReporter {
3639
3640 // Docs: https://electronjs.org/docs/api/crash-reporter
3641
3642 /**
3643 * Set an extra parameter to be sent with the crash report. The values specified
3644 * here will be sent in addition to any values set via the `extra` option when
3645 * `start` was called.
3646 *
3647 * Parameters added in this fashion (or via the `extra` parameter to
3648 * `crashReporter.start`) are specific to the calling process. Adding extra
3649 * parameters in the main process will not cause those parameters to be sent along
3650 * with crashes from renderer or other child processes. Similarly, adding extra
3651 * parameters in a renderer process will not result in those parameters being sent
3652 * with crashes that occur in other renderer processes or in the main process.
3653 *
3654 * **Note:** Parameters have limits on the length of the keys and values. Key names
3655 * must be no longer than 39 bytes, and values must be no longer than 20320 bytes.
3656 * Keys with names longer than the maximum will be silently ignored. Key values
3657 * longer than the maximum length will be truncated.
3658 *
3659 * **Note:** On linux values that are longer than 127 bytes will be chunked into
3660 * multiple keys, each 127 bytes in length. E.g. `addExtraParameter('foo',
3661 * 'a'.repeat(130))` will result in two chunked keys `foo__1` and `foo__2`, the
3662 * first will contain the first 127 bytes and the second will contain the remaining
3663 * 3 bytes. On your crash reporting backend you should stitch together keys in
3664 * this format.
3665 */
3666 addExtraParameter(key: string, value: string): void;
3667 /**
3668 * The directory where crashes are temporarily stored before being uploaded.
3669 *
3670**Note:** This method is deprecated, use `app.getPath('crashDumps')` instead.
3671 *
3672 * @deprecated
3673 */
3674 getCrashesDirectory(): string;
3675 /**
3676 * The date and ID of the last crash report. Only crash reports that have been
3677 * uploaded will be returned; even if a crash report is present on disk it will not
3678 * be returned until it is uploaded. In the case that there are no uploaded
3679 * reports, `null` is returned.
3680 *
3681**Note:** Calling this method from the renderer process is deprecated.
3682 */
3683 getLastCrashReport(): CrashReport;
3684 /**
3685 * The current 'extra' parameters of the crash reporter.
3686 */
3687 getParameters(): Record<string, string>;
3688 /**
3689 * Returns all uploaded crash reports. Each report contains the date and uploaded
3690 * ID.
3691
3692**Note:** Calling this method from the renderer process is deprecated.
3693 */
3694 getUploadedReports(): CrashReport[];
3695 /**
3696 * Whether reports should be submitted to the server. Set through the `start`
3697 * method or `setUploadToServer`.
3698 *
3699**Note:** Calling this method from the renderer process is deprecated.
3700 */
3701 getUploadToServer(): boolean;
3702 /**
3703 * Remove an extra parameter from the current set of parameters. Future crashes
3704 * will not include this parameter.
3705 */
3706 removeExtraParameter(key: string): void;
3707 /**
3708 * This would normally be controlled by user preferences. This has no effect if
3709 * called before `start` is called.
3710 *
3711**Note:** Calling this method from the renderer process is deprecated.
3712 */
3713 setUploadToServer(uploadToServer: boolean): void;
3714 /**
3715 * This method must be called before using any other `crashReporter` APIs. Once
3716 * initialized this way, the crashpad handler collects crashes from all
3717 * subsequently created processes. The crash reporter cannot be disabled once
3718 * started.
3719 *
3720 * This method should be called as early as possible in app startup, preferably
3721 * before `app.on('ready')`. If the crash reporter is not initialized at the time a
3722 * renderer process is created, then that renderer process will not be monitored by
3723 * the crash reporter.
3724 *
3725 * **Note:** You can test out the crash reporter by generating a crash using
3726 * `process.crash()`.
3727 *
3728 * **Note:** If you need to send additional/updated `extra` parameters after your
3729 * first call `start` you can call `addExtraParameter`.
3730 *
3731 * **Note:** Parameters passed in `extra`, `globalExtra` or set with
3732 * `addExtraParameter` have limits on the length of the keys and values. Key names
3733 * must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys
3734 * with names longer than the maximum will be silently ignored. Key values longer
3735 * than the maximum length will be truncated.
3736 *
3737**Note:** Calling this method from the renderer process is deprecated.
3738 */
3739 start(options: CrashReporterStartOptions): void;
3740 }
3741
3742 interface CustomScheme {
3743
3744 // Docs: https://electronjs.org/docs/api/structures/custom-scheme
3745
3746 privileges?: Privileges;
3747 /**
3748 * Custom schemes to be registered with options.
3749 */
3750 scheme: string;
3751 }
3752
3753 class Debugger extends NodeEventEmitter {
3754
3755 // Docs: https://electronjs.org/docs/api/debugger
3756
3757 /**
3758 * Emitted when the debugging session is terminated. This happens either when
3759 * `webContents` is closed or devtools is invoked for the attached `webContents`.
3760 */
3761 on(event: 'detach', listener: (event: Event,
3762 /**
3763 * Reason for detaching debugger.
3764 */
3765 reason: string) => void): this;
3766 once(event: 'detach', listener: (event: Event,
3767 /**
3768 * Reason for detaching debugger.
3769 */
3770 reason: string) => void): this;
3771 addListener(event: 'detach', listener: (event: Event,
3772 /**
3773 * Reason for detaching debugger.
3774 */
3775 reason: string) => void): this;
3776 removeListener(event: 'detach', listener: (event: Event,
3777 /**
3778 * Reason for detaching debugger.
3779 */
3780 reason: string) => void): this;
3781 /**
3782 * Emitted whenever the debugging target issues an instrumentation event.
3783 */
3784 on(event: 'message', listener: (event: Event,
3785 /**
3786 * Method name.
3787 */
3788 method: string,
3789 /**
3790 * Event parameters defined by the 'parameters' attribute in the remote debugging
3791 * protocol.
3792 */
3793 params: any,
3794 /**
3795 * Unique identifier of attached debugging session, will match the value sent from
3796 * `debugger.sendCommand`.
3797 */
3798 sessionId: string) => void): this;
3799 once(event: 'message', listener: (event: Event,
3800 /**
3801 * Method name.
3802 */
3803 method: string,
3804 /**
3805 * Event parameters defined by the 'parameters' attribute in the remote debugging
3806 * protocol.
3807 */
3808 params: any,
3809 /**
3810 * Unique identifier of attached debugging session, will match the value sent from
3811 * `debugger.sendCommand`.
3812 */
3813 sessionId: string) => void): this;
3814 addListener(event: 'message', listener: (event: Event,
3815 /**
3816 * Method name.
3817 */
3818 method: string,
3819 /**
3820 * Event parameters defined by the 'parameters' attribute in the remote debugging
3821 * protocol.
3822 */
3823 params: any,
3824 /**
3825 * Unique identifier of attached debugging session, will match the value sent from
3826 * `debugger.sendCommand`.
3827 */
3828 sessionId: string) => void): this;
3829 removeListener(event: 'message', listener: (event: Event,
3830 /**
3831 * Method name.
3832 */
3833 method: string,
3834 /**
3835 * Event parameters defined by the 'parameters' attribute in the remote debugging
3836 * protocol.
3837 */
3838 params: any,
3839 /**
3840 * Unique identifier of attached debugging session, will match the value sent from
3841 * `debugger.sendCommand`.
3842 */
3843 sessionId: string) => void): this;
3844 /**
3845 * Attaches the debugger to the `webContents`.
3846 */
3847 attach(protocolVersion?: string): void;
3848 /**
3849 * Detaches the debugger from the `webContents`.
3850 */
3851 detach(): void;
3852 /**
3853 * Whether a debugger is attached to the `webContents`.
3854 */
3855 isAttached(): boolean;
3856 /**
3857 * A promise that resolves with the response defined by the 'returns' attribute of
3858 * the command description in the remote debugging protocol or is rejected
3859 * indicating the failure of the command.
3860 *
3861Send given command to the debugging target.
3862 */
3863 sendCommand(method: string, commandParams?: any, sessionId?: string): Promise<any>;
3864 }
3865
3866 interface DesktopCapturer {
3867
3868 // Docs: https://electronjs.org/docs/api/desktop-capturer
3869
3870 /**
3871 * Resolves with an array of `DesktopCapturerSource` objects, each
3872 * `DesktopCapturerSource` represents a screen or an individual window that can be
3873 * captured.
3874 *
3875 * **Note** Capturing the screen contents requires user consent on macOS 10.15
3876 * Catalina or higher, which can detected by
3877 * `systemPreferences.getMediaAccessStatus`.
3878 */
3879 getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
3880 }
3881
3882 interface DesktopCapturerSource {
3883
3884 // Docs: https://electronjs.org/docs/api/structures/desktop-capturer-source
3885
3886 /**
3887 * An icon image of the application that owns the window or null if the source has
3888 * a type screen. The size of the icon is not known in advance and depends on what
3889 * the application provides.
3890 */
3891 appIcon: NativeImage;
3892 /**
3893 * A unique identifier that will correspond to the `id` of the matching Display
3894 * returned by the Screen API. On some platforms, this is equivalent to the `XX`
3895 * portion of the `id` field above and on others it will differ. It will be an
3896 * empty string if not available.
3897 */
3898 display_id: string;
3899 /**
3900 * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
3901 * constraint when calling [`navigator.webkitGetUserMedia`]. The format of the
3902 * identifier will be `window:XX` or `screen:XX`, where `XX` is a random generated
3903 * number.
3904 */
3905 id: string;
3906 /**
3907 * A screen source will be named either `Entire Screen` or `Screen <index>`, while
3908 * the name of a window source will match the window title.
3909 */
3910 name: string;
3911 /**
3912 * A thumbnail image. **Note:** There is no guarantee that the size of the
3913 * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
3914 * to `desktopCapturer.getSources`. The actual size depends on the scale of the
3915 * screen or window.
3916 */
3917 thumbnail: NativeImage;
3918 }
3919
3920 interface Dialog {
3921
3922 // Docs: https://electronjs.org/docs/api/dialog
3923
3924 /**
3925 * resolves when the certificate trust dialog is shown.
3926 *
3927 * On macOS, this displays a modal dialog that shows a message and certificate
3928 * information, and gives the user the option of trusting/importing the
3929 * certificate. If you provide a `browserWindow` argument the dialog will be
3930 * attached to the parent window, making it modal.
3931 *
3932 * On Windows the options are more limited, due to the Win32 APIs used:
3933 *
3934 * * The `message` argument is not used, as the OS provides its own confirmation
3935 * dialog.
3936 * * The `browserWindow` argument is ignored since it is not possible to make this
3937 * confirmation dialog modal.
3938 *
3939 * @platform darwin,win32
3940 */
3941 showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
3942 /**
3943 * resolves when the certificate trust dialog is shown.
3944 *
3945 * On macOS, this displays a modal dialog that shows a message and certificate
3946 * information, and gives the user the option of trusting/importing the
3947 * certificate. If you provide a `browserWindow` argument the dialog will be
3948 * attached to the parent window, making it modal.
3949 *
3950 * On Windows the options are more limited, due to the Win32 APIs used:
3951 *
3952 * * The `message` argument is not used, as the OS provides its own confirmation
3953 * dialog.
3954 * * The `browserWindow` argument is ignored since it is not possible to make this
3955 * confirmation dialog modal.
3956 *
3957 * @platform darwin,win32
3958 */
3959 showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
3960 /**
3961 * Displays a modal dialog that shows an error message.
3962 *
3963 * This API can be called safely before the `ready` event the `app` module emits,
3964 * it is usually used to report errors in early stage of startup. If called before
3965 * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
3966 * dialog will appear.
3967 */
3968 showErrorBox(title: string, content: string): void;
3969 /**
3970 * resolves with a promise containing the following properties:
3971 *
3972 * * `response` Number - The index of the clicked button.
3973 * * `checkboxChecked` Boolean - The checked state of the checkbox if
3974 * `checkboxLabel` was set. Otherwise `false`.
3975 *
3976 * Shows a message box, it will block the process until the message box is closed.
3977 *
3978 * The `browserWindow` argument allows the dialog to attach itself to a parent
3979 * window, making it modal.
3980 */
3981 showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
3982 /**
3983 * resolves with a promise containing the following properties:
3984 *
3985 * * `response` Number - The index of the clicked button.
3986 * * `checkboxChecked` Boolean - The checked state of the checkbox if
3987 * `checkboxLabel` was set. Otherwise `false`.
3988 *
3989 * Shows a message box, it will block the process until the message box is closed.
3990 *
3991 * The `browserWindow` argument allows the dialog to attach itself to a parent
3992 * window, making it modal.
3993 */
3994 showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
3995 /**
3996 * the index of the clicked button.
3997 *
3998 * Shows a message box, it will block the process until the message box is closed.
3999 * It returns the index of the clicked button.
4000 *
4001 * The `browserWindow` argument allows the dialog to attach itself to a parent
4002 * window, making it modal. If `browserWindow` is not shown dialog will not be
4003 * attached to it. In such case it will be displayed as an independent window.
4004 */
4005 showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
4006 /**
4007 * the index of the clicked button.
4008 *
4009 * Shows a message box, it will block the process until the message box is closed.
4010 * It returns the index of the clicked button.
4011 *
4012 * The `browserWindow` argument allows the dialog to attach itself to a parent
4013 * window, making it modal. If `browserWindow` is not shown dialog will not be
4014 * attached to it. In such case it will be displayed as an independent window.
4015 */
4016 showMessageBoxSync(options: MessageBoxSyncOptions): number;
4017 /**
4018 * Resolve with an object containing the following:
4019 *
4020 * * `canceled` Boolean - whether or not the dialog was canceled.
4021 * * `filePaths` String[] - An array of file paths chosen by the user. If the
4022 * dialog is cancelled this will be an empty array.
4023 * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
4024 * `filePaths` array of base64 encoded strings which contains security scoped
4025 * bookmark data. `securityScopedBookmarks` must be enabled for this to be
4026 * populated. (For return values, see table here.)
4027 *
4028 * The `browserWindow` argument allows the dialog to attach itself to a parent
4029 * window, making it modal.
4030 *
4031 * The `filters` specifies an array of file types that can be displayed or selected
4032 * when you want to limit the user to a specific type. For example:
4033 *
4034 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4035 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4036 * `'*'` wildcard (no other wildcard is supported).
4037 *
4038 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4039 * and a directory selector, so if you set `properties` to `['openFile',
4040 * 'openDirectory']` on these platforms, a directory selector will be shown.
4041 */
4042 showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
4043 /**
4044 * Resolve with an object containing the following:
4045 *
4046 * * `canceled` Boolean - whether or not the dialog was canceled.
4047 * * `filePaths` String[] - An array of file paths chosen by the user. If the
4048 * dialog is cancelled this will be an empty array.
4049 * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
4050 * `filePaths` array of base64 encoded strings which contains security scoped
4051 * bookmark data. `securityScopedBookmarks` must be enabled for this to be
4052 * populated. (For return values, see table here.)
4053 *
4054 * The `browserWindow` argument allows the dialog to attach itself to a parent
4055 * window, making it modal.
4056 *
4057 * The `filters` specifies an array of file types that can be displayed or selected
4058 * when you want to limit the user to a specific type. For example:
4059 *
4060 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4061 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4062 * `'*'` wildcard (no other wildcard is supported).
4063 *
4064 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4065 * and a directory selector, so if you set `properties` to `['openFile',
4066 * 'openDirectory']` on these platforms, a directory selector will be shown.
4067 */
4068 showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
4069 /**
4070 * the file paths chosen by the user; if the dialog is cancelled it returns
4071 * `undefined`.
4072 *
4073 * The `browserWindow` argument allows the dialog to attach itself to a parent
4074 * window, making it modal.
4075 *
4076 * The `filters` specifies an array of file types that can be displayed or selected
4077 * when you want to limit the user to a specific type. For example:
4078 *
4079 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4080 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4081 * `'*'` wildcard (no other wildcard is supported).
4082 *
4083 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4084 * and a directory selector, so if you set `properties` to `['openFile',
4085 * 'openDirectory']` on these platforms, a directory selector will be shown.
4086 */
4087 showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
4088 /**
4089 * the file paths chosen by the user; if the dialog is cancelled it returns
4090 * `undefined`.
4091 *
4092 * The `browserWindow` argument allows the dialog to attach itself to a parent
4093 * window, making it modal.
4094 *
4095 * The `filters` specifies an array of file types that can be displayed or selected
4096 * when you want to limit the user to a specific type. For example:
4097 *
4098 * The `extensions` array should contain extensions without wildcards or dots (e.g.
4099 * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
4100 * `'*'` wildcard (no other wildcard is supported).
4101 *
4102 * **Note:** On Windows and Linux an open dialog can not be both a file selector
4103 * and a directory selector, so if you set `properties` to `['openFile',
4104 * 'openDirectory']` on these platforms, a directory selector will be shown.
4105 */
4106 showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
4107 /**
4108 * Resolve with an object containing the following:
4109 *
4110 * * `canceled` Boolean - whether or not the dialog was canceled.
4111 * * `filePath` String (optional) - If the dialog is canceled, this will be
4112 * `undefined`.
4113 * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
4114 * contains the security scoped bookmark data for the saved file.
4115 * `securityScopedBookmarks` must be enabled for this to be present. (For return
4116 * values, see table here.)
4117 *
4118 * The `browserWindow` argument allows the dialog to attach itself to a parent
4119 * window, making it modal.
4120 *
4121 * The `filters` specifies an array of file types that can be displayed, see
4122 * `dialog.showOpenDialog` for an example.
4123 *
4124 * **Note:** On macOS, using the asynchronous version is recommended to avoid
4125 * issues when expanding and collapsing the dialog.
4126 */
4127 showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
4128 /**
4129 * Resolve with an object containing the following:
4130 *
4131 * * `canceled` Boolean - whether or not the dialog was canceled.
4132 * * `filePath` String (optional) - If the dialog is canceled, this will be
4133 * `undefined`.
4134 * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
4135 * contains the security scoped bookmark data for the saved file.
4136 * `securityScopedBookmarks` must be enabled for this to be present. (For return
4137 * values, see table here.)
4138 *
4139 * The `browserWindow` argument allows the dialog to attach itself to a parent
4140 * window, making it modal.
4141 *
4142 * The `filters` specifies an array of file types that can be displayed, see
4143 * `dialog.showOpenDialog` for an example.
4144 *
4145 * **Note:** On macOS, using the asynchronous version is recommended to avoid
4146 * issues when expanding and collapsing the dialog.
4147 */
4148 showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
4149 /**
4150 * the path of the file chosen by the user; if the dialog is cancelled it returns
4151 * `undefined`.
4152 *
4153 * The `browserWindow` argument allows the dialog to attach itself to a parent
4154 * window, making it modal.
4155 *
4156 * The `filters` specifies an array of file types that can be displayed, see
4157 * `dialog.showOpenDialog` for an example.
4158 */
4159 showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined);
4160 /**
4161 * the path of the file chosen by the user; if the dialog is cancelled it returns
4162 * `undefined`.
4163 *
4164 * The `browserWindow` argument allows the dialog to attach itself to a parent
4165 * window, making it modal.
4166 *
4167 * The `filters` specifies an array of file types that can be displayed, see
4168 * `dialog.showOpenDialog` for an example.
4169 */
4170 showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined);
4171 }
4172
4173 interface Display {
4174
4175 // Docs: https://electronjs.org/docs/api/structures/display
4176
4177 /**
4178 * Can be `available`, `unavailable`, `unknown`.
4179 */
4180 accelerometerSupport: ('available' | 'unavailable' | 'unknown');
4181 bounds: Rectangle;
4182 /**
4183 * The number of bits per pixel.
4184 */
4185 colorDepth: number;
4186 /**
4187 * represent a color space (three-dimensional object which contains all realizable
4188 * color combinations) for the purpose of color conversions
4189 */
4190 colorSpace: string;
4191 /**
4192 * The number of bits per color component.
4193 */
4194 depthPerComponent: number;
4195 /**
4196 * Unique identifier associated with the display.
4197 */
4198 id: number;
4199 /**
4200 * `true` for an internal display and `false` for an external display
4201 */
4202 internal: boolean;
4203 /**
4204 * Whether or not the display is a monochrome display.
4205 */
4206 monochrome: boolean;
4207 /**
4208 * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
4209 */
4210 rotation: number;
4211 /**
4212 * Output device's pixel scale factor.
4213 */
4214 scaleFactor: number;
4215 size: Size;
4216 /**
4217 * Can be `available`, `unavailable`, `unknown`.
4218 */
4219 touchSupport: ('available' | 'unavailable' | 'unknown');
4220 workArea: Rectangle;
4221 workAreaSize: Size;
4222 }
4223
4224 class Dock {
4225
4226 // Docs: https://electronjs.org/docs/api/dock
4227
4228 /**
4229 * an ID representing the request.
4230 *
4231 * When `critical` is passed, the dock icon will bounce until either the
4232 * application becomes active or the request is canceled.
4233 *
4234 * When `informational` is passed, the dock icon will bounce for one second.
4235 * However, the request remains active until either the application becomes active
4236 * or the request is canceled.
4237 *
4238 * **Nota Bene:** This method can only be used while the app is not focused; when
4239 * the app is focused it will return -1.
4240 *
4241 * @platform darwin
4242 */
4243 bounce(type?: 'critical' | 'informational'): number;
4244 /**
4245 * Cancel the bounce of `id`.
4246 *
4247 * @platform darwin
4248 */
4249 cancelBounce(id: number): void;
4250 /**
4251 * Bounces the Downloads stack if the filePath is inside the Downloads folder.
4252 *
4253 * @platform darwin
4254 */
4255 downloadFinished(filePath: string): void;
4256 /**
4257 * The badge string of the dock.
4258 *
4259 * @platform darwin
4260 */
4261 getBadge(): string;
4262 /**
4263 * The application's [dock menu][dock-menu].
4264 *
4265 * @platform darwin
4266 */
4267 getMenu(): (Menu) | (null);
4268 /**
4269 * Hides the dock icon.
4270 *
4271 * @platform darwin
4272 */
4273 hide(): void;
4274 /**
4275 * Whether the dock icon is visible.
4276 *
4277 * @platform darwin
4278 */
4279 isVisible(): boolean;
4280 /**
4281 * Sets the string to be displayed in the dock’s badging area.
4282 *
4283 * @platform darwin
4284 */
4285 setBadge(text: string): void;
4286 /**
4287 * Sets the `image` associated with this dock icon.
4288 *
4289 * @platform darwin
4290 */
4291 setIcon(image: (NativeImage) | (string)): void;
4292 /**
4293 * Sets the application's [dock menu][dock-menu].
4294 *
4295 * @platform darwin
4296 */
4297 setMenu(menu: Menu): void;
4298 /**
4299 * Resolves when the dock icon is shown.
4300 *
4301 * @platform darwin
4302 */
4303 show(): Promise<void>;
4304 }
4305
4306 class DownloadItem extends NodeEventEmitter {
4307
4308 // Docs: https://electronjs.org/docs/api/download-item
4309
4310 /**
4311 * Emitted when the download is in a terminal state. This includes a completed
4312 * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
4313 * download that can't be resumed.
4314 *
4315 * The `state` can be one of following:
4316 *
4317 * * `completed` - The download completed successfully.
4318 * * `cancelled` - The download has been cancelled.
4319 * * `interrupted` - The download has interrupted and can not resume.
4320 */
4321 on(event: 'done', listener: (event: Event,
4322 /**
4323 * Can be `completed`, `cancelled` or `interrupted`.
4324 */
4325 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4326 once(event: 'done', listener: (event: Event,
4327 /**
4328 * Can be `completed`, `cancelled` or `interrupted`.
4329 */
4330 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4331 addListener(event: 'done', listener: (event: Event,
4332 /**
4333 * Can be `completed`, `cancelled` or `interrupted`.
4334 */
4335 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4336 removeListener(event: 'done', listener: (event: Event,
4337 /**
4338 * Can be `completed`, `cancelled` or `interrupted`.
4339 */
4340 state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
4341 /**
4342 * Emitted when the download has been updated and is not done.
4343 *
4344 * The `state` can be one of following:
4345 *
4346 * * `progressing` - The download is in-progress.
4347 * * `interrupted` - The download has interrupted and can be resumed.
4348 */
4349 on(event: 'updated', listener: (event: Event,
4350 /**
4351 * Can be `progressing` or `interrupted`.
4352 */
4353 state: ('progressing' | 'interrupted')) => void): this;
4354 once(event: 'updated', listener: (event: Event,
4355 /**
4356 * Can be `progressing` or `interrupted`.
4357 */
4358 state: ('progressing' | 'interrupted')) => void): this;
4359 addListener(event: 'updated', listener: (event: Event,
4360 /**
4361 * Can be `progressing` or `interrupted`.
4362 */
4363 state: ('progressing' | 'interrupted')) => void): this;
4364 removeListener(event: 'updated', listener: (event: Event,
4365 /**
4366 * Can be `progressing` or `interrupted`.
4367 */
4368 state: ('progressing' | 'interrupted')) => void): this;
4369 /**
4370 * Cancels the download operation.
4371 */
4372 cancel(): void;
4373 /**
4374 * Whether the download can resume.
4375 */
4376 canResume(): boolean;
4377 /**
4378 * The Content-Disposition field from the response header.
4379 */
4380 getContentDisposition(): string;
4381 /**
4382 * ETag header value.
4383 */
4384 getETag(): string;
4385 /**
4386 * The file name of the download item.
4387 *
4388 * **Note:** The file name is not always the same as the actual one saved in local
4389 * disk. If user changes the file name in a prompted download saving dialog, the
4390 * actual name of saved file will be different.
4391 */
4392 getFilename(): string;
4393 /**
4394 * Last-Modified header value.
4395 */
4396 getLastModifiedTime(): string;
4397 /**
4398 * The files mime type.
4399 */
4400 getMimeType(): string;
4401 /**
4402 * The received bytes of the download item.
4403 */
4404 getReceivedBytes(): number;
4405 /**
4406 * Returns the object previously set by
4407 * `downloadItem.setSaveDialogOptions(options)`.
4408 */
4409 getSaveDialogOptions(): SaveDialogOptions;
4410 /**
4411 * The save path of the download item. This will be either the path set via
4412 * `downloadItem.setSavePath(path)` or the path selected from the shown save
4413 * dialog.
4414 */
4415 getSavePath(): string;
4416 /**
4417 * Number of seconds since the UNIX epoch when the download was started.
4418 */
4419 getStartTime(): number;
4420 /**
4421 * The current state. Can be `progressing`, `completed`, `cancelled` or
4422 * `interrupted`.
4423 *
4424 * **Note:** The following methods are useful specifically to resume a `cancelled`
4425 * item when session is restarted.
4426 */
4427 getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
4428 /**
4429 * The total size in bytes of the download item.
4430 *
4431If the size is unknown, it returns 0.
4432 */
4433 getTotalBytes(): number;
4434 /**
4435 * The origin URL where the item is downloaded from.
4436 */
4437 getURL(): string;
4438 /**
4439 * The complete URL chain of the item including any redirects.
4440 */
4441 getURLChain(): string[];
4442 /**
4443 * Whether the download has user gesture.
4444 */
4445 hasUserGesture(): boolean;
4446 /**
4447 * Whether the download is paused.
4448 */
4449 isPaused(): boolean;
4450 /**
4451 * Pauses the download.
4452 */
4453 pause(): void;
4454 /**
4455 * Resumes the download that has been paused.
4456 *
4457 * **Note:** To enable resumable downloads the server you are downloading from must
4458 * support range requests and provide both `Last-Modified` and `ETag` header
4459 * values. Otherwise `resume()` will dismiss previously received bytes and restart
4460 * the download from the beginning.
4461 */
4462 resume(): void;
4463 /**
4464 * This API allows the user to set custom options for the save dialog that opens
4465 * for the download item by default. The API is only available in session's
4466 * `will-download` callback function.
4467 */
4468 setSaveDialogOptions(options: SaveDialogOptions): void;
4469 /**
4470 * The API is only available in session's `will-download` callback function. If
4471 * user doesn't set the save path via the API, Electron will use the original
4472 * routine to determine the save path; this usually prompts a save dialog.
4473 */
4474 setSavePath(path: string): void;
4475 savePath: string;
4476 }
4477
4478 interface Event extends GlobalEvent {
4479
4480 // Docs: https://electronjs.org/docs/api/structures/event
4481
4482 preventDefault: (() => void);
4483 }
4484
4485 interface Extension {
4486
4487 // Docs: https://electronjs.org/docs/api/structures/extension
4488
4489 id: string;
4490 /**
4491 * Copy of the extension's manifest data.
4492 */
4493 manifest: any;
4494 name: string;
4495 /**
4496 * The extension's file path.
4497 */
4498 path: string;
4499 /**
4500 * The extension's `chrome-extension://` URL.
4501 */
4502 url: string;
4503 version: string;
4504 }
4505
4506 interface ExtensionInfo {
4507
4508 // Docs: https://electronjs.org/docs/api/structures/extension-info
4509
4510 name: string;
4511 version: string;
4512 }
4513
4514 interface FileFilter {
4515
4516 // Docs: https://electronjs.org/docs/api/structures/file-filter
4517
4518 extensions: string[];
4519 name: string;
4520 }
4521
4522 interface FilePathWithHeaders {
4523
4524 // Docs: https://electronjs.org/docs/api/structures/file-path-with-headers
4525
4526 /**
4527 * Additional headers to be sent.
4528 */
4529 headers?: Record<string, string>;
4530 /**
4531 * The path to the file to send.
4532 */
4533 path: string;
4534 }
4535
4536 interface GlobalShortcut {
4537
4538 // Docs: https://electronjs.org/docs/api/global-shortcut
4539
4540 /**
4541 * Whether this application has registered `accelerator`.
4542 *
4543 * When the accelerator is already taken by other applications, this call will
4544 * still return `false`. This behavior is intended by operating systems, since they
4545 * don't want applications to fight for global shortcuts.
4546 */
4547 isRegistered(accelerator: Accelerator): boolean;
4548 /**
4549 * Whether or not the shortcut was registered successfully.
4550 *
4551 * Registers a global shortcut of `accelerator`. The `callback` is called when the
4552 * registered shortcut is pressed by the user.
4553 *
4554 * When the accelerator is already taken by other applications, this call will
4555 * silently fail. This behavior is intended by operating systems, since they don't
4556 * want applications to fight for global shortcuts.
4557 *
4558 * The following accelerators will not be registered successfully on macOS 10.14
4559 * Mojave unless the app has been authorized as a trusted accessibility client:
4560 *
4561 * * "Media Play/Pause"
4562 * * "Media Next Track"
4563* "Media Previous Track"
4564* "Media Stop"
4565 */
4566 register(accelerator: Accelerator, callback: () => void): boolean;
4567 /**
4568 * Registers a global shortcut of all `accelerator` items in `accelerators`. The
4569 * `callback` is called when any of the registered shortcuts are pressed by the
4570 * user.
4571 *
4572 * When a given accelerator is already taken by other applications, this call will
4573 * silently fail. This behavior is intended by operating systems, since they don't
4574 * want applications to fight for global shortcuts.
4575 *
4576 * The following accelerators will not be registered successfully on macOS 10.14
4577 * Mojave unless the app has been authorized as a trusted accessibility client:
4578 *
4579 * * "Media Play/Pause"
4580 * * "Media Next Track"
4581* "Media Previous Track"
4582* "Media Stop"
4583 */
4584 registerAll(accelerators: string[], callback: () => void): void;
4585 /**
4586 * Unregisters the global shortcut of `accelerator`.
4587 */
4588 unregister(accelerator: Accelerator): void;
4589 /**
4590 * Unregisters all of the global shortcuts.
4591 */
4592 unregisterAll(): void;
4593 }
4594
4595 interface GPUFeatureStatus {
4596
4597 // Docs: https://electronjs.org/docs/api/structures/gpu-feature-status
4598
4599 /**
4600 * Canvas.
4601 */
4602 '2d_canvas': string;
4603 /**
4604 * Flash.
4605 */
4606 flash_3d: string;
4607 /**
4608 * Flash Stage3D.
4609 */
4610 flash_stage3d: string;
4611 /**
4612 * Flash Stage3D Baseline profile.
4613 */
4614 flash_stage3d_baseline: string;
4615 /**
4616 * Compositing.
4617 */
4618 gpu_compositing: string;
4619 /**
4620 * Multiple Raster Threads.
4621 */
4622 multiple_raster_threads: string;
4623 /**
4624 * Native GpuMemoryBuffers.
4625 */
4626 native_gpu_memory_buffers: string;
4627 /**
4628 * Rasterization.
4629 */
4630 rasterization: string;
4631 /**
4632 * Video Decode.
4633 */
4634 video_decode: string;
4635 /**
4636 * Video Encode.
4637 */
4638 video_encode: string;
4639 /**
4640 * VPx Video Decode.
4641 */
4642 vpx_decode: string;
4643 /**
4644 * WebGL.
4645 */
4646 webgl: string;
4647 /**
4648 * WebGL2.
4649 */
4650 webgl2: string;
4651 }
4652
4653 interface InAppPurchase extends NodeJS.EventEmitter {
4654
4655 // Docs: https://electronjs.org/docs/api/in-app-purchase
4656
4657 on(event: 'transactions-updated', listener: Function): this;
4658 once(event: 'transactions-updated', listener: Function): this;
4659 addListener(event: 'transactions-updated', listener: Function): this;
4660 removeListener(event: 'transactions-updated', listener: Function): this;
4661 /**
4662 * whether a user can make a payment.
4663 */
4664 canMakePayments(): boolean;
4665 /**
4666 * Completes all pending transactions.
4667 */
4668 finishAllTransactions(): void;
4669 /**
4670 * Completes the pending transactions corresponding to the date.
4671 */
4672 finishTransactionByDate(date: string): void;
4673 /**
4674 * Resolves with an array of `Product` objects.
4675 *
4676Retrieves the product descriptions.
4677 */
4678 getProducts(productIDs: string[]): Promise<Electron.Product[]>;
4679 /**
4680 * the path to the receipt.
4681 */
4682 getReceiptURL(): string;
4683 /**
4684 * Returns `true` if the product is valid and added to the payment queue.
4685 *
4686 * You should listen for the `transactions-updated` event as soon as possible and
4687 * certainly before you call `purchaseProduct`.
4688 */
4689 purchaseProduct(productID: string, quantity?: number): Promise<boolean>;
4690 /**
4691 * Restores finished transactions. This method can be called either to install
4692 * purchases on additional devices, or to restore purchases for an application that
4693 * the user deleted and reinstalled.
4694 *
4695 * The payment queue delivers a new transaction for each previously completed
4696 * transaction that can be restored. Each transaction includes a copy of the
4697 * original transaction.
4698 */
4699 restoreCompletedTransactions(): void;
4700 }
4701
4702 class IncomingMessage extends NodeEventEmitter {
4703
4704 // Docs: https://electronjs.org/docs/api/incoming-message
4705
4706 /**
4707 * Emitted when a request has been canceled during an ongoing HTTP transaction.
4708 */
4709 on(event: 'aborted', listener: Function): this;
4710 once(event: 'aborted', listener: Function): this;
4711 addListener(event: 'aborted', listener: Function): this;
4712 removeListener(event: 'aborted', listener: Function): this;
4713 /**
4714 * The `data` event is the usual method of transferring response data into
4715 * applicative code.
4716 */
4717 on(event: 'data', listener: (
4718 /**
4719 * A chunk of response body's data.
4720 */
4721 chunk: Buffer) => void): this;
4722 once(event: 'data', listener: (
4723 /**
4724 * A chunk of response body's data.
4725 */
4726 chunk: Buffer) => void): this;
4727 addListener(event: 'data', listener: (
4728 /**
4729 * A chunk of response body's data.
4730 */
4731 chunk: Buffer) => void): this;
4732 removeListener(event: 'data', listener: (
4733 /**
4734 * A chunk of response body's data.
4735 */
4736 chunk: Buffer) => void): this;
4737 /**
4738 * Indicates that response body has ended.
4739 */
4740 on(event: 'end', listener: Function): this;
4741 once(event: 'end', listener: Function): this;
4742 addListener(event: 'end', listener: Function): this;
4743 removeListener(event: 'end', listener: Function): this;
4744 /**
4745 * Returns:
4746 *
4747 * `error` Error - Typically holds an error string identifying failure root cause.
4748 *
4749 * Emitted when an error was encountered while streaming response data events. For
4750 * instance, if the server closes the underlying while the response is still
4751 * streaming, an `error` event will be emitted on the response object and a `close`
4752 * event will subsequently follow on the request object.
4753 */
4754 on(event: 'error', listener: Function): this;
4755 once(event: 'error', listener: Function): this;
4756 addListener(event: 'error', listener: Function): this;
4757 removeListener(event: 'error', listener: Function): this;
4758 headers: Record<string, (string) | (string[])>;
4759 httpVersion: string;
4760 httpVersionMajor: number;
4761 httpVersionMinor: number;
4762 statusCode: number;
4763 statusMessage: string;
4764 }
4765
4766 interface InputEvent {
4767
4768 // Docs: https://electronjs.org/docs/api/structures/input-event
4769
4770 /**
4771 * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
4772 * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
4773 * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
4774 */
4775 modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
4776 }
4777
4778 interface IOCounters {
4779
4780 // Docs: https://electronjs.org/docs/api/structures/io-counters
4781
4782 /**
4783 * Then number of I/O other operations.
4784 */
4785 otherOperationCount: number;
4786 /**
4787 * Then number of I/O other transfers.
4788 */
4789 otherTransferCount: number;
4790 /**
4791 * The number of I/O read operations.
4792 */
4793 readOperationCount: number;
4794 /**
4795 * The number of I/O read transfers.
4796 */
4797 readTransferCount: number;
4798 /**
4799 * The number of I/O write operations.
4800 */
4801 writeOperationCount: number;
4802 /**
4803 * The number of I/O write transfers.
4804 */
4805 writeTransferCount: number;
4806 }
4807
4808 interface IpcMain extends NodeJS.EventEmitter {
4809
4810 // Docs: https://electronjs.org/docs/api/ipc-main
4811
4812 /**
4813 * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
4814 * renderer calls `ipcRenderer.invoke(channel, ...args)`.
4815 *
4816 * If `listener` returns a Promise, the eventual result of the promise will be
4817 * returned as a reply to the remote caller. Otherwise, the return value of the
4818 * listener will be used as the value of the reply.
4819 *
4820 * The `event` that is passed as the first argument to the handler is the same as
4821 * that passed to a regular event listener. It includes information about which
4822 * WebContents is the source of the invoke request.
4823 */
4824 handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
4825 /**
4826 * Handles a single `invoke`able IPC message, then removes the listener. See
4827 * `ipcMain.handle(channel, listener)`.
4828 */
4829 handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
4830 /**
4831 * Listens to `channel`, when a new message arrives `listener` would be called with
4832 * `listener(event, args...)`.
4833 */
4834 on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
4835 /**
4836 * Adds a one time `listener` function for the event. This `listener` is invoked
4837 * only the next time a message is sent to `channel`, after which it is removed.
4838 */
4839 once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
4840 /**
4841 * Removes listeners of the specified `channel`.
4842 */
4843 removeAllListeners(channel?: string): this;
4844 /**
4845 * Removes any handler for `channel`, if present.
4846 */
4847 removeHandler(channel: string): void;
4848 /**
4849 * Removes the specified `listener` from the listener array for the specified
4850 * `channel`.
4851 */
4852 removeListener(channel: string, listener: (...args: any[]) => void): this;
4853 }
4854
4855 interface IpcMainEvent extends Event {
4856
4857 // Docs: https://electronjs.org/docs/api/structures/ipc-main-event
4858
4859 /**
4860 * The ID of the renderer frame that sent this message
4861 */
4862 frameId: number;
4863 /**
4864 * A list of MessagePorts that were transferred with this message
4865 */
4866 ports: MessagePortMain[];
4867 /**
4868 * The internal ID of the renderer process that sent this message
4869 */
4870 processId: number;
4871 /**
4872 * A function that will send an IPC message to the renderer frame that sent the
4873 * original message that you are currently handling. You should use this method to
4874 * "reply" to the sent message in order to guarantee the reply will go to the
4875 * correct process and frame.
4876 */
4877 reply: Function;
4878 /**
4879 * Set this to the value to be returned in a synchronous message
4880 */
4881 returnValue: any;
4882 /**
4883 * Returns the `webContents` that sent the message
4884 */
4885 sender: WebContents;
4886 }
4887
4888 interface IpcMainInvokeEvent extends Event {
4889
4890 // Docs: https://electronjs.org/docs/api/structures/ipc-main-invoke-event
4891
4892 /**
4893 * The ID of the renderer frame that sent this message
4894 */
4895 frameId: number;
4896 /**
4897 * The internal ID of the renderer process that sent this message
4898 */
4899 processId: number;
4900 /**
4901 * Returns the `webContents` that sent the message
4902 */
4903 sender: WebContents;
4904 }
4905
4906 interface IpcRenderer extends NodeJS.EventEmitter {
4907
4908 // Docs: https://electronjs.org/docs/api/ipc-renderer
4909
4910 /**
4911 * Resolves with the response from the main process.
4912 *
4913 * Send a message to the main process via `channel` and expect a result
4914 * asynchronously. Arguments will be serialized with the Structured Clone
4915 * Algorithm, just like `window.postMessage`, so prototype chains will not be
4916 * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
4917 * an exception.
4918 *
4919 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
4920 * Electron objects will throw an exception.
4921 *
4922 * Since the main process does not have support for DOM objects such as
4923 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
4924 * Electron's IPC to the main process, as the main process would have no way to
4925 * decode them. Attempting to send such objects over IPC will result in an error.
4926 *
4927 * The main process should listen for `channel` with `ipcMain.handle()`.
4928 *
4929 * For example:
4930 *
4931 * If you need to transfer a `MessagePort` to the main process, use
4932 * `ipcRenderer.postMessage`.
4933 *
4934 * If you do not need a response to the message, consider using `ipcRenderer.send`.
4935 */
4936 invoke(channel: string, ...args: any[]): Promise<any>;
4937 /**
4938 * Listens to `channel`, when a new message arrives `listener` would be called with
4939 * `listener(event, args...)`.
4940 */
4941 on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
4942 /**
4943 * Adds a one time `listener` function for the event. This `listener` is invoked
4944 * only the next time a message is sent to `channel`, after which it is removed.
4945 */
4946 once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
4947 /**
4948 * Send a message to the main process, optionally transferring ownership of zero or
4949 * more `MessagePort` objects.
4950 *
4951 * The transferred `MessagePort` objects will be available in the main process as
4952 * `MessagePortMain` objects by accessing the `ports` property of the emitted
4953 * event.
4954 *
4955 * For example:
4956 *
4957 * For more information on using `MessagePort` and `MessageChannel`, see the MDN
4958 * documentation.
4959 */
4960 postMessage(channel: string, message: any, transfer?: MessagePort[]): void;
4961 /**
4962 * Removes all listeners, or those of the specified `channel`.
4963 */
4964 removeAllListeners(channel: string): this;
4965 /**
4966 * Removes the specified `listener` from the listener array for the specified
4967 * `channel`.
4968 */
4969 removeListener(channel: string, listener: (...args: any[]) => void): this;
4970 /**
4971 * Send an asynchronous message to the main process via `channel`, along with
4972 * arguments. Arguments will be serialized with the Structured Clone Algorithm,
4973 * just like `window.postMessage`, so prototype chains will not be included.
4974 * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
4975 * exception.
4976 *
4977 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
4978 * Electron objects will throw an exception.
4979 *
4980 * Since the main process does not have support for DOM objects such as
4981 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
4982 * Electron's IPC to the main process, as the main process would have no way to
4983 * decode them. Attempting to send such objects over IPC will result in an error.
4984 *
4985 * The main process handles it by listening for `channel` with the `ipcMain`
4986 * module.
4987 *
4988 * If you need to transfer a `MessagePort` to the main process, use
4989 * `ipcRenderer.postMessage`.
4990 *
4991 * If you want to receive a single response from the main process, like the result
4992 * of a method call, consider using `ipcRenderer.invoke`.
4993 */
4994 send(channel: string, ...args: any[]): void;
4995 /**
4996 * The value sent back by the `ipcMain` handler.
4997 *
4998 * Send a message to the main process via `channel` and expect a result
4999 * synchronously. Arguments will be serialized with the Structured Clone Algorithm,
5000 * just like `window.postMessage`, so prototype chains will not be included.
5001 * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
5002 * exception.
5003 *
5004 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
5005 * Electron objects will throw an exception.
5006 *
5007 * Since the main process does not have support for DOM objects such as
5008 * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
5009 * Electron's IPC to the main process, as the main process would have no way to
5010 * decode them. Attempting to send such objects over IPC will result in an error.
5011 *
5012 * The main process handles it by listening for `channel` with `ipcMain` module,
5013 * and replies by setting `event.returnValue`.
5014 *
5015 * > :warning: **WARNING**: Sending a synchronous message will block the whole
5016 * renderer process until the reply is received, so use this method only as a last
5017 * resort. It's much better to use the asynchronous version, `invoke()`.
5018 */
5019 sendSync(channel: string, ...args: any[]): any;
5020 /**
5021 * Sends a message to a window with `webContentsId` via `channel`.
5022 */
5023 sendTo(webContentsId: number, channel: string, ...args: any[]): void;
5024 /**
5025 * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
5026 * the host page instead of the main process.
5027 */
5028 sendToHost(channel: string, ...args: any[]): void;
5029 }
5030
5031 interface IpcRendererEvent extends Event {
5032
5033 // Docs: https://electronjs.org/docs/api/structures/ipc-renderer-event
5034
5035 /**
5036 * A list of MessagePorts that were transferred with this message
5037 */
5038 ports: MessagePort[];
5039 /**
5040 * The `IpcRenderer` instance that emitted the event originally
5041 */
5042 sender: IpcRenderer;
5043 /**
5044 * The `webContents.id` that sent the message, you can call
5045 * `event.sender.sendTo(event.senderId, ...)` to reply to the message, see
5046 * ipcRenderer.sendTo for more information. This only applies to messages sent from
5047 * a different renderer. Messages sent directly from the main process set
5048 * `event.senderId` to `0`.
5049 */
5050 senderId: number;
5051 }
5052
5053 interface JumpListCategory {
5054
5055 // Docs: https://electronjs.org/docs/api/structures/jump-list-category
5056
5057 /**
5058 * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
5059 * should be omitted.
5060 */
5061 items?: JumpListItem[];
5062 /**
5063 * Must be set if `type` is `custom`, otherwise it should be omitted.
5064 */
5065 name?: string;
5066 /**
5067 * One of the following:
5068 */
5069 type?: ('tasks' | 'frequent' | 'recent' | 'custom');
5070 }
5071
5072 interface JumpListItem {
5073
5074 // Docs: https://electronjs.org/docs/api/structures/jump-list-item
5075
5076 /**
5077 * The command line arguments when `program` is executed. Should only be set if
5078 * `type` is `task`.
5079 */
5080 args?: string;
5081 /**
5082 * Description of the task (displayed in a tooltip). Should only be set if `type`
5083 * is `task`.
5084 */
5085 description?: string;
5086 /**
5087 * The index of the icon in the resource file. If a resource file contains multiple
5088 * icons this value can be used to specify the zero-based index of the icon that
5089 * should be displayed for this task. If a resource file contains only one icon,
5090 * this property should be set to zero.
5091 */
5092 iconIndex?: number;
5093 /**
5094 * The absolute path to an icon to be displayed in a Jump List, which can be an
5095 * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
5096 * can usually specify `process.execPath` to show the program icon.
5097 */
5098 iconPath?: string;
5099 /**
5100 * Path of the file to open, should only be set if `type` is `file`.
5101 */
5102 path?: string;
5103 /**
5104 * Path of the program to execute, usually you should specify `process.execPath`
5105 * which opens the current program. Should only be set if `type` is `task`.
5106 */
5107 program?: string;
5108 /**
5109 * The text to be displayed for the item in the Jump List. Should only be set if
5110 * `type` is `task`.
5111 */
5112 title?: string;
5113 /**
5114 * One of the following:
5115 */
5116 type?: ('task' | 'separator' | 'file');
5117 /**
5118 * The working directory. Default is empty.
5119 */
5120 workingDirectory?: string;
5121 }
5122
5123 interface KeyboardEvent {
5124
5125 // Docs: https://electronjs.org/docs/api/structures/keyboard-event
5126
5127 /**
5128 * whether an Alt key was used in an accelerator to trigger the Event
5129 */
5130 altKey?: boolean;
5131 /**
5132 * whether the Control key was used in an accelerator to trigger the Event
5133 */
5134 ctrlKey?: boolean;
5135 /**
5136 * whether a meta key was used in an accelerator to trigger the Event
5137 */
5138 metaKey?: boolean;
5139 /**
5140 * whether a Shift key was used in an accelerator to trigger the Event
5141 */
5142 shiftKey?: boolean;
5143 /**
5144 * whether an accelerator was used to trigger the event as opposed to another user
5145 * gesture like mouse click
5146 */
5147 triggeredByAccelerator?: boolean;
5148 }
5149
5150 interface KeyboardInputEvent extends InputEvent {
5151
5152 // Docs: https://electronjs.org/docs/api/structures/keyboard-input-event
5153
5154 /**
5155 * The character that will be sent as the keyboard event. Should only use the valid
5156 * key codes in Accelerator.
5157 */
5158 keyCode: string;
5159 /**
5160 * The type of the event, can be `keyDown`, `keyUp` or `char`.
5161 */
5162 type: ('keyDown' | 'keyUp' | 'char');
5163 }
5164
5165 interface MemoryInfo {
5166
5167 // Docs: https://electronjs.org/docs/api/structures/memory-info
5168
5169 /**
5170 * The maximum amount of memory that has ever been pinned to actual physical RAM.
5171 */
5172 peakWorkingSetSize: number;
5173 /**
5174 * The amount of memory not shared by other processes, such as JS heap or HTML
5175 * content.
5176 *
5177 * @platform win32
5178 */
5179 privateBytes?: number;
5180 /**
5181 * The amount of memory currently pinned to actual physical RAM.
5182 */
5183 workingSetSize: number;
5184 }
5185
5186 interface MemoryUsageDetails {
5187
5188 // Docs: https://electronjs.org/docs/api/structures/memory-usage-details
5189
5190 count: number;
5191 liveSize: number;
5192 size: number;
5193 }
5194
5195 class Menu {
5196
5197 // Docs: https://electronjs.org/docs/api/menu
5198
5199 /**
5200 * Emitted when a popup is closed either manually or with `menu.closePopup()`.
5201 */
5202 on(event: 'menu-will-close', listener: (event: Event) => void): this;
5203 once(event: 'menu-will-close', listener: (event: Event) => void): this;
5204 addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
5205 removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
5206 /**
5207 * Emitted when `menu.popup()` is called.
5208 */
5209 on(event: 'menu-will-show', listener: (event: Event) => void): this;
5210 once(event: 'menu-will-show', listener: (event: Event) => void): this;
5211 addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
5212 removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
5213 /**
5214 * Menu
5215 */
5216 constructor();
5217 /**
5218 * Generally, the `template` is an array of `options` for constructing a MenuItem.
5219 * The usage can be referenced above.
5220 *
5221 * You can also attach other fields to the element of the `template` and they will
5222 * become properties of the constructed menu items.
5223 */
5224 static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
5225 /**
5226 * The application menu, if set, or `null`, if not set.
5227 *
5228 * **Note:** The returned `Menu` instance doesn't support dynamic addition or
5229 * removal of menu items. Instance properties can still be dynamically modified.
5230 */
5231 static getApplicationMenu(): (Menu) | (null);
5232 /**
5233 * Sends the `action` to the first responder of application. This is used for
5234 * emulating default macOS menu behaviors. Usually you would use the `role`
5235 * property of a `MenuItem`.
5236 *
5237 * See the macOS Cocoa Event Handling Guide for more information on macOS' native
5238 * actions.
5239 *
5240 * @platform darwin
5241 */
5242 static sendActionToFirstResponder(action: string): void;
5243 /**
5244 * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
5245 * will be set as each window's top menu.
5246 *
5247 * Also on Windows and Linux, you can use a `&` in the top-level item name to
5248 * indicate which letter should get a generated accelerator. For example, using
5249 * `&File` for the file menu would result in a generated `Alt-F` accelerator that
5250 * opens the associated menu. The indicated character in the button label then gets
5251 * an underline, and the `&` character is not displayed on the button label.
5252 *
5253 * In order to escape the `&` character in an item name, add a proceeding `&`. For
5254 * example, `&&File` would result in `&File` displayed on the button label.
5255 *
5256 * Passing `null` will suppress the default menu. On Windows and Linux, this has
5257 * the additional effect of removing the menu bar from the window.
5258 *
5259 * **Note:** The default menu will be created automatically if the app does not set
5260 * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
5261 * `Help`.
5262 */
5263 static setApplicationMenu(menu: (Menu) | (null)): void;
5264 /**
5265 * Appends the `menuItem` to the menu.
5266 */
5267 append(menuItem: MenuItem): void;
5268 /**
5269 * Closes the context menu in the `browserWindow`.
5270 */
5271 closePopup(browserWindow?: BrowserWindow): void;
5272 /**
5273 * the item with the specified `id`
5274 */
5275 getMenuItemById(id: string): (MenuItem) | (null);
5276 /**
5277 * Inserts the `menuItem` to the `pos` position of the menu.
5278 */
5279 insert(pos: number, menuItem: MenuItem): void;
5280 /**
5281 * Pops up this menu as a context menu in the `BrowserWindow`.
5282 */
5283 popup(options?: PopupOptions): void;
5284 items: MenuItem[];
5285 }
5286
5287 class MenuItem {
5288
5289 // Docs: https://electronjs.org/docs/api/menu-item
5290
5291 /**
5292 * MenuItem
5293 */
5294 constructor(options: MenuItemConstructorOptions);
5295 accelerator?: Accelerator;
5296 checked: boolean;
5297 click: Function;
5298 commandId: number;
5299 enabled: boolean;
5300 icon?: (NativeImage) | (string);
5301 id: string;
5302 label: string;
5303 menu: Menu;
5304 registerAccelerator: boolean;
5305 role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
5306 sublabel: string;
5307 submenu?: Menu;
5308 toolTip: string;
5309 type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
5310 visible: boolean;
5311 }
5312
5313 class MessageChannelMain extends NodeEventEmitter {
5314
5315 // Docs: https://electronjs.org/docs/api/message-channel-main
5316
5317 port1: MessagePortMain;
5318 port2: MessagePortMain;
5319 }
5320
5321 class MessagePortMain extends NodeEventEmitter {
5322
5323 // Docs: https://electronjs.org/docs/api/message-port-main
5324
5325 /**
5326 * Emitted when the remote end of a MessagePortMain object becomes disconnected.
5327 */
5328 on(event: 'close', listener: Function): this;
5329 once(event: 'close', listener: Function): this;
5330 addListener(event: 'close', listener: Function): this;
5331 removeListener(event: 'close', listener: Function): this;
5332 /**
5333 * Emitted when a MessagePortMain object receives a message.
5334 */
5335 on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
5336 once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
5337 addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
5338 removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
5339 /**
5340 * Disconnects the port, so it is no longer active.
5341 */
5342 close(): void;
5343 /**
5344 * Sends a message from the port, and optionally, transfers ownership of objects to
5345 * other browsing contexts.
5346 */
5347 postMessage(message: any, transfer?: MessagePortMain[]): void;
5348 /**
5349 * Starts the sending of messages queued on the port. Messages will be queued until
5350 * this method is called.
5351 */
5352 start(): void;
5353 }
5354
5355 interface MimeTypedBuffer {
5356
5357 // Docs: https://electronjs.org/docs/api/structures/mime-typed-buffer
5358
5359 /**
5360 * Charset of the buffer.
5361 */
5362 charset?: string;
5363 /**
5364 * The actual Buffer content.
5365 */
5366 data: Buffer;
5367 /**
5368 * MIME type of the buffer.
5369 */
5370 mimeType?: string;
5371 }
5372
5373 interface MouseInputEvent extends InputEvent {
5374
5375 // Docs: https://electronjs.org/docs/api/structures/mouse-input-event
5376
5377 /**
5378 * The button pressed, can be `left`, `middle`, `right`.
5379 */
5380 button?: ('left' | 'middle' | 'right');
5381 clickCount?: number;
5382 globalX?: number;
5383 globalY?: number;
5384 movementX?: number;
5385 movementY?: number;
5386 /**
5387 * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
5388 * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
5389 */
5390 type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
5391 x: number;
5392 y: number;
5393 }
5394
5395 interface MouseWheelInputEvent extends MouseInputEvent {
5396
5397 // Docs: https://electronjs.org/docs/api/structures/mouse-wheel-input-event
5398
5399 accelerationRatioX?: number;
5400 accelerationRatioY?: number;
5401 canScroll?: boolean;
5402 deltaX?: number;
5403 deltaY?: number;
5404 hasPreciseScrollingDeltas?: boolean;
5405 /**
5406 * The type of the event, can be `mouseWheel`.
5407 */
5408 type: ('mouseWheel');
5409 wheelTicksX?: number;
5410 wheelTicksY?: number;
5411 }
5412
5413 class NativeImage {
5414
5415 // Docs: https://electronjs.org/docs/api/native-image
5416
5417 /**
5418 * Creates an empty `NativeImage` instance.
5419 */
5420 static createEmpty(): NativeImage;
5421 /**
5422 * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
5423 * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
5424 */
5425 static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
5426 /**
5427 * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
5428 * JPEG first.
5429 */
5430 static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
5431 /**
5432 * Creates a new `NativeImage` instance from `dataURL`.
5433 */
5434 static createFromDataURL(dataURL: string): NativeImage;
5435 /**
5436 * Creates a new `NativeImage` instance from the NSImage that maps to the given
5437 * image name. See `System Icons` for a list of possible values.
5438 *
5439 * The `hslShift` is applied to the image with the following rules:
5440 *
5441 * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
5442 * and 360 on the hue color wheel (red).
5443 * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
5444 * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
5445 * saturate the image.
5446 * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
5447 * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
5448 * leave unchanged. 1 = full lightness (make all pixels white).
5449 *
5450 * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
5451 * 0]` will make the image completely black.
5452 *
5453 * In some cases, the `NSImageName` doesn't match its string representation; one
5454 * example of this is `NSFolderImageName`, whose string representation would
5455 * actually be `NSFolder`. Therefore, you'll need to determine the correct string
5456 * representation for your image before passing it in. This can be done with the
5457 * following:
5458 *
5459 * `echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME);
5460 * }' | clang -otest -x objective-c -framework Cocoa - && ./test`
5461 *
5462where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
5463 *
5464 * @platform darwin
5465 */
5466 static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
5467 /**
5468 * Creates a new `NativeImage` instance from a file located at `path`. This method
5469 * returns an empty image if the `path` does not exist, cannot be read, or is not a
5470 * valid image.
5471 */
5472 static createFromPath(path: string): NativeImage;
5473 /**
5474 * fulfilled with the file's thumbnail preview image, which is a NativeImage.
5475 *
5476 * @platform darwin,win32
5477 */
5478 static createThumbnailFromPath(path: string, maxSize: Size): Promise<Electron.NativeImage>;
5479 /**
5480 * Add an image representation for a specific scale factor. This can be used to
5481 * explicitly add different scale factor representations to an image. This can be
5482 * called on empty images.
5483 */
5484 addRepresentation(options: AddRepresentationOptions): void;
5485 /**
5486 * The cropped image.
5487 */
5488 crop(rect: Rectangle): NativeImage;
5489 /**
5490 * The image's aspect ratio.
5491 *
5492 * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
5493 * the image representation most closely matching the passed value.
5494 */
5495 getAspectRatio(scaleFactor?: number): number;
5496 /**
5497 * A Buffer that contains the image's raw bitmap pixel data.
5498 *
5499 * The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does
5500 * not copy the bitmap data, so you have to use the returned Buffer immediately in
5501 * current event loop tick; otherwise the data might be changed or destroyed.
5502 */
5503 getBitmap(options?: BitmapOptions): Buffer;
5504 /**
5505 * A Buffer that stores C pointer to underlying native handle of the image. On
5506 * macOS, a pointer to `NSImage` instance would be returned.
5507 *
5508 * Notice that the returned pointer is a weak pointer to the underlying native
5509 * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
5510 * instance is kept around.
5511 *
5512 * @platform darwin
5513 */
5514 getNativeHandle(): Buffer;
5515 /**
5516 * An array of all scale factors corresponding to representations for a given
5517 * nativeImage.
5518 */
5519 getScaleFactors(): number[];
5520 /**
5521 * If `scaleFactor` is passed, this will return the size corresponding to the image
5522 * representation most closely matching the passed value.
5523 */
5524 getSize(scaleFactor?: number): Size;
5525 /**
5526 * Whether the image is empty.
5527 */
5528 isEmpty(): boolean;
5529 /**
5530 * Whether the image is a template image.
5531 */
5532 isTemplateImage(): boolean;
5533 /**
5534 * The resized image.
5535 *
5536 * If only the `height` or the `width` are specified then the current aspect ratio
5537 * will be preserved in the resized image.
5538 */
5539 resize(options: ResizeOptions): NativeImage;
5540 /**
5541 * Marks the image as a template image.
5542 */
5543 setTemplateImage(option: boolean): void;
5544 /**
5545 * A Buffer that contains a copy of the image's raw bitmap pixel data.
5546 */
5547 toBitmap(options?: ToBitmapOptions): Buffer;
5548 /**
5549 * The data URL of the image.
5550 */
5551 toDataURL(options?: ToDataURLOptions): string;
5552 /**
5553 * A Buffer that contains the image's `JPEG` encoded data.
5554 */
5555 toJPEG(quality: number): Buffer;
5556 /**
5557 * A Buffer that contains the image's `PNG` encoded data.
5558 */
5559 toPNG(options?: ToPNGOptions): Buffer;
5560 isMacTemplateImage: boolean;
5561 }
5562
5563 interface NativeTheme extends NodeJS.EventEmitter {
5564
5565 // Docs: https://electronjs.org/docs/api/native-theme
5566
5567 /**
5568 * Emitted when something in the underlying NativeTheme has changed. This normally
5569 * means that either the value of `shouldUseDarkColors`,
5570 * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
5571 * will have to check them to determine which one has changed.
5572 */
5573 on(event: 'updated', listener: Function): this;
5574 once(event: 'updated', listener: Function): this;
5575 addListener(event: 'updated', listener: Function): this;
5576 removeListener(event: 'updated', listener: Function): this;
5577 /**
5578 * A `Boolean` for if the OS / Chromium currently has a dark mode enabled or is
5579 * being instructed to show a dark-style UI. If you want to modify this value you
5580 * should use `themeSource` below.
5581 *
5582 */
5583 readonly shouldUseDarkColors: boolean;
5584 /**
5585 * A `Boolean` for if the OS / Chromium currently has high-contrast mode enabled or
5586 * is being instructed to show a high-contrast UI.
5587 *
5588 * @platform darwin,win32
5589 */
5590 readonly shouldUseHighContrastColors: boolean;
5591 /**
5592 * A `Boolean` for if the OS / Chromium currently has an inverted color scheme or
5593 * is being instructed to use an inverted color scheme.
5594 *
5595 * @platform darwin,win32
5596 */
5597 readonly shouldUseInvertedColorScheme: boolean;
5598 /**
5599 * A `String` property that can be `system`, `light` or `dark`. It is used to
5600 * override and supersede the value that Chromium has chosen to use internally.
5601 *
5602 * Setting this property to `system` will remove the override and everything will
5603 * be reset to the OS default. By default `themeSource` is `system`.
5604 *
5605 * Settings this property to `dark` will have the following effects:
5606 *
5607 * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
5608 * * Any UI Electron renders on Linux and Windows including context menus,
5609 * devtools, etc. will use the dark UI.
5610 * * Any UI the OS renders on macOS including menus, window frames, etc. will use
5611 * the dark UI.
5612 * * The `prefers-color-scheme` CSS query will match `dark` mode.
5613 * * The `updated` event will be emitted
5614 *
5615 * Settings this property to `light` will have the following effects:
5616 *
5617 * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
5618 * * Any UI Electron renders on Linux and Windows including context menus,
5619 * devtools, etc. will use the light UI.
5620 * * Any UI the OS renders on macOS including menus, window frames, etc. will use
5621 * the light UI.
5622 * * The `prefers-color-scheme` CSS query will match `light` mode.
5623 * * The `updated` event will be emitted
5624 *
5625 * The usage of this property should align with a classic "dark mode" state machine
5626 * in your application where the user has three options.
5627 *
5628 * * `Follow OS` --> `themeSource = 'system'`
5629 * * `Dark Mode` --> `themeSource = 'dark'`
5630 * * `Light Mode` --> `themeSource = 'light'`
5631 *
5632 * Your application should then always use `shouldUseDarkColors` to determine what
5633 * CSS to apply.
5634 */
5635 themeSource: ('system' | 'light' | 'dark');
5636 }
5637
5638 interface Net {
5639
5640 // Docs: https://electronjs.org/docs/api/net
5641
5642 /**
5643 * Creates a `ClientRequest` instance using the provided `options` which are
5644 * directly forwarded to the `ClientRequest` constructor. The `net.request` method
5645 * would be used to issue both secure and insecure HTTP requests according to the
5646 * specified protocol scheme in the `options` object.
5647 */
5648 request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
5649 }
5650
5651 interface NetLog {
5652
5653 // Docs: https://electronjs.org/docs/api/net-log
5654
5655 /**
5656 * resolves when the net log has begun recording.
5657 *
5658Starts recording network events to `path`.
5659 */
5660 startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
5661 /**
5662 * resolves when the net log has been flushed to disk.
5663 *
5664 * Stops recording network events. If not called, net logging will automatically
5665 * end when app quits.
5666 */
5667 stopLogging(): Promise<void>;
5668 /**
5669 * A `Boolean` property that indicates whether network logs are currently being
5670 * recorded.
5671 *
5672 */
5673 readonly currentlyLogging: boolean;
5674 }
5675
5676 interface NewWindowWebContentsEvent extends Event {
5677
5678 // Docs: https://electronjs.org/docs/api/structures/new-window-web-contents-event
5679
5680 newGuest?: BrowserWindow;
5681 }
5682
5683 class Notification extends NodeEventEmitter {
5684
5685 // Docs: https://electronjs.org/docs/api/notification
5686
5687 on(event: 'action', listener: (event: Event,
5688 /**
5689 * The index of the action that was activated.
5690 */
5691 index: number) => void): this;
5692 once(event: 'action', listener: (event: Event,
5693 /**
5694 * The index of the action that was activated.
5695 */
5696 index: number) => void): this;
5697 addListener(event: 'action', listener: (event: Event,
5698 /**
5699 * The index of the action that was activated.
5700 */
5701 index: number) => void): this;
5702 removeListener(event: 'action', listener: (event: Event,
5703 /**
5704 * The index of the action that was activated.
5705 */
5706 index: number) => void): this;
5707 /**
5708 * Emitted when the notification is clicked by the user.
5709 */
5710 on(event: 'click', listener: (event: Event) => void): this;
5711 once(event: 'click', listener: (event: Event) => void): this;
5712 addListener(event: 'click', listener: (event: Event) => void): this;
5713 removeListener(event: 'click', listener: (event: Event) => void): this;
5714 /**
5715 * Emitted when the notification is closed by manual intervention from the user.
5716 *
5717 * This event is not guaranteed to be emitted in all cases where the notification
5718 * is closed.
5719 */
5720 on(event: 'close', listener: (event: Event) => void): this;
5721 once(event: 'close', listener: (event: Event) => void): this;
5722 addListener(event: 'close', listener: (event: Event) => void): this;
5723 removeListener(event: 'close', listener: (event: Event) => void): this;
5724 /**
5725 * Emitted when the user clicks the "Reply" button on a notification with
5726 * `hasReply: true`.
5727 *
5728 * @platform darwin
5729 */
5730 on(event: 'reply', listener: (event: Event,
5731 /**
5732 * The string the user entered into the inline reply field.
5733 */
5734 reply: string) => void): this;
5735 once(event: 'reply', listener: (event: Event,
5736 /**
5737 * The string the user entered into the inline reply field.
5738 */
5739 reply: string) => void): this;
5740 addListener(event: 'reply', listener: (event: Event,
5741 /**
5742 * The string the user entered into the inline reply field.
5743 */
5744 reply: string) => void): this;
5745 removeListener(event: 'reply', listener: (event: Event,
5746 /**
5747 * The string the user entered into the inline reply field.
5748 */
5749 reply: string) => void): this;
5750 /**
5751 * Emitted when the notification is shown to the user, note this could be fired
5752 * multiple times as a notification can be shown multiple times through the
5753 * `show()` method.
5754 */
5755 on(event: 'show', listener: (event: Event) => void): this;
5756 once(event: 'show', listener: (event: Event) => void): this;
5757 addListener(event: 'show', listener: (event: Event) => void): this;
5758 removeListener(event: 'show', listener: (event: Event) => void): this;
5759 /**
5760 * Notification
5761 */
5762 constructor(options?: NotificationConstructorOptions);
5763 /**
5764 * Whether or not desktop notifications are supported on the current system
5765 */
5766 static isSupported(): boolean;
5767 /**
5768 * Dismisses the notification.
5769 */
5770 close(): void;
5771 /**
5772 * Immediately shows the notification to the user, please note this means unlike
5773 * the HTML5 Notification implementation, instantiating a `new Notification` does
5774 * not immediately show it to the user, you need to call this method before the OS
5775 * will display it.
5776 *
5777 * If the notification has been shown before, this method will dismiss the
5778 * previously shown notification and create a new one with identical properties.
5779 */
5780 show(): void;
5781 actions: NotificationAction[];
5782 body: string;
5783 closeButtonText: string;
5784 hasReply: boolean;
5785 replyPlaceholder: string;
5786 silent: boolean;
5787 sound: string;
5788 subtitle: string;
5789 timeoutType: ('default' | 'never');
5790 title: string;
5791 urgency: ('normal' | 'critical' | 'low');
5792 }
5793
5794 interface NotificationAction {
5795
5796 // Docs: https://electronjs.org/docs/api/structures/notification-action
5797
5798 /**
5799 * The label for the given action.
5800 */
5801 text?: string;
5802 /**
5803 * The type of action, can be `button`.
5804 */
5805 type: ('button');
5806 }
5807
5808 interface Point {
5809
5810 // Docs: https://electronjs.org/docs/api/structures/point
5811
5812 x: number;
5813 y: number;
5814 }
5815
5816 interface PostBody {
5817
5818 // Docs: https://electronjs.org/docs/api/structures/post-body
5819
5820 /**
5821 * The boundary used to separate multiple parts of the message. Only valid when
5822 * `contentType` is `multipart/form-data`.
5823 */
5824 boundary?: string;
5825 /**
5826 * The `content-type` header used for the data. One of
5827 * `application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to the
5828 * `enctype` attribute of the submitted HTML form.
5829 */
5830 contentType: string;
5831 /**
5832 * The post data to be sent to the new window.
5833 */
5834 data: Array<PostData>;
5835 }
5836
5837 interface PostData {
5838
5839 // Docs: https://electronjs.org/docs/api/structures/post-data
5840
5841 /**
5842 * The `UUID` of the `Blob` being uploaded. Required for the `blob` type.
5843 */
5844 blobUUID?: string;
5845 /**
5846 * The raw bytes of the post data in a `Buffer`. Required for the `rawData` type.
5847 */
5848 bytes?: string;
5849 /**
5850 * The path of the file being uploaded. Required for the `file` type.
5851 */
5852 filePath?: string;
5853 /**
5854 * The length of the file being uploaded, in bytes. If set to `-1`, the whole file
5855 * will be uploaded. Only valid for `file` types.
5856 */
5857 length?: number;
5858 /**
5859 * The modification time of the file represented by a double, which is the number
5860 * of seconds since the `UNIX Epoch` (Jan 1, 1970). Only valid for `file` types.
5861 */
5862 modificationTime?: number;
5863 /**
5864 * The offset from the beginning of the file being uploaded, in bytes. Only valid
5865 * for `file` types.
5866 */
5867 offset?: number;
5868 /**
5869 * One of the following:
5870 */
5871 type: ('rawData' | 'file' | 'blob');
5872 }
5873
5874 interface PowerMonitor extends NodeJS.EventEmitter {
5875
5876 // Docs: https://electronjs.org/docs/api/power-monitor
5877
5878 /**
5879 * Emitted when the system is about to lock the screen.
5880 *
5881 * @platform darwin,win32
5882 */
5883 on(event: 'lock-screen', listener: Function): this;
5884 once(event: 'lock-screen', listener: Function): this;
5885 addListener(event: 'lock-screen', listener: Function): this;
5886 removeListener(event: 'lock-screen', listener: Function): this;
5887 /**
5888 * Emitted when the system changes to AC power.
5889 *
5890 * @platform darwin,win32
5891 */
5892 on(event: 'on-ac', listener: Function): this;
5893 once(event: 'on-ac', listener: Function): this;
5894 addListener(event: 'on-ac', listener: Function): this;
5895 removeListener(event: 'on-ac', listener: Function): this;
5896 /**
5897 * Emitted when system changes to battery power.
5898 *
5899 * @platform darwin
5900 */
5901 on(event: 'on-battery', listener: Function): this;
5902 once(event: 'on-battery', listener: Function): this;
5903 addListener(event: 'on-battery', listener: Function): this;
5904 removeListener(event: 'on-battery', listener: Function): this;
5905 /**
5906 * Emitted when system is resuming.
5907 *
5908 * @platform darwin,win32
5909 */
5910 on(event: 'resume', listener: Function): this;
5911 once(event: 'resume', listener: Function): this;
5912 addListener(event: 'resume', listener: Function): this;
5913 removeListener(event: 'resume', listener: Function): this;
5914 /**
5915 * Emitted when the system is about to reboot or shut down. If the event handler
5916 * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
5917 * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
5918 * should exit as soon as possible by calling something like `app.quit()`.
5919 *
5920 * @platform linux,darwin
5921 */
5922 on(event: 'shutdown', listener: Function): this;
5923 once(event: 'shutdown', listener: Function): this;
5924 addListener(event: 'shutdown', listener: Function): this;
5925 removeListener(event: 'shutdown', listener: Function): this;
5926 /**
5927 * Emitted when the system is suspending.
5928 *
5929 * @platform darwin,win32
5930 */
5931 on(event: 'suspend', listener: Function): this;
5932 once(event: 'suspend', listener: Function): this;
5933 addListener(event: 'suspend', listener: Function): this;
5934 removeListener(event: 'suspend', listener: Function): this;
5935 /**
5936 * Emitted as soon as the systems screen is unlocked.
5937 *
5938 * @platform darwin,win32
5939 */
5940 on(event: 'unlock-screen', listener: Function): this;
5941 once(event: 'unlock-screen', listener: Function): this;
5942 addListener(event: 'unlock-screen', listener: Function): this;
5943 removeListener(event: 'unlock-screen', listener: Function): this;
5944 /**
5945 * The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
5946 *
5947 * Calculate the system idle state. `idleThreshold` is the amount of time (in
5948 * seconds) before considered idle. `locked` is available on supported systems
5949 * only.
5950 */
5951 getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
5952 /**
5953 * Idle time in seconds
5954
5955Calculate system idle time in seconds.
5956 */
5957 getSystemIdleTime(): number;
5958 }
5959
5960 interface PowerSaveBlocker {
5961
5962 // Docs: https://electronjs.org/docs/api/power-save-blocker
5963
5964 /**
5965 * Whether the corresponding `powerSaveBlocker` has started.
5966 */
5967 isStarted(id: number): boolean;
5968 /**
5969 * The blocker ID that is assigned to this power blocker.
5970 *
5971 * Starts preventing the system from entering lower-power mode. Returns an integer
5972 * identifying the power save blocker.
5973 *
5974 * **Note:** `prevent-display-sleep` has higher precedence over
5975 * `prevent-app-suspension`. Only the highest precedence type takes effect. In
5976 * other words, `prevent-display-sleep` always takes precedence over
5977 * `prevent-app-suspension`.
5978 *
5979 * For example, an API calling A requests for `prevent-app-suspension`, and another
5980 * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
5981 * used until B stops its request. After that, `prevent-app-suspension` is used.
5982 */
5983 start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
5984 /**
5985 * Stops the specified power save blocker.
5986 */
5987 stop(id: number): void;
5988 }
5989
5990 interface PrinterInfo {
5991
5992 // Docs: https://electronjs.org/docs/api/structures/printer-info
5993
5994 /**
5995 * a longer description of the printer's type.
5996 */
5997 description: string;
5998 /**
5999 * the name of the printer as shown in Print Preview.
6000 */
6001 displayName: string;
6002 /**
6003 * whether or not a given printer is set as the default printer on the OS.
6004 */
6005 isDefault: boolean;
6006 /**
6007 * the name of the printer as understood by the OS.
6008 */
6009 name: string;
6010 /**
6011 * an object containing a variable number of platform-specific printer information.
6012 */
6013 options: Options;
6014 /**
6015 * the current status of the printer.
6016 */
6017 status: number;
6018 }
6019
6020 interface ProcessMemoryInfo {
6021
6022 // Docs: https://electronjs.org/docs/api/structures/process-memory-info
6023
6024 /**
6025 * The amount of memory not shared by other processes, such as JS heap or HTML
6026 * content in Kilobytes.
6027 */
6028 private: number;
6029 /**
6030 * The amount of memory currently pinned to actual physical RAM in Kilobytes.
6031 *
6032 * @platform linux,win32
6033 */
6034 residentSet: number;
6035 /**
6036 * The amount of memory shared between processes, typically memory consumed by the
6037 * Electron code itself in Kilobytes.
6038 */
6039 shared: number;
6040 }
6041
6042 interface ProcessMetric {
6043
6044 // Docs: https://electronjs.org/docs/api/structures/process-metric
6045
6046 /**
6047 * CPU usage of the process.
6048 */
6049 cpu: CPUUsage;
6050 /**
6051 * Creation time for this process. The time is represented as number of
6052 * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
6053 * is useful to use both the `pid` and the `creationTime` to uniquely identify a
6054 * process.
6055 */
6056 creationTime: number;
6057 /**
6058 * One of the following values:
6059 *
6060 * @platform win32
6061 */
6062 integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
6063 /**
6064 * Memory information for the process.
6065 */
6066 memory: MemoryInfo;
6067 /**
6068 * The name of the process. i.e. for plugins it might be Flash. Examples for
6069 * utility: `Audio Service`, `Content Decryption Module Service`, `Network
6070 * Service`, `Video Capture`, etc.
6071 */
6072 name?: string;
6073 /**
6074 * Process id of the process.
6075 */
6076 pid: number;
6077 /**
6078 * Whether the process is sandboxed on OS level.
6079 *
6080 * @platform darwin,win32
6081 */
6082 sandboxed?: boolean;
6083 /**
6084 * Process type. One of the following values:
6085 */
6086 type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
6087 }
6088
6089 interface Product {
6090
6091 // Docs: https://electronjs.org/docs/api/structures/product
6092
6093 /**
6094 * The total size of the content, in bytes.
6095 */
6096 contentLengths: number[];
6097 /**
6098 * A string that identifies the version of the content.
6099 */
6100 contentVersion: string;
6101 /**
6102 * 3 character code presenting a product's currency based on the ISO 4217 standard.
6103 */
6104 currencyCode: string;
6105 /**
6106 * The locale formatted price of the product.
6107 */
6108 formattedPrice: string;
6109 /**
6110 * A Boolean value that indicates whether the App Store has downloadable content
6111 * for this product. `true` if at least one file has been associated with the
6112 * product.
6113 */
6114 isDownloadable: boolean;
6115 /**
6116 * A description of the product.
6117 */
6118 localizedDescription: string;
6119 /**
6120 * The name of the product.
6121 */
6122 localizedTitle: string;
6123 /**
6124 * The cost of the product in the local currency.
6125 */
6126 price: number;
6127 /**
6128 * The string that identifies the product to the Apple App Store.
6129 */
6130 productIdentifier: string;
6131 }
6132
6133 interface Protocol {
6134
6135 // Docs: https://electronjs.org/docs/api/protocol
6136
6137 /**
6138 * Whether the protocol was successfully intercepted
6139 *
6140 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
6141 * which sends a `Buffer` as a response.
6142 */
6143 interceptBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
6144 /**
6145 * Whether the protocol was successfully intercepted
6146 *
6147 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
6148 * which sends a file as a response.
6149 */
6150 interceptFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
6151 /**
6152 * Whether the protocol was successfully intercepted
6153 *
6154 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
6155 * which sends a new HTTP request as a response.
6156 */
6157 interceptHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
6158 /**
6159 * Whether the protocol was successfully intercepted
6160 *
6161 * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
6162 * protocol handler.
6163 */
6164 interceptStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
6165 /**
6166 * Whether the protocol was successfully intercepted
6167 *
6168 * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
6169 * which sends a `String` as a response.
6170 */
6171 interceptStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
6172 /**
6173 * Whether `scheme` is already intercepted.
6174 */
6175 isProtocolIntercepted(scheme: string): boolean;
6176 /**
6177 * Whether `scheme` is already registered.
6178 */
6179 isProtocolRegistered(scheme: string): boolean;
6180 /**
6181 * Whether the protocol was successfully registered
6182 *
6183 * Registers a protocol of `scheme` that will send a `Buffer` as a response.
6184 *
6185 * The usage is the same with `registerFileProtocol`, except that the `callback`
6186 * should be called with either a `Buffer` object or an object that has the `data`
6187 * property.
6188
6189Example:
6190 */
6191 registerBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
6192 /**
6193 * Whether the protocol was successfully registered
6194 *
6195 * Registers a protocol of `scheme` that will send a file as the response. The
6196 * `handler` will be called with `request` and `callback` where `request` is an
6197 * incoming request for the `scheme`.
6198 *
6199 * To handle the `request`, the `callback` should be called with either the file's
6200 * path or an object that has a `path` property, e.g. `callback(filePath)` or
6201 * `callback({ path: filePath })`. The `filePath` must be an absolute path.
6202 *
6203 * By default the `scheme` is treated like `http:`, which is parsed differently
6204 * from protocols that follow the "generic URI syntax" like `file:`.
6205 */
6206 registerFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
6207 /**
6208 * Whether the protocol was successfully registered
6209 *
6210 * Registers a protocol of `scheme` that will send an HTTP request as a response.
6211 *
6212 * The usage is the same with `registerFileProtocol`, except that the `callback`
6213 * should be called with an object that has the `url` property.
6214 */
6215 registerHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
6216 /**
6217 * **Note:** This method can only be used before the `ready` event of the `app`
6218 * module gets emitted and can be called only once.
6219 *
6220 * Registers the `scheme` as standard, secure, bypasses content security policy for
6221 * resources, allows registering ServiceWorker, supports fetch API, and streaming
6222 * video/audio. Specify a privilege with the value of `true` to enable the
6223 * capability.
6224 *
6225 * An example of registering a privileged scheme, that bypasses Content Security
6226 * Policy:
6227 *
6228 * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
6229 * `http` and `https` are standard schemes, while `file` is not.
6230 *
6231 * Registering a scheme as standard allows relative and absolute resources to be
6232 * resolved correctly when served. Otherwise the scheme will behave like the `file`
6233 * protocol, but without the ability to resolve relative URLs.
6234 *
6235 * For example when you load following page with custom protocol without
6236 * registering it as standard scheme, the image will not be loaded because
6237 * non-standard schemes can not recognize relative URLs:
6238 *
6239 * Registering a scheme as standard will allow access to files through the
6240 * FileSystem API. Otherwise the renderer will throw a security error for the
6241 * scheme.
6242 *
6243 * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
6244 * cookies) are disabled for non standard schemes. So in general if you want to
6245 * register a custom protocol to replace the `http` protocol, you have to register
6246 * it as a standard scheme.
6247 *
6248 * Protocols that use streams (http and stream protocols) should set `stream:
6249 * true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
6250 * their responses by default. The `stream` flag configures those elements to
6251 * correctly expect streaming responses.
6252 */
6253 registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
6254 /**
6255 * Whether the protocol was successfully registered
6256 *
6257 * Registers a protocol of `scheme` that will send a stream as a response.
6258 *
6259 * The usage is the same with `registerFileProtocol`, except that the `callback`
6260 * should be called with either a `ReadableStream` object or an object that has the
6261 * `data` property.
6262 *
6263 * Example:
6264 *
6265 * It is possible to pass any object that implements the readable stream API (emits
6266 * `data`/`end`/`error` events). For example, here's how a file could be returned:
6267 */
6268 registerStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
6269 /**
6270 * Whether the protocol was successfully registered
6271 *
6272 * Registers a protocol of `scheme` that will send a `String` as a response.
6273 *
6274 * The usage is the same with `registerFileProtocol`, except that the `callback`
6275 * should be called with either a `String` or an object that has the `data`
6276 * property.
6277 */
6278 registerStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
6279 /**
6280 * Whether the protocol was successfully unintercepted
6281 *
6282Remove the interceptor installed for `scheme` and restore its original handler.
6283 */
6284 uninterceptProtocol(scheme: string): boolean;
6285 /**
6286 * Whether the protocol was successfully unregistered
6287 *
6288Unregisters the custom protocol of `scheme`.
6289 */
6290 unregisterProtocol(scheme: string): boolean;
6291 }
6292
6293 interface ProtocolRequest {
6294
6295 // Docs: https://electronjs.org/docs/api/structures/protocol-request
6296
6297 headers: Record<string, string>;
6298 method: string;
6299 referrer: string;
6300 uploadData?: UploadData[];
6301 url: string;
6302 }
6303
6304 interface ProtocolResponse {
6305
6306 // Docs: https://electronjs.org/docs/api/structures/protocol-response
6307
6308 /**
6309 * The charset of response body, default is `"utf-8"`.
6310 */
6311 charset?: string;
6312 /**
6313 * The response body. When returning stream as response, this is a Node.js readable
6314 * stream representing the response body. When returning `Buffer` as response, this
6315 * is a `Buffer`. When returning `String` as response, this is a `String`. This is
6316 * ignored for other types of responses.
6317 */
6318 data?: (Buffer) | (string) | (NodeJS.ReadableStream);
6319 /**
6320 * When assigned, the `request` will fail with the `error` number . For the
6321 * available error numbers you can use, please see the net error list.
6322 */
6323 error?: number;
6324 /**
6325 * An object containing the response headers. The keys must be String, and values
6326 * must be either String or Array of String.
6327 */
6328 headers?: Record<string, (string) | (string[])>;
6329 /**
6330 * The HTTP `method`. This is only used for file and URL responses.
6331 */
6332 method?: string;
6333 /**
6334 * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
6335 * would implicitly set the `content-type` header in response, but if
6336 * `content-type` is already set in `headers`, the `mimeType` would be ignored.
6337 */
6338 mimeType?: string;
6339 /**
6340 * Path to the file which would be sent as response body. This is only used for
6341 * file responses.
6342 */
6343 path?: string;
6344 /**
6345 * The `referrer` URL. This is only used for file and URL responses.
6346 */
6347 referrer?: string;
6348 /**
6349 * The session used for requesting URL, by default the HTTP request will reuse the
6350 * current session. Setting `session` to `null` would use a random independent
6351 * session. This is only used for URL responses.
6352 */
6353 session?: Session;
6354 /**
6355 * The HTTP response code, default is 200.
6356 */
6357 statusCode?: number;
6358 /**
6359 * The data used as upload data. This is only used for URL responses when `method`
6360 * is `"POST"`.
6361 */
6362 uploadData?: ProtocolResponseUploadData;
6363 /**
6364 * Download the `url` and pipe the result as response body. This is only used for
6365 * URL responses.
6366 */
6367 url?: string;
6368 }
6369
6370 interface ProtocolResponseUploadData {
6371
6372 // Docs: https://electronjs.org/docs/api/structures/protocol-response-upload-data
6373
6374 /**
6375 * MIME type of the content.
6376 */
6377 contentType: string;
6378 /**
6379 * Content to be sent.
6380 */
6381 data: (string) | (Buffer);
6382 }
6383
6384 interface Rectangle {
6385
6386 // Docs: https://electronjs.org/docs/api/structures/rectangle
6387
6388 /**
6389 * The height of the rectangle (must be an integer).
6390 */
6391 height: number;
6392 /**
6393 * The width of the rectangle (must be an integer).
6394 */
6395 width: number;
6396 /**
6397 * The x coordinate of the origin of the rectangle (must be an integer).
6398 */
6399 x: number;
6400 /**
6401 * The y coordinate of the origin of the rectangle (must be an integer).
6402 */
6403 y: number;
6404 }
6405
6406 interface Referrer {
6407
6408 // Docs: https://electronjs.org/docs/api/structures/referrer
6409
6410 /**
6411 * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
6412 * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
6413 * See the Referrer-Policy spec for more details on the meaning of these values.
6414 */
6415 policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
6416 /**
6417 * HTTP Referrer URL.
6418 */
6419 url: string;
6420 }
6421
6422 interface Remote extends RemoteMainInterface {
6423
6424 // Docs: https://electronjs.org/docs/api/remote
6425
6426 /**
6427 * The web contents of this web page.
6428 */
6429 getCurrentWebContents(): WebContents;
6430 /**
6431 * The window to which this web page belongs.
6432 *
6433 * **Note:** Do not use `removeAllListeners` on `BrowserWindow`. Use of this can
6434 * remove all `blur` listeners, disable click events on touch bar buttons, and
6435 * other unintended consequences.
6436 */
6437 getCurrentWindow(): BrowserWindow;
6438 /**
6439 * The global variable of `name` (e.g. `global[name]`) in the main process.
6440 */
6441 getGlobal(name: string): any;
6442 /**
6443 * The object returned by `require(module)` in the main process. Modules specified
6444 * by their relative path will resolve relative to the entrypoint of the main
6445 * process.
6446
6447e.g.
6448 */
6449 require(module: string): any;
6450 /**
6451 * A `NodeJS.Process` object. The `process` object in the main process. This is
6452 * the same as `remote.getGlobal('process')` but is cached.
6453 *
6454 */
6455 readonly process: NodeJS.Process;
6456 }
6457
6458 interface Screen extends NodeJS.EventEmitter {
6459
6460 // Docs: https://electronjs.org/docs/api/screen
6461
6462 /**
6463 * Emitted when `newDisplay` has been added.
6464 */
6465 on(event: 'display-added', listener: (event: Event,
6466 newDisplay: Display) => void): this;
6467 once(event: 'display-added', listener: (event: Event,
6468 newDisplay: Display) => void): this;
6469 addListener(event: 'display-added', listener: (event: Event,
6470 newDisplay: Display) => void): this;
6471 removeListener(event: 'display-added', listener: (event: Event,
6472 newDisplay: Display) => void): this;
6473 /**
6474 * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
6475 * an array of strings that describe the changes. Possible changes are `bounds`,
6476 * `workArea`, `scaleFactor` and `rotation`.
6477 */
6478 on(event: 'display-metrics-changed', listener: (event: Event,
6479 display: Display,
6480 changedMetrics: string[]) => void): this;
6481 once(event: 'display-metrics-changed', listener: (event: Event,
6482 display: Display,
6483 changedMetrics: string[]) => void): this;
6484 addListener(event: 'display-metrics-changed', listener: (event: Event,
6485 display: Display,
6486 changedMetrics: string[]) => void): this;
6487 removeListener(event: 'display-metrics-changed', listener: (event: Event,
6488 display: Display,
6489 changedMetrics: string[]) => void): this;
6490 /**
6491 * Emitted when `oldDisplay` has been removed.
6492 */
6493 on(event: 'display-removed', listener: (event: Event,
6494 oldDisplay: Display) => void): this;
6495 once(event: 'display-removed', listener: (event: Event,
6496 oldDisplay: Display) => void): this;
6497 addListener(event: 'display-removed', listener: (event: Event,
6498 oldDisplay: Display) => void): this;
6499 removeListener(event: 'display-removed', listener: (event: Event,
6500 oldDisplay: Display) => void): this;
6501 /**
6502 * Converts a screen DIP point to a screen physical point. The DPI scale is
6503 * performed relative to the display containing the DIP point.
6504 *
6505 * @platform win32
6506 */
6507 dipToScreenPoint(point: Point): Point;
6508 /**
6509 * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
6510 * relative to the display nearest to `window`. If `window` is null, scaling will
6511 * be performed to the display nearest to `rect`.
6512 *
6513 * @platform win32
6514 */
6515 dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
6516 /**
6517 * An array of displays that are currently available.
6518 */
6519 getAllDisplays(): Display[];
6520 /**
6521 * The current absolute position of the mouse pointer.
6522 */
6523 getCursorScreenPoint(): Point;
6524 /**
6525 * The display that most closely intersects the provided bounds.
6526 */
6527 getDisplayMatching(rect: Rectangle): Display;
6528 /**
6529 * The display nearest the specified point.
6530 */
6531 getDisplayNearestPoint(point: Point): Display;
6532 /**
6533 * The primary display.
6534 */
6535 getPrimaryDisplay(): Display;
6536 /**
6537 * Converts a screen physical point to a screen DIP point. The DPI scale is
6538 * performed relative to the display containing the physical point.
6539 *
6540 * @platform win32
6541 */
6542 screenToDipPoint(point: Point): Point;
6543 /**
6544 * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
6545 * relative to the display nearest to `window`. If `window` is null, scaling will
6546 * be performed to the display nearest to `rect`.
6547 *
6548 * @platform win32
6549 */
6550 screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
6551 }
6552
6553 interface ScrubberItem {
6554
6555 // Docs: https://electronjs.org/docs/api/structures/scrubber-item
6556
6557 /**
6558 * The image to appear in this item.
6559 */
6560 icon?: NativeImage;
6561 /**
6562 * The text to appear in this item.
6563 */
6564 label?: string;
6565 }
6566
6567 interface SegmentedControlSegment {
6568
6569 // Docs: https://electronjs.org/docs/api/structures/segmented-control-segment
6570
6571 /**
6572 * Whether this segment is selectable. Default: true.
6573 */
6574 enabled?: boolean;
6575 /**
6576 * The image to appear in this segment.
6577 */
6578 icon?: NativeImage;
6579 /**
6580 * The text to appear in this segment.
6581 */
6582 label?: string;
6583 }
6584
6585 interface ServiceWorkerInfo {
6586
6587 // Docs: https://electronjs.org/docs/api/structures/service-worker-info
6588
6589 /**
6590 * The virtual ID of the process that this service worker is running in. This is
6591 * not an OS level PID. This aligns with the ID set used for
6592 * `webContents.getProcessId()`.
6593 */
6594 renderProcessId: number;
6595 /**
6596 * The base URL that this service worker is active for.
6597 */
6598 scope: string;
6599 /**
6600 * The full URL to the script that this service worker runs
6601 */
6602 scriptUrl: string;
6603 }
6604
6605 class ServiceWorkers extends NodeEventEmitter {
6606
6607 // Docs: https://electronjs.org/docs/api/service-workers
6608
6609 /**
6610 * Emitted when a service worker logs something to the console.
6611 */
6612 on(event: 'console-message', listener: (event: Event,
6613 /**
6614 * Information about the console message
6615 */
6616 messageDetails: MessageDetails) => void): this;
6617 once(event: 'console-message', listener: (event: Event,
6618 /**
6619 * Information about the console message
6620 */
6621 messageDetails: MessageDetails) => void): this;
6622 addListener(event: 'console-message', listener: (event: Event,
6623 /**
6624 * Information about the console message
6625 */
6626 messageDetails: MessageDetails) => void): this;
6627 removeListener(event: 'console-message', listener: (event: Event,
6628 /**
6629 * Information about the console message
6630 */
6631 messageDetails: MessageDetails) => void): this;
6632 /**
6633 * A ServiceWorkerInfo object where the keys are the service worker version ID and
6634 * the values are the information about that service worker.
6635 */
6636 getAllRunning(): Record<number, ServiceWorkerInfo>;
6637 /**
6638 * Information about this service worker
6639 *
6640 * If the service worker does not exist or is not running this method will throw an
6641 * exception.
6642 */
6643 getFromVersionID(versionId: number): ServiceWorkerInfo;
6644 }
6645
6646 class Session extends NodeEventEmitter {
6647
6648 // Docs: https://electronjs.org/docs/api/session
6649
6650 /**
6651 * A session instance from `partition` string. When there is an existing `Session`
6652 * with the same `partition`, it will be returned; otherwise a new `Session`
6653 * instance will be created with `options`.
6654 *
6655 * If `partition` starts with `persist:`, the page will use a persistent session
6656 * available to all pages in the app with the same `partition`. if there is no
6657 * `persist:` prefix, the page will use an in-memory session. If the `partition` is
6658 * empty then default session of the app will be returned.
6659 *
6660 * To create a `Session` with `options`, you have to ensure the `Session` with the
6661 * `partition` has never been used before. There is no way to change the `options`
6662 * of an existing `Session` object.
6663 */
6664 static fromPartition(partition: string, options?: FromPartitionOptions): Session;
6665 /**
6666 * A `Session` object, the default session object of the app.
6667 */
6668 static defaultSession: Session;
6669 /**
6670 * Emitted when a render process requests preconnection to a URL, generally due to
6671 * a resource hint.
6672 */
6673 on(event: 'preconnect', listener: (event: Event,
6674 /**
6675 * The URL being requested for preconnection by the renderer.
6676 */
6677 preconnectUrl: string,
6678 /**
6679 * True if the renderer is requesting that the connection include credentials (see
6680 * the spec for more details.)
6681 */
6682 allowCredentials: boolean) => void): this;
6683 once(event: 'preconnect', listener: (event: Event,
6684 /**
6685 * The URL being requested for preconnection by the renderer.
6686 */
6687 preconnectUrl: string,
6688 /**
6689 * True if the renderer is requesting that the connection include credentials (see
6690 * the spec for more details.)
6691 */
6692 allowCredentials: boolean) => void): this;
6693 addListener(event: 'preconnect', listener: (event: Event,
6694 /**
6695 * The URL being requested for preconnection by the renderer.
6696 */
6697 preconnectUrl: string,
6698 /**
6699 * True if the renderer is requesting that the connection include credentials (see
6700 * the spec for more details.)
6701 */
6702 allowCredentials: boolean) => void): this;
6703 removeListener(event: 'preconnect', listener: (event: Event,
6704 /**
6705 * The URL being requested for preconnection by the renderer.
6706 */
6707 preconnectUrl: string,
6708 /**
6709 * True if the renderer is requesting that the connection include credentials (see
6710 * the spec for more details.)
6711 */
6712 allowCredentials: boolean) => void): this;
6713 /**
6714 * Emitted when a hunspell dictionary file starts downloading
6715 */
6716 on(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
6717 /**
6718 * The language code of the dictionary file
6719 */
6720 languageCode: string) => void): this;
6721 once(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
6722 /**
6723 * The language code of the dictionary file
6724 */
6725 languageCode: string) => void): this;
6726 addListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
6727 /**
6728 * The language code of the dictionary file
6729 */
6730 languageCode: string) => void): this;
6731 removeListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
6732 /**
6733 * The language code of the dictionary file
6734 */
6735 languageCode: string) => void): this;
6736 /**
6737 * Emitted when a hunspell dictionary file download fails. For details on the
6738 * failure you should collect a netlog and inspect the download request.
6739 */
6740 on(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
6741 /**
6742 * The language code of the dictionary file
6743 */
6744 languageCode: string) => void): this;
6745 once(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
6746 /**
6747 * The language code of the dictionary file
6748 */
6749 languageCode: string) => void): this;
6750 addListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
6751 /**
6752 * The language code of the dictionary file
6753 */
6754 languageCode: string) => void): this;
6755 removeListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
6756 /**
6757 * The language code of the dictionary file
6758 */
6759 languageCode: string) => void): this;
6760 /**
6761 * Emitted when a hunspell dictionary file has been successfully downloaded
6762 */
6763 on(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
6764 /**
6765 * The language code of the dictionary file
6766 */
6767 languageCode: string) => void): this;
6768 once(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
6769 /**
6770 * The language code of the dictionary file
6771 */
6772 languageCode: string) => void): this;
6773 addListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
6774 /**
6775 * The language code of the dictionary file
6776 */
6777 languageCode: string) => void): this;
6778 removeListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
6779 /**
6780 * The language code of the dictionary file
6781 */
6782 languageCode: string) => void): this;
6783 /**
6784 * Emitted when a hunspell dictionary file has been successfully initialized. This
6785 * occurs after the file has been downloaded.
6786 */
6787 on(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
6788 /**
6789 * The language code of the dictionary file
6790 */
6791 languageCode: string) => void): this;
6792 once(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
6793 /**
6794 * The language code of the dictionary file
6795 */
6796 languageCode: string) => void): this;
6797 addListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
6798 /**
6799 * The language code of the dictionary file
6800 */
6801 languageCode: string) => void): this;
6802 removeListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
6803 /**
6804 * The language code of the dictionary file
6805 */
6806 languageCode: string) => void): this;
6807 /**
6808 * Emitted when Electron is about to download `item` in `webContents`.
6809 *
6810 * Calling `event.preventDefault()` will cancel the download and `item` will not be
6811 * available from next tick of the process.
6812 */
6813 on(event: 'will-download', listener: (event: Event,
6814 item: DownloadItem,
6815 webContents: WebContents) => void): this;
6816 once(event: 'will-download', listener: (event: Event,
6817 item: DownloadItem,
6818 webContents: WebContents) => void): this;
6819 addListener(event: 'will-download', listener: (event: Event,
6820 item: DownloadItem,
6821 webContents: WebContents) => void): this;
6822 removeListener(event: 'will-download', listener: (event: Event,
6823 item: DownloadItem,
6824 webContents: WebContents) => void): this;
6825 /**
6826 * Whether the word was successfully written to the custom dictionary. This API
6827 * will not work on non-persistent (in-memory) sessions.
6828 *
6829 * **Note:** On macOS and Windows 10 this word will be written to the OS custom
6830 * dictionary as well
6831 */
6832 addWordToSpellCheckerDictionary(word: string): boolean;
6833 /**
6834 * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
6835 * authentication.
6836 */
6837 allowNTLMCredentialsForDomains(domains: string): void;
6838 /**
6839 * resolves when the session’s HTTP authentication cache has been cleared.
6840 */
6841 clearAuthCache(): Promise<void>;
6842 /**
6843 * resolves when the cache clear operation is complete.
6844 *
6845Clears the session’s HTTP cache.
6846 */
6847 clearCache(): Promise<void>;
6848 /**
6849 * Resolves when the operation is complete.
6850
6851Clears the host resolver cache.
6852 */
6853 clearHostResolverCache(): Promise<void>;
6854 /**
6855 * resolves when the storage data has been cleared.
6856 */
6857 clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
6858 /**
6859 * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
6860 * The API will generate a DownloadItem that can be accessed with the will-download
6861 * event. The DownloadItem will not have any `WebContents` associated with it and
6862 * the initial state will be `interrupted`. The download will start only when the
6863 * `resume` API is called on the DownloadItem.
6864 */
6865 createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
6866 /**
6867 * Disables any network emulation already active for the `session`. Resets to the
6868 * original network configuration.
6869 */
6870 disableNetworkEmulation(): void;
6871 /**
6872 * Initiates a download of the resource at `url`. The API will generate a
6873 * DownloadItem that can be accessed with the will-download event.
6874 *
6875 * **Note:** This does not perform any security checks that relate to a page's
6876 * origin, unlike `webContents.downloadURL`.
6877 */
6878 downloadURL(url: string): void;
6879 /**
6880 * Emulates network with the given configuration for the `session`.
6881 */
6882 enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
6883 /**
6884 * Writes any unwritten DOMStorage data to disk.
6885 */
6886 flushStorageData(): void;
6887 /**
6888 * A list of all loaded extensions.
6889 *
6890 * **Note:** This API cannot be called before the `ready` event of the `app` module
6891 * is emitted.
6892 */
6893 getAllExtensions(): Extension[];
6894 /**
6895 * resolves with blob data.
6896 */
6897 getBlobData(identifier: string): Promise<Buffer>;
6898 /**
6899 * the session's current cache size, in bytes.
6900 */
6901 getCacheSize(): Promise<number>;
6902 /**
6903 * | `null` - The loaded extension with the given ID.
6904 *
6905 * **Note:** This API cannot be called before the `ready` event of the `app` module
6906 * is emitted.
6907 */
6908 getExtension(extensionId: string): Extension;
6909 /**
6910 * an array of paths to preload scripts that have been registered.
6911 */
6912 getPreloads(): string[];
6913 /**
6914 * An array of language codes the spellchecker is enabled for. If this list is
6915 * empty the spellchecker will fallback to using `en-US`. By default on launch if
6916 * this setting is an empty list Electron will try to populate this setting with
6917 * the current OS locale. This setting is persisted across restarts.
6918 *
6919 * **Note:** On macOS the OS spellchecker is used and has its own list of
6920 * languages. This API is a no-op on macOS.
6921 */
6922 getSpellCheckerLanguages(): string[];
6923 /**
6924 * The user agent for this session.
6925 */
6926 getUserAgent(): string;
6927 /**
6928 * Whether or not this session is a persistent one. The default `webContents`
6929 * session of a `BrowserWindow` is persistent. When creating a session from a
6930 * partition, session prefixed with `persist:` will be persistent, while others
6931 * will be temporary.
6932 */
6933 isPersistent(): boolean;
6934 /**
6935 * An array of all words in app's custom dictionary. Resolves when the full
6936 * dictionary is loaded from disk.
6937 */
6938 listWordsInSpellCheckerDictionary(): Promise<string[]>;
6939 /**
6940 * resolves when the extension is loaded.
6941 *
6942 * This method will raise an exception if the extension could not be loaded. If
6943 * there are warnings when installing the extension (e.g. if the extension requests
6944 * an API that Electron does not support) then they will be logged to the console.
6945 *
6946 * Note that Electron does not support the full range of Chrome extensions APIs.
6947 * See Supported Extensions APIs for more details on what is supported.
6948 *
6949 * Note that in previous versions of Electron, extensions that were loaded would be
6950 * remembered for future runs of the application. This is no longer the case:
6951 * `loadExtension` must be called on every boot of your app if you want the
6952 * extension to be loaded.
6953 *
6954 * This API does not support loading packed (.crx) extensions.
6955 *
6956 * **Note:** This API cannot be called before the `ready` event of the `app` module
6957 * is emitted.
6958 *
6959 * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
6960 * supported and will throw an error.
6961 */
6962 loadExtension(path: string, options?: LoadExtensionOptions): Promise<Electron.Extension>;
6963 /**
6964 * Preconnects the given number of sockets to an origin.
6965 */
6966 preconnect(options: PreconnectOptions): void;
6967 /**
6968 * Unloads an extension.
6969 *
6970 * **Note:** This API cannot be called before the `ready` event of the `app` module
6971 * is emitted.
6972 */
6973 removeExtension(extensionId: string): void;
6974 /**
6975 * Whether the word was successfully removed from the custom dictionary. This API
6976 * will not work on non-persistent (in-memory) sessions.
6977 *
6978 * **Note:** On macOS and Windows 10 this word will be removed from the OS custom
6979 * dictionary as well
6980 */
6981 removeWordFromSpellCheckerDictionary(word: string): boolean;
6982 /**
6983 * Resolves with the proxy information for `url`.
6984 */
6985 resolveProxy(url: string): Promise<string>;
6986 /**
6987 * Sets the certificate verify proc for `session`, the `proc` will be called with
6988 * `proc(request, callback)` whenever a server certificate verification is
6989 * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
6990 * rejects it.
6991 *
6992 * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
6993 * verify proc.
6994 */
6995 setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
6996 /**
6997 * Sets download saving directory. By default, the download directory will be the
6998 * `Downloads` under the respective app folder.
6999 */
7000 setDownloadPath(path: string): void;
7001 /**
7002 * Sets the handler which can be used to respond to permission checks for the
7003 * `session`. Returning `true` will allow the permission and `false` will reject
7004 * it. To clear the handler, call `setPermissionCheckHandler(null)`.
7005 */
7006 setPermissionCheckHandler(handler: ((webContents: WebContents, permission: string, requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void;
7007 /**
7008 * Sets the handler which can be used to respond to permission requests for the
7009 * `session`. Calling `callback(true)` will allow the permission and
7010 * `callback(false)` will reject it. To clear the handler, call
7011 * `setPermissionRequestHandler(null)`.
7012 */
7013 setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'media' | 'mediaKeySystem' | 'geolocation' | 'notifications' | 'midi' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal', callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void;
7014 /**
7015 * Adds scripts that will be executed on ALL web contents that are associated with
7016 * this session just before normal `preload` scripts run.
7017 */
7018 setPreloads(preloads: string[]): void;
7019 /**
7020 * Resolves when the proxy setting process is complete.
7021 *
7022 * Sets the proxy settings.
7023 *
7024 * When `pacScript` and `proxyRules` are provided together, the `proxyRules` option
7025 * is ignored and `pacScript` configuration is applied.
7026 *
7027 * The `proxyRules` has to follow the rules below:
7028 *
7029 * For example:
7030 *
7031 * * `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
7032 * HTTP proxy `foopy2:80` for `ftp://` URLs.
7033 * * `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
7034 * * `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
7035 * over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
7036 * * `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
7037 * * `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
7038 * over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
7039 * * `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
7040 * proxy if `foopy` is unavailable.
7041 * * `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
7042 * `socks4://foopy2` for all other URLs.
7043 *
7044 * The `proxyBypassRules` is a comma separated list of rules described below:
7045 *
7046 * * `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
7047 *
7048 * Match all hostnames that match the pattern HOSTNAME_PATTERN.
7049 *
7050 * Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
7051 * "https://x.*.y.com:99"
7052 * * `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
7053 *
7054 * Match a particular domain suffix.
7055 *
7056 * Examples: ".google.com", ".com", "http://.google.com"
7057 * * `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
7058 *
7059 * Match URLs which are IP address literals.
7060 *
7061 * Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
7062 * * `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
7063 *
7064 * Match any URL that is to an IP literal that falls between the given range. IP
7065 * range is specified using CIDR notation.
7066 *
7067 * Examples: "192.168.1.1/16", "fefe:13::abc/33".
7068 * * `<local>`
7069 *
7070 * Match local addresses. The meaning of `<local>` is whether the host matches one
7071 * of: "127.0.0.1", "::1", "localhost".
7072 */
7073 setProxy(config: Config): Promise<void>;
7074 /**
7075 * By default Electron will download hunspell dictionaries from the Chromium CDN.
7076 * If you want to override this behavior you can use this API to point the
7077 * dictionary downloader at your own hosted version of the hunspell dictionaries.
7078 * We publish a `hunspell_dictionaries.zip` file with each release which contains
7079 * the files you need to host here, the file server must be **case insensitive**
7080 * you must upload each file twice, once with the case it has in the ZIP file and
7081 * once with the filename as all lower case.
7082 *
7083 * If the files present in `hunspell_dictionaries.zip` are available at
7084 * `https://example.com/dictionaries/language-code.bdic` then you should call this
7085 * api with
7086 * `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`.
7087 * Please note the trailing slash. The URL to the dictionaries is formed as
7088 * `${url}${filename}`.
7089 *
7090 * **Note:** On macOS the OS spellchecker is used and therefore we do not download
7091 * any dictionary files. This API is a no-op on macOS.
7092 */
7093 setSpellCheckerDictionaryDownloadURL(url: string): void;
7094 /**
7095 * The built in spellchecker does not automatically detect what language a user is
7096 * typing in. In order for the spell checker to correctly check their words you
7097 * must call this API with an array of language codes. You can get the list of
7098 * supported language codes with the `ses.availableSpellCheckerLanguages` property.
7099 *
7100 * **Note:** On macOS the OS spellchecker is used and will detect your language
7101 * automatically. This API is a no-op on macOS.
7102 */
7103 setSpellCheckerLanguages(languages: string[]): void;
7104 /**
7105 * Overrides the `userAgent` and `acceptLanguages` for this session.
7106 *
7107 * The `acceptLanguages` must a comma separated ordered list of language codes, for
7108 * example `"en-US,fr,de,ko,zh-CN,ja"`.
7109 *
7110 * This doesn't affect existing `WebContents`, and each `WebContents` can use
7111 * `webContents.setUserAgent` to override the session-wide user agent.
7112 */
7113 setUserAgent(userAgent: string, acceptLanguages?: string): void;
7114 readonly availableSpellCheckerLanguages: string[];
7115 readonly cookies: Cookies;
7116 readonly netLog: NetLog;
7117 readonly protocol: Protocol;
7118 readonly serviceWorkers: ServiceWorkers;
7119 readonly webRequest: WebRequest;
7120 }
7121
7122 interface SharedWorkerInfo {
7123
7124 // Docs: https://electronjs.org/docs/api/structures/shared-worker-info
7125
7126 /**
7127 * The unique id of the shared worker.
7128 */
7129 id: string;
7130 /**
7131 * The url of the shared worker.
7132 */
7133 url: string;
7134 }
7135
7136 interface Shell {
7137
7138 // Docs: https://electronjs.org/docs/api/shell
7139
7140 /**
7141 * Play the beep sound.
7142 */
7143 beep(): void;
7144 /**
7145 * Whether the item was successfully moved to the trash or otherwise deleted.
7146 *
7147Move the given file to trash and returns a boolean status for the operation.
7148 */
7149 moveItemToTrash(fullPath: string, deleteOnFail?: boolean): boolean;
7150 /**
7151 * Open the given external protocol URL in the desktop's default manner. (For
7152 * example, mailto: URLs in the user's default mail agent).
7153 */
7154 openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
7155 /**
7156 * Resolves with a string containing the error message corresponding to the failure
7157 * if a failure occurred, otherwise "".
7158 *
7159Open the given file in the desktop's default manner.
7160 */
7161 openPath(path: string): Promise<string>;
7162 /**
7163 * Resolves the shortcut link at `shortcutPath`.
7164 *
7165An exception will be thrown when any error happens.
7166 *
7167 * @platform win32
7168 */
7169 readShortcutLink(shortcutPath: string): ShortcutDetails;
7170 /**
7171 * Show the given file in a file manager. If possible, select the file.
7172 */
7173 showItemInFolder(fullPath: string): void;
7174 /**
7175 * Whether the shortcut was created successfully.
7176 *
7177Creates or updates a shortcut link at `shortcutPath`.
7178 *
7179 * @platform win32
7180 */
7181 writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
7182 /**
7183 * Whether the shortcut was created successfully.
7184 *
7185Creates or updates a shortcut link at `shortcutPath`.
7186 *
7187 * @platform win32
7188 */
7189 writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
7190 }
7191
7192 interface ShortcutDetails {
7193
7194 // Docs: https://electronjs.org/docs/api/structures/shortcut-details
7195
7196 /**
7197 * The Application User Model ID. Default is empty.
7198 */
7199 appUserModelId?: string;
7200 /**
7201 * The arguments to be applied to `target` when launching from this shortcut.
7202 * Default is empty.
7203 */
7204 args?: string;
7205 /**
7206 * The working directory. Default is empty.
7207 */
7208 cwd?: string;
7209 /**
7210 * The description of the shortcut. Default is empty.
7211 */
7212 description?: string;
7213 /**
7214 * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
7215 * together. Default is empty, which uses the target's icon.
7216 */
7217 icon?: string;
7218 /**
7219 * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
7220 */
7221 iconIndex?: number;
7222 /**
7223 * The target to launch from this shortcut.
7224 */
7225 target: string;
7226 }
7227
7228 interface Size {
7229
7230 // Docs: https://electronjs.org/docs/api/structures/size
7231
7232 height: number;
7233 width: number;
7234 }
7235
7236 interface SystemPreferences extends NodeJS.EventEmitter {
7237
7238 // Docs: https://electronjs.org/docs/api/system-preferences
7239
7240 on(event: 'accent-color-changed', listener: (event: Event,
7241 /**
7242 * The new RGBA color the user assigned to be their system accent color.
7243 */
7244 newColor: string) => void): this;
7245 once(event: 'accent-color-changed', listener: (event: Event,
7246 /**
7247 * The new RGBA color the user assigned to be their system accent color.
7248 */
7249 newColor: string) => void): this;
7250 addListener(event: 'accent-color-changed', listener: (event: Event,
7251 /**
7252 * The new RGBA color the user assigned to be their system accent color.
7253 */
7254 newColor: string) => void): this;
7255 removeListener(event: 'accent-color-changed', listener: (event: Event,
7256 /**
7257 * The new RGBA color the user assigned to be their system accent color.
7258 */
7259 newColor: string) => void): this;
7260 on(event: 'color-changed', listener: (event: Event) => void): this;
7261 once(event: 'color-changed', listener: (event: Event) => void): this;
7262 addListener(event: 'color-changed', listener: (event: Event) => void): this;
7263 removeListener(event: 'color-changed', listener: (event: Event) => void): this;
7264 /**
7265 * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
7266 *
7267 * @deprecated
7268 * @platform win32
7269 */
7270 on(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
7271 /**
7272 * `true` if a high contrast theme is being used, `false` otherwise.
7273 */
7274 highContrastColorScheme: boolean) => void): this;
7275 once(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
7276 /**
7277 * `true` if a high contrast theme is being used, `false` otherwise.
7278 */
7279 highContrastColorScheme: boolean) => void): this;
7280 addListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
7281 /**
7282 * `true` if a high contrast theme is being used, `false` otherwise.
7283 */
7284 highContrastColorScheme: boolean) => void): this;
7285 removeListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
7286 /**
7287 * `true` if a high contrast theme is being used, `false` otherwise.
7288 */
7289 highContrastColorScheme: boolean) => void): this;
7290 /**
7291 * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
7292 *
7293 * @deprecated
7294 * @platform win32
7295 */
7296 on(event: 'inverted-color-scheme-changed', listener: (event: Event,
7297 /**
7298 * `true` if an inverted color scheme (a high contrast color scheme with light text
7299 * and dark backgrounds) is being used, `false` otherwise.
7300 */
7301 invertedColorScheme: boolean) => void): this;
7302 once(event: 'inverted-color-scheme-changed', listener: (event: Event,
7303 /**
7304 * `true` if an inverted color scheme (a high contrast color scheme with light text
7305 * and dark backgrounds) is being used, `false` otherwise.
7306 */
7307 invertedColorScheme: boolean) => void): this;
7308 addListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
7309 /**
7310 * `true` if an inverted color scheme (a high contrast color scheme with light text
7311 * and dark backgrounds) is being used, `false` otherwise.
7312 */
7313 invertedColorScheme: boolean) => void): this;
7314 removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
7315 /**
7316 * `true` if an inverted color scheme (a high contrast color scheme with light text
7317 * and dark backgrounds) is being used, `false` otherwise.
7318 */
7319 invertedColorScheme: boolean) => void): this;
7320 /**
7321 * A promise that resolves with `true` if consent was granted and `false` if it was
7322 * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
7323 * access request was denied and later is changed through the System Preferences
7324 * pane, a restart of the app will be required for the new permissions to take
7325 * effect. If access has already been requested and denied, it _must_ be changed
7326 * through the preference pane; an alert will not pop up and the promise will
7327 * resolve with the existing access status.
7328 *
7329 * **Important:** In order to properly leverage this API, you must set the
7330 * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
7331 * app's `Info.plist` file. The values for these keys will be used to populate the
7332 * permission dialogs so that the user will be properly informed as to the purpose
7333 * of the permission request. See Electron Application Distribution for more
7334 * information about how to set these in the context of Electron.
7335 *
7336 * This user consent was not required until macOS 10.14 Mojave, so this method will
7337 * always return `true` if your system is running 10.13 High Sierra or lower.
7338 *
7339 * @platform darwin
7340 */
7341 askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
7342 /**
7343 * whether or not this device has the ability to use Touch ID.
7344 *
7345 * **NOTE:** This API will return `false` on macOS systems older than Sierra
7346 * 10.12.2.
7347 *
7348 * @platform darwin
7349 */
7350 canPromptTouchID(): boolean;
7351 /**
7352 * The users current system wide accent color preference in RGBA hexadecimal form.
7353 *
7354This API is only available on macOS 10.14 Mojave or newer.
7355 *
7356 * @platform win32,darwin
7357 */
7358 getAccentColor(): string;
7359 /**
7360 * * `shouldRenderRichAnimation` Boolean - Returns true if rich animations should
7361 * be rendered. Looks at session type (e.g. remote desktop) and accessibility
7362 * settings to give guidance for heavy animations.
7363 * * `scrollAnimationsEnabledBySystem` Boolean - Determines on a per-platform basis
7364 * whether scroll animations (e.g. produced by home/end key) should be enabled.
7365 * * `prefersReducedMotion` Boolean - Determines whether the user desires reduced
7366 * motion based on platform APIs.
7367 *
7368Returns an object with system animation settings.
7369 */
7370 getAnimationSettings(): AnimationSettings;
7371 /**
7372 * | `null` - Can be `dark`, `light` or `unknown`.
7373 *
7374 * Gets the macOS appearance setting that you have declared you want for your
7375 * application, maps to NSApplication.appearance. You can use the
7376 * `setAppLevelAppearance` API to set this value.
7377 *
7378 * @deprecated
7379 * @platform darwin
7380 */
7381 getAppLevelAppearance(): ('dark' | 'light' | 'unknown');
7382 /**
7383 * The system color setting in RGB hexadecimal form (`#ABCDEF`). See the Windows
7384 * docs and the macOS docs for more details.
7385 *
7386 * The following colors are only available on macOS 10.14: `find-highlight`,
7387 * `selected-content-background`, `separator`,
7388 * `unemphasized-selected-content-background`,
7389 * `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
7390 *
7391 * @platform win32,darwin
7392 */
7393 getColor(color: '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text' | 'alternate-selected-control-text' | 'control-background' | 'control' | 'control-text' | 'disabled-control-text' | 'find-highlight' | 'grid' | 'header-text' | 'highlight' | 'keyboard-focus-indicator' | 'label' | 'link' | 'placeholder-text' | 'quaternary-label' | 'scrubber-textured-background' | 'secondary-label' | 'selected-content-background' | 'selected-control' | 'selected-control-text' | 'selected-menu-item-text' | 'selected-text-background' | 'selected-text' | 'separator' | 'shadow' | 'tertiary-label' | 'text-background' | 'text' | 'under-page-background' | 'unemphasized-selected-content-background' | 'unemphasized-selected-text-background' | 'unemphasized-selected-text' | 'window-background' | 'window-frame-text'): string;
7394 /**
7395 * Can be `dark`, `light` or `unknown`.
7396 *
7397 * Gets the macOS appearance setting that is currently applied to your application,
7398 * maps to NSApplication.effectiveAppearance
7399 *
7400 * @platform darwin
7401 */
7402 getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
7403 /**
7404 * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
7405 *
7406 * This user consent was not required on macOS 10.13 High Sierra or lower so this
7407 * method will always return `granted`. macOS 10.14 Mojave or higher requires
7408 * consent for `microphone` and `camera` access. macOS 10.15 Catalina or higher
7409 * requires consent for `screen` access.
7410 *
7411 * Windows 10 has a global setting controlling `microphone` and `camera` access for
7412 * all win32 applications. It will always return `granted` for `screen` and for all
7413 * media types on older versions of Windows.
7414 *
7415 * @platform win32,darwin
7416 */
7417 getMediaAccessStatus(mediaType: 'microphone' | 'camera' | 'screen'): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
7418 /**
7419 * The standard system color formatted as `#RRGGBBAA`.
7420 *
7421 * Returns one of several standard system colors that automatically adapt to
7422 * vibrancy and changes in accessibility settings like 'Increase contrast' and
7423 * 'Reduce transparency'. See Apple Documentation for more details.
7424 *
7425 * @platform darwin
7426 */
7427 getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
7428 /**
7429 * The value of `key` in `NSUserDefaults`.
7430 *
7431 * Some popular `key` and `type`s are:
7432 *
7433 * * `AppleInterfaceStyle`: `string`
7434 * * `AppleAquaColorVariant`: `integer`
7435 * * `AppleHighlightColor`: `string`
7436 * * `AppleShowScrollBars`: `string`
7437 * * `NSNavRecentPlaces`: `array`
7438 * * `NSPreferredWebServices`: `dictionary`
7439 * * `NSUserDictionaryReplacementItems`: `array`
7440 *
7441 * @platform darwin
7442 */
7443 getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any;
7444 /**
7445 * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
7446 *
7447 * An example of using it to determine if you should create a transparent window or
7448 * not (transparent windows won't work correctly when DWM composition is disabled):
7449 *
7450 * @platform win32
7451 */
7452 isAeroGlassEnabled(): boolean;
7453 /**
7454 * Whether the system is in Dark Mode.
7455 *
7456 * **Note:** On macOS 10.15 Catalina in order for this API to return the correct
7457 * value when in the "automatic" dark mode setting you must either have
7458 * `NSRequiresAquaSystemAppearance=false` in your `Info.plist` or be on Electron
7459 * `>=7.0.0`. See the dark mode guide for more information.
7460 *
7461**Deprecated:** Should use the new `nativeTheme.shouldUseDarkColors` API.
7462 *
7463 * @deprecated
7464 * @platform darwin,win32
7465 */
7466 isDarkMode(): boolean;
7467 /**
7468 * `true` if a high contrast theme is active, `false` otherwise.
7469 *
7470 * **Deprecated:** Should use the new `nativeTheme.shouldUseHighContrastColors`
7471 * API.
7472 *
7473 * @deprecated
7474 * @platform darwin,win32
7475 */
7476 isHighContrastColorScheme(): boolean;
7477 /**
7478 * `true` if an inverted color scheme (a high contrast color scheme with light text
7479 * and dark backgrounds) is active, `false` otherwise.
7480 *
7481 * **Deprecated:** Should use the new `nativeTheme.shouldUseInvertedColorScheme`
7482 * API.
7483 *
7484 * @deprecated
7485 * @platform win32
7486 */
7487 isInvertedColorScheme(): boolean;
7488 /**
7489 * Whether the Swipe between pages setting is on.
7490 *
7491 * @platform darwin
7492 */
7493 isSwipeTrackingFromScrollEventsEnabled(): boolean;
7494 /**
7495 * `true` if the current process is a trusted accessibility client and `false` if
7496 * it is not.
7497 *
7498 * @platform darwin
7499 */
7500 isTrustedAccessibilityClient(prompt: boolean): boolean;
7501 /**
7502 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
7503 * contains the user information dictionary sent along with the notification.
7504 *
7505 * @platform darwin
7506 */
7507 postLocalNotification(event: string, userInfo: Record<string, any>): void;
7508 /**
7509 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
7510 * contains the user information dictionary sent along with the notification.
7511 *
7512 * @platform darwin
7513 */
7514 postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
7515 /**
7516 * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
7517 * contains the user information dictionary sent along with the notification.
7518 *
7519 * @platform darwin
7520 */
7521 postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
7522 /**
7523 * resolves if the user has successfully authenticated with Touch ID.
7524 *
7525 * This API itself will not protect your user data; rather, it is a mechanism to
7526 * allow you to do so. Native apps will need to set Access Control Constants like
7527 * `kSecAccessControlUserPresence` on their keychain entry so that reading it would
7528 * auto-prompt for Touch ID biometric consent. This could be done with
7529 * `node-keytar`, such that one would store an encryption key with `node-keytar`
7530 * and only fetch it if `promptTouchID()` resolves.
7531 *
7532 * **NOTE:** This API will return a rejected Promise on macOS systems older than
7533 * Sierra 10.12.2.
7534 *
7535 * @platform darwin
7536 */
7537 promptTouchID(reason: string): Promise<void>;
7538 /**
7539 * Add the specified defaults to your application's `NSUserDefaults`.
7540 *
7541 * @platform darwin
7542 */
7543 registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
7544 /**
7545 * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
7546 * or global value of a `key` previously set with `setUserDefault`.
7547 *
7548 * @platform darwin
7549 */
7550 removeUserDefault(key: string): void;
7551 /**
7552 * Sets the appearance setting for your application, this should override the
7553 * system default and override the value of `getEffectiveAppearance`.
7554 *
7555 * @deprecated
7556 * @platform darwin
7557 */
7558 setAppLevelAppearance(appearance: (('dark' | 'light')) | (null)): void;
7559 /**
7560 * Set the value of `key` in `NSUserDefaults`.
7561 *
7562 * Note that `type` should match actual type of `value`. An exception is thrown if
7563 * they don't.
7564 *
7565Some popular `key` and `type`s are:
7566
7567* `ApplePressAndHoldEnabled`: `boolean`
7568 *
7569 * @platform darwin
7570 */
7571 setUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary', value: string): void;
7572 /**
7573 * The ID of this subscription
7574 *
7575 * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
7576 * defaults. This is necessary for events such as
7577 * `NSUserDefaultsDidChangeNotification`.
7578 *
7579 * @platform darwin
7580 */
7581 subscribeLocalNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
7582 /**
7583 * The ID of this subscription
7584 *
7585 * Subscribes to native notifications of macOS, `callback` will be called with
7586 * `callback(event, userInfo)` when the corresponding `event` happens. The
7587 * `userInfo` is an Object that contains the user information dictionary sent along
7588 * with the notification. The `object` is the sender of the notification, and only
7589 * supports `NSString` values for now.
7590 *
7591 * The `id` of the subscriber is returned, which can be used to unsubscribe the
7592 * `event`.
7593 *
7594 * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
7595 * values of `event` are:
7596 *
7597 * * `AppleInterfaceThemeChangedNotification`
7598 * * `AppleAquaColorVariantChanged`
7599 * * `AppleColorPreferencesChangedNotification`
7600 * * `AppleShowScrollBarsSettingChanged`
7601 *
7602 * @platform darwin
7603 */
7604 subscribeNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
7605 /**
7606 * Same as `subscribeNotification`, but uses
7607 * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
7608 * such as `NSWorkspaceDidActivateApplicationNotification`.
7609 *
7610 * @platform darwin
7611 */
7612 subscribeWorkspaceNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): void;
7613 /**
7614 * Same as `unsubscribeNotification`, but removes the subscriber from
7615 * `NSNotificationCenter`.
7616 *
7617 * @platform darwin
7618 */
7619 unsubscribeLocalNotification(id: number): void;
7620 /**
7621 * Removes the subscriber with `id`.
7622 *
7623 * @platform darwin
7624 */
7625 unsubscribeNotification(id: number): void;
7626 /**
7627 * Same as `unsubscribeNotification`, but removes the subscriber from
7628 * `NSWorkspace.sharedWorkspace.notificationCenter`.
7629 *
7630 * @platform darwin
7631 */
7632 unsubscribeWorkspaceNotification(id: number): void;
7633 /**
7634 * A `String` property that can be `dark`, `light` or `unknown`. It determines the
7635 * macOS appearance setting for your application. This maps to values in:
7636 * NSApplication.appearance. Setting this will override the system default as well
7637 * as the value of `getEffectiveAppearance`.
7638 *
7639 * Possible values that can be set are `dark` and `light`, and possible return
7640 * values are `dark`, `light`, and `unknown`.
7641 *
7642This property is only available on macOS 10.14 Mojave or newer.
7643 *
7644 * @platform darwin
7645 */
7646 appLevelAppearance: ('dark' | 'light' | 'unknown');
7647 /**
7648 * A `String` property that can be `dark`, `light` or `unknown`.
7649 *
7650 * Returns the macOS appearance setting that is currently applied to your
7651 * application, maps to NSApplication.effectiveAppearance
7652 *
7653 * @platform darwin
7654 */
7655 readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
7656 }
7657
7658 interface Task {
7659
7660 // Docs: https://electronjs.org/docs/api/structures/task
7661
7662 /**
7663 * The command line arguments when `program` is executed.
7664 */
7665 arguments: string;
7666 /**
7667 * Description of this task.
7668 */
7669 description: string;
7670 /**
7671 * The icon index in the icon file. If an icon file consists of two or more icons,
7672 * set this value to identify the icon. If an icon file consists of one icon, this
7673 * value is 0.
7674 */
7675 iconIndex: number;
7676 /**
7677 * The absolute path to an icon to be displayed in a JumpList, which can be an
7678 * arbitrary resource file that contains an icon. You can usually specify
7679 * `process.execPath` to show the icon of the program.
7680 */
7681 iconPath: string;
7682 /**
7683 * Path of the program to execute, usually you should specify `process.execPath`
7684 * which opens the current program.
7685 */
7686 program: string;
7687 /**
7688 * The string to be displayed in a JumpList.
7689 */
7690 title: string;
7691 /**
7692 * The working directory. Default is empty.
7693 */
7694 workingDirectory?: string;
7695 }
7696
7697 interface ThumbarButton {
7698
7699 // Docs: https://electronjs.org/docs/api/structures/thumbar-button
7700
7701 click: Function;
7702 /**
7703 * Control specific states and behaviors of the button. By default, it is
7704 * `['enabled']`.
7705 */
7706 flags?: string[];
7707 /**
7708 * The icon showing in thumbnail toolbar.
7709 */
7710 icon: NativeImage;
7711 /**
7712 * The text of the button's tooltip.
7713 */
7714 tooltip?: string;
7715 }
7716
7717 class TouchBar {
7718
7719 // Docs: https://electronjs.org/docs/api/touch-bar
7720
7721 /**
7722 * TouchBar
7723 */
7724 constructor(options: TouchBarConstructorOptions);
7725 escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
7726 static TouchBarButton: typeof TouchBarButton;
7727 static TouchBarColorPicker: typeof TouchBarColorPicker;
7728 static TouchBarGroup: typeof TouchBarGroup;
7729 static TouchBarLabel: typeof TouchBarLabel;
7730 static TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
7731 static TouchBarPopover: typeof TouchBarPopover;
7732 static TouchBarScrubber: typeof TouchBarScrubber;
7733 static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
7734 static TouchBarSlider: typeof TouchBarSlider;
7735 static TouchBarSpacer: typeof TouchBarSpacer;
7736 }
7737
7738 class TouchBarButton {
7739
7740 // Docs: https://electronjs.org/docs/api/touch-bar-button
7741
7742 /**
7743 * TouchBarButton
7744 */
7745 constructor(options: TouchBarButtonConstructorOptions);
7746 accessibilityLabel: string;
7747 backgroundColor: string;
7748 enabled: boolean;
7749 icon: NativeImage;
7750 iconPosition: ('left' | 'right' | 'overlay');
7751 label: string;
7752 }
7753
7754 class TouchBarColorPicker extends NodeEventEmitter {
7755
7756 // Docs: https://electronjs.org/docs/api/touch-bar-color-picker
7757
7758 /**
7759 * TouchBarColorPicker
7760 */
7761 constructor(options: TouchBarColorPickerConstructorOptions);
7762 availableColors: string[];
7763 selectedColor: string;
7764 }
7765
7766 class TouchBarGroup extends NodeEventEmitter {
7767
7768 // Docs: https://electronjs.org/docs/api/touch-bar-group
7769
7770 /**
7771 * TouchBarGroup
7772 */
7773 constructor(options: TouchBarGroupConstructorOptions);
7774 }
7775
7776 class TouchBarLabel extends NodeEventEmitter {
7777
7778 // Docs: https://electronjs.org/docs/api/touch-bar-label
7779
7780 /**
7781 * TouchBarLabel
7782 */
7783 constructor(options: TouchBarLabelConstructorOptions);
7784 accessibilityLabel: string;
7785 label: string;
7786 textColor: string;
7787 }
7788
7789 class TouchBarOtherItemsProxy extends NodeEventEmitter {
7790
7791 // Docs: https://electronjs.org/docs/api/touch-bar-other-items-proxy
7792
7793 /**
7794 * TouchBarOtherItemsProxy
7795 */
7796 constructor();
7797 }
7798
7799 class TouchBarPopover extends NodeEventEmitter {
7800
7801 // Docs: https://electronjs.org/docs/api/touch-bar-popover
7802
7803 /**
7804 * TouchBarPopover
7805 */
7806 constructor(options: TouchBarPopoverConstructorOptions);
7807 icon: NativeImage;
7808 label: string;
7809 }
7810
7811 class TouchBarScrubber extends NodeEventEmitter {
7812
7813 // Docs: https://electronjs.org/docs/api/touch-bar-scrubber
7814
7815 /**
7816 * TouchBarScrubber
7817 */
7818 constructor(options: TouchBarScrubberConstructorOptions);
7819 continuous: boolean;
7820 items: ScrubberItem[];
7821 mode: ('fixed' | 'free');
7822 overlayStyle: ('background' | 'outline' | 'none');
7823 selectedStyle: ('background' | 'outline' | 'none');
7824 showArrowButtons: boolean;
7825 }
7826
7827 class TouchBarSegmentedControl extends NodeEventEmitter {
7828
7829 // Docs: https://electronjs.org/docs/api/touch-bar-segmented-control
7830
7831 /**
7832 * TouchBarSegmentedControl
7833 */
7834 constructor(options: TouchBarSegmentedControlConstructorOptions);
7835 mode: ('single' | 'multiple' | 'buttons');
7836 segments: SegmentedControlSegment[];
7837 segmentStyle: string;
7838 selectedIndex: number;
7839 }
7840
7841 class TouchBarSlider extends NodeEventEmitter {
7842
7843 // Docs: https://electronjs.org/docs/api/touch-bar-slider
7844
7845 /**
7846 * TouchBarSlider
7847 */
7848 constructor(options: TouchBarSliderConstructorOptions);
7849 label: string;
7850 maxValue: number;
7851 minValue: number;
7852 value: number;
7853 }
7854
7855 class TouchBarSpacer extends NodeEventEmitter {
7856
7857 // Docs: https://electronjs.org/docs/api/touch-bar-spacer
7858
7859 /**
7860 * TouchBarSpacer
7861 */
7862 constructor(options: TouchBarSpacerConstructorOptions);
7863 size: ('small' | 'large' | 'flexible');
7864 }
7865
7866 interface TraceCategoriesAndOptions {
7867
7868 // Docs: https://electronjs.org/docs/api/structures/trace-categories-and-options
7869
7870 /**
7871 * A filter to control what category groups should be traced. A filter can have an
7872 * optional '-' prefix to exclude category groups that contain a matching category.
7873 * Having both included and excluded category patterns in the same list is not
7874 * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
7875 * `-excluded_category1,-excluded_category2`.
7876 */
7877 categoryFilter: string;
7878 /**
7879 * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
7880 * the following strings: `record-until-full`, `record-continuously`,
7881 * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
7882 * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
7883 * modes and hence mutually exclusive. If more than one trace recording modes
7884 * appear in the `traceOptions` string, the last one takes precedence. If none of
7885 * the trace recording modes are specified, recording mode is `record-until-full`.
7886 * The trace option will first be reset to the default option (`record_mode` set to
7887 * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
7888 * before options parsed from `traceOptions` are applied on it.
7889 */
7890 traceOptions: string;
7891 }
7892
7893 interface TraceConfig {
7894
7895 // Docs: https://electronjs.org/docs/api/structures/trace-config
7896
7897 /**
7898 * if true, filter event data according to a specific list of events that have been
7899 * manually vetted to not include any PII. See the implementation in Chromium for
7900 * specifics.
7901 */
7902 enable_argument_filter?: boolean;
7903 /**
7904 * a list of tracing categories to exclude. Can include glob-like patterns using
7905 * `*` at the end of the category name. See tracing categories for the list of
7906 * categories.
7907 */
7908 excluded_categories?: string[];
7909 /**
7910 * a list of histogram names to report with the trace.
7911 */
7912 histogram_names?: string[];
7913 /**
7914 * a list of tracing categories to include. Can include glob-like patterns using
7915 * `*` at the end of the category name. See tracing categories for the list of
7916 * categories.
7917 */
7918 included_categories?: string[];
7919 /**
7920 * a list of process IDs to include in the trace. If not specified, trace all
7921 * processes.
7922 */
7923 included_process_ids?: number[];
7924 /**
7925 * if the `disabled-by-default-memory-infra` category is enabled, this contains
7926 * optional additional configuration for data collection. See the Chromium
7927 * memory-infra docs for more information.
7928 */
7929 memory_dump_config?: Record<string, any>;
7930 /**
7931 * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
7932 * or `trace-to-console`. Defaults to `record-until-full`.
7933 */
7934 recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
7935 /**
7936 * maximum size of the trace recording buffer in events.
7937 */
7938 trace_buffer_size_in_events?: number;
7939 /**
7940 * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
7941 */
7942 trace_buffer_size_in_kb?: number;
7943 }
7944
7945 interface Transaction {
7946
7947 // Docs: https://electronjs.org/docs/api/structures/transaction
7948
7949 /**
7950 * The error code if an error occurred while processing the transaction.
7951 */
7952 errorCode: number;
7953 /**
7954 * The error message if an error occurred while processing the transaction.
7955 */
7956 errorMessage: string;
7957 /**
7958 * The identifier of the restored transaction by the App Store.
7959 */
7960 originalTransactionIdentifier: string;
7961 payment: Payment;
7962 /**
7963 * The date the transaction was added to the App Store’s payment queue.
7964 */
7965 transactionDate: string;
7966 /**
7967 * A string that uniquely identifies a successful payment transaction.
7968 */
7969 transactionIdentifier: string;
7970 /**
7971 * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
7972 * `deferred`.
7973 */
7974 transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
7975 }
7976
7977 class Tray extends NodeEventEmitter {
7978
7979 // Docs: https://electronjs.org/docs/api/tray
7980
7981 /**
7982 * Emitted when the tray balloon is clicked.
7983 *
7984 * @platform win32
7985 */
7986 on(event: 'balloon-click', listener: Function): this;
7987 once(event: 'balloon-click', listener: Function): this;
7988 addListener(event: 'balloon-click', listener: Function): this;
7989 removeListener(event: 'balloon-click', listener: Function): this;
7990 /**
7991 * Emitted when the tray balloon is closed because of timeout or user manually
7992 * closes it.
7993 *
7994 * @platform win32
7995 */
7996 on(event: 'balloon-closed', listener: Function): this;
7997 once(event: 'balloon-closed', listener: Function): this;
7998 addListener(event: 'balloon-closed', listener: Function): this;
7999 removeListener(event: 'balloon-closed', listener: Function): this;
8000 /**
8001 * Emitted when the tray balloon shows.
8002 *
8003 * @platform win32
8004 */
8005 on(event: 'balloon-show', listener: Function): this;
8006 once(event: 'balloon-show', listener: Function): this;
8007 addListener(event: 'balloon-show', listener: Function): this;
8008 removeListener(event: 'balloon-show', listener: Function): this;
8009 /**
8010 * Emitted when the tray icon is clicked.
8011 */
8012 on(event: 'click', listener: (event: KeyboardEvent,
8013 /**
8014 * The bounds of tray icon.
8015 */
8016 bounds: Rectangle,
8017 /**
8018 * The position of the event.
8019 */
8020 position: Point) => void): this;
8021 once(event: 'click', listener: (event: KeyboardEvent,
8022 /**
8023 * The bounds of tray icon.
8024 */
8025 bounds: Rectangle,
8026 /**
8027 * The position of the event.
8028 */
8029 position: Point) => void): this;
8030 addListener(event: 'click', listener: (event: KeyboardEvent,
8031 /**
8032 * The bounds of tray icon.
8033 */
8034 bounds: Rectangle,
8035 /**
8036 * The position of the event.
8037 */
8038 position: Point) => void): this;
8039 removeListener(event: 'click', listener: (event: KeyboardEvent,
8040 /**
8041 * The bounds of tray icon.
8042 */
8043 bounds: Rectangle,
8044 /**
8045 * The position of the event.
8046 */
8047 position: Point) => void): this;
8048 /**
8049 * Emitted when the tray icon is double clicked.
8050 *
8051 * @platform darwin,win32
8052 */
8053 on(event: 'double-click', listener: (event: KeyboardEvent,
8054 /**
8055 * The bounds of tray icon.
8056 */
8057 bounds: Rectangle) => void): this;
8058 once(event: 'double-click', listener: (event: KeyboardEvent,
8059 /**
8060 * The bounds of tray icon.
8061 */
8062 bounds: Rectangle) => void): this;
8063 addListener(event: 'double-click', listener: (event: KeyboardEvent,
8064 /**
8065 * The bounds of tray icon.
8066 */
8067 bounds: Rectangle) => void): this;
8068 removeListener(event: 'double-click', listener: (event: KeyboardEvent,
8069 /**
8070 * The bounds of tray icon.
8071 */
8072 bounds: Rectangle) => void): this;
8073 /**
8074 * Emitted when a drag operation ends on the tray or ends at another location.
8075 *
8076 * @platform darwin
8077 */
8078 on(event: 'drag-end', listener: Function): this;
8079 once(event: 'drag-end', listener: Function): this;
8080 addListener(event: 'drag-end', listener: Function): this;
8081 removeListener(event: 'drag-end', listener: Function): this;
8082 /**
8083 * Emitted when a drag operation enters the tray icon.
8084 *
8085 * @platform darwin
8086 */
8087 on(event: 'drag-enter', listener: Function): this;
8088 once(event: 'drag-enter', listener: Function): this;
8089 addListener(event: 'drag-enter', listener: Function): this;
8090 removeListener(event: 'drag-enter', listener: Function): this;
8091 /**
8092 * Emitted when a drag operation exits the tray icon.
8093 *
8094 * @platform darwin
8095 */
8096 on(event: 'drag-leave', listener: Function): this;
8097 once(event: 'drag-leave', listener: Function): this;
8098 addListener(event: 'drag-leave', listener: Function): this;
8099 removeListener(event: 'drag-leave', listener: Function): this;
8100 /**
8101 * Emitted when any dragged items are dropped on the tray icon.
8102 *
8103 * @platform darwin
8104 */
8105 on(event: 'drop', listener: Function): this;
8106 once(event: 'drop', listener: Function): this;
8107 addListener(event: 'drop', listener: Function): this;
8108 removeListener(event: 'drop', listener: Function): this;
8109 /**
8110 * Emitted when dragged files are dropped in the tray icon.
8111 *
8112 * @platform darwin
8113 */
8114 on(event: 'drop-files', listener: (event: Event,
8115 /**
8116 * The paths of the dropped files.
8117 */
8118 files: string[]) => void): this;
8119 once(event: 'drop-files', listener: (event: Event,
8120 /**
8121 * The paths of the dropped files.
8122 */
8123 files: string[]) => void): this;
8124 addListener(event: 'drop-files', listener: (event: Event,
8125 /**
8126 * The paths of the dropped files.
8127 */
8128 files: string[]) => void): this;
8129 removeListener(event: 'drop-files', listener: (event: Event,
8130 /**
8131 * The paths of the dropped files.
8132 */
8133 files: string[]) => void): this;
8134 /**
8135 * Emitted when dragged text is dropped in the tray icon.
8136 *
8137 * @platform darwin
8138 */
8139 on(event: 'drop-text', listener: (event: Event,
8140 /**
8141 * the dropped text string.
8142 */
8143 text: string) => void): this;
8144 once(event: 'drop-text', listener: (event: Event,
8145 /**
8146 * the dropped text string.
8147 */
8148 text: string) => void): this;
8149 addListener(event: 'drop-text', listener: (event: Event,
8150 /**
8151 * the dropped text string.
8152 */
8153 text: string) => void): this;
8154 removeListener(event: 'drop-text', listener: (event: Event,
8155 /**
8156 * the dropped text string.
8157 */
8158 text: string) => void): this;
8159 /**
8160 * Emitted when the mouse clicks the tray icon.
8161 *
8162 * @platform darwin
8163 */
8164 on(event: 'mouse-down', listener: (event: KeyboardEvent,
8165 /**
8166 * The position of the event.
8167 */
8168 position: Point) => void): this;
8169 once(event: 'mouse-down', listener: (event: KeyboardEvent,
8170 /**
8171 * The position of the event.
8172 */
8173 position: Point) => void): this;
8174 addListener(event: 'mouse-down', listener: (event: KeyboardEvent,
8175 /**
8176 * The position of the event.
8177 */
8178 position: Point) => void): this;
8179 removeListener(event: 'mouse-down', listener: (event: KeyboardEvent,
8180 /**
8181 * The position of the event.
8182 */
8183 position: Point) => void): this;
8184 /**
8185 * Emitted when the mouse enters the tray icon.
8186 *
8187 * @platform darwin
8188 */
8189 on(event: 'mouse-enter', listener: (event: KeyboardEvent,
8190 /**
8191 * The position of the event.
8192 */
8193 position: Point) => void): this;
8194 once(event: 'mouse-enter', listener: (event: KeyboardEvent,
8195 /**
8196 * The position of the event.
8197 */
8198 position: Point) => void): this;
8199 addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
8200 /**
8201 * The position of the event.
8202 */
8203 position: Point) => void): this;
8204 removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
8205 /**
8206 * The position of the event.
8207 */
8208 position: Point) => void): this;
8209 /**
8210 * Emitted when the mouse exits the tray icon.
8211 *
8212 * @platform darwin
8213 */
8214 on(event: 'mouse-leave', listener: (event: KeyboardEvent,
8215 /**
8216 * The position of the event.
8217 */
8218 position: Point) => void): this;
8219 once(event: 'mouse-leave', listener: (event: KeyboardEvent,
8220 /**
8221 * The position of the event.
8222 */
8223 position: Point) => void): this;
8224 addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
8225 /**
8226 * The position of the event.
8227 */
8228 position: Point) => void): this;
8229 removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
8230 /**
8231 * The position of the event.
8232 */
8233 position: Point) => void): this;
8234 /**
8235 * Emitted when the mouse moves in the tray icon.
8236 *
8237 * @platform darwin,win32
8238 */
8239 on(event: 'mouse-move', listener: (event: KeyboardEvent,
8240 /**
8241 * The position of the event.
8242 */
8243 position: Point) => void): this;
8244 once(event: 'mouse-move', listener: (event: KeyboardEvent,
8245 /**
8246 * The position of the event.
8247 */
8248 position: Point) => void): this;
8249 addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
8250 /**
8251 * The position of the event.
8252 */
8253 position: Point) => void): this;
8254 removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
8255 /**
8256 * The position of the event.
8257 */
8258 position: Point) => void): this;
8259 /**
8260 * Emitted when the mouse is released from clicking the tray icon.
8261 *
8262 * Note: This will not be emitted if you have set a context menu for your Tray
8263 * using `tray.setContextMenu`, as a result of macOS-level constraints.
8264 *
8265 * @platform darwin
8266 */
8267 on(event: 'mouse-up', listener: (event: KeyboardEvent,
8268 /**
8269 * The position of the event.
8270 */
8271 position: Point) => void): this;
8272 once(event: 'mouse-up', listener: (event: KeyboardEvent,
8273 /**
8274 * The position of the event.
8275 */
8276 position: Point) => void): this;
8277 addListener(event: 'mouse-up', listener: (event: KeyboardEvent,
8278 /**
8279 * The position of the event.
8280 */
8281 position: Point) => void): this;
8282 removeListener(event: 'mouse-up', listener: (event: KeyboardEvent,
8283 /**
8284 * The position of the event.
8285 */
8286 position: Point) => void): this;
8287 /**
8288 * Emitted when the tray icon is right clicked.
8289 *
8290 * @platform darwin,win32
8291 */
8292 on(event: 'right-click', listener: (event: KeyboardEvent,
8293 /**
8294 * The bounds of tray icon.
8295 */
8296 bounds: Rectangle) => void): this;
8297 once(event: 'right-click', listener: (event: KeyboardEvent,
8298 /**
8299 * The bounds of tray icon.
8300 */
8301 bounds: Rectangle) => void): this;
8302 addListener(event: 'right-click', listener: (event: KeyboardEvent,
8303 /**
8304 * The bounds of tray icon.
8305 */
8306 bounds: Rectangle) => void): this;
8307 removeListener(event: 'right-click', listener: (event: KeyboardEvent,
8308 /**
8309 * The bounds of tray icon.
8310 */
8311 bounds: Rectangle) => void): this;
8312 /**
8313 * Tray
8314 */
8315 constructor(image: (NativeImage) | (string), guid?: string);
8316 /**
8317 * Closes an open context menu, as set by `tray.setContextMenu()`.
8318 *
8319 * @platform darwin,win32
8320 */
8321 closeContextMenu(): void;
8322 /**
8323 * Destroys the tray icon immediately.
8324 */
8325 destroy(): void;
8326 /**
8327 * Displays a tray balloon.
8328 *
8329 * @platform win32
8330 */
8331 displayBalloon(options: DisplayBalloonOptions): void;
8332 /**
8333 * Returns focus to the taskbar notification area. Notification area icons should
8334 * use this message when they have completed their UI operation. For example, if
8335 * the icon displays a shortcut menu, but the user presses ESC to cancel it, use
8336 * `tray.focus()` to return focus to the notification area.
8337 *
8338 * @platform win32
8339 */
8340 focus(): void;
8341 /**
8342 * The `bounds` of this tray icon as `Object`.
8343 *
8344 * @platform darwin,win32
8345 */
8346 getBounds(): Rectangle;
8347 /**
8348 * Whether double click events will be ignored.
8349 *
8350 * @platform darwin
8351 */
8352 getIgnoreDoubleClickEvents(): boolean;
8353 /**
8354 * the title displayed next to the tray icon in the status bar
8355 *
8356 * @platform darwin
8357 */
8358 getTitle(): string;
8359 /**
8360 * Whether the tray icon is destroyed.
8361 */
8362 isDestroyed(): boolean;
8363 /**
8364 * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
8365 * will be shown instead of the tray icon's context menu.
8366 *
8367The `position` is only available on Windows, and it is (0, 0) by default.
8368 *
8369 * @platform darwin,win32
8370 */
8371 popUpContextMenu(menu?: Menu, position?: Point): void;
8372 /**
8373 * Removes a tray balloon.
8374 *
8375 * @platform win32
8376 */
8377 removeBalloon(): void;
8378 /**
8379 * Sets the context menu for this icon.
8380 */
8381 setContextMenu(menu: (Menu) | (null)): void;
8382 /**
8383 * Sets the option to ignore double click events. Ignoring these events allows you
8384 * to detect every individual click of the tray icon.
8385 *
8386This value is set to false by default.
8387 *
8388 * @platform darwin
8389 */
8390 setIgnoreDoubleClickEvents(ignore: boolean): void;
8391 /**
8392 * Sets the `image` associated with this tray icon.
8393 */
8394 setImage(image: (NativeImage) | (string)): void;
8395 /**
8396 * Sets the `image` associated with this tray icon when pressed on macOS.
8397 *
8398 * @platform darwin
8399 */
8400 setPressedImage(image: (NativeImage) | (string)): void;
8401 /**
8402 * Sets the title displayed next to the tray icon in the status bar (Support ANSI
8403 * colors).
8404 *
8405 * @platform darwin
8406 */
8407 setTitle(title: string, options?: TitleOptions): void;
8408 /**
8409 * Sets the hover text for this tray icon.
8410 */
8411 setToolTip(toolTip: string): void;
8412 }
8413
8414 interface UploadBlob {
8415
8416 // Docs: https://electronjs.org/docs/api/structures/upload-blob
8417
8418 /**
8419 * UUID of blob data to upload.
8420 */
8421 blobUUID: string;
8422 /**
8423 * `blob`.
8424 */
8425 type: string;
8426 }
8427
8428 interface UploadData {
8429
8430 // Docs: https://electronjs.org/docs/api/structures/upload-data
8431
8432 /**
8433 * UUID of blob data. Use ses.getBlobData method to retrieve the data.
8434 */
8435 blobUUID?: string;
8436 /**
8437 * Content being sent.
8438 */
8439 bytes: Buffer;
8440 /**
8441 * Path of file being uploaded.
8442 */
8443 file?: string;
8444 }
8445
8446 interface UploadFile {
8447
8448 // Docs: https://electronjs.org/docs/api/structures/upload-file
8449
8450 /**
8451 * Path of file to be uploaded.
8452 */
8453 filePath: string;
8454 /**
8455 * Number of bytes to read from `offset`. Defaults to `0`.
8456 */
8457 length: number;
8458 /**
8459 * Last Modification time in number of seconds since the UNIX epoch.
8460 */
8461 modificationTime: number;
8462 /**
8463 * Defaults to `0`.
8464 */
8465 offset: number;
8466 /**
8467 * `file`.
8468 */
8469 type: string;
8470 }
8471
8472 interface UploadRawData {
8473
8474 // Docs: https://electronjs.org/docs/api/structures/upload-raw-data
8475
8476 /**
8477 * Data to be uploaded.
8478 */
8479 bytes: Buffer;
8480 /**
8481 * `rawData`.
8482 */
8483 type: string;
8484 }
8485
8486 class WebContents extends NodeEventEmitter {
8487
8488 // Docs: https://electronjs.org/docs/api/web-contents
8489
8490 /**
8491 * | undefined - A WebContents instance with the given ID, or `undefined` if there
8492 * is no WebContents associated with the given ID.
8493 */
8494 static fromId(id: number): WebContents;
8495 /**
8496 * An array of all `WebContents` instances. This will contain web contents for all
8497 * windows, webviews, opened devtools, and devtools extension background pages.
8498 */
8499 static getAllWebContents(): WebContents[];
8500 /**
8501 * The web contents that is focused in this application, otherwise returns `null`.
8502 */
8503 static getFocusedWebContents(): WebContents;
8504 /**
8505 * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
8506 * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
8507 * menu shortcuts.
8508 *
8509To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
8510 */
8511 on(event: 'before-input-event', listener: (event: Event,
8512 /**
8513 * Input properties.
8514 */
8515 input: Input) => void): this;
8516 once(event: 'before-input-event', listener: (event: Event,
8517 /**
8518 * Input properties.
8519 */
8520 input: Input) => void): this;
8521 addListener(event: 'before-input-event', listener: (event: Event,
8522 /**
8523 * Input properties.
8524 */
8525 input: Input) => void): this;
8526 removeListener(event: 'before-input-event', listener: (event: Event,
8527 /**
8528 * Input properties.
8529 */
8530 input: Input) => void): this;
8531 /**
8532 * Emitted when failed to verify the `certificate` for `url`.
8533 *
8534The usage is the same with the `certificate-error` event of `app`.
8535 */
8536 on(event: 'certificate-error', listener: (event: Event,
8537 url: string,
8538 /**
8539 * The error code.
8540 */
8541 error: string,
8542 certificate: Certificate,
8543 callback: (isTrusted: boolean) => void) => void): this;
8544 once(event: 'certificate-error', listener: (event: Event,
8545 url: string,
8546 /**
8547 * The error code.
8548 */
8549 error: string,
8550 certificate: Certificate,
8551 callback: (isTrusted: boolean) => void) => void): this;
8552 addListener(event: 'certificate-error', listener: (event: Event,
8553 url: string,
8554 /**
8555 * The error code.
8556 */
8557 error: string,
8558 certificate: Certificate,
8559 callback: (isTrusted: boolean) => void) => void): this;
8560 removeListener(event: 'certificate-error', listener: (event: Event,
8561 url: string,
8562 /**
8563 * The error code.
8564 */
8565 error: string,
8566 certificate: Certificate,
8567 callback: (isTrusted: boolean) => void) => void): this;
8568 /**
8569 * Emitted when the associated window logs a console message.
8570 */
8571 on(event: 'console-message', listener: (event: Event,
8572 /**
8573 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
8574 * `error`.
8575 */
8576 level: number,
8577 /**
8578 * The actual console message
8579 */
8580 message: string,
8581 /**
8582 * The line number of the source that triggered this console message
8583 */
8584 line: number,
8585 sourceId: string) => void): this;
8586 once(event: 'console-message', listener: (event: Event,
8587 /**
8588 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
8589 * `error`.
8590 */
8591 level: number,
8592 /**
8593 * The actual console message
8594 */
8595 message: string,
8596 /**
8597 * The line number of the source that triggered this console message
8598 */
8599 line: number,
8600 sourceId: string) => void): this;
8601 addListener(event: 'console-message', listener: (event: Event,
8602 /**
8603 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
8604 * `error`.
8605 */
8606 level: number,
8607 /**
8608 * The actual console message
8609 */
8610 message: string,
8611 /**
8612 * The line number of the source that triggered this console message
8613 */
8614 line: number,
8615 sourceId: string) => void): this;
8616 removeListener(event: 'console-message', listener: (event: Event,
8617 /**
8618 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
8619 * `error`.
8620 */
8621 level: number,
8622 /**
8623 * The actual console message
8624 */
8625 message: string,
8626 /**
8627 * The line number of the source that triggered this console message
8628 */
8629 line: number,
8630 sourceId: string) => void): this;
8631 /**
8632 * Emitted when there is a new context menu that needs to be handled.
8633 */
8634 on(event: 'context-menu', listener: (event: Event,
8635 params: ContextMenuParams) => void): this;
8636 once(event: 'context-menu', listener: (event: Event,
8637 params: ContextMenuParams) => void): this;
8638 addListener(event: 'context-menu', listener: (event: Event,
8639 params: ContextMenuParams) => void): this;
8640 removeListener(event: 'context-menu', listener: (event: Event,
8641 params: ContextMenuParams) => void): this;
8642 /**
8643 * Emitted when the renderer process crashes or is killed.
8644 *
8645 * **Deprecated:** This event is superceded by the `render-process-gone` event
8646 * which contains more information about why the render process disappeared. It
8647 * isn't always because it crashed. The `killed` boolean can be replaced by
8648 * checking `reason === 'killed'` when you switch to that event.
8649 *
8650 * @deprecated
8651 */
8652 on(event: 'crashed', listener: (event: Event,
8653 killed: boolean) => void): this;
8654 once(event: 'crashed', listener: (event: Event,
8655 killed: boolean) => void): this;
8656 addListener(event: 'crashed', listener: (event: Event,
8657 killed: boolean) => void): this;
8658 removeListener(event: 'crashed', listener: (event: Event,
8659 killed: boolean) => void): this;
8660 /**
8661 * Emitted when the cursor's type changes. The `type` parameter can be `default`,
8662 * `crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
8663 * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
8664 * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
8665 * `row-resize`, `m-panning`, `e-panning`, `n-panning`, `ne-panning`, `nw-panning`,
8666 * `s-panning`, `se-panning`, `sw-panning`, `w-panning`, `move`, `vertical-text`,
8667 * `cell`, `context-menu`, `alias`, `progress`, `nodrop`, `copy`, `none`,
8668 * `not-allowed`, `zoom-in`, `zoom-out`, `grab`, `grabbing` or `custom`.
8669 *
8670 * If the `type` parameter is `custom`, the `image` parameter will hold the custom
8671 * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
8672 * additional information about the custom cursor.
8673 */
8674 on(event: 'cursor-changed', listener: (event: Event,
8675 type: string,
8676 image: NativeImage,
8677 /**
8678 * scaling factor for the custom cursor.
8679 */
8680 scale: number,
8681 /**
8682 * the size of the `image`.
8683 */
8684 size: Size,
8685 /**
8686 * coordinates of the custom cursor's hotspot.
8687 */
8688 hotspot: Point) => void): this;
8689 once(event: 'cursor-changed', listener: (event: Event,
8690 type: string,
8691 image: NativeImage,
8692 /**
8693 * scaling factor for the custom cursor.
8694 */
8695 scale: number,
8696 /**
8697 * the size of the `image`.
8698 */
8699 size: Size,
8700 /**
8701 * coordinates of the custom cursor's hotspot.
8702 */
8703 hotspot: Point) => void): this;
8704 addListener(event: 'cursor-changed', listener: (event: Event,
8705 type: string,
8706 image: NativeImage,
8707 /**
8708 * scaling factor for the custom cursor.
8709 */
8710 scale: number,
8711 /**
8712 * the size of the `image`.
8713 */
8714 size: Size,
8715 /**
8716 * coordinates of the custom cursor's hotspot.
8717 */
8718 hotspot: Point) => void): this;
8719 removeListener(event: 'cursor-changed', listener: (event: Event,
8720 type: string,
8721 image: NativeImage,
8722 /**
8723 * scaling factor for the custom cursor.
8724 */
8725 scale: number,
8726 /**
8727 * the size of the `image`.
8728 */
8729 size: Size,
8730 /**
8731 * coordinates of the custom cursor's hotspot.
8732 */
8733 hotspot: Point) => void): this;
8734 /**
8735 * Emitted when `desktopCapturer.getSources()` is called in the renderer process.
8736 * Calling `event.preventDefault()` will make it return empty sources.
8737 */
8738 on(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
8739 once(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
8740 addListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
8741 removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
8742 /**
8743 * Emitted when `webContents` is destroyed.
8744 */
8745 on(event: 'destroyed', listener: Function): this;
8746 once(event: 'destroyed', listener: Function): this;
8747 addListener(event: 'destroyed', listener: Function): this;
8748 removeListener(event: 'destroyed', listener: Function): this;
8749 /**
8750 * Emitted when DevTools is closed.
8751 */
8752 on(event: 'devtools-closed', listener: Function): this;
8753 once(event: 'devtools-closed', listener: Function): this;
8754 addListener(event: 'devtools-closed', listener: Function): this;
8755 removeListener(event: 'devtools-closed', listener: Function): this;
8756 /**
8757 * Emitted when DevTools is focused / opened.
8758 */
8759 on(event: 'devtools-focused', listener: Function): this;
8760 once(event: 'devtools-focused', listener: Function): this;
8761 addListener(event: 'devtools-focused', listener: Function): this;
8762 removeListener(event: 'devtools-focused', listener: Function): this;
8763 /**
8764 * Emitted when DevTools is opened.
8765 */
8766 on(event: 'devtools-opened', listener: Function): this;
8767 once(event: 'devtools-opened', listener: Function): this;
8768 addListener(event: 'devtools-opened', listener: Function): this;
8769 removeListener(event: 'devtools-opened', listener: Function): this;
8770 /**
8771 * Emitted when the devtools window instructs the webContents to reload
8772 */
8773 on(event: 'devtools-reload-page', listener: Function): this;
8774 once(event: 'devtools-reload-page', listener: Function): this;
8775 addListener(event: 'devtools-reload-page', listener: Function): this;
8776 removeListener(event: 'devtools-reload-page', listener: Function): this;
8777 /**
8778 * Emitted when a `<webview>` has been attached to this web contents.
8779 */
8780 on(event: 'did-attach-webview', listener: (event: Event,
8781 /**
8782 * The guest web contents that is used by the `<webview>`.
8783 */
8784 webContents: WebContents) => void): this;
8785 once(event: 'did-attach-webview', listener: (event: Event,
8786 /**
8787 * The guest web contents that is used by the `<webview>`.
8788 */
8789 webContents: WebContents) => void): this;
8790 addListener(event: 'did-attach-webview', listener: (event: Event,
8791 /**
8792 * The guest web contents that is used by the `<webview>`.
8793 */
8794 webContents: WebContents) => void): this;
8795 removeListener(event: 'did-attach-webview', listener: (event: Event,
8796 /**
8797 * The guest web contents that is used by the `<webview>`.
8798 */
8799 webContents: WebContents) => void): this;
8800 /**
8801 * Emitted when a page's theme color changes. This is usually due to encountering a
8802 * meta tag:
8803 */
8804 on(event: 'did-change-theme-color', listener: (event: Event,
8805 /**
8806 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
8807 */
8808 color: (string) | (null)) => void): this;
8809 once(event: 'did-change-theme-color', listener: (event: Event,
8810 /**
8811 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
8812 */
8813 color: (string) | (null)) => void): this;
8814 addListener(event: 'did-change-theme-color', listener: (event: Event,
8815 /**
8816 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
8817 */
8818 color: (string) | (null)) => void): this;
8819 removeListener(event: 'did-change-theme-color', listener: (event: Event,
8820 /**
8821 * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
8822 */
8823 color: (string) | (null)) => void): this;
8824 /**
8825 * This event is like `did-finish-load` but emitted when the load failed. The full
8826 * list of error codes and their meaning is available here.
8827 */
8828 on(event: 'did-fail-load', listener: (event: Event,
8829 errorCode: number,
8830 errorDescription: string,
8831 validatedURL: string,
8832 isMainFrame: boolean,
8833 frameProcessId: number,
8834 frameRoutingId: number) => void): this;
8835 once(event: 'did-fail-load', listener: (event: Event,
8836 errorCode: number,
8837 errorDescription: string,
8838 validatedURL: string,
8839 isMainFrame: boolean,
8840 frameProcessId: number,
8841 frameRoutingId: number) => void): this;
8842 addListener(event: 'did-fail-load', listener: (event: Event,
8843 errorCode: number,
8844 errorDescription: string,
8845 validatedURL: string,
8846 isMainFrame: boolean,
8847 frameProcessId: number,
8848 frameRoutingId: number) => void): this;
8849 removeListener(event: 'did-fail-load', listener: (event: Event,
8850 errorCode: number,
8851 errorDescription: string,
8852 validatedURL: string,
8853 isMainFrame: boolean,
8854 frameProcessId: number,
8855 frameRoutingId: number) => void): this;
8856 /**
8857 * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
8858 * `window.stop()` was invoked).
8859 */
8860 on(event: 'did-fail-provisional-load', listener: (event: Event,
8861 errorCode: number,
8862 errorDescription: string,
8863 validatedURL: string,
8864 isMainFrame: boolean,
8865 frameProcessId: number,
8866 frameRoutingId: number) => void): this;
8867 once(event: 'did-fail-provisional-load', listener: (event: Event,
8868 errorCode: number,
8869 errorDescription: string,
8870 validatedURL: string,
8871 isMainFrame: boolean,
8872 frameProcessId: number,
8873 frameRoutingId: number) => void): this;
8874 addListener(event: 'did-fail-provisional-load', listener: (event: Event,
8875 errorCode: number,
8876 errorDescription: string,
8877 validatedURL: string,
8878 isMainFrame: boolean,
8879 frameProcessId: number,
8880 frameRoutingId: number) => void): this;
8881 removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
8882 errorCode: number,
8883 errorDescription: string,
8884 validatedURL: string,
8885 isMainFrame: boolean,
8886 frameProcessId: number,
8887 frameRoutingId: number) => void): this;
8888 /**
8889 * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
8890 * spinning, and the `onload` event was dispatched.
8891 */
8892 on(event: 'did-finish-load', listener: Function): this;
8893 once(event: 'did-finish-load', listener: Function): this;
8894 addListener(event: 'did-finish-load', listener: Function): this;
8895 removeListener(event: 'did-finish-load', listener: Function): this;
8896 /**
8897 * Emitted when a frame has done navigation.
8898 */
8899 on(event: 'did-frame-finish-load', listener: (event: Event,
8900 isMainFrame: boolean,
8901 frameProcessId: number,
8902 frameRoutingId: number) => void): this;
8903 once(event: 'did-frame-finish-load', listener: (event: Event,
8904 isMainFrame: boolean,
8905 frameProcessId: number,
8906 frameRoutingId: number) => void): this;
8907 addListener(event: 'did-frame-finish-load', listener: (event: Event,
8908 isMainFrame: boolean,
8909 frameProcessId: number,
8910 frameRoutingId: number) => void): this;
8911 removeListener(event: 'did-frame-finish-load', listener: (event: Event,
8912 isMainFrame: boolean,
8913 frameProcessId: number,
8914 frameRoutingId: number) => void): this;
8915 /**
8916 * Emitted when any frame navigation is done.
8917 *
8918 * This event is not emitted for in-page navigations, such as clicking anchor links
8919 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
8920 * this purpose.
8921 */
8922 on(event: 'did-frame-navigate', listener: (event: Event,
8923 url: string,
8924 /**
8925 * -1 for non HTTP navigations
8926 */
8927 httpResponseCode: number,
8928 /**
8929 * empty for non HTTP navigations,
8930 */
8931 httpStatusText: string,
8932 isMainFrame: boolean,
8933 frameProcessId: number,
8934 frameRoutingId: number) => void): this;
8935 once(event: 'did-frame-navigate', listener: (event: Event,
8936 url: string,
8937 /**
8938 * -1 for non HTTP navigations
8939 */
8940 httpResponseCode: number,
8941 /**
8942 * empty for non HTTP navigations,
8943 */
8944 httpStatusText: string,
8945 isMainFrame: boolean,
8946 frameProcessId: number,
8947 frameRoutingId: number) => void): this;
8948 addListener(event: 'did-frame-navigate', listener: (event: Event,
8949 url: string,
8950 /**
8951 * -1 for non HTTP navigations
8952 */
8953 httpResponseCode: number,
8954 /**
8955 * empty for non HTTP navigations,
8956 */
8957 httpStatusText: string,
8958 isMainFrame: boolean,
8959 frameProcessId: number,
8960 frameRoutingId: number) => void): this;
8961 removeListener(event: 'did-frame-navigate', listener: (event: Event,
8962 url: string,
8963 /**
8964 * -1 for non HTTP navigations
8965 */
8966 httpResponseCode: number,
8967 /**
8968 * empty for non HTTP navigations,
8969 */
8970 httpStatusText: string,
8971 isMainFrame: boolean,
8972 frameProcessId: number,
8973 frameRoutingId: number) => void): this;
8974 /**
8975 * Emitted when a main frame navigation is done.
8976 *
8977 * This event is not emitted for in-page navigations, such as clicking anchor links
8978 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
8979 * this purpose.
8980 */
8981 on(event: 'did-navigate', listener: (event: Event,
8982 url: string,
8983 /**
8984 * -1 for non HTTP navigations
8985 */
8986 httpResponseCode: number,
8987 /**
8988 * empty for non HTTP navigations
8989 */
8990 httpStatusText: string) => void): this;
8991 once(event: 'did-navigate', listener: (event: Event,
8992 url: string,
8993 /**
8994 * -1 for non HTTP navigations
8995 */
8996 httpResponseCode: number,
8997 /**
8998 * empty for non HTTP navigations
8999 */
9000 httpStatusText: string) => void): this;
9001 addListener(event: 'did-navigate', listener: (event: Event,
9002 url: string,
9003 /**
9004 * -1 for non HTTP navigations
9005 */
9006 httpResponseCode: number,
9007 /**
9008 * empty for non HTTP navigations
9009 */
9010 httpStatusText: string) => void): this;
9011 removeListener(event: 'did-navigate', listener: (event: Event,
9012 url: string,
9013 /**
9014 * -1 for non HTTP navigations
9015 */
9016 httpResponseCode: number,
9017 /**
9018 * empty for non HTTP navigations
9019 */
9020 httpStatusText: string) => void): this;
9021 /**
9022 * Emitted when an in-page navigation happened in any frame.
9023 *
9024 * When in-page navigation happens, the page URL changes but does not cause
9025 * navigation outside of the page. Examples of this occurring are when anchor links
9026 * are clicked or when the DOM `hashchange` event is triggered.
9027 */
9028 on(event: 'did-navigate-in-page', listener: (event: Event,
9029 url: string,
9030 isMainFrame: boolean,
9031 frameProcessId: number,
9032 frameRoutingId: number) => void): this;
9033 once(event: 'did-navigate-in-page', listener: (event: Event,
9034 url: string,
9035 isMainFrame: boolean,
9036 frameProcessId: number,
9037 frameRoutingId: number) => void): this;
9038 addListener(event: 'did-navigate-in-page', listener: (event: Event,
9039 url: string,
9040 isMainFrame: boolean,
9041 frameProcessId: number,
9042 frameRoutingId: number) => void): this;
9043 removeListener(event: 'did-navigate-in-page', listener: (event: Event,
9044 url: string,
9045 isMainFrame: boolean,
9046 frameProcessId: number,
9047 frameRoutingId: number) => void): this;
9048 /**
9049 * Emitted after a server side redirect occurs during navigation. For example a
9050 * 302 redirect.
9051 *
9052 * This event cannot be prevented, if you want to prevent redirects you should
9053 * checkout out the `will-redirect` event above.
9054 */
9055 on(event: 'did-redirect-navigation', listener: (event: Event,
9056 url: string,
9057 isInPlace: boolean,
9058 isMainFrame: boolean,
9059 frameProcessId: number,
9060 frameRoutingId: number) => void): this;
9061 once(event: 'did-redirect-navigation', listener: (event: Event,
9062 url: string,
9063 isInPlace: boolean,
9064 isMainFrame: boolean,
9065 frameProcessId: number,
9066 frameRoutingId: number) => void): this;
9067 addListener(event: 'did-redirect-navigation', listener: (event: Event,
9068 url: string,
9069 isInPlace: boolean,
9070 isMainFrame: boolean,
9071 frameProcessId: number,
9072 frameRoutingId: number) => void): this;
9073 removeListener(event: 'did-redirect-navigation', listener: (event: Event,
9074 url: string,
9075 isInPlace: boolean,
9076 isMainFrame: boolean,
9077 frameProcessId: number,
9078 frameRoutingId: number) => void): this;
9079 /**
9080 * Corresponds to the points in time when the spinner of the tab started spinning.
9081 */
9082 on(event: 'did-start-loading', listener: Function): this;
9083 once(event: 'did-start-loading', listener: Function): this;
9084 addListener(event: 'did-start-loading', listener: Function): this;
9085 removeListener(event: 'did-start-loading', listener: Function): this;
9086 /**
9087 * Emitted when any frame (including main) starts navigating. `isInplace` will be
9088 * `true` for in-page navigations.
9089 */
9090 on(event: 'did-start-navigation', listener: (event: Event,
9091 url: string,
9092 isInPlace: boolean,
9093 isMainFrame: boolean,
9094 frameProcessId: number,
9095 frameRoutingId: number) => void): this;
9096 once(event: 'did-start-navigation', listener: (event: Event,
9097 url: string,
9098 isInPlace: boolean,
9099 isMainFrame: boolean,
9100 frameProcessId: number,
9101 frameRoutingId: number) => void): this;
9102 addListener(event: 'did-start-navigation', listener: (event: Event,
9103 url: string,
9104 isInPlace: boolean,
9105 isMainFrame: boolean,
9106 frameProcessId: number,
9107 frameRoutingId: number) => void): this;
9108 removeListener(event: 'did-start-navigation', listener: (event: Event,
9109 url: string,
9110 isInPlace: boolean,
9111 isMainFrame: boolean,
9112 frameProcessId: number,
9113 frameRoutingId: number) => void): this;
9114 /**
9115 * Corresponds to the points in time when the spinner of the tab stopped spinning.
9116 */
9117 on(event: 'did-stop-loading', listener: Function): this;
9118 once(event: 'did-stop-loading', listener: Function): this;
9119 addListener(event: 'did-stop-loading', listener: Function): this;
9120 removeListener(event: 'did-stop-loading', listener: Function): this;
9121 /**
9122 * Emitted when the document in the given frame is loaded.
9123 */
9124 on(event: 'dom-ready', listener: (event: Event) => void): this;
9125 once(event: 'dom-ready', listener: (event: Event) => void): this;
9126 addListener(event: 'dom-ready', listener: (event: Event) => void): this;
9127 removeListener(event: 'dom-ready', listener: (event: Event) => void): this;
9128 /**
9129 * Emitted when the window enters a full-screen state triggered by HTML API.
9130 */
9131 on(event: 'enter-html-full-screen', listener: Function): this;
9132 once(event: 'enter-html-full-screen', listener: Function): this;
9133 addListener(event: 'enter-html-full-screen', listener: Function): this;
9134 removeListener(event: 'enter-html-full-screen', listener: Function): this;
9135 /**
9136 * Emitted when a result is available for [`webContents.findInPage`] request.
9137 */
9138 on(event: 'found-in-page', listener: (event: Event,
9139 result: Result) => void): this;
9140 once(event: 'found-in-page', listener: (event: Event,
9141 result: Result) => void): this;
9142 addListener(event: 'found-in-page', listener: (event: Event,
9143 result: Result) => void): this;
9144 removeListener(event: 'found-in-page', listener: (event: Event,
9145 result: Result) => void): this;
9146 /**
9147 * Emitted when the renderer process sends an asynchronous message via
9148 * `ipcRenderer.send()`.
9149 */
9150 on(event: 'ipc-message', listener: (event: Event,
9151 channel: string,
9152 ...args: any[]) => void): this;
9153 once(event: 'ipc-message', listener: (event: Event,
9154 channel: string,
9155 ...args: any[]) => void): this;
9156 addListener(event: 'ipc-message', listener: (event: Event,
9157 channel: string,
9158 ...args: any[]) => void): this;
9159 removeListener(event: 'ipc-message', listener: (event: Event,
9160 channel: string,
9161 ...args: any[]) => void): this;
9162 /**
9163 * Emitted when the renderer process sends a synchronous message via
9164 * `ipcRenderer.sendSync()`.
9165 */
9166 on(event: 'ipc-message-sync', listener: (event: Event,
9167 channel: string,
9168 ...args: any[]) => void): this;
9169 once(event: 'ipc-message-sync', listener: (event: Event,
9170 channel: string,
9171 ...args: any[]) => void): this;
9172 addListener(event: 'ipc-message-sync', listener: (event: Event,
9173 channel: string,
9174 ...args: any[]) => void): this;
9175 removeListener(event: 'ipc-message-sync', listener: (event: Event,
9176 channel: string,
9177 ...args: any[]) => void): this;
9178 /**
9179 * Emitted when the window leaves a full-screen state triggered by HTML API.
9180 */
9181 on(event: 'leave-html-full-screen', listener: Function): this;
9182 once(event: 'leave-html-full-screen', listener: Function): this;
9183 addListener(event: 'leave-html-full-screen', listener: Function): this;
9184 removeListener(event: 'leave-html-full-screen', listener: Function): this;
9185 /**
9186 * Emitted when `webContents` wants to do basic auth.
9187 *
9188The usage is the same with the `login` event of `app`.
9189 */
9190 on(event: 'login', listener: (event: Event,
9191 authenticationResponseDetails: AuthenticationResponseDetails,
9192 authInfo: AuthInfo,
9193 callback: (username?: string, password?: string) => void) => void): this;
9194 once(event: 'login', listener: (event: Event,
9195 authenticationResponseDetails: AuthenticationResponseDetails,
9196 authInfo: AuthInfo,
9197 callback: (username?: string, password?: string) => void) => void): this;
9198 addListener(event: 'login', listener: (event: Event,
9199 authenticationResponseDetails: AuthenticationResponseDetails,
9200 authInfo: AuthInfo,
9201 callback: (username?: string, password?: string) => void) => void): this;
9202 removeListener(event: 'login', listener: (event: Event,
9203 authenticationResponseDetails: AuthenticationResponseDetails,
9204 authInfo: AuthInfo,
9205 callback: (username?: string, password?: string) => void) => void): this;
9206 /**
9207 * Emitted when media is paused or done playing.
9208 */
9209 on(event: 'media-paused', listener: Function): this;
9210 once(event: 'media-paused', listener: Function): this;
9211 addListener(event: 'media-paused', listener: Function): this;
9212 removeListener(event: 'media-paused', listener: Function): this;
9213 /**
9214 * Emitted when media starts playing.
9215 */
9216 on(event: 'media-started-playing', listener: Function): this;
9217 once(event: 'media-started-playing', listener: Function): this;
9218 addListener(event: 'media-started-playing', listener: Function): this;
9219 removeListener(event: 'media-started-playing', listener: Function): this;
9220 /**
9221 * Emitted when the page requests to open a new window for a `url`. It could be
9222 * requested by `window.open` or an external link like `<a target='_blank'>`.
9223 *
9224 * By default a new `BrowserWindow` will be created for the `url`.
9225 *
9226 * Calling `event.preventDefault()` will prevent Electron from automatically
9227 * creating a new `BrowserWindow`. If you call `event.preventDefault()` and
9228 * manually create a new `BrowserWindow` then you must set `event.newGuest` to
9229 * reference the new `BrowserWindow` instance, failing to do so may result in
9230 * unexpected behavior. For example:
9231 */
9232 on(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
9233 url: string,
9234 frameName: string,
9235 /**
9236 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
9237 * `save-to-disk` and `other`.
9238 */
9239 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
9240 /**
9241 * The options which will be used for creating the new `BrowserWindow`.
9242 */
9243 options: BrowserWindowConstructorOptions,
9244 /**
9245 * The non-standard features (features not handled by Chromium or Electron) given
9246 * to `window.open()`.
9247 */
9248 additionalFeatures: string[],
9249 /**
9250 * The referrer that will be passed to the new window. May or may not result in the
9251 * `Referer` header being sent, depending on the referrer policy.
9252 */
9253 referrer: Referrer,
9254 /**
9255 * The post data that will be sent to the new window, along with the appropriate
9256 * headers that will be set. If no post data is to be sent, the value will be
9257 * `null`. Only defined when the window is being created by a form that set
9258 * `target=_blank`.
9259 */
9260 postBody: PostBody) => void): this;
9261 once(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
9262 url: string,
9263 frameName: string,
9264 /**
9265 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
9266 * `save-to-disk` and `other`.
9267 */
9268 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
9269 /**
9270 * The options which will be used for creating the new `BrowserWindow`.
9271 */
9272 options: BrowserWindowConstructorOptions,
9273 /**
9274 * The non-standard features (features not handled by Chromium or Electron) given
9275 * to `window.open()`.
9276 */
9277 additionalFeatures: string[],
9278 /**
9279 * The referrer that will be passed to the new window. May or may not result in the
9280 * `Referer` header being sent, depending on the referrer policy.
9281 */
9282 referrer: Referrer,
9283 /**
9284 * The post data that will be sent to the new window, along with the appropriate
9285 * headers that will be set. If no post data is to be sent, the value will be
9286 * `null`. Only defined when the window is being created by a form that set
9287 * `target=_blank`.
9288 */
9289 postBody: PostBody) => void): this;
9290 addListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
9291 url: string,
9292 frameName: string,
9293 /**
9294 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
9295 * `save-to-disk` and `other`.
9296 */
9297 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
9298 /**
9299 * The options which will be used for creating the new `BrowserWindow`.
9300 */
9301 options: BrowserWindowConstructorOptions,
9302 /**
9303 * The non-standard features (features not handled by Chromium or Electron) given
9304 * to `window.open()`.
9305 */
9306 additionalFeatures: string[],
9307 /**
9308 * The referrer that will be passed to the new window. May or may not result in the
9309 * `Referer` header being sent, depending on the referrer policy.
9310 */
9311 referrer: Referrer,
9312 /**
9313 * The post data that will be sent to the new window, along with the appropriate
9314 * headers that will be set. If no post data is to be sent, the value will be
9315 * `null`. Only defined when the window is being created by a form that set
9316 * `target=_blank`.
9317 */
9318 postBody: PostBody) => void): this;
9319 removeListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
9320 url: string,
9321 frameName: string,
9322 /**
9323 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
9324 * `save-to-disk` and `other`.
9325 */
9326 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
9327 /**
9328 * The options which will be used for creating the new `BrowserWindow`.
9329 */
9330 options: BrowserWindowConstructorOptions,
9331 /**
9332 * The non-standard features (features not handled by Chromium or Electron) given
9333 * to `window.open()`.
9334 */
9335 additionalFeatures: string[],
9336 /**
9337 * The referrer that will be passed to the new window. May or may not result in the
9338 * `Referer` header being sent, depending on the referrer policy.
9339 */
9340 referrer: Referrer,
9341 /**
9342 * The post data that will be sent to the new window, along with the appropriate
9343 * headers that will be set. If no post data is to be sent, the value will be
9344 * `null`. Only defined when the window is being created by a form that set
9345 * `target=_blank`.
9346 */
9347 postBody: PostBody) => void): this;
9348 /**
9349 * Emitted when page receives favicon urls.
9350 */
9351 on(event: 'page-favicon-updated', listener: (event: Event,
9352 /**
9353 * Array of URLs.
9354 */
9355 favicons: string[]) => void): this;
9356 once(event: 'page-favicon-updated', listener: (event: Event,
9357 /**
9358 * Array of URLs.
9359 */
9360 favicons: string[]) => void): this;
9361 addListener(event: 'page-favicon-updated', listener: (event: Event,
9362 /**
9363 * Array of URLs.
9364 */
9365 favicons: string[]) => void): this;
9366 removeListener(event: 'page-favicon-updated', listener: (event: Event,
9367 /**
9368 * Array of URLs.
9369 */
9370 favicons: string[]) => void): this;
9371 /**
9372 * Fired when page title is set during navigation. `explicitSet` is false when
9373 * title is synthesized from file url.
9374 */
9375 on(event: 'page-title-updated', listener: (event: Event,
9376 title: string,
9377 explicitSet: boolean) => void): this;
9378 once(event: 'page-title-updated', listener: (event: Event,
9379 title: string,
9380 explicitSet: boolean) => void): this;
9381 addListener(event: 'page-title-updated', listener: (event: Event,
9382 title: string,
9383 explicitSet: boolean) => void): this;
9384 removeListener(event: 'page-title-updated', listener: (event: Event,
9385 title: string,
9386 explicitSet: boolean) => void): this;
9387 /**
9388 * Emitted when a new frame is generated. Only the dirty area is passed in the
9389 * buffer.
9390 */
9391 on(event: 'paint', listener: (event: Event,
9392 dirtyRect: Rectangle,
9393 /**
9394 * The image data of the whole frame.
9395 */
9396 image: NativeImage) => void): this;
9397 once(event: 'paint', listener: (event: Event,
9398 dirtyRect: Rectangle,
9399 /**
9400 * The image data of the whole frame.
9401 */
9402 image: NativeImage) => void): this;
9403 addListener(event: 'paint', listener: (event: Event,
9404 dirtyRect: Rectangle,
9405 /**
9406 * The image data of the whole frame.
9407 */
9408 image: NativeImage) => void): this;
9409 removeListener(event: 'paint', listener: (event: Event,
9410 dirtyRect: Rectangle,
9411 /**
9412 * The image data of the whole frame.
9413 */
9414 image: NativeImage) => void): this;
9415 /**
9416 * Emitted when a plugin process has crashed.
9417 */
9418 on(event: 'plugin-crashed', listener: (event: Event,
9419 name: string,
9420 version: string) => void): this;
9421 once(event: 'plugin-crashed', listener: (event: Event,
9422 name: string,
9423 version: string) => void): this;
9424 addListener(event: 'plugin-crashed', listener: (event: Event,
9425 name: string,
9426 version: string) => void): this;
9427 removeListener(event: 'plugin-crashed', listener: (event: Event,
9428 name: string,
9429 version: string) => void): this;
9430 /**
9431 * Emitted when the preload script `preloadPath` throws an unhandled exception
9432 * `error`.
9433 */
9434 on(event: 'preload-error', listener: (event: Event,
9435 preloadPath: string,
9436 error: Error) => void): this;
9437 once(event: 'preload-error', listener: (event: Event,
9438 preloadPath: string,
9439 error: Error) => void): this;
9440 addListener(event: 'preload-error', listener: (event: Event,
9441 preloadPath: string,
9442 error: Error) => void): this;
9443 removeListener(event: 'preload-error', listener: (event: Event,
9444 preloadPath: string,
9445 error: Error) => void): this;
9446 /**
9447 * Emitted when `remote.getBuiltin()` is called in the renderer process. Calling
9448 * `event.preventDefault()` will prevent the module from being returned. Custom
9449 * value can be returned by setting `event.returnValue`.
9450 *
9451 * @deprecated
9452 */
9453 on(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
9454 moduleName: string) => void): this;
9455 once(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
9456 moduleName: string) => void): this;
9457 addListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
9458 moduleName: string) => void): this;
9459 removeListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
9460 moduleName: string) => void): this;
9461 /**
9462 * Emitted when `remote.getCurrentWebContents()` is called in the renderer process.
9463 * Calling `event.preventDefault()` will prevent the object from being returned.
9464 * Custom value can be returned by setting `event.returnValue`.
9465 *
9466 * @deprecated
9467 */
9468 on(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
9469 once(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
9470 addListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
9471 removeListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
9472 /**
9473 * Emitted when `remote.getCurrentWindow()` is called in the renderer process.
9474 * Calling `event.preventDefault()` will prevent the object from being returned.
9475 * Custom value can be returned by setting `event.returnValue`.
9476 *
9477 * @deprecated
9478 */
9479 on(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
9480 once(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
9481 addListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
9482 removeListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
9483 /**
9484 * Emitted when `remote.getGlobal()` is called in the renderer process. Calling
9485 * `event.preventDefault()` will prevent the global from being returned. Custom
9486 * value can be returned by setting `event.returnValue`.
9487 *
9488 * @deprecated
9489 */
9490 on(event: 'remote-get-global', listener: (event: IpcMainEvent,
9491 globalName: string) => void): this;
9492 once(event: 'remote-get-global', listener: (event: IpcMainEvent,
9493 globalName: string) => void): this;
9494 addListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
9495 globalName: string) => void): this;
9496 removeListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
9497 globalName: string) => void): this;
9498 /**
9499 * Emitted when `remote.require()` is called in the renderer process. Calling
9500 * `event.preventDefault()` will prevent the module from being returned. Custom
9501 * value can be returned by setting `event.returnValue`.
9502 *
9503 * @deprecated
9504 */
9505 on(event: 'remote-require', listener: (event: IpcMainEvent,
9506 moduleName: string) => void): this;
9507 once(event: 'remote-require', listener: (event: IpcMainEvent,
9508 moduleName: string) => void): this;
9509 addListener(event: 'remote-require', listener: (event: IpcMainEvent,
9510 moduleName: string) => void): this;
9511 removeListener(event: 'remote-require', listener: (event: IpcMainEvent,
9512 moduleName: string) => void): this;
9513 /**
9514 * Emitted when the renderer process unexpectedly disappears. This is normally
9515 * because it was crashed or killed.
9516 */
9517 on(event: 'render-process-gone', listener: (event: Event,
9518 details: RenderProcessGoneDetails) => void): this;
9519 once(event: 'render-process-gone', listener: (event: Event,
9520 details: RenderProcessGoneDetails) => void): this;
9521 addListener(event: 'render-process-gone', listener: (event: Event,
9522 details: RenderProcessGoneDetails) => void): this;
9523 removeListener(event: 'render-process-gone', listener: (event: Event,
9524 details: RenderProcessGoneDetails) => void): this;
9525 /**
9526 * Emitted when the unresponsive web page becomes responsive again.
9527 */
9528 on(event: 'responsive', listener: Function): this;
9529 once(event: 'responsive', listener: Function): this;
9530 addListener(event: 'responsive', listener: Function): this;
9531 removeListener(event: 'responsive', listener: Function): this;
9532 /**
9533 * Emitted when bluetooth device needs to be selected on call to
9534 * `navigator.bluetooth.requestDevice`. To use `navigator.bluetooth` api
9535 * `webBluetooth` should be enabled. If `event.preventDefault` is not called, first
9536 * available device will be selected. `callback` should be called with `deviceId`
9537 * to be selected, passing empty string to `callback` will cancel the request.
9538 */
9539 on(event: 'select-bluetooth-device', listener: (event: Event,
9540 devices: BluetoothDevice[],
9541 callback: (deviceId: string) => void) => void): this;
9542 once(event: 'select-bluetooth-device', listener: (event: Event,
9543 devices: BluetoothDevice[],
9544 callback: (deviceId: string) => void) => void): this;
9545 addListener(event: 'select-bluetooth-device', listener: (event: Event,
9546 devices: BluetoothDevice[],
9547 callback: (deviceId: string) => void) => void): this;
9548 removeListener(event: 'select-bluetooth-device', listener: (event: Event,
9549 devices: BluetoothDevice[],
9550 callback: (deviceId: string) => void) => void): this;
9551 /**
9552 * Emitted when a client certificate is requested.
9553 *
9554The usage is the same with the `select-client-certificate` event of `app`.
9555 */
9556 on(event: 'select-client-certificate', listener: (event: Event,
9557 url: string,
9558 certificateList: Certificate[],
9559 callback: (certificate: Certificate) => void) => void): this;
9560 once(event: 'select-client-certificate', listener: (event: Event,
9561 url: string,
9562 certificateList: Certificate[],
9563 callback: (certificate: Certificate) => void) => void): this;
9564 addListener(event: 'select-client-certificate', listener: (event: Event,
9565 url: string,
9566 certificateList: Certificate[],
9567 callback: (certificate: Certificate) => void) => void): this;
9568 removeListener(event: 'select-client-certificate', listener: (event: Event,
9569 url: string,
9570 certificateList: Certificate[],
9571 callback: (certificate: Certificate) => void) => void): this;
9572 /**
9573 * Emitted when the web page becomes unresponsive.
9574 */
9575 on(event: 'unresponsive', listener: Function): this;
9576 once(event: 'unresponsive', listener: Function): this;
9577 addListener(event: 'unresponsive', listener: Function): this;
9578 removeListener(event: 'unresponsive', listener: Function): this;
9579 /**
9580 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
9581 */
9582 on(event: 'update-target-url', listener: (event: Event,
9583 url: string) => void): this;
9584 once(event: 'update-target-url', listener: (event: Event,
9585 url: string) => void): this;
9586 addListener(event: 'update-target-url', listener: (event: Event,
9587 url: string) => void): this;
9588 removeListener(event: 'update-target-url', listener: (event: Event,
9589 url: string) => void): this;
9590 /**
9591 * Emitted when a `<webview>`'s web contents is being attached to this web
9592 * contents. Calling `event.preventDefault()` will destroy the guest page.
9593 *
9594 * This event can be used to configure `webPreferences` for the `webContents` of a
9595 * `<webview>` before it's loaded, and provides the ability to set settings that
9596 * can't be set via `<webview>` attributes.
9597 *
9598 * **Note:** The specified `preload` script option will appear as `preloadURL` (not
9599 * `preload`) in the `webPreferences` object emitted with this event.
9600 */
9601 on(event: 'will-attach-webview', listener: (event: Event,
9602 /**
9603 * The web preferences that will be used by the guest page. This object can be
9604 * modified to adjust the preferences for the guest page.
9605 */
9606 webPreferences: WebPreferences,
9607 /**
9608 * The other `<webview>` parameters such as the `src` URL. This object can be
9609 * modified to adjust the parameters of the guest page.
9610 */
9611 params: Record<string, string>) => void): this;
9612 once(event: 'will-attach-webview', listener: (event: Event,
9613 /**
9614 * The web preferences that will be used by the guest page. This object can be
9615 * modified to adjust the preferences for the guest page.
9616 */
9617 webPreferences: WebPreferences,
9618 /**
9619 * The other `<webview>` parameters such as the `src` URL. This object can be
9620 * modified to adjust the parameters of the guest page.
9621 */
9622 params: Record<string, string>) => void): this;
9623 addListener(event: 'will-attach-webview', listener: (event: Event,
9624 /**
9625 * The web preferences that will be used by the guest page. This object can be
9626 * modified to adjust the preferences for the guest page.
9627 */
9628 webPreferences: WebPreferences,
9629 /**
9630 * The other `<webview>` parameters such as the `src` URL. This object can be
9631 * modified to adjust the parameters of the guest page.
9632 */
9633 params: Record<string, string>) => void): this;
9634 removeListener(event: 'will-attach-webview', listener: (event: Event,
9635 /**
9636 * The web preferences that will be used by the guest page. This object can be
9637 * modified to adjust the preferences for the guest page.
9638 */
9639 webPreferences: WebPreferences,
9640 /**
9641 * The other `<webview>` parameters such as the `src` URL. This object can be
9642 * modified to adjust the parameters of the guest page.
9643 */
9644 params: Record<string, string>) => void): this;
9645 /**
9646 * Emitted when a user or the page wants to start navigation. It can happen when
9647 * the `window.location` object is changed or a user clicks a link in the page.
9648 *
9649 * This event will not emit when the navigation is started programmatically with
9650 * APIs like `webContents.loadURL` and `webContents.back`.
9651 *
9652 * It is also not emitted for in-page navigations, such as clicking anchor links or
9653 * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
9654 * purpose.
9655
9656Calling `event.preventDefault()` will prevent the navigation.
9657 */
9658 on(event: 'will-navigate', listener: (event: Event,
9659 url: string) => void): this;
9660 once(event: 'will-navigate', listener: (event: Event,
9661 url: string) => void): this;
9662 addListener(event: 'will-navigate', listener: (event: Event,
9663 url: string) => void): this;
9664 removeListener(event: 'will-navigate', listener: (event: Event,
9665 url: string) => void): this;
9666 /**
9667 * Emitted when a `beforeunload` event handler is attempting to cancel a page
9668 * unload.
9669 *
9670 * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
9671 * and allow the page to be unloaded.
9672 */
9673 on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
9674 once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
9675 addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
9676 removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
9677 /**
9678 * Emitted as a server side redirect occurs during navigation. For example a 302
9679 * redirect.
9680 *
9681 * This event will be emitted after `did-start-navigation` and always before the
9682 * `did-redirect-navigation` event for the same navigation.
9683 *
9684 * Calling `event.preventDefault()` will prevent the navigation (not just the
9685 * redirect).
9686 */
9687 on(event: 'will-redirect', listener: (event: Event,
9688 url: string,
9689 isInPlace: boolean,
9690 isMainFrame: boolean,
9691 frameProcessId: number,
9692 frameRoutingId: number) => void): this;
9693 once(event: 'will-redirect', listener: (event: Event,
9694 url: string,
9695 isInPlace: boolean,
9696 isMainFrame: boolean,
9697 frameProcessId: number,
9698 frameRoutingId: number) => void): this;
9699 addListener(event: 'will-redirect', listener: (event: Event,
9700 url: string,
9701 isInPlace: boolean,
9702 isMainFrame: boolean,
9703 frameProcessId: number,
9704 frameRoutingId: number) => void): this;
9705 removeListener(event: 'will-redirect', listener: (event: Event,
9706 url: string,
9707 isInPlace: boolean,
9708 isMainFrame: boolean,
9709 frameProcessId: number,
9710 frameRoutingId: number) => void): this;
9711 /**
9712 * Emitted when the user is requesting to change the zoom level using the mouse
9713 * wheel.
9714 */
9715 on(event: 'zoom-changed', listener: (event: Event,
9716 /**
9717 * Can be `in` or `out`.
9718 */
9719 zoomDirection: ('in' | 'out')) => void): this;
9720 once(event: 'zoom-changed', listener: (event: Event,
9721 /**
9722 * Can be `in` or `out`.
9723 */
9724 zoomDirection: ('in' | 'out')) => void): this;
9725 addListener(event: 'zoom-changed', listener: (event: Event,
9726 /**
9727 * Can be `in` or `out`.
9728 */
9729 zoomDirection: ('in' | 'out')) => void): this;
9730 removeListener(event: 'zoom-changed', listener: (event: Event,
9731 /**
9732 * Can be `in` or `out`.
9733 */
9734 zoomDirection: ('in' | 'out')) => void): this;
9735 /**
9736 * Adds the specified path to DevTools workspace. Must be used after DevTools
9737 * creation:
9738 */
9739 addWorkSpace(path: string): void;
9740 /**
9741 * Begin subscribing for presentation events and captured frames, the `callback`
9742 * will be called with `callback(image, dirtyRect)` when there is a presentation
9743 * event.
9744 *
9745 * The `image` is an instance of NativeImage that stores the captured frame.
9746 *
9747 * The `dirtyRect` is an object with `x, y, width, height` properties that
9748 * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
9749 * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
9750 */
9751 beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
9752 /**
9753 * Begin subscribing for presentation events and captured frames, the `callback`
9754 * will be called with `callback(image, dirtyRect)` when there is a presentation
9755 * event.
9756 *
9757 * The `image` is an instance of NativeImage that stores the captured frame.
9758 *
9759 * The `dirtyRect` is an object with `x, y, width, height` properties that
9760 * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
9761 * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
9762 */
9763 beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
9764 /**
9765 * Whether the browser can go back to previous web page.
9766 */
9767 canGoBack(): boolean;
9768 /**
9769 * Whether the browser can go forward to next web page.
9770 */
9771 canGoForward(): boolean;
9772 /**
9773 * Whether the web page can go to `offset`.
9774 */
9775 canGoToOffset(offset: number): boolean;
9776 /**
9777 * Resolves with a NativeImage
9778 *
9779 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
9780 * whole visible page.
9781 */
9782 capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
9783 /**
9784 * Clears the navigation history.
9785 */
9786 clearHistory(): void;
9787 /**
9788 * Closes the devtools.
9789 */
9790 closeDevTools(): void;
9791 /**
9792 * Executes the editing command `copy` in web page.
9793 */
9794 copy(): void;
9795 /**
9796 * Copy the image at the given position to the clipboard.
9797 */
9798 copyImageAt(x: number, y: number): void;
9799 /**
9800 * Executes the editing command `cut` in web page.
9801 */
9802 cut(): void;
9803 /**
9804 * Decrease the capturer count by one. The page will be set to hidden or occluded
9805 * state when its browser window is hidden or occluded and the capturer count
9806 * reaches zero. If you want to decrease the hidden capturer count instead you
9807 * should set `stayHidden` to true.
9808 */
9809 decrementCapturerCount(stayHidden?: boolean): void;
9810 /**
9811 * Executes the editing command `delete` in web page.
9812 */
9813 delete(): void;
9814 /**
9815 * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
9816 */
9817 disableDeviceEmulation(): void;
9818 /**
9819 * Initiates a download of the resource at `url` without navigating. The
9820 * `will-download` event of `session` will be triggered.
9821 */
9822 downloadURL(url: string): void;
9823 /**
9824 * Enable device emulation with the given parameters.
9825 */
9826 enableDeviceEmulation(parameters: Parameters): void;
9827 /**
9828 * End subscribing for frame presentation events.
9829 */
9830 endFrameSubscription(): void;
9831 /**
9832 * A promise that resolves with the result of the executed code or is rejected if
9833 * the result of the code is a rejected promise.
9834 *
9835 * Evaluates `code` in page.
9836 *
9837 * In the browser window some HTML APIs like `requestFullScreen` can only be
9838 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
9839 * this limitation.
9840
9841Code execution will be suspended until web page stop loading.
9842 */
9843 executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
9844 /**
9845 * A promise that resolves with the result of the executed code or is rejected if
9846 * the result of the code is a rejected promise.
9847 *
9848Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
9849 */
9850 executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
9851 /**
9852 * The request id used for the request.
9853 *
9854 * Starts a request to find all matches for the `text` in the web page. The result
9855 * of the request can be obtained by subscribing to `found-in-page` event.
9856 */
9857 findInPage(text: string, options?: FindInPageOptions): number;
9858 /**
9859 * Focuses the web page.
9860 */
9861 focus(): void;
9862 /**
9863 * Forcefully terminates the renderer process that is currently hosting this
9864 * `webContents`. This will cause the `render-process-gone` event to be emitted
9865 * with the `reason=killed || reason=crashed`. Please note that some webContents
9866 * share renderer processes and therefore calling this method may also crash the
9867 * host process for other webContents as well.
9868 *
9869 * Calling `reload()` immediately after calling this method will force the reload
9870 * to occur in a new process. This should be used when this process is unstable or
9871 * unusable, for instance in order to recover from the `unresponsive` event.
9872 */
9873 forcefullyCrashRenderer(): void;
9874 /**
9875 * Information about all Shared Workers.
9876 */
9877 getAllSharedWorkers(): SharedWorkerInfo[];
9878 /**
9879 * whether or not this WebContents will throttle animations and timers when the
9880 * page becomes backgrounded. This also affects the Page Visibility API.
9881 */
9882 getBackgroundThrottling(): boolean;
9883 /**
9884 * If *offscreen rendering* is enabled returns the current frame rate.
9885 */
9886 getFrameRate(): number;
9887 /**
9888 * The operating system `pid` of the associated renderer process.
9889 */
9890 getOSProcessId(): number;
9891 /**
9892 * Get the system printer list.
9893 */
9894 getPrinters(): PrinterInfo[];
9895 /**
9896 * The Chromium internal `pid` of the associated renderer. Can be compared to the
9897 * `frameProcessId` passed by frame specific navigation events (e.g.
9898 * `did-frame-navigate`)
9899 */
9900 getProcessId(): number;
9901 /**
9902 * The title of the current web page.
9903 */
9904 getTitle(): string;
9905 /**
9906 * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
9907 * `remote`, `webview` or `offscreen`.
9908 */
9909 getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
9910 /**
9911 * The URL of the current web page.
9912 */
9913 getURL(): string;
9914 /**
9915 * The user agent for this web page.
9916 */
9917 getUserAgent(): string;
9918 /**
9919 * Returns the WebRTC IP Handling Policy.
9920 */
9921 getWebRTCIPHandlingPolicy(): string;
9922 /**
9923 * the current zoom factor.
9924 */
9925 getZoomFactor(): number;
9926 /**
9927 * the current zoom level.
9928 */
9929 getZoomLevel(): number;
9930 /**
9931 * Makes the browser go back a web page.
9932 */
9933 goBack(): void;
9934 /**
9935 * Makes the browser go forward a web page.
9936 */
9937 goForward(): void;
9938 /**
9939 * Navigates browser to the specified absolute web page index.
9940 */
9941 goToIndex(index: number): void;
9942 /**
9943 * Navigates to the specified offset from the "current entry".
9944 */
9945 goToOffset(offset: number): void;
9946 /**
9947 * Increase the capturer count by one. The page is considered visible when its
9948 * browser window is hidden and the capturer count is non-zero. If you would like
9949 * the page to stay hidden, you should ensure that `stayHidden` is set to true.
9950 *
9951This also affects the Page Visibility API.
9952 */
9953 incrementCapturerCount(size?: Size, stayHidden?: boolean): void;
9954 /**
9955 * A promise that resolves with a key for the inserted CSS that can later be used
9956 * to remove the CSS via `contents.removeInsertedCSS(key)`.
9957 *
9958 * Injects CSS into the current web page and returns a unique key for the inserted
9959 * stylesheet.
9960 */
9961 insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
9962 /**
9963 * Inserts `text` to the focused element.
9964 */
9965 insertText(text: string): Promise<void>;
9966 /**
9967 * Starts inspecting element at position (`x`, `y`).
9968 */
9969 inspectElement(x: number, y: number): void;
9970 /**
9971 * Opens the developer tools for the service worker context.
9972 */
9973 inspectServiceWorker(): void;
9974 /**
9975 * Opens the developer tools for the shared worker context.
9976 */
9977 inspectSharedWorker(): void;
9978 /**
9979 * Inspects the shared worker based on its ID.
9980 */
9981 inspectSharedWorkerById(workerId: string): void;
9982 /**
9983 * Schedules a full repaint of the window this web contents is in.
9984 *
9985 * If *offscreen rendering* is enabled invalidates the frame and generates a new
9986 * one through the `'paint'` event.
9987 */
9988 invalidate(): void;
9989 /**
9990 * Whether this page has been muted.
9991 */
9992 isAudioMuted(): boolean;
9993 /**
9994 * Whether this page is being captured. It returns true when the capturer count is
9995 * large then 0.
9996 */
9997 isBeingCaptured(): boolean;
9998 /**
9999 * Whether the renderer process has crashed.
10000 */
10001 isCrashed(): boolean;
10002 /**
10003 * Whether audio is currently playing.
10004 */
10005 isCurrentlyAudible(): boolean;
10006 /**
10007 * Whether the web page is destroyed.
10008 */
10009 isDestroyed(): boolean;
10010 /**
10011 * Whether the devtools view is focused .
10012 */
10013 isDevToolsFocused(): boolean;
10014 /**
10015 * Whether the devtools is opened.
10016 */
10017 isDevToolsOpened(): boolean;
10018 /**
10019 * Whether the web page is focused.
10020 */
10021 isFocused(): boolean;
10022 /**
10023 * Whether web page is still loading resources.
10024 */
10025 isLoading(): boolean;
10026 /**
10027 * Whether the main frame (and not just iframes or frames within it) is still
10028 * loading.
10029 */
10030 isLoadingMainFrame(): boolean;
10031 /**
10032 * Indicates whether *offscreen rendering* is enabled.
10033 */
10034 isOffscreen(): boolean;
10035 /**
10036 * If *offscreen rendering* is enabled returns whether it is currently painting.
10037 */
10038 isPainting(): boolean;
10039 /**
10040 * Whether the web page is waiting for a first-response from the main resource of
10041 * the page.
10042 */
10043 isWaitingForResponse(): boolean;
10044 /**
10045 * the promise will resolve when the page has finished loading (see
10046 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
10047 *
10048 * Loads the given file in the window, `filePath` should be a path to an HTML file
10049 * relative to the root of your application. For instance an app structure like
10050 * this:
10051
10052Would require code like this
10053 */
10054 loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
10055 /**
10056 * the promise will resolve when the page has finished loading (see
10057 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
10058 * A noop rejection handler is already attached, which avoids unhandled rejection
10059 * errors.
10060 *
10061 * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
10062 * the `http://` or `file://`. If the load should bypass http cache then use the
10063 * `pragma` header to achieve it.
10064 */
10065 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
10066 /**
10067 * Opens the devtools.
10068 *
10069 * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
10070 * explicitly passing an empty `mode` can force using last used dock state.
10071 */
10072 openDevTools(options?: OpenDevToolsOptions): void;
10073 /**
10074 * Executes the editing command `paste` in web page.
10075 */
10076 paste(): void;
10077 /**
10078 * Executes the editing command `pasteAndMatchStyle` in web page.
10079 */
10080 pasteAndMatchStyle(): void;
10081 /**
10082 * Send a message to the renderer process, optionally transferring ownership of
10083 * zero or more [`MessagePortMain`][] objects.
10084 *
10085 * The transferred `MessagePortMain` objects will be available in the renderer
10086 * process by accessing the `ports` property of the emitted event. When they arrive
10087 * in the renderer, they will be native DOM `MessagePort` objects.
10088
10089For example:
10090 */
10091 postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
10092 /**
10093 * When a custom `pageSize` is passed, Chromium attempts to validate platform
10094 * specific minimum values for `width_microns` and `height_microns`. Width and
10095 * height must both be minimum 353 microns but may be higher on some operating
10096 * systems.
10097 *
10098 * Prints window's web page. When `silent` is set to `true`, Electron will pick the
10099 * system's default printer if `deviceName` is empty and the default settings for
10100 * printing.
10101 *
10102 * Use `page-break-before: always;` CSS style to force to print to a new page.
10103 *
10104Example usage:
10105 */
10106 print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void;
10107 /**
10108 * Resolves with the generated PDF data.
10109 *
10110 * Prints window's web page as PDF with Chromium's preview printing custom
10111 * settings.
10112 *
10113 * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
10114 *
10115 * By default, an empty `options` will be regarded as:
10116 *
10117 * Use `page-break-before: always; ` CSS style to force to print to a new page.
10118 *
10119An example of `webContents.printToPDF`:
10120 */
10121 printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
10122 /**
10123 * Executes the editing command `redo` in web page.
10124 */
10125 redo(): void;
10126 /**
10127 * Reloads the current web page.
10128 */
10129 reload(): void;
10130 /**
10131 * Reloads current page and ignores cache.
10132 */
10133 reloadIgnoringCache(): void;
10134 /**
10135 * Resolves if the removal was successful.
10136 *
10137 * Removes the inserted CSS from the current web page. The stylesheet is identified
10138 * by its key, which is returned from `contents.insertCSS(css)`.
10139 */
10140 removeInsertedCSS(key: string): Promise<void>;
10141 /**
10142 * Removes the specified path from DevTools workspace.
10143 */
10144 removeWorkSpace(path: string): void;
10145 /**
10146 * Executes the editing command `replace` in web page.
10147 */
10148 replace(text: string): void;
10149 /**
10150 * Executes the editing command `replaceMisspelling` in web page.
10151 */
10152 replaceMisspelling(text: string): void;
10153 /**
10154 * resolves if the page is saved.
10155 */
10156 savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
10157 /**
10158 * Executes the editing command `selectAll` in web page.
10159 */
10160 selectAll(): void;
10161 /**
10162 * Send an asynchronous message to the renderer process via `channel`, along with
10163 * arguments. Arguments will be serialized with the Structured Clone Algorithm,
10164 * just like `postMessage`, so prototype chains will not be included. Sending
10165 * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
10166 *
10167 * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
10168 * Electron objects will throw an exception.
10169 *
10170 * The renderer process can handle the message by listening to `channel` with the
10171 * `ipcRenderer` module.
10172 *
10173An example of sending messages from the main process to the renderer process:
10174 */
10175 send(channel: string, ...args: any[]): void;
10176 /**
10177 * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
10178 * contents needs to be focused for `sendInputEvent()` to work.
10179 */
10180 sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
10181 /**
10182 * Send an asynchronous message to a specific frame in a renderer process via
10183 * `channel`, along with arguments. Arguments will be serialized with the
10184 * Structured Clone Algorithm, just like `postMessage`, so prototype chains will
10185 * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
10186 * will throw an exception.
10187 *
10188 * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
10189 * Electron objects will throw an exception.
10190 *
10191 * The renderer process can handle the message by listening to `channel` with the
10192 * `ipcRenderer` module.
10193 *
10194 * If you want to get the `frameId` of a given renderer context you should use the
10195 * `webFrame.routingId` value. E.g.
10196 *
10197You can also read `frameId` from all incoming IPC messages in the main process.
10198 */
10199 sendToFrame(frameId: (number) | ([number, number]), channel: string, ...args: any[]): void;
10200 /**
10201 * Mute the audio on the current web page.
10202 */
10203 setAudioMuted(muted: boolean): void;
10204 /**
10205 * Controls whether or not this WebContents will throttle animations and timers
10206 * when the page becomes backgrounded. This also affects the Page Visibility API.
10207 */
10208 setBackgroundThrottling(allowed: boolean): void;
10209 /**
10210 * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
10211 *
10212 * The `devToolsWebContents` must not have done any navigation, and it should not
10213 * be used for other purposes after the call.
10214 *
10215 * By default Electron manages the devtools by creating an internal `WebContents`
10216 * with native view, which developers have very limited control of. With the
10217 * `setDevToolsWebContents` method, developers can use any `WebContents` to show
10218 * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
10219 * tag.
10220 *
10221 * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
10222 * caller's responsibility to destroy `devToolsWebContents`.
10223 *
10224 * An example of showing devtools in a `<webview>` tag:
10225 *
10226An example of showing devtools in a `BrowserWindow`:
10227 */
10228 setDevToolsWebContents(devToolsWebContents: WebContents): void;
10229 /**
10230 * If *offscreen rendering* is enabled sets the frame rate to the specified number.
10231 * Only values between 1 and 240 are accepted.
10232 */
10233 setFrameRate(fps: number): void;
10234 /**
10235 * Ignore application menu shortcuts while this web contents is focused.
10236 */
10237 setIgnoreMenuShortcuts(ignore: boolean): void;
10238 /**
10239 * Overrides the user agent for this web page.
10240 */
10241 setUserAgent(userAgent: string): void;
10242 /**
10243 * Sets the maximum and minimum pinch-to-zoom level.
10244 *
10245 * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
10246 * call:
10247 */
10248 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
10249 /**
10250 * Setting the WebRTC IP handling policy allows you to control which IPs are
10251 * exposed via WebRTC. See BrowserLeaks for more details.
10252 */
10253 setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
10254 /**
10255 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
10256 * divided by 100, so 300% = 3.0.
10257
10258The factor must be greater than 0.0.
10259 */
10260 setZoomFactor(factor: number): void;
10261 /**
10262 * Changes the zoom level to the specified level. The original size is 0 and each
10263 * increment above or below represents zooming 20% larger or smaller to default
10264 * limits of 300% and 50% of original size, respectively. The formula for this is
10265 * `scale := 1.2 ^ level`.
10266 */
10267 setZoomLevel(level: number): void;
10268 /**
10269 * Shows pop-up dictionary that searches the selected word on the page.
10270 *
10271 * @platform darwin
10272 */
10273 showDefinitionForSelection(): void;
10274 /**
10275 * Sets the `item` as dragging item for current drag-drop operation, `file` is the
10276 * absolute path of the file to be dragged, and `icon` is the image showing under
10277 * the cursor when dragging.
10278 */
10279 startDrag(item: Item): void;
10280 /**
10281 * If *offscreen rendering* is enabled and not painting, start painting.
10282 */
10283 startPainting(): void;
10284 /**
10285 * Stops any pending navigation.
10286 */
10287 stop(): void;
10288 /**
10289 * Stops any `findInPage` request for the `webContents` with the provided `action`.
10290 */
10291 stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
10292 /**
10293 * If *offscreen rendering* is enabled and painting, stop painting.
10294 */
10295 stopPainting(): void;
10296 /**
10297 * Indicates whether the snapshot has been created successfully.
10298 *
10299Takes a V8 heap snapshot and saves it to `filePath`.
10300 */
10301 takeHeapSnapshot(filePath: string): Promise<void>;
10302 /**
10303 * Toggles the developer tools.
10304 */
10305 toggleDevTools(): void;
10306 /**
10307 * Executes the editing command `undo` in web page.
10308 */
10309 undo(): void;
10310 /**
10311 * Executes the editing command `unselect` in web page.
10312 */
10313 unselect(): void;
10314 audioMuted: boolean;
10315 backgroundThrottling: boolean;
10316 readonly debugger: Debugger;
10317 readonly devToolsWebContents: (WebContents) | (null);
10318 frameRate: number;
10319 readonly hostWebContents: WebContents;
10320 readonly id: number;
10321 readonly session: Session;
10322 userAgent: string;
10323 zoomFactor: number;
10324 zoomLevel: number;
10325 }
10326
10327 interface WebFrame extends NodeJS.EventEmitter {
10328
10329 // Docs: https://electronjs.org/docs/api/web-frame
10330
10331 /**
10332 * Attempts to free memory that is no longer being used (like images from a
10333 * previous navigation).
10334 *
10335 * Note that blindly calling this method probably makes Electron slower since it
10336 * will have to refill these emptied caches, you should only call it if an event in
10337 * your app has occurred that makes you think your page is actually using less
10338 * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
10339 * and intend to stay there).
10340 */
10341 clearCache(): void;
10342 /**
10343 * A promise that resolves with the result of the executed code or is rejected if
10344 * execution throws or results in a rejected promise.
10345 *
10346 * Evaluates `code` in page.
10347 *
10348 * In the browser window some HTML APIs like `requestFullScreen` can only be
10349 * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
10350 * this limitation.
10351 */
10352 executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
10353 /**
10354 * A promise that resolves with the result of the executed code or is rejected if
10355 * execution could not start.
10356 *
10357 * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
10358 *
10359 * Note that when the execution of script fails, the returned promise will not
10360 * reject and the `result` would be `undefined`. This is because Chromium does not
10361 * dispatch errors of isolated worlds to foreign worlds.
10362 */
10363 executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
10364 /**
10365 * A child of `webFrame` with the supplied `name`, `null` would be returned if
10366 * there's no such frame or if the frame is not in the current renderer process.
10367 */
10368 findFrameByName(name: string): WebFrame;
10369 /**
10370 * that has the supplied `routingId`, `null` if not found.
10371 */
10372 findFrameByRoutingId(routingId: number): WebFrame;
10373 /**
10374 * The frame element in `webFrame's` document selected by `selector`, `null` would
10375 * be returned if `selector` does not select a frame or if the frame is not in the
10376 * current renderer process.
10377 */
10378 getFrameForSelector(selector: string): WebFrame;
10379 /**
10380 * * `images` MemoryUsageDetails
10381 * * `scripts` MemoryUsageDetails
10382 * * `cssStyleSheets` MemoryUsageDetails
10383 * * `xslStyleSheets` MemoryUsageDetails
10384 * * `fonts` MemoryUsageDetails
10385 * * `other` MemoryUsageDetails
10386 *
10387 * Returns an object describing usage information of Blink's internal memory
10388 * caches.
10389
10390This will generate:
10391 */
10392 getResourceUsage(): ResourceUsage;
10393 /**
10394 * The current zoom factor.
10395 */
10396 getZoomFactor(): number;
10397 /**
10398 * The current zoom level.
10399 */
10400 getZoomLevel(): number;
10401 /**
10402 * A key for the inserted CSS that can later be used to remove the CSS via
10403 * `webFrame.removeInsertedCSS(key)`.
10404 *
10405 * Injects CSS into the current web page and returns a unique key for the inserted
10406 * stylesheet.
10407 */
10408 insertCSS(css: string): string;
10409 /**
10410 * Inserts `text` to the focused element.
10411 */
10412 insertText(text: string): void;
10413 /**
10414 * Removes the inserted CSS from the current web page. The stylesheet is identified
10415 * by its key, which is returned from `webFrame.insertCSS(css)`.
10416 */
10417 removeInsertedCSS(key: string): void;
10418 /**
10419 * Set the security origin, content security policy and name of the isolated world.
10420 * Note: If the `csp` is specified, then the `securityOrigin` also has to be
10421 * specified.
10422 */
10423 setIsolatedWorldInfo(worldId: number, info: Info): void;
10424 /**
10425 * Sets a provider for spell checking in input fields and text areas.
10426 *
10427 * If you want to use this method you must disable the builtin spellchecker when
10428 * you construct the window.
10429 *
10430 * The `provider` must be an object that has a `spellCheck` method that accepts an
10431 * array of individual words for spellchecking. The `spellCheck` function runs
10432 * asynchronously and calls the `callback` function with an array of misspelt words
10433 * when complete.
10434
10435An example of using node-spellchecker as provider:
10436 */
10437 setSpellCheckProvider(language: string, provider: Provider): void;
10438 /**
10439 * Sets the maximum and minimum pinch-to-zoom level.
10440 *
10441 * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
10442 * call:
10443 */
10444 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
10445 /**
10446 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
10447 * divided by 100, so 300% = 3.0.
10448
10449The factor must be greater than 0.0.
10450 */
10451 setZoomFactor(factor: number): void;
10452 /**
10453 * Changes the zoom level to the specified level. The original size is 0 and each
10454 * increment above or below represents zooming 20% larger or smaller to default
10455 * limits of 300% and 50% of original size, respectively.
10456 */
10457 setZoomLevel(level: number): void;
10458 /**
10459 * A `WebFrame | null` representing the first child frame of `webFrame`, the
10460 * property would be `null` if `webFrame` has no children or if first child is not
10461 * in the current renderer process.
10462 *
10463 */
10464 readonly firstChild: (WebFrame) | (null);
10465 /**
10466 * A `WebFrame | null` representing next sibling frame, the property would be
10467 * `null` if `webFrame` is the last frame in its parent or if the next sibling is
10468 * not in the current renderer process.
10469 *
10470 */
10471 readonly nextSibling: (WebFrame) | (null);
10472 /**
10473 * A `WebFrame | null` representing the frame which opened `webFrame`, the property
10474 * would be `null` if there's no opener or opener is not in the current renderer
10475 * process.
10476 *
10477 */
10478 readonly opener: (WebFrame) | (null);
10479 /**
10480 * A `WebFrame | null` representing parent frame of `webFrame`, the property would
10481 * be `null` if `webFrame` is top or parent is not in the current renderer process.
10482 *
10483 */
10484 readonly parent: (WebFrame) | (null);
10485 /**
10486 * An `Integer` representing the unique frame id in the current renderer process.
10487 * Distinct WebFrame instances that refer to the same underlying frame will have
10488 * the same `routingId`.
10489 *
10490 */
10491 readonly routingId: number;
10492 /**
10493 * A `WebFrame | null` representing top frame in frame hierarchy to which
10494 * `webFrame` belongs, the property would be `null` if top frame is not in the
10495 * current renderer process.
10496 *
10497 */
10498 readonly top: (WebFrame) | (null);
10499 }
10500
10501 class WebRequest {
10502
10503 // Docs: https://electronjs.org/docs/api/web-request
10504
10505 /**
10506 * The `listener` will be called with `listener(details)` when a server initiated
10507 * redirect is about to occur.
10508 */
10509 onBeforeRedirect(filter: Filter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
10510 /**
10511 * The `listener` will be called with `listener(details)` when a server initiated
10512 * redirect is about to occur.
10513 */
10514 onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
10515 /**
10516 * The `listener` will be called with `listener(details, callback)` when a request
10517 * is about to occur.
10518 *
10519 * The `uploadData` is an array of `UploadData` objects.
10520 *
10521 * The `callback` has to be called with an `response` object.
10522 *
10523Some examples of valid `urls`:
10524 */
10525 onBeforeRequest(filter: Filter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
10526 /**
10527 * The `listener` will be called with `listener(details, callback)` when a request
10528 * is about to occur.
10529 *
10530 * The `uploadData` is an array of `UploadData` objects.
10531 *
10532 * The `callback` has to be called with an `response` object.
10533 *
10534Some examples of valid `urls`:
10535 */
10536 onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
10537 /**
10538 * The `listener` will be called with `listener(details, callback)` before sending
10539 * an HTTP request, once the request headers are available. This may occur after a
10540 * TCP connection is made to the server, but before any http data is sent.
10541 *
10542The `callback` has to be called with a `response` object.
10543 */
10544 onBeforeSendHeaders(filter: Filter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
10545 /**
10546 * The `listener` will be called with `listener(details, callback)` before sending
10547 * an HTTP request, once the request headers are available. This may occur after a
10548 * TCP connection is made to the server, but before any http data is sent.
10549 *
10550The `callback` has to be called with a `response` object.
10551 */
10552 onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
10553 /**
10554 * The `listener` will be called with `listener(details)` when a request is
10555 * completed.
10556 */
10557 onCompleted(filter: Filter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
10558 /**
10559 * The `listener` will be called with `listener(details)` when a request is
10560 * completed.
10561 */
10562 onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
10563 /**
10564 * The `listener` will be called with `listener(details)` when an error occurs.
10565 */
10566 onErrorOccurred(filter: Filter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
10567 /**
10568 * The `listener` will be called with `listener(details)` when an error occurs.
10569 */
10570 onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
10571 /**
10572 * The `listener` will be called with `listener(details, callback)` when HTTP
10573 * response headers of a request have been received.
10574 *
10575The `callback` has to be called with a `response` object.
10576 */
10577 onHeadersReceived(filter: Filter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
10578 /**
10579 * The `listener` will be called with `listener(details, callback)` when HTTP
10580 * response headers of a request have been received.
10581 *
10582The `callback` has to be called with a `response` object.
10583 */
10584 onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
10585 /**
10586 * The `listener` will be called with `listener(details)` when first byte of the
10587 * response body is received. For HTTP requests, this means that the status line
10588 * and response headers are available.
10589 */
10590 onResponseStarted(filter: Filter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
10591 /**
10592 * The `listener` will be called with `listener(details)` when first byte of the
10593 * response body is received. For HTTP requests, this means that the status line
10594 * and response headers are available.
10595 */
10596 onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
10597 /**
10598 * The `listener` will be called with `listener(details)` just before a request is
10599 * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
10600 * response are visible by the time this listener is fired.
10601 */
10602 onSendHeaders(filter: Filter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
10603 /**
10604 * The `listener` will be called with `listener(details)` just before a request is
10605 * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
10606 * response are visible by the time this listener is fired.
10607 */
10608 onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
10609 }
10610
10611 interface WebSource {
10612
10613 // Docs: https://electronjs.org/docs/api/structures/web-source
10614
10615 code: string;
10616 /**
10617 * Default is 1.
10618 */
10619 startLine?: number;
10620 url?: string;
10621 }
10622
10623 interface WebviewTag extends HTMLElement {
10624
10625 // Docs: https://electronjs.org/docs/api/webview-tag
10626
10627 /**
10628 * Fired when a load has committed. This includes navigation within the current
10629 * document as well as subframe document-level loads, but does not include
10630 * asynchronous resource loads.
10631 */
10632 addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
10633 removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
10634 /**
10635 * Fired when the navigation is done, i.e. the spinner of the tab will stop
10636 * spinning, and the `onload` event is dispatched.
10637 */
10638 addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this;
10639 removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this;
10640 /**
10641 * This event is like `did-finish-load`, but fired when the load failed or was
10642 * cancelled, e.g. `window.stop()` is invoked.
10643 */
10644 addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
10645 removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
10646 /**
10647 * Fired when a frame has done navigation.
10648 */
10649 addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
10650 removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
10651 /**
10652 * Corresponds to the points in time when the spinner of the tab starts spinning.
10653 */
10654 addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this;
10655 removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this;
10656 /**
10657 * Corresponds to the points in time when the spinner of the tab stops spinning.
10658 */
10659 addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this;
10660 removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this;
10661 /**
10662 * Fired when document in the given frame is loaded.
10663 */
10664 addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this;
10665 removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this;
10666 /**
10667 * Fired when page title is set during navigation. `explicitSet` is false when
10668 * title is synthesized from file url.
10669 */
10670 addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
10671 removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
10672 /**
10673 * Fired when page receives favicon urls.
10674 */
10675 addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
10676 removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
10677 /**
10678 * Fired when page enters fullscreen triggered by HTML API.
10679 */
10680 addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
10681 removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this;
10682 /**
10683 * Fired when page leaves fullscreen triggered by HTML API.
10684 */
10685 addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
10686 removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this;
10687 /**
10688 * Fired when the guest window logs a console message.
10689 *
10690 * The following example code forwards all log messages to the embedder's console
10691 * without regard for log level or other properties.
10692 */
10693 addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
10694 removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
10695 /**
10696 * Fired when a result is available for `webview.findInPage` request.
10697 */
10698 addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
10699 removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
10700 /**
10701 * Fired when the guest page attempts to open a new browser window.
10702 *
10703The following example code opens the new url in system's default browser.
10704 */
10705 addEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void, useCapture?: boolean): this;
10706 removeEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void): this;
10707 /**
10708 * Emitted when a user or the page wants to start navigation. It can happen when
10709 * the `window.location` object is changed or a user clicks a link in the page.
10710 *
10711 * This event will not emit when the navigation is started programmatically with
10712 * APIs like `<webview>.loadURL` and `<webview>.back`.
10713 *
10714 * It is also not emitted during in-page navigation, such as clicking anchor links
10715 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
10716 * this purpose.
10717
10718Calling `event.preventDefault()` does __NOT__ have any effect.
10719 */
10720 addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
10721 removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
10722 /**
10723 * Emitted when a navigation is done.
10724 *
10725 * This event is not emitted for in-page navigations, such as clicking anchor links
10726 * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
10727 * this purpose.
10728 */
10729 addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
10730 removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
10731 /**
10732 * Emitted when an in-page navigation happened.
10733 *
10734 * When in-page navigation happens, the page URL changes but does not cause
10735 * navigation outside of the page. Examples of this occurring are when anchor links
10736 * are clicked or when the DOM `hashchange` event is triggered.
10737 */
10738 addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
10739 removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
10740 /**
10741 * Fired when the guest page attempts to close itself.
10742 *
10743 * The following example code navigates the `webview` to `about:blank` when the
10744 * guest attempts to close itself.
10745 */
10746 addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this;
10747 removeEventListener(event: 'close', listener: (event: Event) => void): this;
10748 /**
10749 * Fired when the guest page has sent an asynchronous message to embedder page.
10750 *
10751 * With `sendToHost` method and `ipc-message` event you can communicate between
10752 * guest page and embedder page:
10753 */
10754 addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
10755 removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
10756 /**
10757 * Fired when the renderer process is crashed.
10758 */
10759 addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this;
10760 removeEventListener(event: 'crashed', listener: (event: Event) => void): this;
10761 /**
10762 * Fired when a plugin process is crashed.
10763 */
10764 addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
10765 removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
10766 /**
10767 * Fired when the WebContents is destroyed.
10768 */
10769 addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this;
10770 removeEventListener(event: 'destroyed', listener: (event: Event) => void): this;
10771 /**
10772 * Emitted when media starts playing.
10773 */
10774 addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this;
10775 removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this;
10776 /**
10777 * Emitted when media is paused or done playing.
10778 */
10779 addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this;
10780 removeEventListener(event: 'media-paused', listener: (event: Event) => void): this;
10781 /**
10782 * Emitted when a page's theme color changes. This is usually due to encountering a
10783 * meta tag:
10784 */
10785 addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
10786 removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
10787 /**
10788 * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
10789 */
10790 addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
10791 removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
10792 /**
10793 * Emitted when DevTools is opened.
10794 */
10795 addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this;
10796 removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this;
10797 /**
10798 * Emitted when DevTools is closed.
10799 */
10800 addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this;
10801 removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this;
10802 /**
10803 * Emitted when DevTools is focused / opened.
10804 */
10805 addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this;
10806 removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this;
10807 addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
10808 addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
10809 removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
10810 removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
10811 /**
10812 * Whether the guest page can go back.
10813 */
10814 canGoBack(): boolean;
10815 /**
10816 * Whether the guest page can go forward.
10817 */
10818 canGoForward(): boolean;
10819 /**
10820 * Whether the guest page can go to `offset`.
10821 */
10822 canGoToOffset(offset: number): boolean;
10823 /**
10824 * Resolves with a NativeImage
10825 *
10826 * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
10827 * whole visible page.
10828 */
10829 capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
10830 /**
10831 * Clears the navigation history.
10832 */
10833 clearHistory(): void;
10834 /**
10835 * Closes the DevTools window of guest page.
10836 */
10837 closeDevTools(): void;
10838 /**
10839 * Executes editing command `copy` in page.
10840 */
10841 copy(): void;
10842 /**
10843 * Executes editing command `cut` in page.
10844 */
10845 cut(): void;
10846 /**
10847 * Executes editing command `delete` in page.
10848 */
10849 delete(): void;
10850 /**
10851 * Initiates a download of the resource at `url` without navigating.
10852 */
10853 downloadURL(url: string): void;
10854 /**
10855 * A promise that resolves with the result of the executed code or is rejected if
10856 * the result of the code is a rejected promise.
10857 *
10858 * Evaluates `code` in page. If `userGesture` is set, it will create the user
10859 * gesture context in the page. HTML APIs like `requestFullScreen`, which require
10860 * user action, can take advantage of this option for automation.
10861 */
10862 executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
10863 /**
10864 * The request id used for the request.
10865 *
10866 * Starts a request to find all matches for the `text` in the web page. The result
10867 * of the request can be obtained by subscribing to `found-in-page` event.
10868 */
10869 findInPage(text: string, options?: FindInPageOptions): number;
10870 /**
10871 * The title of guest page.
10872 */
10873 getTitle(): string;
10874 /**
10875 * The URL of guest page.
10876 */
10877 getURL(): string;
10878 /**
10879 * The user agent for guest page.
10880 */
10881 getUserAgent(): string;
10882 /**
10883 * The WebContents ID of this `webview`.
10884 */
10885 getWebContentsId(): number;
10886 /**
10887 * the current zoom factor.
10888 */
10889 getZoomFactor(): number;
10890 /**
10891 * the current zoom level.
10892 */
10893 getZoomLevel(): number;
10894 /**
10895 * Makes the guest page go back.
10896 */
10897 goBack(): void;
10898 /**
10899 * Makes the guest page go forward.
10900 */
10901 goForward(): void;
10902 /**
10903 * Navigates to the specified absolute index.
10904 */
10905 goToIndex(index: number): void;
10906 /**
10907 * Navigates to the specified offset from the "current entry".
10908 */
10909 goToOffset(offset: number): void;
10910 /**
10911 * A promise that resolves with a key for the inserted CSS that can later be used
10912 * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
10913 *
10914 * Injects CSS into the current web page and returns a unique key for the inserted
10915 * stylesheet.
10916 */
10917 insertCSS(css: string): Promise<string>;
10918 /**
10919 * Inserts `text` to the focused element.
10920 */
10921 insertText(text: string): Promise<void>;
10922 /**
10923 * Starts inspecting element at position (`x`, `y`) of guest page.
10924 */
10925 inspectElement(x: number, y: number): void;
10926 /**
10927 * Opens the DevTools for the service worker context present in the guest page.
10928 */
10929 inspectServiceWorker(): void;
10930 /**
10931 * Opens the DevTools for the shared worker context present in the guest page.
10932 */
10933 inspectSharedWorker(): void;
10934 /**
10935 * Whether guest page has been muted.
10936 */
10937 isAudioMuted(): boolean;
10938 /**
10939 * Whether the renderer process has crashed.
10940 */
10941 isCrashed(): boolean;
10942 /**
10943 * Whether audio is currently playing.
10944 */
10945 isCurrentlyAudible(): boolean;
10946 /**
10947 * Whether DevTools window of guest page is focused.
10948 */
10949 isDevToolsFocused(): boolean;
10950 /**
10951 * Whether guest page has a DevTools window attached.
10952 */
10953 isDevToolsOpened(): boolean;
10954 /**
10955 * Whether guest page is still loading resources.
10956 */
10957 isLoading(): boolean;
10958 /**
10959 * Whether the main frame (and not just iframes or frames within it) is still
10960 * loading.
10961 */
10962 isLoadingMainFrame(): boolean;
10963 /**
10964 * Whether the guest page is waiting for a first-response for the main resource of
10965 * the page.
10966 */
10967 isWaitingForResponse(): boolean;
10968 /**
10969 * The promise will resolve when the page has finished loading (see
10970 * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
10971 *
10972 * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
10973 * the `http://` or `file://`.
10974 */
10975 loadURL(url: string, options?: LoadURLOptions): Promise<void>;
10976 /**
10977 * Opens a DevTools window for guest page.
10978 */
10979 openDevTools(): void;
10980 /**
10981 * Executes editing command `paste` in page.
10982 */
10983 paste(): void;
10984 /**
10985 * Executes editing command `pasteAndMatchStyle` in page.
10986 */
10987 pasteAndMatchStyle(): void;
10988 /**
10989 * Prints `webview`'s web page. Same as `webContents.print([options])`.
10990 */
10991 print(options?: WebviewTagPrintOptions): Promise<void>;
10992 /**
10993 * Resolves with the generated PDF data.
10994 *
10995Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
10996 */
10997 printToPDF(options: PrintToPDFOptions): Promise<Uint8Array>;
10998 /**
10999 * Executes editing command `redo` in page.
11000 */
11001 redo(): void;
11002 /**
11003 * Reloads the guest page.
11004 */
11005 reload(): void;
11006 /**
11007 * Reloads the guest page and ignores cache.
11008 */
11009 reloadIgnoringCache(): void;
11010 /**
11011 * Resolves if the removal was successful.
11012 *
11013 * Removes the inserted CSS from the current web page. The stylesheet is identified
11014 * by its key, which is returned from `<webview>.insertCSS(css)`.
11015 */
11016 removeInsertedCSS(key: string): Promise<void>;
11017 /**
11018 * Executes editing command `replace` in page.
11019 */
11020 replace(text: string): void;
11021 /**
11022 * Executes editing command `replaceMisspelling` in page.
11023 */
11024 replaceMisspelling(text: string): void;
11025 /**
11026 * Executes editing command `selectAll` in page.
11027 */
11028 selectAll(): void;
11029 /**
11030 * Send an asynchronous message to renderer process via `channel`, you can also
11031 * send arbitrary arguments. The renderer process can handle the message by
11032 * listening to the `channel` event with the `ipcRenderer` module.
11033 *
11034See webContents.send for examples.
11035 */
11036 send(channel: string, ...args: any[]): Promise<void>;
11037 /**
11038 * Sends an input `event` to the page.
11039 *
11040See webContents.sendInputEvent for detailed description of `event` object.
11041 */
11042 sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
11043 /**
11044 * Set guest page muted.
11045 */
11046 setAudioMuted(muted: boolean): void;
11047 /**
11048 * Overrides the user agent for the guest page.
11049 */
11050 setUserAgent(userAgent: string): void;
11051 /**
11052 * Sets the maximum and minimum pinch-to-zoom level.
11053 */
11054 setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
11055 /**
11056 * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
11057 * divided by 100, so 300% = 3.0.
11058 */
11059 setZoomFactor(factor: number): void;
11060 /**
11061 * Changes the zoom level to the specified level. The original size is 0 and each
11062 * increment above or below represents zooming 20% larger or smaller to default
11063 * limits of 300% and 50% of original size, respectively. The formula for this is
11064 * `scale := 1.2 ^ level`.
11065 */
11066 setZoomLevel(level: number): void;
11067 /**
11068 * Shows pop-up dictionary that searches the selected word on the page.
11069 *
11070 * @platform darwin
11071 */
11072 showDefinitionForSelection(): void;
11073 /**
11074 * Stops any pending navigation.
11075 */
11076 stop(): void;
11077 /**
11078 * Stops any `findInPage` request for the `webview` with the provided `action`.
11079 */
11080 stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
11081 /**
11082 * Executes editing command `undo` in page.
11083 */
11084 undo(): void;
11085 /**
11086 * Executes editing command `unselect` in page.
11087 */
11088 unselect(): void;
11089 /**
11090 * A `Boolean`. When this attribute is present the guest page will be allowed to
11091 * open new windows. Popups are disabled by default.
11092 */
11093 allowpopups: boolean;
11094 /**
11095 * A `String` which is a list of strings which specifies the blink features to be
11096 * disabled separated by `,`. The full list of supported feature strings can be
11097 * found in the RuntimeEnabledFeatures.json5 file.
11098 */
11099 disableblinkfeatures: string;
11100 /**
11101 * A `Boolean`. When this attribute is present the guest page will have web
11102 * security disabled. Web security is enabled by default.
11103 */
11104 disablewebsecurity: boolean;
11105 /**
11106 * A `String` which is a list of strings which specifies the blink features to be
11107 * enabled separated by `,`. The full list of supported feature strings can be
11108 * found in the RuntimeEnabledFeatures.json5 file.
11109 */
11110 enableblinkfeatures: string;
11111 /**
11112 * A `Boolean`. When this attribute is `false` the guest page in `webview` will not
11113 * have access to the `remote` module. The remote module is unavailable by default.
11114 */
11115 enableremotemodule: boolean;
11116 /**
11117 * A `String` that sets the referrer URL for the guest page.
11118 */
11119 httpreferrer: string;
11120 /**
11121 * A `Boolean`. When this attribute is present the guest page in `webview` will
11122 * have node integration and can use node APIs like `require` and `process` to
11123 * access low level system resources. Node integration is disabled by default in
11124 * the guest page.
11125 */
11126 nodeintegration: boolean;
11127 /**
11128 * A `Boolean` for the experimental option for enabling NodeJS support in
11129 * sub-frames such as iframes inside the `webview`. All your preloads will load for
11130 * every iframe, you can use `process.isMainFrame` to determine if you are in the
11131 * main frame or not. This option is disabled by default in the guest page.
11132 */
11133 nodeintegrationinsubframes: boolean;
11134 /**
11135 * A `String` that sets the session used by the page. If `partition` starts with
11136 * `persist:`, the page will use a persistent session available to all pages in the
11137 * app with the same `partition`. if there is no `persist:` prefix, the page will
11138 * use an in-memory session. By assigning the same `partition`, multiple pages can
11139 * share the same session. If the `partition` is unset then default session of the
11140 * app will be used.
11141 *
11142 * This value can only be modified before the first navigation, since the session
11143 * of an active renderer process cannot change. Subsequent attempts to modify the
11144 * value will fail with a DOM exception.
11145 */
11146 partition: string;
11147 /**
11148 * A `Boolean`. When this attribute is present the guest page in `webview` will be
11149 * able to use browser plugins. Plugins are disabled by default.
11150 */
11151 plugins: boolean;
11152 /**
11153 * A `String` that specifies a script that will be loaded before other scripts run
11154 * in the guest page. The protocol of script's URL must be either `file:` or
11155 * `asar:`, because it will be loaded by `require` in guest page under the hood.
11156 *
11157 * When the guest page doesn't have node integration this script will still have
11158 * access to all Node APIs, but global objects injected by Node will be deleted
11159 * after this script has finished executing.
11160 *
11161 * **Note:** This option will appear as `preloadURL` (not `preload`) in the
11162 * `webPreferences` specified to the `will-attach-webview` event.
11163 */
11164 preload: string;
11165 /**
11166 * A `String` representing the visible URL. Writing to this attribute initiates
11167 * top-level navigation.
11168 *
11169 * Assigning `src` its own value will reload the current page.
11170 *
11171 * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
11172 * world!`.
11173 */
11174 src: string;
11175 /**
11176 * A `String` that sets the user agent for the guest page before the page is
11177 * navigated to. Once the page is loaded, use the `setUserAgent` method to change
11178 * the user agent.
11179 */
11180 useragent: string;
11181 /**
11182 * A `String` which is a comma separated list of strings which specifies the web
11183 * preferences to be set on the webview. The full list of supported preference
11184 * strings can be found in BrowserWindow.
11185 *
11186 * The string follows the same format as the features string in `window.open`. A
11187 * name by itself is given a `true` boolean value. A preference can be set to
11188 * another value by including an `=`, followed by the value. Special values `yes`
11189 * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
11190 * `false`.
11191 */
11192 webpreferences: string;
11193 }
11194
11195 interface AboutPanelOptionsOptions {
11196 /**
11197 * The app's name.
11198 */
11199 applicationName?: string;
11200 /**
11201 * The app's version.
11202 */
11203 applicationVersion?: string;
11204 /**
11205 * Copyright information.
11206 */
11207 copyright?: string;
11208 /**
11209 * The app's build version number.
11210 *
11211 * @platform darwin
11212 */
11213 version?: string;
11214 /**
11215 * Credit information.
11216 *
11217 * @platform darwin,win32
11218 */
11219 credits?: string;
11220 /**
11221 * List of app authors.
11222 *
11223 * @platform linux
11224 */
11225 authors?: string[];
11226 /**
11227 * The app's website.
11228 *
11229 * @platform linux
11230 */
11231 website?: string;
11232 /**
11233 * Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as
11234 * 64x64 pixels while retaining aspect ratio.
11235 *
11236 * @platform linux,win32
11237 */
11238 iconPath?: string;
11239 }
11240
11241 interface AddRepresentationOptions {
11242 /**
11243 * The scale factor to add the image representation for.
11244 */
11245 scaleFactor: number;
11246 /**
11247 * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
11248 */
11249 width?: number;
11250 /**
11251 * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
11252 */
11253 height?: number;
11254 /**
11255 * The buffer containing the raw image data.
11256 */
11257 buffer?: Buffer;
11258 /**
11259 * The data URL containing either a base 64 encoded PNG or JPEG image.
11260 */
11261 dataURL?: string;
11262 }
11263
11264 interface AnimationSettings {
11265 /**
11266 * Returns true if rich animations should be rendered. Looks at session type (e.g.
11267 * remote desktop) and accessibility settings to give guidance for heavy
11268 * animations.
11269 */
11270 shouldRenderRichAnimation: boolean;
11271 /**
11272 * Determines on a per-platform basis whether scroll animations (e.g. produced by
11273 * home/end key) should be enabled.
11274 */
11275 scrollAnimationsEnabledBySystem: boolean;
11276 /**
11277 * Determines whether the user desires reduced motion based on platform APIs.
11278 */
11279 prefersReducedMotion: boolean;
11280 }
11281
11282 interface AppDetailsOptions {
11283 /**
11284 * Window's App User Model ID. It has to be set, otherwise the other options will
11285 * have no effect.
11286 */
11287 appId?: string;
11288 /**
11289 * Window's Relaunch Icon.
11290 */
11291 appIconPath?: string;
11292 /**
11293 * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
11294 * Default is `0`.
11295 */
11296 appIconIndex?: number;
11297 /**
11298 * Window's Relaunch Command.
11299 */
11300 relaunchCommand?: string;
11301 /**
11302 * Window's Relaunch Display Name.
11303 */
11304 relaunchDisplayName?: string;
11305 }
11306
11307 interface ApplicationInfoForProtocolReturnValue {
11308 /**
11309 * the display icon of the app handling the protocol.
11310 */
11311 icon: NativeImage;
11312 /**
11313 * installation path of the app handling the protocol.
11314 */
11315 path: string;
11316 /**
11317 * display name of the app handling the protocol.
11318 */
11319 name: string;
11320 }
11321
11322 interface AuthenticationResponseDetails {
11323 url: string;
11324 }
11325
11326 interface AuthInfo {
11327 isProxy: boolean;
11328 scheme: string;
11329 host: string;
11330 port: number;
11331 realm: string;
11332 }
11333
11334 interface AutoResizeOptions {
11335 /**
11336 * If `true`, the view's width will grow and shrink together with the window.
11337 * `false` by default.
11338 */
11339 width?: boolean;
11340 /**
11341 * If `true`, the view's height will grow and shrink together with the window.
11342 * `false` by default.
11343 */
11344 height?: boolean;
11345 /**
11346 * If `true`, the view's x position and width will grow and shrink proportionally
11347 * with the window. `false` by default.
11348 */
11349 horizontal?: boolean;
11350 /**
11351 * If `true`, the view's y position and height will grow and shrink proportionally
11352 * with the window. `false` by default.
11353 */
11354 vertical?: boolean;
11355 }
11356
11357 interface BeforeSendResponse {
11358 cancel?: boolean;
11359 /**
11360 * When provided, request will be made with these headers.
11361 */
11362 requestHeaders?: Record<string, (string) | (string[])>;
11363 }
11364
11365 interface BitmapOptions {
11366 /**
11367 * Defaults to 1.0.
11368 */
11369 scaleFactor?: number;
11370 }
11371
11372 interface BlinkMemoryInfo {
11373 /**
11374 * Size of all allocated objects in Kilobytes.
11375 */
11376 allocated: number;
11377 /**
11378 * Size of all marked objects in Kilobytes.
11379 */
11380 marked: number;
11381 /**
11382 * Total allocated space in Kilobytes.
11383 */
11384 total: number;
11385 }
11386
11387 interface BrowserViewConstructorOptions {
11388 /**
11389 * See BrowserWindow.
11390 */
11391 webPreferences?: WebPreferences;
11392 }
11393
11394 interface BrowserWindowConstructorOptions {
11395 /**
11396 * Window's width in pixels. Default is `800`.
11397 */
11398 width?: number;
11399 /**
11400 * Window's height in pixels. Default is `600`.
11401 */
11402 height?: number;
11403 /**
11404 * (**required** if y is used) Window's left offset from screen. Default is to
11405 * center the window.
11406 */
11407 x?: number;
11408 /**
11409 * (**required** if x is used) Window's top offset from screen. Default is to
11410 * center the window.
11411 */
11412 y?: number;
11413 /**
11414 * The `width` and `height` would be used as web page's size, which means the
11415 * actual window's size will include window frame's size and be slightly larger.
11416 * Default is `false`.
11417 */
11418 useContentSize?: boolean;
11419 /**
11420 * Show window in the center of the screen.
11421 */
11422 center?: boolean;
11423 /**
11424 * Window's minimum width. Default is `0`.
11425 */
11426 minWidth?: number;
11427 /**
11428 * Window's minimum height. Default is `0`.
11429 */
11430 minHeight?: number;
11431 /**
11432 * Window's maximum width. Default is no limit.
11433 */
11434 maxWidth?: number;
11435 /**
11436 * Window's maximum height. Default is no limit.
11437 */
11438 maxHeight?: number;
11439 /**
11440 * Whether window is resizable. Default is `true`.
11441 */
11442 resizable?: boolean;
11443 /**
11444 * Whether window is movable. This is not implemented on Linux. Default is `true`.
11445 */
11446 movable?: boolean;
11447 /**
11448 * Whether window is minimizable. This is not implemented on Linux. Default is
11449 * `true`.
11450 */
11451 minimizable?: boolean;
11452 /**
11453 * Whether window is maximizable. This is not implemented on Linux. Default is
11454 * `true`.
11455 */
11456 maximizable?: boolean;
11457 /**
11458 * Whether window is closable. This is not implemented on Linux. Default is `true`.
11459 */
11460 closable?: boolean;
11461 /**
11462 * Whether the window can be focused. Default is `true`. On Windows setting
11463 * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
11464 * `focusable: false` makes the window stop interacting with wm, so the window will
11465 * always stay on top in all workspaces.
11466 */
11467 focusable?: boolean;
11468 /**
11469 * Whether the window should always stay on top of other windows. Default is
11470 * `false`.
11471 */
11472 alwaysOnTop?: boolean;
11473 /**
11474 * Whether the window should show in fullscreen. When explicitly set to `false` the
11475 * fullscreen button will be hidden or disabled on macOS. Default is `false`.
11476 */
11477 fullscreen?: boolean;
11478 /**
11479 * Whether the window can be put into fullscreen mode. On macOS, also whether the
11480 * maximize/zoom button should toggle full screen mode or maximize window. Default
11481 * is `true`.
11482 */
11483 fullscreenable?: boolean;
11484 /**
11485 * Use pre-Lion fullscreen on macOS. Default is `false`.
11486 */
11487 simpleFullscreen?: boolean;
11488 /**
11489 * Whether to show the window in taskbar. Default is `false`.
11490 */
11491 skipTaskbar?: boolean;
11492 /**
11493 * Whether the window is in kiosk mode. Default is `false`.
11494 */
11495 kiosk?: boolean;
11496 /**
11497 * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
11498 * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
11499 */
11500 title?: string;
11501 /**
11502 * The window icon. On Windows it is recommended to use `ICO` icons to get best
11503 * visual effects, you can also leave it undefined so the executable's icon will be
11504 * used.
11505 */
11506 icon?: (NativeImage) | (string);
11507 /**
11508 * Whether window should be shown when created. Default is `true`.
11509 */
11510 show?: boolean;
11511 /**
11512 * Whether the renderer should be active when `show` is `false` and it has just
11513 * been created. In order for `document.visibilityState` to work correctly on
11514 * first load with `show: false` you should set this to `false`. Setting this to
11515 * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
11516 */
11517 paintWhenInitiallyHidden?: boolean;
11518 /**
11519 * Specify `false` to create a Frameless Window. Default is `true`.
11520 */
11521 frame?: boolean;
11522 /**
11523 * Specify parent window. Default is `null`.
11524 */
11525 parent?: BrowserWindow;
11526 /**
11527 * Whether this is a modal window. This only works when the window is a child
11528 * window. Default is `false`.
11529 */
11530 modal?: boolean;
11531 /**
11532 * Whether the web view accepts a single mouse-down event that simultaneously
11533 * activates the window. Default is `false`.
11534 */
11535 acceptFirstMouse?: boolean;
11536 /**
11537 * Whether to hide cursor when typing. Default is `false`.
11538 */
11539 disableAutoHideCursor?: boolean;
11540 /**
11541 * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
11542 */
11543 autoHideMenuBar?: boolean;
11544 /**
11545 * Enable the window to be resized larger than screen. Only relevant for macOS, as
11546 * other OSes allow larger-than-screen windows by default. Default is `false`.
11547 */
11548 enableLargerThanScreen?: boolean;
11549 /**
11550 * Window's background color as a hexadecimal value, like `#66CD00` or `#FFF` or
11551 * `#80FFFFFF` (alpha in #AARRGGBB format is supported if `transparent` is set to
11552 * `true`). Default is `#FFF` (white).
11553 */
11554 backgroundColor?: string;
11555 /**
11556 * Whether window should have a shadow. Default is `true`.
11557 */
11558 hasShadow?: boolean;
11559 /**
11560 * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
11561 * (fully opaque). This is only implemented on Windows and macOS.
11562 */
11563 opacity?: number;
11564 /**
11565 * Forces using dark theme for the window, only works on some GTK+3 desktop
11566 * environments. Default is `false`.
11567 */
11568 darkTheme?: boolean;
11569 /**
11570 * Makes the window transparent. Default is `false`. On Windows, does not work
11571 * unless the window is frameless.
11572 */
11573 transparent?: boolean;
11574 /**
11575 * The type of window, default is normal window. See more about this below.
11576 */
11577 type?: string;
11578 /**
11579 * Specify how the material appearance should reflect window activity state on
11580 * macOS. Must be used with the `vibrancy` property. Possible values are:
11581 */
11582 visualEffectState?: ('followWindow' | 'active' | 'inactive');
11583 /**
11584 * The style of window title bar. Default is `default`. Possible values are:
11585 */
11586 titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
11587 /**
11588 * Set a custom position for the traffic light buttons. Can only be used with
11589 * `titleBarStyle` set to `hidden`
11590 */
11591 trafficLightPosition?: Point;
11592 /**
11593 * Shows the title in the title bar in full screen mode on macOS for all
11594 * `titleBarStyle` options. Default is `false`.
11595 */
11596 fullscreenWindowTitle?: boolean;
11597 /**
11598 * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
11599 * window frame. Setting it to `false` will remove window shadow and window
11600 * animations. Default is `true`.
11601 */
11602 thickFrame?: boolean;
11603 /**
11604 * Add a type of vibrancy effect to the window, only on macOS. Can be
11605 * `appearance-based`, `light`, `dark`, `titlebar`, `selection`, `menu`, `popover`,
11606 * `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`,
11607 * `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please
11608 * note that using `frame: false` in combination with a vibrancy value requires
11609 * that you use a non-default `titleBarStyle` as well. Also note that
11610 * `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` have been
11611 * deprecated and will be removed in an upcoming version of macOS.
11612 */
11613 vibrancy?: ('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page');
11614 /**
11615 * Controls the behavior on macOS when option-clicking the green stoplight button
11616 * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
11617 * will grow to the preferred width of the web page when zoomed, `false` will cause
11618 * it to zoom to the width of the screen. This will also affect the behavior when
11619 * calling `maximize()` directly. Default is `false`.
11620 */
11621 zoomToPageWidth?: boolean;
11622 /**
11623 * Tab group name, allows opening the window as a native tab on macOS 10.12+.
11624 * Windows with the same tabbing identifier will be grouped together. This also
11625 * adds a native new tab button to your window's tab bar and allows your `app` and
11626 * window to receive the `new-window-for-tab` event.
11627 */
11628 tabbingIdentifier?: string;
11629 /**
11630 * Settings of web page's features.
11631 */
11632 webPreferences?: WebPreferences;
11633 }
11634
11635 interface CertificateTrustDialogOptions {
11636 /**
11637 * The certificate to trust/import.
11638 */
11639 certificate: Certificate;
11640 /**
11641 * The message to display to the user.
11642 */
11643 message: string;
11644 }
11645
11646 interface ClearStorageDataOptions {
11647 /**
11648 * Should follow `window.location.origin`’s representation `scheme://host:port`.
11649 */
11650 origin?: string;
11651 /**
11652 * The types of storages to clear, can contain: `appcache`, `cookies`,
11653 * `filesystem`, `indexdb`, `localstorage`, `shadercache`, `websql`,
11654 * `serviceworkers`, `cachestorage`. If not specified, clear all storage types.
11655 */
11656 storages?: string[];
11657 /**
11658 * The types of quotas to clear, can contain: `temporary`, `persistent`,
11659 * `syncable`. If not specified, clear all quotas.
11660 */
11661 quotas?: string[];
11662 }
11663
11664 interface ClientRequestConstructorOptions {
11665 /**
11666 * The HTTP request method. Defaults to the GET method.
11667 */
11668 method?: string;
11669 /**
11670 * The request URL. Must be provided in the absolute form with the protocol scheme
11671 * specified as http or https.
11672 */
11673 url?: string;
11674 /**
11675 * The `Session` instance with which the request is associated.
11676 */
11677 session?: Session;
11678 /**
11679 * The name of the `partition` with which the request is associated. Defaults to
11680 * the empty string. The `session` option prevails on `partition`. Thus if a
11681 * `session` is explicitly specified, `partition` is ignored.
11682 */
11683 partition?: string;
11684 /**
11685 * Whether to send cookies with this request from the provided session. This will
11686 * make the `net` request's cookie behavior match a `fetch` request. Default is
11687 * `false`.
11688 */
11689 useSessionCookies?: boolean;
11690 /**
11691 * The protocol scheme in the form 'scheme:'. Currently supported values are
11692 * 'http:' or 'https:'. Defaults to 'http:'.
11693 */
11694 protocol?: string;
11695 /**
11696 * The server host provided as a concatenation of the hostname and the port number
11697 * 'hostname:port'.
11698 */
11699 host?: string;
11700 /**
11701 * The server host name.
11702 */
11703 hostname?: string;
11704 /**
11705 * The server's listening port number.
11706 */
11707 port?: number;
11708 /**
11709 * The path part of the request URL.
11710 */
11711 path?: string;
11712 /**
11713 * The redirect mode for this request. Should be one of `follow`, `error` or
11714 * `manual`. Defaults to `follow`. When mode is `error`, any redirection will be
11715 * aborted. When mode is `manual` the redirection will be cancelled unless
11716 * `request.followRedirect` is invoked synchronously during the `redirect` event.
11717 */
11718 redirect?: string;
11719 }
11720
11721 interface Config {
11722 /**
11723 * The URL associated with the PAC file.
11724 */
11725 pacScript?: string;
11726 /**
11727 * Rules indicating which proxies to use.
11728 */
11729 proxyRules?: string;
11730 /**
11731 * Rules indicating which URLs should bypass the proxy settings.
11732 */
11733 proxyBypassRules?: string;
11734 }
11735
11736 interface ConsoleMessageEvent extends Event {
11737 /**
11738 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
11739 * `error`.
11740 */
11741 level: number;
11742 /**
11743 * The actual console message
11744 */
11745 message: string;
11746 /**
11747 * The line number of the source that triggered this console message
11748 */
11749 line: number;
11750 sourceId: string;
11751 }
11752
11753 interface ContextMenuParams {
11754 /**
11755 * x coordinate.
11756 */
11757 x: number;
11758 /**
11759 * y coordinate.
11760 */
11761 y: number;
11762 /**
11763 * URL of the link that encloses the node the context menu was invoked on.
11764 */
11765 linkURL: string;
11766 /**
11767 * Text associated with the link. May be an empty string if the contents of the
11768 * link are an image.
11769 */
11770 linkText: string;
11771 /**
11772 * URL of the top level page that the context menu was invoked on.
11773 */
11774 pageURL: string;
11775 /**
11776 * URL of the subframe that the context menu was invoked on.
11777 */
11778 frameURL: string;
11779 /**
11780 * Source URL for the element that the context menu was invoked on. Elements with
11781 * source URLs are images, audio and video.
11782 */
11783 srcURL: string;
11784 /**
11785 * Type of the node the context menu was invoked on. Can be `none`, `image`,
11786 * `audio`, `video`, `canvas`, `file` or `plugin`.
11787 */
11788 mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
11789 /**
11790 * Whether the context menu was invoked on an image which has non-empty contents.
11791 */
11792 hasImageContents: boolean;
11793 /**
11794 * Whether the context is editable.
11795 */
11796 isEditable: boolean;
11797 /**
11798 * Text of the selection that the context menu was invoked on.
11799 */
11800 selectionText: string;
11801 /**
11802 * Title or alt text of the selection that the context was invoked on.
11803 */
11804 titleText: string;
11805 /**
11806 * The misspelled word under the cursor, if any.
11807 */
11808 misspelledWord: string;
11809 /**
11810 * An array of suggested words to show the user to replace the `misspelledWord`.
11811 * Only available if there is a misspelled word and spellchecker is enabled.
11812 */
11813 dictionarySuggestions: string[];
11814 /**
11815 * The character encoding of the frame on which the menu was invoked.
11816 */
11817 frameCharset: string;
11818 /**
11819 * If the context menu was invoked on an input field, the type of that field.
11820 * Possible values are `none`, `plainText`, `password`, `other`.
11821 */
11822 inputFieldType: string;
11823 /**
11824 * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
11825 * `touch` or `touchMenu`.
11826 */
11827 menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu');
11828 /**
11829 * The flags for the media element the context menu was invoked on.
11830 */
11831 mediaFlags: MediaFlags;
11832 /**
11833 * These flags indicate whether the renderer believes it is able to perform the
11834 * corresponding action.
11835 */
11836 editFlags: EditFlags;
11837 }
11838
11839 interface CookiesGetFilter {
11840 /**
11841 * Retrieves cookies which are associated with `url`. Empty implies retrieving
11842 * cookies of all URLs.
11843 */
11844 url?: string;
11845 /**
11846 * Filters cookies by name.
11847 */
11848 name?: string;
11849 /**
11850 * Retrieves cookies whose domains match or are subdomains of `domains`.
11851 */
11852 domain?: string;
11853 /**
11854 * Retrieves cookies whose path matches `path`.
11855 */
11856 path?: string;
11857 /**
11858 * Filters cookies by their Secure property.
11859 */
11860 secure?: boolean;
11861 /**
11862 * Filters out session or persistent cookies.
11863 */
11864 session?: boolean;
11865 }
11866
11867 interface CookiesSetDetails {
11868 /**
11869 * The URL to associate the cookie with. The promise will be rejected if the URL is
11870 * invalid.
11871 */
11872 url: string;
11873 /**
11874 * The name of the cookie. Empty by default if omitted.
11875 */
11876 name?: string;
11877 /**
11878 * The value of the cookie. Empty by default if omitted.
11879 */
11880 value?: string;
11881 /**
11882 * The domain of the cookie; this will be normalized with a preceding dot so that
11883 * it's also valid for subdomains. Empty by default if omitted.
11884 */
11885 domain?: string;
11886 /**
11887 * The path of the cookie. Empty by default if omitted.
11888 */
11889 path?: string;
11890 /**
11891 * Whether the cookie should be marked as Secure. Defaults to false.
11892 */
11893 secure?: boolean;
11894 /**
11895 * Whether the cookie should be marked as HTTP only. Defaults to false.
11896 */
11897 httpOnly?: boolean;
11898 /**
11899 * The expiration date of the cookie as the number of seconds since the UNIX epoch.
11900 * If omitted then the cookie becomes a session cookie and will not be retained
11901 * between sessions.
11902 */
11903 expirationDate?: number;
11904 /**
11905 * The Same Site policy to apply to this cookie. Can be `unspecified`,
11906 * `no_restriction`, `lax` or `strict`. Default is `no_restriction`.
11907 */
11908 sameSite?: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
11909 }
11910
11911 interface CrashReporterStartOptions {
11912 /**
11913 * URL that crash reports will be sent to as POST.
11914 */
11915 submitURL: string;
11916 /**
11917 * Defaults to `app.name`.
11918 */
11919 productName?: string;
11920 /**
11921 * Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
11922 *
11923 * @deprecated
11924 */
11925 companyName?: string;
11926 /**
11927 * Whether crash reports should be sent to the server. If false, crash reports will
11928 * be collected and stored in the crashes directory, but not uploaded. Default is
11929 * `true`.
11930 */
11931 uploadToServer?: boolean;
11932 /**
11933 * If true, crashes generated in the main process will not be forwarded to the
11934 * system crash handler. Default is `false`.
11935 */
11936 ignoreSystemCrashHandler?: boolean;
11937 /**
11938 * If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
11939 *
11940 * @platform darwin,win32
11941 */
11942 rateLimit?: boolean;
11943 /**
11944 * If true, crash reports will be compressed and uploaded with `Content-Encoding:
11945 * gzip`. Default is `false`.
11946 */
11947 compress?: boolean;
11948 /**
11949 * Extra string key/value annotations that will be sent along with crash reports
11950 * that are generated in the main process. Only string values are supported.
11951 * Crashes generated in child processes will not contain these extra parameters to
11952 * crash reports generated from child processes, call `addExtraParameter` from the
11953 * child process.
11954 */
11955 extra?: Record<string, string>;
11956 /**
11957 * Extra string key/value annotations that will be sent along with any crash
11958 * reports generated in any process. These annotations cannot be changed once the
11959 * crash reporter has been started. If a key is present in both the global extra
11960 * parameters and the process-specific extra parameters, then the global one will
11961 * take precedence. By default, `productName` and the app version are included, as
11962 * well as the Electron version.
11963 */
11964 globalExtra?: Record<string, string>;
11965 }
11966
11967 interface CreateFromBitmapOptions {
11968 width: number;
11969 height: number;
11970 /**
11971 * Defaults to 1.0.
11972 */
11973 scaleFactor?: number;
11974 }
11975
11976 interface CreateFromBufferOptions {
11977 /**
11978 * Required for bitmap buffers.
11979 */
11980 width?: number;
11981 /**
11982 * Required for bitmap buffers.
11983 */
11984 height?: number;
11985 /**
11986 * Defaults to 1.0.
11987 */
11988 scaleFactor?: number;
11989 }
11990
11991 interface CreateInterruptedDownloadOptions {
11992 /**
11993 * Absolute path of the download.
11994 */
11995 path: string;
11996 /**
11997 * Complete URL chain for the download.
11998 */
11999 urlChain: string[];
12000 mimeType?: string;
12001 /**
12002 * Start range for the download.
12003 */
12004 offset: number;
12005 /**
12006 * Total length of the download.
12007 */
12008 length: number;
12009 /**
12010 * Last-Modified header value.
12011 */
12012 lastModified?: string;
12013 /**
12014 * ETag header value.
12015 */
12016 eTag?: string;
12017 /**
12018 * Time when download was started in number of seconds since UNIX epoch.
12019 */
12020 startTime?: number;
12021 }
12022
12023 interface Data {
12024 text?: string;
12025 html?: string;
12026 image?: NativeImage;
12027 rtf?: string;
12028 /**
12029 * The title of the URL at `text`.
12030 */
12031 bookmark?: string;
12032 }
12033
12034 interface Details {
12035 /**
12036 * Process type. One of the following values:
12037 */
12038 type: ('Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
12039 /**
12040 * The reason the child process is gone. Possible values:
12041 */
12042 reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
12043 /**
12044 * The exit code for the process (e.g. status from waitpid if on posix, from
12045 * GetExitCodeProcess on Windows).
12046 */
12047 exitCode: number;
12048 /**
12049 * The name of the process. i.e. for plugins it might be Flash. Examples for
12050 * utility: `Audio Service`, `Content Decryption Module Service`, `Network
12051 * Service`, `Video Capture`, etc.
12052 */
12053 name?: string;
12054 }
12055
12056 interface DidChangeThemeColorEvent extends Event {
12057 themeColor: string;
12058 }
12059
12060 interface DidFailLoadEvent extends Event {
12061 errorCode: number;
12062 errorDescription: string;
12063 validatedURL: string;
12064 isMainFrame: boolean;
12065 }
12066
12067 interface DidFrameFinishLoadEvent extends Event {
12068 isMainFrame: boolean;
12069 }
12070
12071 interface DidNavigateEvent extends Event {
12072 url: string;
12073 }
12074
12075 interface DidNavigateInPageEvent extends Event {
12076 isMainFrame: boolean;
12077 url: string;
12078 }
12079
12080 interface DisplayBalloonOptions {
12081 /**
12082 * Icon to use when `iconType` is `custom`.
12083 */
12084 icon?: (NativeImage) | (string);
12085 /**
12086 * Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
12087 */
12088 iconType?: ('none' | 'info' | 'warning' | 'error' | 'custom');
12089 title: string;
12090 content: string;
12091 /**
12092 * The large version of the icon should be used. Default is `true`. Maps to
12093 * `NIIF_LARGE_ICON`.
12094 */
12095 largeIcon?: boolean;
12096 /**
12097 * Do not play the associated sound. Default is `false`. Maps to `NIIF_NOSOUND`.
12098 */
12099 noSound?: boolean;
12100 /**
12101 * Do not display the balloon notification if the current user is in "quiet time".
12102 * Default is `false`. Maps to `NIIF_RESPECT_QUIET_TIME`.
12103 */
12104 respectQuietTime?: boolean;
12105 }
12106
12107 interface EnableNetworkEmulationOptions {
12108 /**
12109 * Whether to emulate network outage. Defaults to false.
12110 */
12111 offline?: boolean;
12112 /**
12113 * RTT in ms. Defaults to 0 which will disable latency throttling.
12114 */
12115 latency?: number;
12116 /**
12117 * Download rate in Bps. Defaults to 0 which will disable download throttling.
12118 */
12119 downloadThroughput?: number;
12120 /**
12121 * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
12122 */
12123 uploadThroughput?: number;
12124 }
12125
12126 interface FeedURLOptions {
12127 url: string;
12128 /**
12129 * HTTP request headers.
12130 *
12131 * @platform darwin
12132 */
12133 headers?: Record<string, string>;
12134 /**
12135 * Can be `json` or `default`, see the Squirrel.Mac README for more information.
12136 *
12137 * @platform darwin
12138 */
12139 serverType?: ('json' | 'default');
12140 }
12141
12142 interface FileIconOptions {
12143 size: ('small' | 'normal' | 'large');
12144 }
12145
12146 interface Filter {
12147 /**
12148 * Array of URL patterns that will be used to filter out the requests that do not
12149 * match the URL patterns.
12150 */
12151 urls: string[];
12152 }
12153
12154 interface FindInPageOptions {
12155 /**
12156 * Whether to search forward or backward, defaults to `true`.
12157 */
12158 forward?: boolean;
12159 /**
12160 * Whether the operation is first request or a follow up, defaults to `false`.
12161 */
12162 findNext?: boolean;
12163 /**
12164 * Whether search should be case-sensitive, defaults to `false`.
12165 */
12166 matchCase?: boolean;
12167 /**
12168 * Whether to look only at the start of words. defaults to `false`.
12169 */
12170 wordStart?: boolean;
12171 /**
12172 * When combined with `wordStart`, accepts a match in the middle of a word if the
12173 * match begins with an uppercase letter followed by a lowercase or non-letter.
12174 * Accepts several other intra-word matches, defaults to `false`.
12175 */
12176 medialCapitalAsWordStart?: boolean;
12177 }
12178
12179 interface FocusOptions {
12180 /**
12181 * Make the receiver the active app even if another app is currently active.
12182 *
12183 * @platform darwin
12184 */
12185 steal: boolean;
12186 }
12187
12188 interface FoundInPageEvent extends Event {
12189 result: FoundInPageResult;
12190 }
12191
12192 interface FromPartitionOptions {
12193 /**
12194 * Whether to enable cache.
12195 */
12196 cache: boolean;
12197 }
12198
12199 interface HeadersReceivedResponse {
12200 cancel?: boolean;
12201 /**
12202 * When provided, the server is assumed to have responded with these headers.
12203 */
12204 responseHeaders?: Record<string, (string) | (string[])>;
12205 /**
12206 * Should be provided when overriding `responseHeaders` to change header status
12207 * otherwise original response header's status will be used.
12208 */
12209 statusLine?: string;
12210 }
12211
12212 interface HeapStatistics {
12213 totalHeapSize: number;
12214 totalHeapSizeExecutable: number;
12215 totalPhysicalSize: number;
12216 totalAvailableSize: number;
12217 usedHeapSize: number;
12218 heapSizeLimit: number;
12219 mallocedMemory: number;
12220 peakMallocedMemory: number;
12221 doesZapGarbage: boolean;
12222 }
12223
12224 interface IgnoreMouseEventsOptions {
12225 /**
12226 * If true, forwards mouse move messages to Chromium, enabling mouse related events
12227 * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
12228 * forwarding is always disabled regardless of this value.
12229 *
12230 * @platform darwin,win32
12231 */
12232 forward?: boolean;
12233 }
12234
12235 interface ImportCertificateOptions {
12236 /**
12237 * Path for the pkcs12 file.
12238 */
12239 certificate: string;
12240 /**
12241 * Passphrase for the certificate.
12242 */
12243 password: string;
12244 }
12245
12246 interface Info {
12247 /**
12248 * Security origin for the isolated world.
12249 */
12250 securityOrigin?: string;
12251 /**
12252 * Content Security Policy for the isolated world.
12253 */
12254 csp?: string;
12255 /**
12256 * Name for isolated world. Useful in devtools.
12257 */
12258 name?: string;
12259 }
12260
12261 interface Input {
12262 /**
12263 * Either `keyUp` or `keyDown`.
12264 */
12265 type: string;
12266 /**
12267 * Equivalent to KeyboardEvent.key.
12268 */
12269 key: string;
12270 /**
12271 * Equivalent to KeyboardEvent.code.
12272 */
12273 code: string;
12274 /**
12275 * Equivalent to KeyboardEvent.repeat.
12276 */
12277 isAutoRepeat: boolean;
12278 /**
12279 * Equivalent to KeyboardEvent.isComposing.
12280 */
12281 isComposing: boolean;
12282 /**
12283 * Equivalent to KeyboardEvent.shiftKey.
12284 */
12285 shift: boolean;
12286 /**
12287 * Equivalent to KeyboardEvent.controlKey.
12288 */
12289 control: boolean;
12290 /**
12291 * Equivalent to KeyboardEvent.altKey.
12292 */
12293 alt: boolean;
12294 /**
12295 * Equivalent to KeyboardEvent.metaKey.
12296 */
12297 meta: boolean;
12298 }
12299
12300 interface InsertCSSOptions {
12301 /**
12302 * Can be either 'user' or 'author'; Specifying 'user' enables you to prevent
12303 * websites from overriding the CSS you insert. Default is 'author'.
12304 */
12305 cssOrigin?: string;
12306 }
12307
12308 interface IpcMessageEvent extends Event {
12309 channel: string;
12310 args: any[];
12311 }
12312
12313 interface Item {
12314 /**
12315 * The path(s) to the file(s) being dragged.
12316 */
12317 file: (string[]) | (string);
12318 /**
12319 * The image must be non-empty on macOS.
12320 */
12321 icon: (NativeImage) | (string);
12322 }
12323
12324 interface JumpListSettings {
12325 /**
12326 * The minimum number of items that will be shown in the Jump List (for a more
12327 * detailed description of this value see the MSDN docs).
12328 */
12329 minItems: number;
12330 /**
12331 * Array of `JumpListItem` objects that correspond to items that the user has
12332 * explicitly removed from custom categories in the Jump List. These items must not
12333 * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
12334 * Windows will not display any custom category that contains any of the removed
12335 * items.
12336 */
12337 removedItems: JumpListItem[];
12338 }
12339
12340 interface LoadCommitEvent extends Event {
12341 url: string;
12342 isMainFrame: boolean;
12343 }
12344
12345 interface LoadExtensionOptions {
12346 /**
12347 * Whether to allow the extension to read local files over `file://` protocol and
12348 * inject content scripts into `file://` pages. This is required e.g. for loading
12349 * devtools extensions on `file://` URLs. Defaults to false.
12350 */
12351 allowFileAccess: boolean;
12352 }
12353
12354 interface LoadFileOptions {
12355 /**
12356 * Passed to `url.format()`.
12357 */
12358 query?: Record<string, string>;
12359 /**
12360 * Passed to `url.format()`.
12361 */
12362 search?: string;
12363 /**
12364 * Passed to `url.format()`.
12365 */
12366 hash?: string;
12367 }
12368
12369 interface LoadURLOptions {
12370 /**
12371 * An HTTP Referrer url.
12372 */
12373 httpReferrer?: (string) | (Referrer);
12374 /**
12375 * A user agent originating the request.
12376 */
12377 userAgent?: string;
12378 /**
12379 * Extra headers separated by "\n"
12380 */
12381 extraHeaders?: string;
12382 postData?: (UploadRawData[]) | (UploadFile[]) | (UploadBlob[]);
12383 /**
12384 * Base url (with trailing path separator) for files to be loaded by the data url.
12385 * This is needed only if the specified `url` is a data url and needs to load other
12386 * files.
12387 */
12388 baseURLForDataURL?: string;
12389 }
12390
12391 interface LoginItemSettings {
12392 /**
12393 * `true` if the app is set to open at login.
12394 */
12395 openAtLogin: boolean;
12396 /**
12397 * `true` if the app is set to open as hidden at login. This setting is not
12398 * available on MAS builds.
12399 *
12400 * @platform darwin
12401 */
12402 openAsHidden: boolean;
12403 /**
12404 * `true` if the app was opened at login automatically. This setting is not
12405 * available on MAS builds.
12406 *
12407 * @platform darwin
12408 */
12409 wasOpenedAtLogin: boolean;
12410 /**
12411 * `true` if the app was opened as a hidden login item. This indicates that the app
12412 * should not open any windows at startup. This setting is not available on MAS
12413 * builds.
12414 *
12415 * @platform darwin
12416 */
12417 wasOpenedAsHidden: boolean;
12418 /**
12419 * `true` if the app was opened as a login item that should restore the state from
12420 * the previous session. This indicates that the app should restore the windows
12421 * that were open the last time the app was closed. This setting is not available
12422 * on MAS builds.
12423 *
12424 * @platform darwin
12425 */
12426 restoreState: boolean;
12427 /**
12428 * `true` if app is set to open at login and its run key is not deactivated. This
12429 * differs from `openAtLogin` as it ignores the `args` option, this property will
12430 * be true if the given executable would be launched at login with **any**
12431 * arguments.
12432 *
12433 * @platform win32
12434 */
12435 executableWillLaunchAtLogin: boolean;
12436 launchItems: LaunchItems[];
12437 }
12438
12439 interface LoginItemSettingsOptions {
12440 /**
12441 * The executable path to compare against. Defaults to `process.execPath`.
12442 *
12443 * @platform win32
12444 */
12445 path?: string;
12446 /**
12447 * The command-line arguments to compare against. Defaults to an empty array.
12448 *
12449 * @platform win32
12450 */
12451 args?: string[];
12452 }
12453
12454 interface MenuItemConstructorOptions {
12455 /**
12456 * Will be called with `click(menuItem, browserWindow, event)` when the menu item
12457 * is clicked.
12458 */
12459 click?: (menuItem: MenuItem, browserWindow: (BrowserWindow) | (undefined), event: KeyboardEvent) => void;
12460 /**
12461 * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
12462 * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
12463 * `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`,
12464 * `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
12465 * `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,
12466 * `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`,
12467 * `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
12468 * - Define the action of the menu item, when specified the `click` property will
12469 * be ignored. See roles.
12470 */
12471 role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
12472 /**
12473 * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
12474 */
12475 type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
12476 label?: string;
12477 sublabel?: string;
12478 /**
12479 * Hover text for this menu item.
12480 *
12481 * @platform darwin
12482 */
12483 toolTip?: string;
12484 accelerator?: Accelerator;
12485 icon?: (NativeImage) | (string);
12486 /**
12487 * If false, the menu item will be greyed out and unclickable.
12488 */
12489 enabled?: boolean;
12490 /**
12491 * default is `true`, and when `false` will prevent the accelerator from triggering
12492 * the item if the item is not visible`.
12493 *
12494 * @platform darwin
12495 */
12496 acceleratorWorksWhenHidden?: boolean;
12497 /**
12498 * If false, the menu item will be entirely hidden.
12499 */
12500 visible?: boolean;
12501 /**
12502 * Should only be specified for `checkbox` or `radio` type menu items.
12503 */
12504 checked?: boolean;
12505 /**
12506 * If false, the accelerator won't be registered with the system, but it will still
12507 * be displayed. Defaults to true.
12508 *
12509 * @platform linux,win32
12510 */
12511 registerAccelerator?: boolean;
12512 /**
12513 * Should be specified for `submenu` type menu items. If `submenu` is specified,
12514 * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
12515 * be automatically converted to one using `Menu.buildFromTemplate`.
12516 */
12517 submenu?: (MenuItemConstructorOptions[]) | (Menu);
12518 /**
12519 * Unique within a single menu. If defined then it can be used as a reference to
12520 * this item by the position attribute.
12521 */
12522 id?: string;
12523 /**
12524 * Inserts this item before the item with the specified label. If the referenced
12525 * item doesn't exist the item will be inserted at the end of the menu. Also
12526 * implies that the menu item in question should be placed in the same “group” as
12527 * the item.
12528 */
12529 before?: string[];
12530 /**
12531 * Inserts this item after the item with the specified label. If the referenced
12532 * item doesn't exist the item will be inserted at the end of the menu.
12533 */
12534 after?: string[];
12535 /**
12536 * Provides a means for a single context menu to declare the placement of their
12537 * containing group before the containing group of the item with the specified
12538 * label.
12539 */
12540 beforeGroupContaining?: string[];
12541 /**
12542 * Provides a means for a single context menu to declare the placement of their
12543 * containing group after the containing group of the item with the specified
12544 * label.
12545 */
12546 afterGroupContaining?: string[];
12547 }
12548
12549 interface MessageBoxOptions {
12550 /**
12551 * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
12552 * `"question"` displays the same icon as `"info"`, unless you set an icon using
12553 * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
12554 * warning icon.
12555 */
12556 type?: string;
12557 /**
12558 * Array of texts for buttons. On Windows, an empty array will result in one button
12559 * labeled "OK".
12560 */
12561 buttons?: string[];
12562 /**
12563 * Index of the button in the buttons array which will be selected by default when
12564 * the message box opens.
12565 */
12566 defaultId?: number;
12567 /**
12568 * Title of the message box, some platforms will not show it.
12569 */
12570 title?: string;
12571 /**
12572 * Content of the message box.
12573 */
12574 message: string;
12575 /**
12576 * Extra information of the message.
12577 */
12578 detail?: string;
12579 /**
12580 * If provided, the message box will include a checkbox with the given label.
12581 */
12582 checkboxLabel?: string;
12583 /**
12584 * Initial checked state of the checkbox. `false` by default.
12585 */
12586 checkboxChecked?: boolean;
12587 icon?: NativeImage;
12588 /**
12589 * The index of the button to be used to cancel the dialog, via the `Esc` key. By
12590 * default this is assigned to the first button with "cancel" or "no" as the label.
12591 * If no such labeled buttons exist and this option is not set, `0` will be used as
12592 * the return value.
12593 */
12594 cancelId?: number;
12595 /**
12596 * On Windows Electron will try to figure out which one of the `buttons` are common
12597 * buttons (like "Cancel" or "Yes"), and show the others as command links in the
12598 * dialog. This can make the dialog appear in the style of modern Windows apps. If
12599 * you don't like this behavior, you can set `noLink` to `true`.
12600 */
12601 noLink?: boolean;
12602 /**
12603 * Normalize the keyboard access keys across platforms. Default is `false`.
12604 * Enabling this assumes `&` is used in the button labels for the placement of the
12605 * keyboard shortcut access key and labels will be converted so they work correctly
12606 * on each platform, `&` characters are removed on macOS, converted to `_` on
12607 * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
12608 * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
12609 * via `Alt-W` on Windows and Linux.
12610 */
12611 normalizeAccessKeys?: boolean;
12612 }
12613
12614 interface MessageBoxReturnValue {
12615 /**
12616 * The index of the clicked button.
12617 */
12618 response: number;
12619 /**
12620 * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
12621 */
12622 checkboxChecked: boolean;
12623 }
12624
12625 interface MessageBoxSyncOptions {
12626 /**
12627 * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
12628 * `"question"` displays the same icon as `"info"`, unless you set an icon using
12629 * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
12630 * warning icon.
12631 */
12632 type?: string;
12633 /**
12634 * Array of texts for buttons. On Windows, an empty array will result in one button
12635 * labeled "OK".
12636 */
12637 buttons?: string[];
12638 /**
12639 * Index of the button in the buttons array which will be selected by default when
12640 * the message box opens.
12641 */
12642 defaultId?: number;
12643 /**
12644 * Title of the message box, some platforms will not show it.
12645 */
12646 title?: string;
12647 /**
12648 * Content of the message box.
12649 */
12650 message: string;
12651 /**
12652 * Extra information of the message.
12653 */
12654 detail?: string;
12655 /**
12656 * If provided, the message box will include a checkbox with the given label.
12657 */
12658 checkboxLabel?: string;
12659 /**
12660 * Initial checked state of the checkbox. `false` by default.
12661 */
12662 checkboxChecked?: boolean;
12663 icon?: (NativeImage) | (string);
12664 /**
12665 * The index of the button to be used to cancel the dialog, via the `Esc` key. By
12666 * default this is assigned to the first button with "cancel" or "no" as the label.
12667 * If no such labeled buttons exist and this option is not set, `0` will be used as
12668 * the return value.
12669 */
12670 cancelId?: number;
12671 /**
12672 * On Windows Electron will try to figure out which one of the `buttons` are common
12673 * buttons (like "Cancel" or "Yes"), and show the others as command links in the
12674 * dialog. This can make the dialog appear in the style of modern Windows apps. If
12675 * you don't like this behavior, you can set `noLink` to `true`.
12676 */
12677 noLink?: boolean;
12678 /**
12679 * Normalize the keyboard access keys across platforms. Default is `false`.
12680 * Enabling this assumes `&` is used in the button labels for the placement of the
12681 * keyboard shortcut access key and labels will be converted so they work correctly
12682 * on each platform, `&` characters are removed on macOS, converted to `_` on
12683 * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
12684 * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
12685 * via `Alt-W` on Windows and Linux.
12686 */
12687 normalizeAccessKeys?: boolean;
12688 }
12689
12690 interface MessageDetails {
12691 /**
12692 * The actual console message
12693 */
12694 message: string;
12695 /**
12696 * The version ID of the service worker that sent the log message
12697 */
12698 versionId: number;
12699 /**
12700 * The type of source for this message. Can be `javascript`, `xml`, `network`,
12701 * `console-api`, `storage`, `app-cache`, `rendering`, `security`, `deprecation`,
12702 * `worker`, `violation`, `intervention`, `recommendation` or `other`.
12703 */
12704 source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'app-cache' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
12705 /**
12706 * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
12707 * `error`.
12708 */
12709 level: number;
12710 /**
12711 * The URL the message came from
12712 */
12713 sourceUrl: string;
12714 /**
12715 * The line number of the source that triggered this console message
12716 */
12717 lineNumber: number;
12718 }
12719
12720 interface MessageEvent {
12721 data: any;
12722 ports: MessagePortMain[];
12723 }
12724
12725 interface MoveToApplicationsFolderOptions {
12726 /**
12727 * A handler for potential conflict in move failure.
12728 */
12729 conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
12730 }
12731
12732 interface NewWindowEvent extends Event {
12733 url: string;
12734 frameName: string;
12735 /**
12736 * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
12737 * `save-to-disk` and `other`.
12738 */
12739 disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
12740 /**
12741 * The options which should be used for creating the new `BrowserWindow`.
12742 */
12743 options: BrowserWindowConstructorOptions;
12744 }
12745
12746 interface NotificationConstructorOptions {
12747 /**
12748 * A title for the notification, which will be shown at the top of the notification
12749 * window when it is shown.
12750 */
12751 title: string;
12752 /**
12753 * A subtitle for the notification, which will be displayed below the title.
12754 *
12755 * @platform darwin
12756 */
12757 subtitle?: string;
12758 /**
12759 * The body text of the notification, which will be displayed below the title or
12760 * subtitle.
12761 */
12762 body: string;
12763 /**
12764 * Whether or not to emit an OS notification noise when showing the notification.
12765 */
12766 silent?: boolean;
12767 /**
12768 * An icon to use in the notification.
12769 */
12770 icon?: (string) | (NativeImage);
12771 /**
12772 * Whether or not to add an inline reply option to the notification.
12773 *
12774 * @platform darwin
12775 */
12776 hasReply?: boolean;
12777 /**
12778 * The timeout duration of the notification. Can be 'default' or 'never'.
12779 *
12780 * @platform linux,win32
12781 */
12782 timeoutType?: ('default' | 'never');
12783 /**
12784 * The placeholder to write in the inline reply input field.
12785 *
12786 * @platform darwin
12787 */
12788 replyPlaceholder?: string;
12789 /**
12790 * The name of the sound file to play when the notification is shown.
12791 *
12792 * @platform darwin
12793 */
12794 sound?: string;
12795 /**
12796 * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
12797 *
12798 * @platform linux
12799 */
12800 urgency?: ('normal' | 'critical' | 'low');
12801 /**
12802 * Actions to add to the notification. Please read the available actions and
12803 * limitations in the `NotificationAction` documentation.
12804 *
12805 * @platform darwin
12806 */
12807 actions?: NotificationAction[];
12808 /**
12809 * A custom title for the close button of an alert. An empty string will cause the
12810 * default localized text to be used.
12811 *
12812 * @platform darwin
12813 */
12814 closeButtonText?: string;
12815 }
12816
12817 interface OnBeforeRedirectListenerDetails {
12818 id: number;
12819 url: string;
12820 method: string;
12821 webContentsId?: number;
12822 resourceType: string;
12823 referrer: string;
12824 timestamp: number;
12825 redirectURL: string;
12826 statusCode: number;
12827 statusLine: string;
12828 /**
12829 * The server IP address that the request was actually sent to.
12830 */
12831 ip?: string;
12832 fromCache: boolean;
12833 responseHeaders?: Record<string, string[]>;
12834 }
12835
12836 interface OnBeforeRequestListenerDetails {
12837 id: number;
12838 url: string;
12839 method: string;
12840 webContentsId?: number;
12841 resourceType: string;
12842 referrer: string;
12843 timestamp: number;
12844 uploadData: UploadData[];
12845 }
12846
12847 interface OnBeforeSendHeadersListenerDetails {
12848 id: number;
12849 url: string;
12850 method: string;
12851 webContentsId?: number;
12852 resourceType: string;
12853 referrer: string;
12854 timestamp: number;
12855 requestHeaders: Record<string, string>;
12856 }
12857
12858 interface OnCompletedListenerDetails {
12859 id: number;
12860 url: string;
12861 method: string;
12862 webContentsId?: number;
12863 resourceType: string;
12864 referrer: string;
12865 timestamp: number;
12866 responseHeaders?: Record<string, string[]>;
12867 fromCache: boolean;
12868 statusCode: number;
12869 statusLine: string;
12870 error: string;
12871 }
12872
12873 interface OnErrorOccurredListenerDetails {
12874 id: number;
12875 url: string;
12876 method: string;
12877 webContentsId?: number;
12878 resourceType: string;
12879 referrer: string;
12880 timestamp: number;
12881 fromCache: boolean;
12882 /**
12883 * The error description.
12884 */
12885 error: string;
12886 }
12887
12888 interface OnHeadersReceivedListenerDetails {
12889 id: number;
12890 url: string;
12891 method: string;
12892 webContentsId?: number;
12893 resourceType: string;
12894 referrer: string;
12895 timestamp: number;
12896 statusLine: string;
12897 statusCode: number;
12898 requestHeaders: Record<string, string>;
12899 responseHeaders?: Record<string, string[]>;
12900 }
12901
12902 interface OnResponseStartedListenerDetails {
12903 id: number;
12904 url: string;
12905 method: string;
12906 webContentsId?: number;
12907 resourceType: string;
12908 referrer: string;
12909 timestamp: number;
12910 responseHeaders?: Record<string, string[]>;
12911 /**
12912 * Indicates whether the response was fetched from disk cache.
12913 */
12914 fromCache: boolean;
12915 statusCode: number;
12916 statusLine: string;
12917 }
12918
12919 interface OnSendHeadersListenerDetails {
12920 id: number;
12921 url: string;
12922 method: string;
12923 webContentsId?: number;
12924 resourceType: string;
12925 referrer: string;
12926 timestamp: number;
12927 requestHeaders: Record<string, string>;
12928 }
12929
12930 interface OpenDevToolsOptions {
12931 /**
12932 * Opens the devtools with specified dock state, can be `right`, `bottom`,
12933 * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
12934 * possible to dock back. In `detach` mode it's not.
12935 */
12936 mode: ('right' | 'bottom' | 'undocked' | 'detach');
12937 /**
12938 * Whether to bring the opened devtools window to the foreground. The default is
12939 * `true`.
12940 */
12941 activate?: boolean;
12942 }
12943
12944 interface OpenDialogOptions {
12945 title?: string;
12946 defaultPath?: string;
12947 /**
12948 * Custom label for the confirmation button, when left empty the default label will
12949 * be used.
12950 */
12951 buttonLabel?: string;
12952 filters?: FileFilter[];
12953 /**
12954 * Contains which features the dialog should use. The following values are
12955 * supported:
12956 */
12957 properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
12958 /**
12959 * Message to display above input boxes.
12960 *
12961 * @platform darwin
12962 */
12963 message?: string;
12964 /**
12965 * Create security scoped bookmarks when packaged for the Mac App Store.
12966 *
12967 * @platform darwin,mas
12968 */
12969 securityScopedBookmarks?: boolean;
12970 }
12971
12972 interface OpenDialogReturnValue {
12973 /**
12974 * whether or not the dialog was canceled.
12975 */
12976 canceled: boolean;
12977 /**
12978 * An array of file paths chosen by the user. If the dialog is cancelled this will
12979 * be an empty array.
12980 */
12981 filePaths: string[];
12982 /**
12983 * An array matching the `filePaths` array of base64 encoded strings which contains
12984 * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
12985 * this to be populated. (For return values, see table here.)
12986 *
12987 * @platform darwin,mas
12988 */
12989 bookmarks?: string[];
12990 }
12991
12992 interface OpenDialogSyncOptions {
12993 title?: string;
12994 defaultPath?: string;
12995 /**
12996 * Custom label for the confirmation button, when left empty the default label will
12997 * be used.
12998 */
12999 buttonLabel?: string;
13000 filters?: FileFilter[];
13001 /**
13002 * Contains which features the dialog should use. The following values are
13003 * supported:
13004 */
13005 properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
13006 /**
13007 * Message to display above input boxes.
13008 *
13009 * @platform darwin
13010 */
13011 message?: string;
13012 /**
13013 * Create security scoped bookmarks when packaged for the Mac App Store.
13014 *
13015 * @platform darwin,mas
13016 */
13017 securityScopedBookmarks?: boolean;
13018 }
13019
13020 interface OpenExternalOptions {
13021 /**
13022 * `true` to bring the opened application to the foreground. The default is `true`.
13023 *
13024 * @platform darwin
13025 */
13026 activate?: boolean;
13027 /**
13028 * The working directory.
13029 *
13030 * @platform win32
13031 */
13032 workingDirectory?: string;
13033 }
13034
13035 interface Options {
13036 }
13037
13038 interface PageFaviconUpdatedEvent extends Event {
13039 /**
13040 * Array of URLs.
13041 */
13042 favicons: string[];
13043 }
13044
13045 interface PageTitleUpdatedEvent extends Event {
13046 title: string;
13047 explicitSet: boolean;
13048 }
13049
13050 interface Parameters {
13051 /**
13052 * Specify the screen type to emulate (default: `desktop`):
13053 */
13054 screenPosition: ('desktop' | 'mobile');
13055 /**
13056 * Set the emulated screen size (screenPosition == mobile).
13057 */
13058 screenSize: Size;
13059 /**
13060 * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
13061 * 0 }`).
13062 */
13063 viewPosition: Point;
13064 /**
13065 * Set the device scale factor (if zero defaults to original device scale factor)
13066 * (default: `0`).
13067 */
13068 deviceScaleFactor: number;
13069 /**
13070 * Set the emulated view size (empty means no override)
13071 */
13072 viewSize: Size;
13073 /**
13074 * Scale of emulated view inside available space (not in fit to view mode)
13075 * (default: `1`).
13076 */
13077 scale: number;
13078 }
13079
13080 interface Payment {
13081 /**
13082 * The identifier of the purchased product.
13083 */
13084 productIdentifier: string;
13085 /**
13086 * The quantity purchased.
13087 */
13088 quantity: number;
13089 }
13090
13091 interface PermissionCheckHandlerHandlerDetails {
13092 /**
13093 * The security origin of the `media` check.
13094 */
13095 securityOrigin: string;
13096 /**
13097 * The type of media access being requested, can be `video`, `audio` or `unknown`
13098 */
13099 mediaType: ('video' | 'audio' | 'unknown');
13100 /**
13101 * The last URL the requesting frame loaded
13102 */
13103 requestingUrl: string;
13104 /**
13105 * Whether the frame making the request is the main frame
13106 */
13107 isMainFrame: boolean;
13108 }
13109
13110 interface PermissionRequestHandlerHandlerDetails {
13111 /**
13112 * The url of the `openExternal` request.
13113 */
13114 externalURL?: string;
13115 /**
13116 * The types of media access being requested, elements can be `video` or `audio`
13117 */
13118 mediaTypes?: Array<'video' | 'audio'>;
13119 /**
13120 * The last URL the requesting frame loaded
13121 */
13122 requestingUrl: string;
13123 /**
13124 * Whether the frame making the request is the main frame
13125 */
13126 isMainFrame: boolean;
13127 }
13128
13129 interface PluginCrashedEvent extends Event {
13130 name: string;
13131 version: string;
13132 }
13133
13134 interface PopupOptions {
13135 /**
13136 * Default is the focused window.
13137 */
13138 window?: BrowserWindow;
13139 /**
13140 * Default is the current mouse cursor position. Must be declared if `y` is
13141 * declared.
13142 */
13143 x?: number;
13144 /**
13145 * Default is the current mouse cursor position. Must be declared if `x` is
13146 * declared.
13147 */
13148 y?: number;
13149 /**
13150 * The index of the menu item to be positioned under the mouse cursor at the
13151 * specified coordinates. Default is -1.
13152 *
13153 * @platform darwin
13154 */
13155 positioningItem?: number;
13156 /**
13157 * Called when menu is closed.
13158 */
13159 callback?: () => void;
13160 }
13161
13162 interface PreconnectOptions {
13163 /**
13164 * URL for preconnect. Only the origin is relevant for opening the socket.
13165 */
13166 url: string;
13167 /**
13168 * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
13169 */
13170 numSockets?: number;
13171 }
13172
13173 interface PrintToPDFOptions {
13174 /**
13175 * the header and footer for the PDF.
13176 */
13177 headerFooter?: Record<string, string>;
13178 /**
13179 * `true` for landscape, `false` for portrait.
13180 */
13181 landscape?: boolean;
13182 /**
13183 * Specifies the type of margins to use. Uses 0 for default margin, 1 for no
13184 * margin, and 2 for minimum margin. and `width` in microns.
13185 */
13186 marginsType?: number;
13187 /**
13188 * The scale factor of the web page. Can range from 0 to 100.
13189 */
13190 scaleFactor?: number;
13191 /**
13192 * The page range to print.
13193 */
13194 pageRanges?: Record<string, number>;
13195 /**
13196 * Specify page size of the generated PDF. Can be `A3`, `A4`, `A5`, `Legal`,
13197 * `Letter`, `Tabloid` or an Object containing `height`
13198 */
13199 pageSize?: (string) | (Size);
13200 /**
13201 * Whether to print CSS backgrounds.
13202 */
13203 printBackground?: boolean;
13204 /**
13205 * Whether to print selection only.
13206 */
13207 printSelectionOnly?: boolean;
13208 }
13209
13210 interface Privileges {
13211 /**
13212 * Default false.
13213 */
13214 standard?: boolean;
13215 /**
13216 * Default false.
13217 */
13218 secure?: boolean;
13219 /**
13220 * Default false.
13221 */
13222 bypassCSP?: boolean;
13223 /**
13224 * Default false.
13225 */
13226 allowServiceWorkers?: boolean;
13227 /**
13228 * Default false.
13229 */
13230 supportFetchAPI?: boolean;
13231 /**
13232 * Default false.
13233 */
13234 corsEnabled?: boolean;
13235 /**
13236 * Default false.
13237 */
13238 stream?: boolean;
13239 }
13240
13241 interface ProgressBarOptions {
13242 /**
13243 * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
13244 * `paused`.
13245 *
13246 * @platform win32
13247 */
13248 mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
13249 }
13250
13251 interface Provider {
13252 spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
13253 }
13254
13255 interface ReadBookmark {
13256 title: string;
13257 url: string;
13258 }
13259
13260 interface RelaunchOptions {
13261 args?: string[];
13262 execPath?: string;
13263 }
13264
13265 interface RenderProcessGoneDetails {
13266 /**
13267 * The reason the render process is gone. Possible values:
13268 */
13269 reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
13270 }
13271
13272 interface Request {
13273 hostname: string;
13274 certificate: Certificate;
13275 validatedCertificate: Certificate;
13276 /**
13277 * Verification result from chromium.
13278 */
13279 verificationResult: string;
13280 /**
13281 * Error code.
13282 */
13283 errorCode: number;
13284 }
13285
13286 interface ResizeOptions {
13287 /**
13288 * Defaults to the image's width.
13289 */
13290 width?: number;
13291 /**
13292 * Defaults to the image's height.
13293 */
13294 height?: number;
13295 /**
13296 * The desired quality of the resize image. Possible values are `good`, `better`,
13297 * or `best`. The default is `best`. These values express a desired quality/speed
13298 * tradeoff. They are translated into an algorithm-specific method that depends on
13299 * the capabilities (CPU, GPU) of the underlying platform. It is possible for all
13300 * three methods to be mapped to the same algorithm on a given platform.
13301 */
13302 quality?: string;
13303 }
13304
13305 interface ResourceUsage {
13306 images: MemoryUsageDetails;
13307 scripts: MemoryUsageDetails;
13308 cssStyleSheets: MemoryUsageDetails;
13309 xslStyleSheets: MemoryUsageDetails;
13310 fonts: MemoryUsageDetails;
13311 other: MemoryUsageDetails;
13312 }
13313
13314 interface Response {
13315 cancel?: boolean;
13316 /**
13317 * The original request is prevented from being sent or completed and is instead
13318 * redirected to the given URL.
13319 */
13320 redirectURL?: string;
13321 }
13322
13323 interface Result {
13324 requestId: number;
13325 /**
13326 * Position of the active match.
13327 */
13328 activeMatchOrdinal: number;
13329 /**
13330 * Number of Matches.
13331 */
13332 matches: number;
13333 /**
13334 * Coordinates of first match region.
13335 */
13336 selectionArea: Rectangle;
13337 finalUpdate: boolean;
13338 }
13339
13340 interface SaveDialogOptions {
13341 title?: string;
13342 /**
13343 * Absolute directory path, absolute file path, or file name to use by default.
13344 */
13345 defaultPath?: string;
13346 /**
13347 * Custom label for the confirmation button, when left empty the default label will
13348 * be used.
13349 */
13350 buttonLabel?: string;
13351 filters?: FileFilter[];
13352 /**
13353 * Message to display above text fields.
13354 *
13355 * @platform darwin
13356 */
13357 message?: string;
13358 /**
13359 * Custom label for the text displayed in front of the filename text field.
13360 *
13361 * @platform darwin
13362 */
13363 nameFieldLabel?: string;
13364 /**
13365 * Show the tags input box, defaults to `true`.
13366 *
13367 * @platform darwin
13368 */
13369 showsTagField?: boolean;
13370 properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
13371 /**
13372 * Create a security scoped bookmark when packaged for the Mac App Store. If this
13373 * option is enabled and the file doesn't already exist a blank file will be
13374 * created at the chosen path.
13375 *
13376 * @platform darwin,mas
13377 */
13378 securityScopedBookmarks?: boolean;
13379 }
13380
13381 interface SaveDialogReturnValue {
13382 /**
13383 * whether or not the dialog was canceled.
13384 */
13385 canceled: boolean;
13386 /**
13387 * If the dialog is canceled, this will be `undefined`.
13388 */
13389 filePath?: string;
13390 /**
13391 * Base64 encoded string which contains the security scoped bookmark data for the
13392 * saved file. `securityScopedBookmarks` must be enabled for this to be present.
13393 * (For return values, see table here.)
13394 *
13395 * @platform darwin,mas
13396 */
13397 bookmark?: string;
13398 }
13399
13400 interface SaveDialogSyncOptions {
13401 title?: string;
13402 /**
13403 * Absolute directory path, absolute file path, or file name to use by default.
13404 */
13405 defaultPath?: string;
13406 /**
13407 * Custom label for the confirmation button, when left empty the default label will
13408 * be used.
13409 */
13410 buttonLabel?: string;
13411 filters?: FileFilter[];
13412 /**
13413 * Message to display above text fields.
13414 *
13415 * @platform darwin
13416 */
13417 message?: string;
13418 /**
13419 * Custom label for the text displayed in front of the filename text field.
13420 *
13421 * @platform darwin
13422 */
13423 nameFieldLabel?: string;
13424 /**
13425 * Show the tags input box, defaults to `true`.
13426 *
13427 * @platform darwin
13428 */
13429 showsTagField?: boolean;
13430 properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
13431 /**
13432 * Create a security scoped bookmark when packaged for the Mac App Store. If this
13433 * option is enabled and the file doesn't already exist a blank file will be
13434 * created at the chosen path.
13435 *
13436 * @platform darwin,mas
13437 */
13438 securityScopedBookmarks?: boolean;
13439 }
13440
13441 interface Settings {
13442 /**
13443 * `true` to open the app at login, `false` to remove the app as a login item.
13444 * Defaults to `false`.
13445 */
13446 openAtLogin?: boolean;
13447 /**
13448 * `true` to open the app as hidden. Defaults to `false`. The user can edit this
13449 * setting from the System Preferences so
13450 * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
13451 * opened to know the current value. This setting is not available on MAS builds.
13452 *
13453 * @platform darwin
13454 */
13455 openAsHidden?: boolean;
13456 /**
13457 * The executable to launch at login. Defaults to `process.execPath`.
13458 *
13459 * @platform win32
13460 */
13461 path?: string;
13462 /**
13463 * The command-line arguments to pass to the executable. Defaults to an empty
13464 * array. Take care to wrap paths in quotes.
13465 *
13466 * @platform win32
13467 */
13468 args?: string[];
13469 /**
13470 * `true` will change the startup approved registry key and `enable / disable` the
13471 * App in Task Manager and Windows Settings. Defaults to `true`.
13472 *
13473 * @platform win32
13474 */
13475 enabled?: boolean;
13476 /**
13477 * value name to write into registry. Defaults to the app's AppUserModelId(). Set
13478 * the app's login item settings.
13479 *
13480 * @platform win32
13481 */
13482 name?: string;
13483 }
13484
13485 interface SourcesOptions {
13486 /**
13487 * An array of Strings that lists the types of desktop sources to be captured,
13488 * available types are `screen` and `window`.
13489 */
13490 types: string[];
13491 /**
13492 * The size that the media source thumbnail should be scaled to. Default is `150` x
13493 * `150`. Set width or height to 0 when you do not need the thumbnails. This will
13494 * save the processing time required for capturing the content of each window and
13495 * screen.
13496 */
13497 thumbnailSize?: Size;
13498 /**
13499 * Set to true to enable fetching window icons. The default value is false. When
13500 * false the appIcon property of the sources return null. Same if a source has the
13501 * type screen.
13502 */
13503 fetchWindowIcons?: boolean;
13504 }
13505
13506 interface StartLoggingOptions {
13507 /**
13508 * What kinds of data should be captured. By default, only metadata about requests
13509 * will be captured. Setting this to `includeSensitive` will include cookies and
13510 * authentication data. Setting it to `everything` will include all bytes
13511 * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
13512 */
13513 captureMode?: ('default' | 'includeSensitive' | 'everything');
13514 /**
13515 * When the log grows beyond this size, logging will automatically stop. Defaults
13516 * to unlimited.
13517 */
13518 maxFileSize?: number;
13519 }
13520
13521 interface SystemMemoryInfo {
13522 /**
13523 * The total amount of physical memory in Kilobytes available to the system.
13524 */
13525 total: number;
13526 /**
13527 * The total amount of memory not being used by applications or disk cache.
13528 */
13529 free: number;
13530 /**
13531 * The total amount of swap memory in Kilobytes available to the system.
13532 *
13533 * @platform win32,linux
13534 */
13535 swapTotal: number;
13536 /**
13537 * The free amount of swap memory in Kilobytes available to the system.
13538 *
13539 * @platform win32,linux
13540 */
13541 swapFree: number;
13542 }
13543
13544 interface TitleOptions {
13545 /**
13546 * The font family variant to display, can be `monospaced` or `monospacedDigit`.
13547 * `monospaced` is available in macOS 10.15+ and `monospacedDigit` is available in
13548 * macOS 10.11+. When left blank, the title uses the default system font.
13549 */
13550 fontType?: ('monospaced' | 'monospacedDigit');
13551 }
13552
13553 interface ToBitmapOptions {
13554 /**
13555 * Defaults to 1.0.
13556 */
13557 scaleFactor?: number;
13558 }
13559
13560 interface ToDataURLOptions {
13561 /**
13562 * Defaults to 1.0.
13563 */
13564 scaleFactor?: number;
13565 }
13566
13567 interface ToPNGOptions {
13568 /**
13569 * Defaults to 1.0.
13570 */
13571 scaleFactor?: number;
13572 }
13573
13574 interface TouchBarButtonConstructorOptions {
13575 /**
13576 * Button text.
13577 */
13578 label?: string;
13579 /**
13580 * A short description of the button for use by screenreaders like VoiceOver.
13581 */
13582 accessibilityLabel?: string;
13583 /**
13584 * Button background color in hex format, i.e `#ABCDEF`.
13585 */
13586 backgroundColor?: string;
13587 /**
13588 * Button icon.
13589 */
13590 icon?: (NativeImage) | (string);
13591 /**
13592 * Can be `left`, `right` or `overlay`. Defaults to `overlay`.
13593 */
13594 iconPosition?: ('left' | 'right' | 'overlay');
13595 /**
13596 * Function to call when the button is clicked.
13597 */
13598 click?: () => void;
13599 /**
13600 * Whether the button is in an enabled state. Default is `true`.
13601 */
13602 enabled?: boolean;
13603 }
13604
13605 interface TouchBarColorPickerConstructorOptions {
13606 /**
13607 * Array of hex color strings to appear as possible colors to select.
13608 */
13609 availableColors?: string[];
13610 /**
13611 * The selected hex color in the picker, i.e `#ABCDEF`.
13612 */
13613 selectedColor?: string;
13614 /**
13615 * Function to call when a color is selected.
13616 */
13617 change?: (color: string) => void;
13618 }
13619
13620 interface TouchBarConstructorOptions {
13621 items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
13622 escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
13623 }
13624
13625 interface TouchBarGroupConstructorOptions {
13626 /**
13627 * Items to display as a group.
13628 */
13629 items: TouchBar;
13630 }
13631
13632 interface TouchBarLabelConstructorOptions {
13633 /**
13634 * Text to display.
13635 */
13636 label?: string;
13637 /**
13638 * A short description of the button for use by screenreaders like VoiceOver.
13639 */
13640 accessibilityLabel?: string;
13641 /**
13642 * Hex color of text, i.e `#ABCDEF`.
13643 */
13644 textColor?: string;
13645 }
13646
13647 interface TouchBarPopoverConstructorOptions {
13648 /**
13649 * Popover button text.
13650 */
13651 label?: string;
13652 /**
13653 * Popover button icon.
13654 */
13655 icon?: NativeImage;
13656 /**
13657 * Items to display in the popover.
13658 */
13659 items: TouchBar;
13660 /**
13661 * `true` to display a close button on the left of the popover, `false` to not show
13662 * it. Default is `true`.
13663 */
13664 showCloseButton?: boolean;
13665 }
13666
13667 interface TouchBarScrubberConstructorOptions {
13668 /**
13669 * An array of items to place in this scrubber.
13670 */
13671 items: ScrubberItem[];
13672 /**
13673 * Called when the user taps an item that was not the last tapped item.
13674 */
13675 select?: (selectedIndex: number) => void;
13676 /**
13677 * Called when the user taps any item.
13678 */
13679 highlight?: (highlightedIndex: number) => void;
13680 /**
13681 * Selected item style. Can be `background`, `outline` or `none`. Defaults to
13682 * `none`.
13683 */
13684 selectedStyle?: ('background' | 'outline' | 'none');
13685 /**
13686 * Selected overlay item style. Can be `background`, `outline` or `none`. Defaults
13687 * to `none`.
13688 */
13689 overlayStyle?: ('background' | 'outline' | 'none');
13690 /**
13691 * Defaults to `false`.
13692 */
13693 showArrowButtons?: boolean;
13694 /**
13695 * Can be `fixed` or `free`. The default is `free`.
13696 */
13697 mode?: ('fixed' | 'free');
13698 /**
13699 * Defaults to `true`.
13700 */
13701 continuous?: boolean;
13702 }
13703
13704 interface TouchBarSegmentedControlConstructorOptions {
13705 /**
13706 * Style of the segments:
13707 */
13708 segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
13709 /**
13710 * The selection mode of the control:
13711 */
13712 mode?: ('single' | 'multiple' | 'buttons');
13713 /**
13714 * An array of segments to place in this control.
13715 */
13716 segments: SegmentedControlSegment[];
13717 /**
13718 * The index of the currently selected segment, will update automatically with user
13719 * interaction. When the mode is `multiple` it will be the last selected item.
13720 */
13721 selectedIndex?: number;
13722 /**
13723 * Called when the user selects a new segment.
13724 */
13725 change?: (selectedIndex: number, isSelected: boolean) => void;
13726 }
13727
13728 interface TouchBarSliderConstructorOptions {
13729 /**
13730 * Label text.
13731 */
13732 label?: string;
13733 /**
13734 * Selected value.
13735 */
13736 value?: number;
13737 /**
13738 * Minimum value.
13739 */
13740 minValue?: number;
13741 /**
13742 * Maximum value.
13743 */
13744 maxValue?: number;
13745 /**
13746 * Function to call when the slider is changed.
13747 */
13748 change?: (newValue: number) => void;
13749 }
13750
13751 interface TouchBarSpacerConstructorOptions {
13752 /**
13753 * Size of spacer, possible values are:
13754 */
13755 size?: ('small' | 'large' | 'flexible');
13756 }
13757
13758 interface TraceBufferUsageReturnValue {
13759 value: number;
13760 percentage: number;
13761 }
13762
13763 interface UpdateTargetUrlEvent extends Event {
13764 url: string;
13765 }
13766
13767 interface UploadProgress {
13768 /**
13769 * Whether the request is currently active. If this is false no other properties
13770 * will be set
13771 */
13772 active: boolean;
13773 /**
13774 * Whether the upload has started. If this is false both `current` and `total` will
13775 * be set to 0.
13776 */
13777 started: boolean;
13778 /**
13779 * The number of bytes that have been uploaded so far
13780 */
13781 current: number;
13782 /**
13783 * The number of bytes that will be uploaded this request
13784 */
13785 total: number;
13786 }
13787
13788 interface VisibleOnAllWorkspacesOptions {
13789 /**
13790 * Sets whether the window should be visible above fullscreen windows
13791 *
13792 * @platform darwin
13793 */
13794 visibleOnFullScreen?: boolean;
13795 }
13796
13797 interface WebContentsPrintOptions {
13798 /**
13799 * Don't ask user for print settings. Default is `false`.
13800 */
13801 silent?: boolean;
13802 /**
13803 * Prints the background color and image of the web page. Default is `false`.
13804 */
13805 printBackground?: boolean;
13806 /**
13807 * Set the printer device name to use. Must be the system-defined name and not the
13808 * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
13809 */
13810 deviceName?: string;
13811 /**
13812 * Set whether the printed web page will be in color or grayscale. Default is
13813 * `true`.
13814 */
13815 color?: boolean;
13816 margins?: Margins;
13817 /**
13818 * Whether the web page should be printed in landscape mode. Default is `false`.
13819 */
13820 landscape?: boolean;
13821 /**
13822 * The scale factor of the web page.
13823 */
13824 scaleFactor?: number;
13825 /**
13826 * The number of pages to print per page sheet.
13827 */
13828 pagesPerSheet?: number;
13829 /**
13830 * Whether the web page should be collated.
13831 */
13832 collate?: boolean;
13833 /**
13834 * The number of copies of the web page to print.
13835 */
13836 copies?: number;
13837 /**
13838 * The page range to print. On macOS, only one range is honored.
13839 */
13840 pageRanges?: PageRanges[];
13841 /**
13842 * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
13843 * `longEdge`.
13844 */
13845 duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
13846 dpi?: Record<string, number>;
13847 /**
13848 * String to be printed as page header.
13849 */
13850 header?: string;
13851 /**
13852 * String to be printed as page footer.
13853 */
13854 footer?: string;
13855 /**
13856 * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
13857 * `Letter`, `Tabloid` or an Object containing `height`.
13858 */
13859 pageSize?: (string) | (Size);
13860 }
13861
13862 interface WebviewTagPrintOptions {
13863 /**
13864 * Don't ask user for print settings. Default is `false`.
13865 */
13866 silent?: boolean;
13867 /**
13868 * Prints the background color and image of the web page. Default is `false`.
13869 */
13870 printBackground?: boolean;
13871 /**
13872 * Set the printer device name to use. Must be the system-defined name and not the
13873 * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
13874 */
13875 deviceName?: string;
13876 /**
13877 * Set whether the printed web page will be in color or grayscale. Default is
13878 * `true`.
13879 */
13880 color?: boolean;
13881 margins?: Margins;
13882 /**
13883 * Whether the web page should be printed in landscape mode. Default is `false`.
13884 */
13885 landscape?: boolean;
13886 /**
13887 * The scale factor of the web page.
13888 */
13889 scaleFactor?: number;
13890 /**
13891 * The number of pages to print per page sheet.
13892 */
13893 pagesPerSheet?: number;
13894 /**
13895 * Whether the web page should be collated.
13896 */
13897 collate?: boolean;
13898 /**
13899 * The number of copies of the web page to print.
13900 */
13901 copies?: number;
13902 /**
13903 * The page range to print.
13904 */
13905 pageRanges?: PageRanges[];
13906 /**
13907 * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
13908 * `longEdge`.
13909 */
13910 duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
13911 dpi?: Record<string, number>;
13912 /**
13913 * String to be printed as page header.
13914 */
13915 header?: string;
13916 /**
13917 * String to be printed as page footer.
13918 */
13919 footer?: string;
13920 /**
13921 * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
13922 * `Letter`, `Tabloid` or an Object containing `height`.
13923 */
13924 pageSize?: (string) | (Size);
13925 }
13926
13927 interface WillNavigateEvent extends Event {
13928 url: string;
13929 }
13930
13931 interface EditFlags {
13932 /**
13933 * Whether the renderer believes it can undo.
13934 */
13935 canUndo: boolean;
13936 /**
13937 * Whether the renderer believes it can redo.
13938 */
13939 canRedo: boolean;
13940 /**
13941 * Whether the renderer believes it can cut.
13942 */
13943 canCut: boolean;
13944 /**
13945 * Whether the renderer believes it can copy
13946 */
13947 canCopy: boolean;
13948 /**
13949 * Whether the renderer believes it can paste.
13950 */
13951 canPaste: boolean;
13952 /**
13953 * Whether the renderer believes it can delete.
13954 */
13955 canDelete: boolean;
13956 /**
13957 * Whether the renderer believes it can select all.
13958 */
13959 canSelectAll: boolean;
13960 }
13961
13962 interface FoundInPageResult {
13963 requestId: number;
13964 /**
13965 * Position of the active match.
13966 */
13967 activeMatchOrdinal: number;
13968 /**
13969 * Number of Matches.
13970 */
13971 matches: number;
13972 /**
13973 * Coordinates of first match region.
13974 */
13975 selectionArea: Rectangle;
13976 finalUpdate: boolean;
13977 }
13978
13979 interface LaunchItems {
13980 /**
13981 * name value of a registry entry.
13982 *
13983 * @platform win32
13984 */
13985 name: string;
13986 /**
13987 * The executable to an app that corresponds to a registry entry.
13988 *
13989 * @platform win32
13990 */
13991 path: string;
13992 /**
13993 * the command-line arguments to pass to the executable.
13994 *
13995 * @platform win32
13996 */
13997 args: string[];
13998 /**
13999 * one of `user` or `machine`. Indicates whether the registry entry is under
14000 * `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
14001 *
14002 * @platform win32
14003 */
14004 scope: string;
14005 /**
14006 * `true` if the app registry key is startup approved and therefore shows as
14007 * `enabled` in Task Manager and Windows settings.
14008 *
14009 * @platform win32
14010 */
14011 enabled: boolean;
14012 }
14013
14014 interface Margins {
14015 /**
14016 * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
14017 * you will also need to specify `top`, `bottom`, `left`, and `right`.
14018 */
14019 marginType?: ('default' | 'none' | 'printableArea' | 'custom');
14020 /**
14021 * The top margin of the printed web page, in pixels.
14022 */
14023 top?: number;
14024 /**
14025 * The bottom margin of the printed web page, in pixels.
14026 */
14027 bottom?: number;
14028 /**
14029 * The left margin of the printed web page, in pixels.
14030 */
14031 left?: number;
14032 /**
14033 * The right margin of the printed web page, in pixels.
14034 */
14035 right?: number;
14036 }
14037
14038 interface MediaFlags {
14039 /**
14040 * Whether the media element has crashed.
14041 */
14042 inError: boolean;
14043 /**
14044 * Whether the media element is paused.
14045 */
14046 isPaused: boolean;
14047 /**
14048 * Whether the media element is muted.
14049 */
14050 isMuted: boolean;
14051 /**
14052 * Whether the media element has audio.
14053 */
14054 hasAudio: boolean;
14055 /**
14056 * Whether the media element is looping.
14057 */
14058 isLooping: boolean;
14059 /**
14060 * Whether the media element's controls are visible.
14061 */
14062 isControlsVisible: boolean;
14063 /**
14064 * Whether the media element's controls are toggleable.
14065 */
14066 canToggleControls: boolean;
14067 /**
14068 * Whether the media element can be rotated.
14069 */
14070 canRotate: boolean;
14071 }
14072
14073 interface PageRanges {
14074 /**
14075 * Index of the first page to print (0-based).
14076 */
14077 from: number;
14078 /**
14079 * Index of the last page to print (inclusive) (0-based).
14080 */
14081 to: number;
14082 }
14083
14084 interface WebPreferences {
14085 /**
14086 * Whether to enable DevTools. If it is set to `false`, can not use
14087 * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
14088 */
14089 devTools?: boolean;
14090 /**
14091 * Whether node integration is enabled. Default is `false`.
14092 */
14093 nodeIntegration?: boolean;
14094 /**
14095 * Whether node integration is enabled in web workers. Default is `false`. More
14096 * about this can be found in Multithreading.
14097 */
14098 nodeIntegrationInWorker?: boolean;
14099 /**
14100 * Experimental option for enabling Node.js support in sub-frames such as iframes
14101 * and child windows. All your preloads will load for every iframe, you can use
14102 * `process.isMainFrame` to determine if you are in the main frame or not.
14103 */
14104 nodeIntegrationInSubFrames?: boolean;
14105 /**
14106 * Specifies a script that will be loaded before other scripts run in the page.
14107 * This script will always have access to node APIs no matter whether node
14108 * integration is turned on or off. The value should be the absolute file path to
14109 * the script. When node integration is turned off, the preload script can
14110 * reintroduce Node global symbols back to the global scope. See example here.
14111 */
14112 preload?: string;
14113 /**
14114 * If set, this will sandbox the renderer associated with the window, making it
14115 * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
14116 * This is not the same as the `nodeIntegration` option and the APIs available to
14117 * the preload script are more limited. Read more about the option here.
14118 */
14119 sandbox?: boolean;
14120 /**
14121 * Whether to enable the `remote` module. Default is `false`.
14122 */
14123 enableRemoteModule?: boolean;
14124 /**
14125 * Sets the session used by the page. Instead of passing the Session object
14126 * directly, you can also choose to use the `partition` option instead, which
14127 * accepts a partition string. When both `session` and `partition` are provided,
14128 * `session` will be preferred. Default is the default session.
14129 */
14130 session?: Session;
14131 /**
14132 * Sets the session used by the page according to the session's partition string.
14133 * If `partition` starts with `persist:`, the page will use a persistent session
14134 * available to all pages in the app with the same `partition`. If there is no
14135 * `persist:` prefix, the page will use an in-memory session. By assigning the same
14136 * `partition`, multiple pages can share the same session. Default is the default
14137 * session.
14138 */
14139 partition?: string;
14140 /**
14141 * When specified, web pages with the same `affinity` will run in the same renderer
14142 * process. Note that due to reusing the renderer process, certain `webPreferences`
14143 * options will also be shared between the web pages even when you specified
14144 * different values for them, including but not limited to `preload`, `sandbox` and
14145 * `nodeIntegration`. So it is suggested to use exact same `webPreferences` for web
14146 * pages with the same `affinity`. _Deprecated_
14147 */
14148 affinity?: string;
14149 /**
14150 * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
14151 */
14152 zoomFactor?: number;
14153 /**
14154 * Enables JavaScript support. Default is `true`.
14155 */
14156 javascript?: boolean;
14157 /**
14158 * When `false`, it will disable the same-origin policy (usually using testing
14159 * websites by people), and set `allowRunningInsecureContent` to `true` if this
14160 * options has not been set by user. Default is `true`.
14161 */
14162 webSecurity?: boolean;
14163 /**
14164 * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
14165 * `false`.
14166 */
14167 allowRunningInsecureContent?: boolean;
14168 /**
14169 * Enables image support. Default is `true`.
14170 */
14171 images?: boolean;
14172 /**
14173 * Make TextArea elements resizable. Default is `true`.
14174 */
14175 textAreasAreResizable?: boolean;
14176 /**
14177 * Enables WebGL support. Default is `true`.
14178 */
14179 webgl?: boolean;
14180 /**
14181 * Whether plugins should be enabled. Default is `false`.
14182 */
14183 plugins?: boolean;
14184 /**
14185 * Enables Chromium's experimental features. Default is `false`.
14186 */
14187 experimentalFeatures?: boolean;
14188 /**
14189 * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
14190 */
14191 scrollBounce?: boolean;
14192 /**
14193 * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
14194 * to enable. The full list of supported feature strings can be found in the
14195 * RuntimeEnabledFeatures.json5 file.
14196 */
14197 enableBlinkFeatures?: string;
14198 /**
14199 * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
14200 * to disable. The full list of supported feature strings can be found in the
14201 * RuntimeEnabledFeatures.json5 file.
14202 */
14203 disableBlinkFeatures?: string;
14204 /**
14205 * Sets the default font for the font-family.
14206 */
14207 defaultFontFamily?: DefaultFontFamily;
14208 /**
14209 * Defaults to `16`.
14210 */
14211 defaultFontSize?: number;
14212 /**
14213 * Defaults to `13`.
14214 */
14215 defaultMonospaceFontSize?: number;
14216 /**
14217 * Defaults to `0`.
14218 */
14219 minimumFontSize?: number;
14220 /**
14221 * Defaults to `ISO-8859-1`.
14222 */
14223 defaultEncoding?: string;
14224 /**
14225 * Whether to throttle animations and timers when the page becomes background. This
14226 * also affects the Page Visibility API. Defaults to `true`.
14227 */
14228 backgroundThrottling?: boolean;
14229 /**
14230 * Whether to enable offscreen rendering for the browser window. Defaults to
14231 * `false`. See the offscreen rendering tutorial for more details.
14232 */
14233 offscreen?: boolean;
14234 /**
14235 * Whether to run Electron APIs and the specified `preload` script in a separate
14236 * JavaScript context. Defaults to `false`. The context that the `preload` script
14237 * runs in will still have full access to the `document` and `window` globals but
14238 * it will use its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.)
14239 * and will be isolated from any changes made to the global environment by the
14240 * loaded page. The Electron API will only be available in the `preload` script and
14241 * not the loaded page. This option should be used when loading potentially
14242 * untrusted remote content to ensure the loaded content cannot tamper with the
14243 * `preload` script and any Electron APIs being used. This option uses the same
14244 * technique used by Chrome Content Scripts. You can access this context in the dev
14245 * tools by selecting the 'Electron Isolated Context' entry in the combo box at the
14246 * top of the Console tab.
14247 */
14248 contextIsolation?: boolean;
14249 /**
14250 * If true, values returned from `webFrame.executeJavaScript` will be sanitized to
14251 * ensure JS values can't unsafely cross between worlds when using
14252 * `contextIsolation`. The default is `false`. In Electron 12, the default will be
14253 * changed to `true`. _Deprecated_
14254 */
14255 worldSafeExecuteJavaScript?: boolean;
14256 /**
14257 * Whether to use native `window.open()`. Defaults to `false`. Child windows will
14258 * always have node integration disabled unless `nodeIntegrationInSubFrames` is
14259 * true. **Note:** This option is currently experimental.
14260 */
14261 nativeWindowOpen?: boolean;
14262 /**
14263 * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
14264 * `preload` script configured for the `<webview>` will have node integration
14265 * enabled when it is executed so you should ensure remote/untrusted content is not
14266 * able to create a `<webview>` tag with a possibly malicious `preload` script. You
14267 * can use the `will-attach-webview` event on webContents to strip away the
14268 * `preload` script and to validate or alter the `<webview>`'s initial settings.
14269 */
14270 webviewTag?: boolean;
14271 /**
14272 * A list of strings that will be appended to `process.argv` in the renderer
14273 * process of this app. Useful for passing small bits of data down to renderer
14274 * process preload scripts.
14275 */
14276 additionalArguments?: string[];
14277 /**
14278 * Whether to enable browser style consecutive dialog protection. Default is
14279 * `false`.
14280 */
14281 safeDialogs?: boolean;
14282 /**
14283 * The message to display when consecutive dialog protection is triggered. If not
14284 * defined the default message would be used, note that currently the default
14285 * message is in English and not localized.
14286 */
14287 safeDialogsMessage?: string;
14288 /**
14289 * Whether to disable dialogs completely. Overrides `safeDialogs`. Default is
14290 * `false`.
14291 */
14292 disableDialogs?: boolean;
14293 /**
14294 * Whether dragging and dropping a file or link onto the page causes a navigation.
14295 * Default is `false`.
14296 */
14297 navigateOnDragDrop?: boolean;
14298 /**
14299 * Autoplay policy to apply to content in the window, can be
14300 * `no-user-gesture-required`, `user-gesture-required`,
14301 * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
14302 */
14303 autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
14304 /**
14305 * Whether to prevent the window from resizing when entering HTML Fullscreen.
14306 * Default is `false`.
14307 */
14308 disableHtmlFullscreenWindowResize?: boolean;
14309 /**
14310 * An alternative title string provided only to accessibility tools such as screen
14311 * readers. This string is not directly visible to users.
14312 */
14313 accessibleTitle?: string;
14314 /**
14315 * Whether to enable the builtin spellchecker. Default is `true`.
14316 */
14317 spellcheck?: boolean;
14318 /**
14319 * Whether to enable the WebSQL api. Default is `true`.
14320 */
14321 enableWebSQL?: boolean;
14322 /**
14323 * Enforces the v8 code caching policy used by blink. Accepted values are
14324 */
14325 v8CacheOptions?: ('none' | 'code' | 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile');
14326 }
14327
14328 interface DefaultFontFamily {
14329 /**
14330 * Defaults to `Times New Roman`.
14331 */
14332 standard?: string;
14333 /**
14334 * Defaults to `Times New Roman`.
14335 */
14336 serif?: string;
14337 /**
14338 * Defaults to `Arial`.
14339 */
14340 sansSerif?: string;
14341 /**
14342 * Defaults to `Courier New`.
14343 */
14344 monospace?: string;
14345 /**
14346 * Defaults to `Script`.
14347 */
14348 cursive?: string;
14349 /**
14350 * Defaults to `Impact`.
14351 */
14352 fantasy?: string;
14353 }
14354
14355 interface RemoteMainInterface {
14356 app: App;
14357 autoUpdater: AutoUpdater;
14358 BrowserView: typeof BrowserView;
14359 BrowserWindow: typeof BrowserWindow;
14360 ClientRequest: typeof ClientRequest;
14361 clipboard: Clipboard;
14362 CommandLine: typeof CommandLine;
14363 contentTracing: ContentTracing;
14364 Cookies: typeof Cookies;
14365 crashReporter: CrashReporter;
14366 Debugger: typeof Debugger;
14367 desktopCapturer: DesktopCapturer;
14368 dialog: Dialog;
14369 Dock: typeof Dock;
14370 DownloadItem: typeof DownloadItem;
14371 globalShortcut: GlobalShortcut;
14372 inAppPurchase: InAppPurchase;
14373 IncomingMessage: typeof IncomingMessage;
14374 ipcMain: IpcMain;
14375 Menu: typeof Menu;
14376 MenuItem: typeof MenuItem;
14377 MessageChannelMain: typeof MessageChannelMain;
14378 MessagePortMain: typeof MessagePortMain;
14379 nativeImage: typeof NativeImage;
14380 nativeTheme: NativeTheme;
14381 net: Net;
14382 netLog: NetLog;
14383 Notification: typeof Notification;
14384 powerMonitor: PowerMonitor;
14385 powerSaveBlocker: PowerSaveBlocker;
14386 protocol: Protocol;
14387 screen: Screen;
14388 ServiceWorkers: typeof ServiceWorkers;
14389 session: typeof Session;
14390 shell: Shell;
14391 systemPreferences: SystemPreferences;
14392 TouchBar: typeof TouchBar;
14393 TouchBarButton: typeof TouchBarButton;
14394 TouchBarColorPicker: typeof TouchBarColorPicker;
14395 TouchBarGroup: typeof TouchBarGroup;
14396 TouchBarLabel: typeof TouchBarLabel;
14397 TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
14398 TouchBarPopover: typeof TouchBarPopover;
14399 TouchBarScrubber: typeof TouchBarScrubber;
14400 TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
14401 TouchBarSlider: typeof TouchBarSlider;
14402 TouchBarSpacer: typeof TouchBarSpacer;
14403 Tray: typeof Tray;
14404 webContents: typeof WebContents;
14405 WebRequest: typeof WebRequest;
14406 }
14407
14408
14409
14410 namespace Common {
14411 const clipboard: Clipboard;
14412 const crashReporter: CrashReporter;
14413 const desktopCapturer: DesktopCapturer;
14414 class NativeImage extends Electron.NativeImage {}
14415 type nativeImage = NativeImage;
14416 const nativeImage: typeof NativeImage;
14417 const shell: Shell;
14418 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
14419 type AddRepresentationOptions = Electron.AddRepresentationOptions;
14420 type AnimationSettings = Electron.AnimationSettings;
14421 type AppDetailsOptions = Electron.AppDetailsOptions;
14422 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
14423 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
14424 type AuthInfo = Electron.AuthInfo;
14425 type AutoResizeOptions = Electron.AutoResizeOptions;
14426 type BeforeSendResponse = Electron.BeforeSendResponse;
14427 type BitmapOptions = Electron.BitmapOptions;
14428 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
14429 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
14430 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
14431 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
14432 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
14433 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
14434 type Config = Electron.Config;
14435 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
14436 type ContextMenuParams = Electron.ContextMenuParams;
14437 type CookiesGetFilter = Electron.CookiesGetFilter;
14438 type CookiesSetDetails = Electron.CookiesSetDetails;
14439 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
14440 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
14441 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
14442 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
14443 type Data = Electron.Data;
14444 type Details = Electron.Details;
14445 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
14446 type DidFailLoadEvent = Electron.DidFailLoadEvent;
14447 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
14448 type DidNavigateEvent = Electron.DidNavigateEvent;
14449 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
14450 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
14451 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
14452 type FeedURLOptions = Electron.FeedURLOptions;
14453 type FileIconOptions = Electron.FileIconOptions;
14454 type Filter = Electron.Filter;
14455 type FindInPageOptions = Electron.FindInPageOptions;
14456 type FocusOptions = Electron.FocusOptions;
14457 type FoundInPageEvent = Electron.FoundInPageEvent;
14458 type FromPartitionOptions = Electron.FromPartitionOptions;
14459 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
14460 type HeapStatistics = Electron.HeapStatistics;
14461 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
14462 type ImportCertificateOptions = Electron.ImportCertificateOptions;
14463 type Info = Electron.Info;
14464 type Input = Electron.Input;
14465 type InsertCSSOptions = Electron.InsertCSSOptions;
14466 type IpcMessageEvent = Electron.IpcMessageEvent;
14467 type Item = Electron.Item;
14468 type JumpListSettings = Electron.JumpListSettings;
14469 type LoadCommitEvent = Electron.LoadCommitEvent;
14470 type LoadExtensionOptions = Electron.LoadExtensionOptions;
14471 type LoadFileOptions = Electron.LoadFileOptions;
14472 type LoadURLOptions = Electron.LoadURLOptions;
14473 type LoginItemSettings = Electron.LoginItemSettings;
14474 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
14475 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
14476 type MessageBoxOptions = Electron.MessageBoxOptions;
14477 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
14478 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
14479 type MessageDetails = Electron.MessageDetails;
14480 type MessageEvent = Electron.MessageEvent;
14481 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
14482 type NewWindowEvent = Electron.NewWindowEvent;
14483 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
14484 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
14485 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
14486 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
14487 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
14488 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
14489 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
14490 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
14491 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
14492 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
14493 type OpenDialogOptions = Electron.OpenDialogOptions;
14494 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
14495 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
14496 type OpenExternalOptions = Electron.OpenExternalOptions;
14497 type Options = Electron.Options;
14498 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
14499 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
14500 type Parameters = Electron.Parameters;
14501 type Payment = Electron.Payment;
14502 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
14503 type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
14504 type PluginCrashedEvent = Electron.PluginCrashedEvent;
14505 type PopupOptions = Electron.PopupOptions;
14506 type PreconnectOptions = Electron.PreconnectOptions;
14507 type PrintToPDFOptions = Electron.PrintToPDFOptions;
14508 type Privileges = Electron.Privileges;
14509 type ProgressBarOptions = Electron.ProgressBarOptions;
14510 type Provider = Electron.Provider;
14511 type ReadBookmark = Electron.ReadBookmark;
14512 type RelaunchOptions = Electron.RelaunchOptions;
14513 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
14514 type Request = Electron.Request;
14515 type ResizeOptions = Electron.ResizeOptions;
14516 type ResourceUsage = Electron.ResourceUsage;
14517 type Response = Electron.Response;
14518 type Result = Electron.Result;
14519 type SaveDialogOptions = Electron.SaveDialogOptions;
14520 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
14521 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
14522 type Settings = Electron.Settings;
14523 type SourcesOptions = Electron.SourcesOptions;
14524 type StartLoggingOptions = Electron.StartLoggingOptions;
14525 type SystemMemoryInfo = Electron.SystemMemoryInfo;
14526 type TitleOptions = Electron.TitleOptions;
14527 type ToBitmapOptions = Electron.ToBitmapOptions;
14528 type ToDataURLOptions = Electron.ToDataURLOptions;
14529 type ToPNGOptions = Electron.ToPNGOptions;
14530 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
14531 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
14532 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
14533 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
14534 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
14535 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
14536 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
14537 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
14538 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
14539 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
14540 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
14541 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
14542 type UploadProgress = Electron.UploadProgress;
14543 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
14544 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
14545 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
14546 type WillNavigateEvent = Electron.WillNavigateEvent;
14547 type EditFlags = Electron.EditFlags;
14548 type FoundInPageResult = Electron.FoundInPageResult;
14549 type LaunchItems = Electron.LaunchItems;
14550 type Margins = Electron.Margins;
14551 type MediaFlags = Electron.MediaFlags;
14552 type PageRanges = Electron.PageRanges;
14553 type WebPreferences = Electron.WebPreferences;
14554 type DefaultFontFamily = Electron.DefaultFontFamily;
14555 type BluetoothDevice = Electron.BluetoothDevice;
14556 type Certificate = Electron.Certificate;
14557 type CertificatePrincipal = Electron.CertificatePrincipal;
14558 type Cookie = Electron.Cookie;
14559 type CPUUsage = Electron.CPUUsage;
14560 type CrashReport = Electron.CrashReport;
14561 type CustomScheme = Electron.CustomScheme;
14562 type DesktopCapturerSource = Electron.DesktopCapturerSource;
14563 type Display = Electron.Display;
14564 type Event = Electron.Event;
14565 type Extension = Electron.Extension;
14566 type ExtensionInfo = Electron.ExtensionInfo;
14567 type FileFilter = Electron.FileFilter;
14568 type FilePathWithHeaders = Electron.FilePathWithHeaders;
14569 type GPUFeatureStatus = Electron.GPUFeatureStatus;
14570 type InputEvent = Electron.InputEvent;
14571 type IOCounters = Electron.IOCounters;
14572 type IpcMainEvent = Electron.IpcMainEvent;
14573 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
14574 type IpcRendererEvent = Electron.IpcRendererEvent;
14575 type JumpListCategory = Electron.JumpListCategory;
14576 type JumpListItem = Electron.JumpListItem;
14577 type KeyboardEvent = Electron.KeyboardEvent;
14578 type KeyboardInputEvent = Electron.KeyboardInputEvent;
14579 type MemoryInfo = Electron.MemoryInfo;
14580 type MemoryUsageDetails = Electron.MemoryUsageDetails;
14581 type MimeTypedBuffer = Electron.MimeTypedBuffer;
14582 type MouseInputEvent = Electron.MouseInputEvent;
14583 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
14584 type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
14585 type NotificationAction = Electron.NotificationAction;
14586 type Point = Electron.Point;
14587 type PostBody = Electron.PostBody;
14588 type PostData = Electron.PostData;
14589 type PrinterInfo = Electron.PrinterInfo;
14590 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
14591 type ProcessMetric = Electron.ProcessMetric;
14592 type Product = Electron.Product;
14593 type ProtocolRequest = Electron.ProtocolRequest;
14594 type ProtocolResponse = Electron.ProtocolResponse;
14595 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
14596 type Rectangle = Electron.Rectangle;
14597 type Referrer = Electron.Referrer;
14598 type ScrubberItem = Electron.ScrubberItem;
14599 type SegmentedControlSegment = Electron.SegmentedControlSegment;
14600 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
14601 type SharedWorkerInfo = Electron.SharedWorkerInfo;
14602 type ShortcutDetails = Electron.ShortcutDetails;
14603 type Size = Electron.Size;
14604 type Task = Electron.Task;
14605 type ThumbarButton = Electron.ThumbarButton;
14606 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
14607 type TraceConfig = Electron.TraceConfig;
14608 type Transaction = Electron.Transaction;
14609 type UploadBlob = Electron.UploadBlob;
14610 type UploadData = Electron.UploadData;
14611 type UploadFile = Electron.UploadFile;
14612 type UploadRawData = Electron.UploadRawData;
14613 type WebSource = Electron.WebSource;
14614 }
14615
14616 namespace Main {
14617 const app: App;
14618 const autoUpdater: AutoUpdater;
14619 class BrowserView extends Electron.BrowserView {}
14620 class BrowserWindow extends Electron.BrowserWindow {}
14621 class ClientRequest extends Electron.ClientRequest {}
14622 class CommandLine extends Electron.CommandLine {}
14623 const contentTracing: ContentTracing;
14624 class Cookies extends Electron.Cookies {}
14625 class Debugger extends Electron.Debugger {}
14626 const dialog: Dialog;
14627 class Dock extends Electron.Dock {}
14628 class DownloadItem extends Electron.DownloadItem {}
14629 const globalShortcut: GlobalShortcut;
14630 const inAppPurchase: InAppPurchase;
14631 class IncomingMessage extends Electron.IncomingMessage {}
14632 const ipcMain: IpcMain;
14633 class Menu extends Electron.Menu {}
14634 class MenuItem extends Electron.MenuItem {}
14635 class MessageChannelMain extends Electron.MessageChannelMain {}
14636 class MessagePortMain extends Electron.MessagePortMain {}
14637 const nativeTheme: NativeTheme;
14638 const net: Net;
14639 const netLog: NetLog;
14640 class Notification extends Electron.Notification {}
14641 const powerMonitor: PowerMonitor;
14642 const powerSaveBlocker: PowerSaveBlocker;
14643 const protocol: Protocol;
14644 const screen: Screen;
14645 class ServiceWorkers extends Electron.ServiceWorkers {}
14646 class Session extends Electron.Session {}
14647 type session = Session;
14648 const session: typeof Session;
14649 const systemPreferences: SystemPreferences;
14650 class TouchBar extends Electron.TouchBar {}
14651 class TouchBarButton extends Electron.TouchBarButton {}
14652 class TouchBarColorPicker extends Electron.TouchBarColorPicker {}
14653 class TouchBarGroup extends Electron.TouchBarGroup {}
14654 class TouchBarLabel extends Electron.TouchBarLabel {}
14655 class TouchBarOtherItemsProxy extends Electron.TouchBarOtherItemsProxy {}
14656 class TouchBarPopover extends Electron.TouchBarPopover {}
14657 class TouchBarScrubber extends Electron.TouchBarScrubber {}
14658 class TouchBarSegmentedControl extends Electron.TouchBarSegmentedControl {}
14659 class TouchBarSlider extends Electron.TouchBarSlider {}
14660 class TouchBarSpacer extends Electron.TouchBarSpacer {}
14661 class Tray extends Electron.Tray {}
14662 class WebContents extends Electron.WebContents {}
14663 type webContents = WebContents;
14664 const webContents: typeof WebContents;
14665 class WebRequest extends Electron.WebRequest {}
14666 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
14667 type AddRepresentationOptions = Electron.AddRepresentationOptions;
14668 type AnimationSettings = Electron.AnimationSettings;
14669 type AppDetailsOptions = Electron.AppDetailsOptions;
14670 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
14671 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
14672 type AuthInfo = Electron.AuthInfo;
14673 type AutoResizeOptions = Electron.AutoResizeOptions;
14674 type BeforeSendResponse = Electron.BeforeSendResponse;
14675 type BitmapOptions = Electron.BitmapOptions;
14676 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
14677 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
14678 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
14679 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
14680 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
14681 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
14682 type Config = Electron.Config;
14683 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
14684 type ContextMenuParams = Electron.ContextMenuParams;
14685 type CookiesGetFilter = Electron.CookiesGetFilter;
14686 type CookiesSetDetails = Electron.CookiesSetDetails;
14687 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
14688 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
14689 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
14690 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
14691 type Data = Electron.Data;
14692 type Details = Electron.Details;
14693 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
14694 type DidFailLoadEvent = Electron.DidFailLoadEvent;
14695 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
14696 type DidNavigateEvent = Electron.DidNavigateEvent;
14697 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
14698 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
14699 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
14700 type FeedURLOptions = Electron.FeedURLOptions;
14701 type FileIconOptions = Electron.FileIconOptions;
14702 type Filter = Electron.Filter;
14703 type FindInPageOptions = Electron.FindInPageOptions;
14704 type FocusOptions = Electron.FocusOptions;
14705 type FoundInPageEvent = Electron.FoundInPageEvent;
14706 type FromPartitionOptions = Electron.FromPartitionOptions;
14707 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
14708 type HeapStatistics = Electron.HeapStatistics;
14709 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
14710 type ImportCertificateOptions = Electron.ImportCertificateOptions;
14711 type Info = Electron.Info;
14712 type Input = Electron.Input;
14713 type InsertCSSOptions = Electron.InsertCSSOptions;
14714 type IpcMessageEvent = Electron.IpcMessageEvent;
14715 type Item = Electron.Item;
14716 type JumpListSettings = Electron.JumpListSettings;
14717 type LoadCommitEvent = Electron.LoadCommitEvent;
14718 type LoadExtensionOptions = Electron.LoadExtensionOptions;
14719 type LoadFileOptions = Electron.LoadFileOptions;
14720 type LoadURLOptions = Electron.LoadURLOptions;
14721 type LoginItemSettings = Electron.LoginItemSettings;
14722 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
14723 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
14724 type MessageBoxOptions = Electron.MessageBoxOptions;
14725 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
14726 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
14727 type MessageDetails = Electron.MessageDetails;
14728 type MessageEvent = Electron.MessageEvent;
14729 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
14730 type NewWindowEvent = Electron.NewWindowEvent;
14731 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
14732 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
14733 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
14734 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
14735 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
14736 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
14737 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
14738 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
14739 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
14740 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
14741 type OpenDialogOptions = Electron.OpenDialogOptions;
14742 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
14743 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
14744 type OpenExternalOptions = Electron.OpenExternalOptions;
14745 type Options = Electron.Options;
14746 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
14747 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
14748 type Parameters = Electron.Parameters;
14749 type Payment = Electron.Payment;
14750 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
14751 type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
14752 type PluginCrashedEvent = Electron.PluginCrashedEvent;
14753 type PopupOptions = Electron.PopupOptions;
14754 type PreconnectOptions = Electron.PreconnectOptions;
14755 type PrintToPDFOptions = Electron.PrintToPDFOptions;
14756 type Privileges = Electron.Privileges;
14757 type ProgressBarOptions = Electron.ProgressBarOptions;
14758 type Provider = Electron.Provider;
14759 type ReadBookmark = Electron.ReadBookmark;
14760 type RelaunchOptions = Electron.RelaunchOptions;
14761 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
14762 type Request = Electron.Request;
14763 type ResizeOptions = Electron.ResizeOptions;
14764 type ResourceUsage = Electron.ResourceUsage;
14765 type Response = Electron.Response;
14766 type Result = Electron.Result;
14767 type SaveDialogOptions = Electron.SaveDialogOptions;
14768 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
14769 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
14770 type Settings = Electron.Settings;
14771 type SourcesOptions = Electron.SourcesOptions;
14772 type StartLoggingOptions = Electron.StartLoggingOptions;
14773 type SystemMemoryInfo = Electron.SystemMemoryInfo;
14774 type TitleOptions = Electron.TitleOptions;
14775 type ToBitmapOptions = Electron.ToBitmapOptions;
14776 type ToDataURLOptions = Electron.ToDataURLOptions;
14777 type ToPNGOptions = Electron.ToPNGOptions;
14778 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
14779 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
14780 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
14781 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
14782 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
14783 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
14784 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
14785 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
14786 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
14787 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
14788 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
14789 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
14790 type UploadProgress = Electron.UploadProgress;
14791 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
14792 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
14793 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
14794 type WillNavigateEvent = Electron.WillNavigateEvent;
14795 type EditFlags = Electron.EditFlags;
14796 type FoundInPageResult = Electron.FoundInPageResult;
14797 type LaunchItems = Electron.LaunchItems;
14798 type Margins = Electron.Margins;
14799 type MediaFlags = Electron.MediaFlags;
14800 type PageRanges = Electron.PageRanges;
14801 type WebPreferences = Electron.WebPreferences;
14802 type DefaultFontFamily = Electron.DefaultFontFamily;
14803 type BluetoothDevice = Electron.BluetoothDevice;
14804 type Certificate = Electron.Certificate;
14805 type CertificatePrincipal = Electron.CertificatePrincipal;
14806 type Cookie = Electron.Cookie;
14807 type CPUUsage = Electron.CPUUsage;
14808 type CrashReport = Electron.CrashReport;
14809 type CustomScheme = Electron.CustomScheme;
14810 type DesktopCapturerSource = Electron.DesktopCapturerSource;
14811 type Display = Electron.Display;
14812 type Event = Electron.Event;
14813 type Extension = Electron.Extension;
14814 type ExtensionInfo = Electron.ExtensionInfo;
14815 type FileFilter = Electron.FileFilter;
14816 type FilePathWithHeaders = Electron.FilePathWithHeaders;
14817 type GPUFeatureStatus = Electron.GPUFeatureStatus;
14818 type InputEvent = Electron.InputEvent;
14819 type IOCounters = Electron.IOCounters;
14820 type IpcMainEvent = Electron.IpcMainEvent;
14821 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
14822 type IpcRendererEvent = Electron.IpcRendererEvent;
14823 type JumpListCategory = Electron.JumpListCategory;
14824 type JumpListItem = Electron.JumpListItem;
14825 type KeyboardEvent = Electron.KeyboardEvent;
14826 type KeyboardInputEvent = Electron.KeyboardInputEvent;
14827 type MemoryInfo = Electron.MemoryInfo;
14828 type MemoryUsageDetails = Electron.MemoryUsageDetails;
14829 type MimeTypedBuffer = Electron.MimeTypedBuffer;
14830 type MouseInputEvent = Electron.MouseInputEvent;
14831 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
14832 type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
14833 type NotificationAction = Electron.NotificationAction;
14834 type Point = Electron.Point;
14835 type PostBody = Electron.PostBody;
14836 type PostData = Electron.PostData;
14837 type PrinterInfo = Electron.PrinterInfo;
14838 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
14839 type ProcessMetric = Electron.ProcessMetric;
14840 type Product = Electron.Product;
14841 type ProtocolRequest = Electron.ProtocolRequest;
14842 type ProtocolResponse = Electron.ProtocolResponse;
14843 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
14844 type Rectangle = Electron.Rectangle;
14845 type Referrer = Electron.Referrer;
14846 type ScrubberItem = Electron.ScrubberItem;
14847 type SegmentedControlSegment = Electron.SegmentedControlSegment;
14848 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
14849 type SharedWorkerInfo = Electron.SharedWorkerInfo;
14850 type ShortcutDetails = Electron.ShortcutDetails;
14851 type Size = Electron.Size;
14852 type Task = Electron.Task;
14853 type ThumbarButton = Electron.ThumbarButton;
14854 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
14855 type TraceConfig = Electron.TraceConfig;
14856 type Transaction = Electron.Transaction;
14857 type UploadBlob = Electron.UploadBlob;
14858 type UploadData = Electron.UploadData;
14859 type UploadFile = Electron.UploadFile;
14860 type UploadRawData = Electron.UploadRawData;
14861 type WebSource = Electron.WebSource;
14862 }
14863
14864 namespace Renderer {
14865 class BrowserWindowProxy extends Electron.BrowserWindowProxy {}
14866 const contextBridge: ContextBridge;
14867 const ipcRenderer: IpcRenderer;
14868 const remote: Remote;
14869 const webFrame: WebFrame;
14870 const webviewTag: WebviewTag;
14871 type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
14872 type AddRepresentationOptions = Electron.AddRepresentationOptions;
14873 type AnimationSettings = Electron.AnimationSettings;
14874 type AppDetailsOptions = Electron.AppDetailsOptions;
14875 type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
14876 type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
14877 type AuthInfo = Electron.AuthInfo;
14878 type AutoResizeOptions = Electron.AutoResizeOptions;
14879 type BeforeSendResponse = Electron.BeforeSendResponse;
14880 type BitmapOptions = Electron.BitmapOptions;
14881 type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
14882 type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
14883 type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
14884 type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
14885 type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
14886 type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
14887 type Config = Electron.Config;
14888 type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
14889 type ContextMenuParams = Electron.ContextMenuParams;
14890 type CookiesGetFilter = Electron.CookiesGetFilter;
14891 type CookiesSetDetails = Electron.CookiesSetDetails;
14892 type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
14893 type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
14894 type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
14895 type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
14896 type Data = Electron.Data;
14897 type Details = Electron.Details;
14898 type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
14899 type DidFailLoadEvent = Electron.DidFailLoadEvent;
14900 type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
14901 type DidNavigateEvent = Electron.DidNavigateEvent;
14902 type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
14903 type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
14904 type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
14905 type FeedURLOptions = Electron.FeedURLOptions;
14906 type FileIconOptions = Electron.FileIconOptions;
14907 type Filter = Electron.Filter;
14908 type FindInPageOptions = Electron.FindInPageOptions;
14909 type FocusOptions = Electron.FocusOptions;
14910 type FoundInPageEvent = Electron.FoundInPageEvent;
14911 type FromPartitionOptions = Electron.FromPartitionOptions;
14912 type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
14913 type HeapStatistics = Electron.HeapStatistics;
14914 type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
14915 type ImportCertificateOptions = Electron.ImportCertificateOptions;
14916 type Info = Electron.Info;
14917 type Input = Electron.Input;
14918 type InsertCSSOptions = Electron.InsertCSSOptions;
14919 type IpcMessageEvent = Electron.IpcMessageEvent;
14920 type Item = Electron.Item;
14921 type JumpListSettings = Electron.JumpListSettings;
14922 type LoadCommitEvent = Electron.LoadCommitEvent;
14923 type LoadExtensionOptions = Electron.LoadExtensionOptions;
14924 type LoadFileOptions = Electron.LoadFileOptions;
14925 type LoadURLOptions = Electron.LoadURLOptions;
14926 type LoginItemSettings = Electron.LoginItemSettings;
14927 type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
14928 type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
14929 type MessageBoxOptions = Electron.MessageBoxOptions;
14930 type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
14931 type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
14932 type MessageDetails = Electron.MessageDetails;
14933 type MessageEvent = Electron.MessageEvent;
14934 type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
14935 type NewWindowEvent = Electron.NewWindowEvent;
14936 type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
14937 type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
14938 type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
14939 type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
14940 type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
14941 type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
14942 type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
14943 type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
14944 type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
14945 type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
14946 type OpenDialogOptions = Electron.OpenDialogOptions;
14947 type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
14948 type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
14949 type OpenExternalOptions = Electron.OpenExternalOptions;
14950 type Options = Electron.Options;
14951 type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
14952 type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
14953 type Parameters = Electron.Parameters;
14954 type Payment = Electron.Payment;
14955 type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
14956 type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
14957 type PluginCrashedEvent = Electron.PluginCrashedEvent;
14958 type PopupOptions = Electron.PopupOptions;
14959 type PreconnectOptions = Electron.PreconnectOptions;
14960 type PrintToPDFOptions = Electron.PrintToPDFOptions;
14961 type Privileges = Electron.Privileges;
14962 type ProgressBarOptions = Electron.ProgressBarOptions;
14963 type Provider = Electron.Provider;
14964 type ReadBookmark = Electron.ReadBookmark;
14965 type RelaunchOptions = Electron.RelaunchOptions;
14966 type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
14967 type Request = Electron.Request;
14968 type ResizeOptions = Electron.ResizeOptions;
14969 type ResourceUsage = Electron.ResourceUsage;
14970 type Response = Electron.Response;
14971 type Result = Electron.Result;
14972 type SaveDialogOptions = Electron.SaveDialogOptions;
14973 type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
14974 type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
14975 type Settings = Electron.Settings;
14976 type SourcesOptions = Electron.SourcesOptions;
14977 type StartLoggingOptions = Electron.StartLoggingOptions;
14978 type SystemMemoryInfo = Electron.SystemMemoryInfo;
14979 type TitleOptions = Electron.TitleOptions;
14980 type ToBitmapOptions = Electron.ToBitmapOptions;
14981 type ToDataURLOptions = Electron.ToDataURLOptions;
14982 type ToPNGOptions = Electron.ToPNGOptions;
14983 type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
14984 type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
14985 type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
14986 type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
14987 type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
14988 type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
14989 type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
14990 type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
14991 type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
14992 type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
14993 type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
14994 type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
14995 type UploadProgress = Electron.UploadProgress;
14996 type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
14997 type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
14998 type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
14999 type WillNavigateEvent = Electron.WillNavigateEvent;
15000 type EditFlags = Electron.EditFlags;
15001 type FoundInPageResult = Electron.FoundInPageResult;
15002 type LaunchItems = Electron.LaunchItems;
15003 type Margins = Electron.Margins;
15004 type MediaFlags = Electron.MediaFlags;
15005 type PageRanges = Electron.PageRanges;
15006 type WebPreferences = Electron.WebPreferences;
15007 type DefaultFontFamily = Electron.DefaultFontFamily;
15008 type BluetoothDevice = Electron.BluetoothDevice;
15009 type Certificate = Electron.Certificate;
15010 type CertificatePrincipal = Electron.CertificatePrincipal;
15011 type Cookie = Electron.Cookie;
15012 type CPUUsage = Electron.CPUUsage;
15013 type CrashReport = Electron.CrashReport;
15014 type CustomScheme = Electron.CustomScheme;
15015 type DesktopCapturerSource = Electron.DesktopCapturerSource;
15016 type Display = Electron.Display;
15017 type Event = Electron.Event;
15018 type Extension = Electron.Extension;
15019 type ExtensionInfo = Electron.ExtensionInfo;
15020 type FileFilter = Electron.FileFilter;
15021 type FilePathWithHeaders = Electron.FilePathWithHeaders;
15022 type GPUFeatureStatus = Electron.GPUFeatureStatus;
15023 type InputEvent = Electron.InputEvent;
15024 type IOCounters = Electron.IOCounters;
15025 type IpcMainEvent = Electron.IpcMainEvent;
15026 type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
15027 type IpcRendererEvent = Electron.IpcRendererEvent;
15028 type JumpListCategory = Electron.JumpListCategory;
15029 type JumpListItem = Electron.JumpListItem;
15030 type KeyboardEvent = Electron.KeyboardEvent;
15031 type KeyboardInputEvent = Electron.KeyboardInputEvent;
15032 type MemoryInfo = Electron.MemoryInfo;
15033 type MemoryUsageDetails = Electron.MemoryUsageDetails;
15034 type MimeTypedBuffer = Electron.MimeTypedBuffer;
15035 type MouseInputEvent = Electron.MouseInputEvent;
15036 type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
15037 type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
15038 type NotificationAction = Electron.NotificationAction;
15039 type Point = Electron.Point;
15040 type PostBody = Electron.PostBody;
15041 type PostData = Electron.PostData;
15042 type PrinterInfo = Electron.PrinterInfo;
15043 type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
15044 type ProcessMetric = Electron.ProcessMetric;
15045 type Product = Electron.Product;
15046 type ProtocolRequest = Electron.ProtocolRequest;
15047 type ProtocolResponse = Electron.ProtocolResponse;
15048 type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
15049 type Rectangle = Electron.Rectangle;
15050 type Referrer = Electron.Referrer;
15051 type ScrubberItem = Electron.ScrubberItem;
15052 type SegmentedControlSegment = Electron.SegmentedControlSegment;
15053 type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
15054 type SharedWorkerInfo = Electron.SharedWorkerInfo;
15055 type ShortcutDetails = Electron.ShortcutDetails;
15056 type Size = Electron.Size;
15057 type Task = Electron.Task;
15058 type ThumbarButton = Electron.ThumbarButton;
15059 type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
15060 type TraceConfig = Electron.TraceConfig;
15061 type Transaction = Electron.Transaction;
15062 type UploadBlob = Electron.UploadBlob;
15063 type UploadData = Electron.UploadData;
15064 type UploadFile = Electron.UploadFile;
15065 type UploadRawData = Electron.UploadRawData;
15066 type WebSource = Electron.WebSource;
15067 }
15068
15069 const app: App;
15070 const autoUpdater: AutoUpdater;
15071 const clipboard: Clipboard;
15072 const contentTracing: ContentTracing;
15073 const contextBridge: ContextBridge;
15074 const crashReporter: CrashReporter;
15075 const desktopCapturer: DesktopCapturer;
15076 const dialog: Dialog;
15077 const globalShortcut: GlobalShortcut;
15078 const inAppPurchase: InAppPurchase;
15079 const ipcMain: IpcMain;
15080 const ipcRenderer: IpcRenderer;
15081 type nativeImage = NativeImage;
15082 const nativeImage: typeof NativeImage;
15083 const nativeTheme: NativeTheme;
15084 const net: Net;
15085 const netLog: NetLog;
15086 const powerMonitor: PowerMonitor;
15087 const powerSaveBlocker: PowerSaveBlocker;
15088 const protocol: Protocol;
15089 const remote: Remote;
15090 const screen: Screen;
15091 type session = Session;
15092 const session: typeof Session;
15093 const shell: Shell;
15094 const systemPreferences: SystemPreferences;
15095 type webContents = WebContents;
15096 const webContents: typeof WebContents;
15097 const webFrame: WebFrame;
15098 const webviewTag: WebviewTag;
15099
15100}
15101
15102declare module 'electron' {
15103 export = Electron;
15104}
15105
15106declare module 'electron/main' {
15107 export = Electron.Main
15108}
15109
15110declare module 'electron/common' {
15111 export = Electron.Common
15112}
15113
15114declare module 'electron/renderer' {
15115 export = Electron.Renderer
15116}
15117
15118interface NodeRequireFunction {
15119 (moduleName: 'electron'): typeof Electron;
15120}
15121
15122interface File {
15123 /**
15124 * The real path to the file on the users filesystem
15125 */
15126 path: string;
15127}
15128
15129declare module 'original-fs' {
15130 import * as fs from 'fs';
15131 export = fs;
15132}
15133
15134interface Document {
15135 createElement(tagName: 'webview'): Electron.WebviewTag;
15136}
15137
15138declare namespace NodeJS {
15139 interface Process extends NodeJS.EventEmitter {
15140
15141 // Docs: https://electronjs.org/docs/api/process
15142
15143 /**
15144 * Emitted when Electron has loaded its internal initialization script and is
15145 * beginning to load the web page or the main script.
15146 *
15147 * It can be used by the preload script to add removed Node global symbols back to
15148 * the global scope when node integration is turned off:
15149 */
15150 on(event: 'loaded', listener: Function): this;
15151 once(event: 'loaded', listener: Function): this;
15152 addListener(event: 'loaded', listener: Function): this;
15153 removeListener(event: 'loaded', listener: Function): this;
15154 /**
15155 * Causes the main thread of the current process crash.
15156 */
15157 crash(): void;
15158 /**
15159 * * `allocated` Integer - Size of all allocated objects in Kilobytes.
15160 * * `marked` Integer - Size of all marked objects in Kilobytes.
15161 * * `total` Integer - Total allocated space in Kilobytes.
15162 *
15163 * Returns an object with Blink memory information. It can be useful for debugging
15164 * rendering / DOM related memory issues. Note that all values are reported in
15165 * Kilobytes.
15166 */
15167 getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
15168 getCPUUsage(): Electron.CPUUsage;
15169 /**
15170 * The number of milliseconds since epoch, or `null` if the information is
15171 * unavailable
15172 *
15173 * Indicates the creation time of the application. The time is represented as
15174 * number of milliseconds since epoch. It returns null if it is unable to get the
15175 * process creation time.
15176 */
15177 getCreationTime(): (number) | (null);
15178 /**
15179 * * `totalHeapSize` Integer
15180 * * `totalHeapSizeExecutable` Integer
15181 * * `totalPhysicalSize` Integer
15182 * * `totalAvailableSize` Integer
15183 * * `usedHeapSize` Integer
15184 * * `heapSizeLimit` Integer
15185 * * `mallocedMemory` Integer
15186 * * `peakMallocedMemory` Integer
15187 * * `doesZapGarbage` Boolean
15188 *
15189 * Returns an object with V8 heap statistics. Note that all statistics are reported
15190 * in Kilobytes.
15191 */
15192 getHeapStatistics(): Electron.HeapStatistics;
15193 getIOCounters(): Electron.IOCounters;
15194 /**
15195 * Resolves with a ProcessMemoryInfo
15196 *
15197 * Returns an object giving memory usage statistics about the current process. Note
15198 * that all statistics are reported in Kilobytes. This api should be called after
15199 * app ready.
15200 *
15201 * Chromium does not provide `residentSet` value for macOS. This is because macOS
15202 * performs in-memory compression of pages that haven't been recently used. As a
15203 * result the resident set size value is not what one would expect. `private`
15204 * memory is more representative of the actual pre-compression memory usage of the
15205 * process on macOS.
15206 */
15207 getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
15208 /**
15209 * * `total` Integer - The total amount of physical memory in Kilobytes available
15210 * to the system.
15211 * * `free` Integer - The total amount of memory not being used by applications or
15212 * disk cache.
15213 * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
15214 * Kilobytes available to the system.
15215 * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
15216 * Kilobytes available to the system.
15217 *
15218 * Returns an object giving memory usage statistics about the entire system. Note
15219 * that all statistics are reported in Kilobytes.
15220 */
15221 getSystemMemoryInfo(): Electron.SystemMemoryInfo;
15222 /**
15223 * The version of the host operating system.
15224 *
15225 * Example:
15226 *
15227 * **Note:** It returns the actual operating system version instead of kernel
15228 * version on macOS unlike `os.release()`.
15229 */
15230 getSystemVersion(): string;
15231 /**
15232 * Causes the main thread of the current process hang.
15233 */
15234 hang(): void;
15235 /**
15236 * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
15237 * whichever is lower for the current process.
15238 *
15239 * @platform darwin,linux
15240 */
15241 setFdLimit(maxDescriptors: number): void;
15242 /**
15243 * Indicates whether the snapshot has been created successfully.
15244 *
15245Takes a V8 heap snapshot and saves it to `filePath`.
15246 */
15247 takeHeapSnapshot(filePath: string): boolean;
15248 /**
15249 * A `String` representing Chrome's version string.
15250 *
15251 */
15252 readonly chrome: string;
15253 /**
15254 * A `Boolean`. When app is started by being passed as parameter to the default
15255 * app, this property is `true` in the main process, otherwise it is `undefined`.
15256 *
15257 */
15258 readonly defaultApp: boolean;
15259 /**
15260 * A `String` representing Electron's version string.
15261 *
15262 */
15263 readonly electron: string;
15264 /**
15265 * A `Boolean`, `true` when the current renderer context is the "main" renderer
15266 * frame. If you want the ID of the current frame you should use
15267 * `webFrame.routingId`.
15268 *
15269 */
15270 readonly isMainFrame: boolean;
15271 /**
15272 * A `Boolean`. For Mac App Store build, this property is `true`, for other builds
15273 * it is `undefined`.
15274 *
15275 */
15276 readonly mas: boolean;
15277 /**
15278 * A `Boolean` that controls ASAR support inside your application. Setting this to
15279 * `true` will disable the support for `asar` archives in Node's built-in modules.
15280 */
15281 noAsar: boolean;
15282 /**
15283 * A `Boolean` that controls whether or not deprecation warnings are printed to
15284 * `stderr`. Setting this to `true` will silence deprecation warnings. This
15285 * property is used instead of the `--no-deprecation` command line flag.
15286 */
15287 noDeprecation: boolean;
15288 /**
15289 * A `String` representing the path to the resources directory.
15290 *
15291 */
15292 readonly resourcesPath: string;
15293 /**
15294 * A `Boolean`. When the renderer process is sandboxed, this property is `true`,
15295 * otherwise it is `undefined`.
15296 *
15297 */
15298 readonly sandboxed: boolean;
15299 /**
15300 * A `Boolean` that controls whether or not deprecation warnings will be thrown as
15301 * exceptions. Setting this to `true` will throw errors for deprecations. This
15302 * property is used instead of the `--throw-deprecation` command line flag.
15303 */
15304 throwDeprecation: boolean;
15305 /**
15306 * A `Boolean` that controls whether or not deprecations printed to `stderr`
15307 * include their stack trace. Setting this to `true` will print stack traces for
15308 * deprecations. This property is instead of the `--trace-deprecation` command line
15309 * flag.
15310 */
15311 traceDeprecation: boolean;
15312 /**
15313 * A `Boolean` that controls whether or not process warnings printed to `stderr`
15314 * include their stack trace. Setting this to `true` will print stack traces for
15315 * process warnings (including deprecations). This property is instead of the
15316 * `--trace-warnings` command line flag.
15317 */
15318 traceProcessWarnings: boolean;
15319 /**
15320 * A `String` representing the current process's type, can be:
15321 *
15322 * * `browser` - The main process
15323 * * `renderer` - A renderer process
15324* `worker` - In a web worker
15325 *
15326 */
15327 readonly type: ('browser' | 'renderer' | 'worker');
15328 /**
15329 * A `Boolean`. If the app is running as a Windows Store app (appx), this property
15330 * is `true`, for otherwise it is `undefined`.
15331 *
15332 */
15333 readonly windowsStore: boolean;
15334 }
15335 interface ProcessVersions {
15336 readonly electron: string;
15337 readonly chrome: string;
15338 }
15339}
\No newline at end of file