1 | // Type definitions for Electron 11.0.0-nightly.20200708
|
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 |
|
8 | type GlobalEvent = Event;
|
9 |
|
10 | declare 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: http://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 during Handoff when an activity from a different device wants to be
|
198 | * resumed. You should call `event.preventDefault()` if you want to handle this
|
199 | * event.
|
200 | *
|
201 | * A user activity can be continued only in an app that has the same developer Team
|
202 | * ID as the activity's source app and that supports the activity's type. Supported
|
203 | * activity types are specified in the app's `Info.plist` under the
|
204 | * `NSUserActivityTypes` key.
|
205 | *
|
206 | * @platform darwin
|
207 | */
|
208 | on(event: 'continue-activity', listener: (event: Event,
|
209 | /**
|
210 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
211 | */
|
212 | type: string,
|
213 | /**
|
214 | * Contains app-specific state stored by the activity on another device.
|
215 | */
|
216 | userInfo: unknown) => void): this;
|
217 | once(event: 'continue-activity', listener: (event: Event,
|
218 | /**
|
219 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
220 | */
|
221 | type: string,
|
222 | /**
|
223 | * Contains app-specific state stored by the activity on another device.
|
224 | */
|
225 | userInfo: unknown) => void): this;
|
226 | addListener(event: 'continue-activity', listener: (event: Event,
|
227 | /**
|
228 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
229 | */
|
230 | type: string,
|
231 | /**
|
232 | * Contains app-specific state stored by the activity on another device.
|
233 | */
|
234 | userInfo: unknown) => void): this;
|
235 | removeListener(event: 'continue-activity', listener: (event: Event,
|
236 | /**
|
237 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
238 | */
|
239 | type: string,
|
240 | /**
|
241 | * Contains app-specific state stored by the activity on another device.
|
242 | */
|
243 | userInfo: unknown) => void): this;
|
244 | /**
|
245 | * Emitted during Handoff when an activity from a different device fails to be
|
246 | * resumed.
|
247 | *
|
248 | * @platform darwin
|
249 | */
|
250 | on(event: 'continue-activity-error', listener: (event: Event,
|
251 | /**
|
252 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
253 | */
|
254 | type: string,
|
255 | /**
|
256 | * A string with the error's localized description.
|
257 | */
|
258 | error: string) => void): this;
|
259 | once(event: 'continue-activity-error', listener: (event: Event,
|
260 | /**
|
261 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
262 | */
|
263 | type: string,
|
264 | /**
|
265 | * A string with the error's localized description.
|
266 | */
|
267 | error: string) => void): this;
|
268 | addListener(event: 'continue-activity-error', listener: (event: Event,
|
269 | /**
|
270 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
271 | */
|
272 | type: string,
|
273 | /**
|
274 | * A string with the error's localized description.
|
275 | */
|
276 | error: string) => void): this;
|
277 | removeListener(event: 'continue-activity-error', listener: (event: Event,
|
278 | /**
|
279 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
280 | */
|
281 | type: string,
|
282 | /**
|
283 | * A string with the error's localized description.
|
284 | */
|
285 | error: string) => void): this;
|
286 | /**
|
287 | * Emitted when `desktopCapturer.getSources()` is called in the renderer process of
|
288 | * `webContents`. Calling `event.preventDefault()` will make it return empty
|
289 | * sources.
|
290 | */
|
291 | on(event: 'desktop-capturer-get-sources', listener: (event: Event,
|
292 | webContents: WebContents) => void): this;
|
293 | once(event: 'desktop-capturer-get-sources', listener: (event: Event,
|
294 | webContents: WebContents) => void): this;
|
295 | addListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
|
296 | webContents: WebContents) => void): this;
|
297 | removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
|
298 | webContents: WebContents) => void): this;
|
299 | /**
|
300 | * Emitted when mac application become active. Difference from `activate` event is
|
301 | * that `did-become-active` is emitted every time the app becomes active, not only
|
302 | * when Dock icon is clicked or application is re-launched.
|
303 | *
|
304 | * @platform darwin
|
305 | */
|
306 | on(event: 'did-become-active', listener: (event: Event) => void): this;
|
307 | once(event: 'did-become-active', listener: (event: Event) => void): this;
|
308 | addListener(event: 'did-become-active', listener: (event: Event) => void): this;
|
309 | removeListener(event: 'did-become-active', listener: (event: Event) => void): this;
|
310 | /**
|
311 | * Emitted whenever there is a GPU info update.
|
312 | */
|
313 | on(event: 'gpu-info-update', listener: Function): this;
|
314 | once(event: 'gpu-info-update', listener: Function): this;
|
315 | addListener(event: 'gpu-info-update', listener: Function): this;
|
316 | removeListener(event: 'gpu-info-update', listener: Function): this;
|
317 | /**
|
318 | * Emitted when the GPU process crashes or is killed.
|
319 | */
|
320 | on(event: 'gpu-process-crashed', listener: (event: Event,
|
321 | killed: boolean) => void): this;
|
322 | once(event: 'gpu-process-crashed', listener: (event: Event,
|
323 | killed: boolean) => void): this;
|
324 | addListener(event: 'gpu-process-crashed', listener: (event: Event,
|
325 | killed: boolean) => void): this;
|
326 | removeListener(event: 'gpu-process-crashed', listener: (event: Event,
|
327 | killed: boolean) => void): this;
|
328 | /**
|
329 | * Emitted when `webContents` wants to do basic auth.
|
330 | *
|
331 | * The default behavior is to cancel all authentications. To override this you
|
332 | * should prevent the default behavior with `event.preventDefault()` and call
|
333 | * `callback(username, password)` with the credentials.
|
334 | *
|
335 | * If `callback` is called without a username or password, the authentication
|
336 | * request will be cancelled and the authentication error will be returned to the
|
337 | * page.
|
338 | */
|
339 | on(event: 'login', listener: (event: Event,
|
340 | webContents: WebContents,
|
341 | authenticationResponseDetails: AuthenticationResponseDetails,
|
342 | authInfo: AuthInfo,
|
343 | callback: (username?: string, password?: string) => void) => void): this;
|
344 | once(event: 'login', listener: (event: Event,
|
345 | webContents: WebContents,
|
346 | authenticationResponseDetails: AuthenticationResponseDetails,
|
347 | authInfo: AuthInfo,
|
348 | callback: (username?: string, password?: string) => void) => void): this;
|
349 | addListener(event: 'login', listener: (event: Event,
|
350 | webContents: WebContents,
|
351 | authenticationResponseDetails: AuthenticationResponseDetails,
|
352 | authInfo: AuthInfo,
|
353 | callback: (username?: string, password?: string) => void) => void): this;
|
354 | removeListener(event: 'login', listener: (event: Event,
|
355 | webContents: WebContents,
|
356 | authenticationResponseDetails: AuthenticationResponseDetails,
|
357 | authInfo: AuthInfo,
|
358 | callback: (username?: string, password?: string) => void) => void): this;
|
359 | /**
|
360 | * Emitted when the user clicks the native macOS new tab button. The new tab button
|
361 | * is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
|
362 | *
|
363 | * @platform darwin
|
364 | */
|
365 | on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
|
366 | once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
|
367 | addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
|
368 | removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
|
369 | /**
|
370 | * Emitted when the user wants to open a file with the application. The `open-file`
|
371 | * event is usually emitted when the application is already open and the OS wants
|
372 | * to reuse the application to open the file. `open-file` is also emitted when a
|
373 | * file is dropped onto the dock and the application is not yet running. Make sure
|
374 | * to listen for the `open-file` event very early in your application startup to
|
375 | * handle this case (even before the `ready` event is emitted).
|
376 | *
|
377 | * You should call `event.preventDefault()` if you want to handle this event.
|
378 | *
|
379 | * On Windows, you have to parse `process.argv` (in the main process) to get the
|
380 | * filepath.
|
381 | *
|
382 | * @platform darwin
|
383 | */
|
384 | on(event: 'open-file', listener: (event: Event,
|
385 | path: string) => void): this;
|
386 | once(event: 'open-file', listener: (event: Event,
|
387 | path: string) => void): this;
|
388 | addListener(event: 'open-file', listener: (event: Event,
|
389 | path: string) => void): this;
|
390 | removeListener(event: 'open-file', listener: (event: Event,
|
391 | path: string) => void): this;
|
392 | /**
|
393 | * Emitted when the user wants to open a URL with the application. Your
|
394 | * application's `Info.plist` file must define the URL scheme within the
|
395 | * `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
|
396 | *
|
397 | You should call `event.preventDefault()` if you want to handle this event.
|
398 | *
|
399 | * @platform darwin
|
400 | */
|
401 | on(event: 'open-url', listener: (event: Event,
|
402 | url: string) => void): this;
|
403 | once(event: 'open-url', listener: (event: Event,
|
404 | url: string) => void): this;
|
405 | addListener(event: 'open-url', listener: (event: Event,
|
406 | url: string) => void): this;
|
407 | removeListener(event: 'open-url', listener: (event: Event,
|
408 | url: string) => void): this;
|
409 | /**
|
410 | * Emitted when the application is quitting.
|
411 | *
|
412 | * **Note:** On Windows, this event will not be emitted if the app is closed due to
|
413 | * a shutdown/restart of the system or a user logout.
|
414 | */
|
415 | on(event: 'quit', listener: (event: Event,
|
416 | exitCode: number) => void): this;
|
417 | once(event: 'quit', listener: (event: Event,
|
418 | exitCode: number) => void): this;
|
419 | addListener(event: 'quit', listener: (event: Event,
|
420 | exitCode: number) => void): this;
|
421 | removeListener(event: 'quit', listener: (event: Event,
|
422 | exitCode: number) => void): this;
|
423 | /**
|
424 | * Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
|
425 | * holds the `userInfo` of the `NSUserNotification` that was used to open the
|
426 | * application, if it was launched from Notification Center. You can also call
|
427 | * `app.isReady()` to check if this event has already fired and `app.whenReady()`
|
428 | * to get a Promise that is fulfilled when Electron is initialized.
|
429 | */
|
430 | on(event: 'ready', listener: (launchInfo: unknown) => void): this;
|
431 | once(event: 'ready', listener: (launchInfo: unknown) => void): this;
|
432 | addListener(event: 'ready', listener: (launchInfo: unknown) => void): this;
|
433 | removeListener(event: 'ready', listener: (launchInfo: unknown) => void): this;
|
434 | /**
|
435 | * Emitted when `remote.getBuiltin()` is called in the renderer process of
|
436 | * `webContents`. Calling `event.preventDefault()` will prevent the module from
|
437 | * being returned. Custom value can be returned by setting `event.returnValue`.
|
438 | */
|
439 | on(event: 'remote-get-builtin', listener: (event: Event,
|
440 | webContents: WebContents,
|
441 | moduleName: string) => void): this;
|
442 | once(event: 'remote-get-builtin', listener: (event: Event,
|
443 | webContents: WebContents,
|
444 | moduleName: string) => void): this;
|
445 | addListener(event: 'remote-get-builtin', listener: (event: Event,
|
446 | webContents: WebContents,
|
447 | moduleName: string) => void): this;
|
448 | removeListener(event: 'remote-get-builtin', listener: (event: Event,
|
449 | webContents: WebContents,
|
450 | moduleName: string) => void): this;
|
451 | /**
|
452 | * Emitted when `remote.getCurrentWebContents()` is called in the renderer process
|
453 | * of `webContents`. Calling `event.preventDefault()` will prevent the object from
|
454 | * being returned. Custom value can be returned by setting `event.returnValue`.
|
455 | */
|
456 | on(event: 'remote-get-current-web-contents', listener: (event: Event,
|
457 | webContents: WebContents) => void): this;
|
458 | once(event: 'remote-get-current-web-contents', listener: (event: Event,
|
459 | webContents: WebContents) => void): this;
|
460 | addListener(event: 'remote-get-current-web-contents', listener: (event: Event,
|
461 | webContents: WebContents) => void): this;
|
462 | removeListener(event: 'remote-get-current-web-contents', listener: (event: Event,
|
463 | webContents: WebContents) => void): this;
|
464 | /**
|
465 | * Emitted when `remote.getCurrentWindow()` is called in the renderer process of
|
466 | * `webContents`. Calling `event.preventDefault()` will prevent the object from
|
467 | * being returned. Custom value can be returned by setting `event.returnValue`.
|
468 | */
|
469 | on(event: 'remote-get-current-window', listener: (event: Event,
|
470 | webContents: WebContents) => void): this;
|
471 | once(event: 'remote-get-current-window', listener: (event: Event,
|
472 | webContents: WebContents) => void): this;
|
473 | addListener(event: 'remote-get-current-window', listener: (event: Event,
|
474 | webContents: WebContents) => void): this;
|
475 | removeListener(event: 'remote-get-current-window', listener: (event: Event,
|
476 | webContents: WebContents) => void): this;
|
477 | /**
|
478 | * Emitted when `remote.getGlobal()` is called in the renderer process of
|
479 | * `webContents`. Calling `event.preventDefault()` will prevent the global from
|
480 | * being returned. Custom value can be returned by setting `event.returnValue`.
|
481 | */
|
482 | on(event: 'remote-get-global', listener: (event: Event,
|
483 | webContents: WebContents,
|
484 | globalName: string) => void): this;
|
485 | once(event: 'remote-get-global', listener: (event: Event,
|
486 | webContents: WebContents,
|
487 | globalName: string) => void): this;
|
488 | addListener(event: 'remote-get-global', listener: (event: Event,
|
489 | webContents: WebContents,
|
490 | globalName: string) => void): this;
|
491 | removeListener(event: 'remote-get-global', listener: (event: Event,
|
492 | webContents: WebContents,
|
493 | globalName: string) => void): this;
|
494 | /**
|
495 | * Emitted when `remote.require()` is called in the renderer process of
|
496 | * `webContents`. Calling `event.preventDefault()` will prevent the module from
|
497 | * being returned. Custom value can be returned by setting `event.returnValue`.
|
498 | */
|
499 | on(event: 'remote-require', listener: (event: Event,
|
500 | webContents: WebContents,
|
501 | moduleName: string) => void): this;
|
502 | once(event: 'remote-require', listener: (event: Event,
|
503 | webContents: WebContents,
|
504 | moduleName: string) => void): this;
|
505 | addListener(event: 'remote-require', listener: (event: Event,
|
506 | webContents: WebContents,
|
507 | moduleName: string) => void): this;
|
508 | removeListener(event: 'remote-require', listener: (event: Event,
|
509 | webContents: WebContents,
|
510 | moduleName: string) => void): this;
|
511 | /**
|
512 | * Emitted when the renderer process unexpectedly dissapears. This is normally
|
513 | * because it was crashed or killed.
|
514 | */
|
515 | on(event: 'render-process-gone', listener: (event: Event,
|
516 | webContents: WebContents,
|
517 | details: Details) => void): this;
|
518 | once(event: 'render-process-gone', listener: (event: Event,
|
519 | webContents: WebContents,
|
520 | details: Details) => void): this;
|
521 | addListener(event: 'render-process-gone', listener: (event: Event,
|
522 | webContents: WebContents,
|
523 | details: Details) => void): this;
|
524 | removeListener(event: 'render-process-gone', listener: (event: Event,
|
525 | webContents: WebContents,
|
526 | details: Details) => void): this;
|
527 | on(event: 'renderer-process-crashed', listener: (event: Event,
|
528 | webContents: WebContents,
|
529 | killed: boolean) => void): this;
|
530 | once(event: 'renderer-process-crashed', listener: (event: Event,
|
531 | webContents: WebContents,
|
532 | killed: boolean) => void): this;
|
533 | addListener(event: 'renderer-process-crashed', listener: (event: Event,
|
534 | webContents: WebContents,
|
535 | killed: boolean) => void): this;
|
536 | removeListener(event: 'renderer-process-crashed', listener: (event: Event,
|
537 | webContents: WebContents,
|
538 | killed: boolean) => void): this;
|
539 | /**
|
540 | * This event will be emitted inside the primary instance of your application when
|
541 | * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
|
542 | *
|
543 | * `argv` is an Array of the second instance's command line arguments, and
|
544 | * `workingDirectory` is its current working directory. Usually applications
|
545 | * respond to this by making their primary window focused and non-minimized.
|
546 | *
|
547 | * **Note:** If the second instance is started by a different user than the first,
|
548 | * the `argv` array will not include the arguments.
|
549 | *
|
550 | * This event is guaranteed to be emitted after the `ready` event of `app` gets
|
551 | * emitted.
|
552 | *
|
553 | * **Note:** Extra command line arguments might be added by Chromium, such as
|
554 | * `--original-process-start-time`.
|
555 | */
|
556 | on(event: 'second-instance', listener: (event: Event,
|
557 | /**
|
558 | * An array of the second instance's command line arguments
|
559 | */
|
560 | argv: string[],
|
561 | /**
|
562 | * The second instance's working directory
|
563 | */
|
564 | workingDirectory: string) => void): this;
|
565 | once(event: 'second-instance', listener: (event: Event,
|
566 | /**
|
567 | * An array of the second instance's command line arguments
|
568 | */
|
569 | argv: string[],
|
570 | /**
|
571 | * The second instance's working directory
|
572 | */
|
573 | workingDirectory: string) => void): this;
|
574 | addListener(event: 'second-instance', listener: (event: Event,
|
575 | /**
|
576 | * An array of the second instance's command line arguments
|
577 | */
|
578 | argv: string[],
|
579 | /**
|
580 | * The second instance's working directory
|
581 | */
|
582 | workingDirectory: string) => void): this;
|
583 | removeListener(event: 'second-instance', listener: (event: Event,
|
584 | /**
|
585 | * An array of the second instance's command line arguments
|
586 | */
|
587 | argv: string[],
|
588 | /**
|
589 | * The second instance's working directory
|
590 | */
|
591 | workingDirectory: string) => void): this;
|
592 | /**
|
593 | * Emitted when a client certificate is requested.
|
594 | *
|
595 | * The `url` corresponds to the navigation entry requesting the client certificate
|
596 | * and `callback` can be called with an entry filtered from the list. Using
|
597 | * `event.preventDefault()` prevents the application from using the first
|
598 | * certificate from the store.
|
599 | */
|
600 | on(event: 'select-client-certificate', listener: (event: Event,
|
601 | webContents: WebContents,
|
602 | url: string,
|
603 | certificateList: Certificate[],
|
604 | callback: (certificate?: Certificate) => void) => void): this;
|
605 | once(event: 'select-client-certificate', listener: (event: Event,
|
606 | webContents: WebContents,
|
607 | url: string,
|
608 | certificateList: Certificate[],
|
609 | callback: (certificate?: Certificate) => void) => void): this;
|
610 | addListener(event: 'select-client-certificate', listener: (event: Event,
|
611 | webContents: WebContents,
|
612 | url: string,
|
613 | certificateList: Certificate[],
|
614 | callback: (certificate?: Certificate) => void) => void): this;
|
615 | removeListener(event: 'select-client-certificate', listener: (event: Event,
|
616 | webContents: WebContents,
|
617 | url: string,
|
618 | certificateList: Certificate[],
|
619 | callback: (certificate?: Certificate) => void) => void): this;
|
620 | /**
|
621 | * Emitted when Electron has created a new `session`.
|
622 | */
|
623 | on(event: 'session-created', listener: (session: Session) => void): this;
|
624 | once(event: 'session-created', listener: (session: Session) => void): this;
|
625 | addListener(event: 'session-created', listener: (session: Session) => void): this;
|
626 | removeListener(event: 'session-created', listener: (session: Session) => void): this;
|
627 | /**
|
628 | * Emitted when Handoff is about to be resumed on another device. If you need to
|
629 | * update the state to be transferred, you should call `event.preventDefault()`
|
630 | * immediately, construct a new `userInfo` dictionary and call
|
631 | * `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
|
632 | * fail and `continue-activity-error` will be called.
|
633 | *
|
634 | * @platform darwin
|
635 | */
|
636 | on(event: 'update-activity-state', listener: (event: Event,
|
637 | /**
|
638 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
639 | */
|
640 | type: string,
|
641 | /**
|
642 | * Contains app-specific state stored by the activity.
|
643 | */
|
644 | userInfo: unknown) => void): this;
|
645 | once(event: 'update-activity-state', listener: (event: Event,
|
646 | /**
|
647 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
648 | */
|
649 | type: string,
|
650 | /**
|
651 | * Contains app-specific state stored by the activity.
|
652 | */
|
653 | userInfo: unknown) => void): this;
|
654 | addListener(event: 'update-activity-state', listener: (event: Event,
|
655 | /**
|
656 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
657 | */
|
658 | type: string,
|
659 | /**
|
660 | * Contains app-specific state stored by the activity.
|
661 | */
|
662 | userInfo: unknown) => void): this;
|
663 | removeListener(event: 'update-activity-state', listener: (event: Event,
|
664 | /**
|
665 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
666 | */
|
667 | type: string,
|
668 | /**
|
669 | * Contains app-specific state stored by the activity.
|
670 | */
|
671 | userInfo: unknown) => void): this;
|
672 | /**
|
673 | * Emitted when a new webContents is created.
|
674 | */
|
675 | on(event: 'web-contents-created', listener: (event: Event,
|
676 | webContents: WebContents) => void): this;
|
677 | once(event: 'web-contents-created', listener: (event: Event,
|
678 | webContents: WebContents) => void): this;
|
679 | addListener(event: 'web-contents-created', listener: (event: Event,
|
680 | webContents: WebContents) => void): this;
|
681 | removeListener(event: 'web-contents-created', listener: (event: Event,
|
682 | webContents: WebContents) => void): this;
|
683 | /**
|
684 | * Emitted during Handoff before an activity from a different device wants to be
|
685 | * resumed. You should call `event.preventDefault()` if you want to handle this
|
686 | * event.
|
687 | *
|
688 | * @platform darwin
|
689 | */
|
690 | on(event: 'will-continue-activity', listener: (event: Event,
|
691 | /**
|
692 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
693 | */
|
694 | type: string) => void): this;
|
695 | once(event: 'will-continue-activity', listener: (event: Event,
|
696 | /**
|
697 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
698 | */
|
699 | type: string) => void): this;
|
700 | addListener(event: 'will-continue-activity', listener: (event: Event,
|
701 | /**
|
702 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
703 | */
|
704 | type: string) => void): this;
|
705 | removeListener(event: 'will-continue-activity', listener: (event: Event,
|
706 | /**
|
707 | * A string identifying the activity. Maps to `NSUserActivity.activityType`.
|
708 | */
|
709 | type: string) => void): this;
|
710 | /**
|
711 | * Emitted when the application has finished basic startup. On Windows and Linux,
|
712 | * the `will-finish-launching` event is the same as the `ready` event; on macOS,
|
713 | * this event represents the `applicationWillFinishLaunching` notification of
|
714 | * `NSApplication`. You would usually set up listeners for the `open-file` and
|
715 | * `open-url` events here, and start the crash reporter and auto updater.
|
716 | *
|
717 | In most cases, you should do everything in the `ready` event handler.
|
718 | */
|
719 | on(event: 'will-finish-launching', listener: Function): this;
|
720 | once(event: 'will-finish-launching', listener: Function): this;
|
721 | addListener(event: 'will-finish-launching', listener: Function): this;
|
722 | removeListener(event: 'will-finish-launching', listener: Function): this;
|
723 | /**
|
724 | * Emitted when all windows have been closed and the application will quit. Calling
|
725 | * `event.preventDefault()` will prevent the default behavior, which is terminating
|
726 | * the application.
|
727 | *
|
728 | * See the description of the `window-all-closed` event for the differences between
|
729 | * the `will-quit` and `window-all-closed` events.
|
730 | *
|
731 | * **Note:** On Windows, this event will not be emitted if the app is closed due to
|
732 | * a shutdown/restart of the system or a user logout.
|
733 | */
|
734 | on(event: 'will-quit', listener: (event: Event) => void): this;
|
735 | once(event: 'will-quit', listener: (event: Event) => void): this;
|
736 | addListener(event: 'will-quit', listener: (event: Event) => void): this;
|
737 | removeListener(event: 'will-quit', listener: (event: Event) => void): this;
|
738 | /**
|
739 | * Emitted when all windows have been closed.
|
740 | *
|
741 | * If you do not subscribe to this event and all windows are closed, the default
|
742 | * behavior is to quit the app; however, if you subscribe, you control whether the
|
743 | * app quits or not. If the user pressed `Cmd + Q`, or the developer called
|
744 | * `app.quit()`, Electron will first try to close all the windows and then emit the
|
745 | * `will-quit` event, and in this case the `window-all-closed` event would not be
|
746 | * emitted.
|
747 | */
|
748 | on(event: 'window-all-closed', listener: Function): this;
|
749 | once(event: 'window-all-closed', listener: Function): this;
|
750 | addListener(event: 'window-all-closed', listener: Function): this;
|
751 | removeListener(event: 'window-all-closed', listener: Function): this;
|
752 | /**
|
753 | * Adds `path` to the recent documents list.
|
754 | *
|
755 | * This list is managed by the OS. On Windows, you can visit the list from the task
|
756 | * bar, and on macOS, you can visit it from dock menu.
|
757 | *
|
758 | * @platform darwin,win32
|
759 | */
|
760 | addRecentDocument(path: string): void;
|
761 | /**
|
762 | * Clears the recent documents list.
|
763 | *
|
764 | * @platform darwin,win32
|
765 | */
|
766 | clearRecentDocuments(): void;
|
767 | /**
|
768 | * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
|
769 | * basis if the GPU processes crashes too frequently. This function disables that
|
770 | * behavior.
|
771 |
|
772 | This method can only be called before app is ready.
|
773 | */
|
774 | disableDomainBlockingFor3DAPIs(): void;
|
775 | /**
|
776 | * Disables hardware acceleration for current app.
|
777 | *
|
778 | This method can only be called before app is ready.
|
779 | */
|
780 | disableHardwareAcceleration(): void;
|
781 | /**
|
782 | * Enables full sandbox mode on the app. This means that all renderers will be
|
783 | * launched sandboxed, regardless of the value of the `sandbox` flag in
|
784 | * WebPreferences.
|
785 |
|
786 | This method can only be called before app is ready.
|
787 | */
|
788 | enableSandbox(): void;
|
789 | /**
|
790 | * Exits immediately with `exitCode`. `exitCode` defaults to 0.
|
791 | *
|
792 | * All windows will be closed immediately without asking the user, and the
|
793 | * `before-quit` and `will-quit` events will not be emitted.
|
794 | */
|
795 | exit(exitCode?: number): void;
|
796 | /**
|
797 | * On Linux, focuses on the first visible window. On macOS, makes the application
|
798 | * the active app. On Windows, focuses on the application's first window.
|
799 | *
|
800 | You should seek to use the `steal` option as sparingly as possible.
|
801 | */
|
802 | focus(options?: FocusOptions): void;
|
803 | /**
|
804 | * Resolve with an object containing the following:
|
805 | *
|
806 | * * `icon` NativeImage - the display icon of the app handling the protocol.
|
807 | * * `path` String - installation path of the app handling the protocol.
|
808 | * * `name` String - display name of the app handling the protocol.
|
809 | *
|
810 | * This method returns a promise that contains the application name, icon and path
|
811 | * of the default handler for the protocol (aka URI scheme) of a URL.
|
812 | *
|
813 | * @platform darwin,win32
|
814 | */
|
815 | getApplicationInfoForProtocol(url: string): Promise<Electron.ApplicationInfoForProtocolReturnValue>;
|
816 | /**
|
817 | * Name of the application handling the protocol, or an empty string if there is no
|
818 | * handler. For instance, if Electron is the default handler of the URL, this could
|
819 | * be `Electron` on Windows and Mac. However, don't rely on the precise format
|
820 | * which is not guaranteed to remain unchanged. Expect a different format on Linux,
|
821 | * possibly with a `.desktop` suffix.
|
822 | *
|
823 | * This method returns the application name of the default handler for the protocol
|
824 | * (aka URI scheme) of a URL.
|
825 | */
|
826 | getApplicationNameForProtocol(url: string): string;
|
827 | /**
|
828 | * Array of `ProcessMetric` objects that correspond to memory and CPU usage
|
829 | * statistics of all the processes associated with the app.
|
830 | */
|
831 | getAppMetrics(): ProcessMetric[];
|
832 | /**
|
833 | * The current application directory.
|
834 | */
|
835 | getAppPath(): string;
|
836 | /**
|
837 | * The current value displayed in the counter badge.
|
838 | *
|
839 | * @platform linux,darwin
|
840 | */
|
841 | getBadgeCount(): number;
|
842 | /**
|
843 | * The type of the currently running activity.
|
844 | *
|
845 | * @platform darwin
|
846 | */
|
847 | getCurrentActivityType(): string;
|
848 | /**
|
849 | * fulfilled with the app's icon, which is a NativeImage.
|
850 | *
|
851 | * Fetches a path's associated icon.
|
852 | *
|
853 | * On _Windows_, there a 2 kinds of icons:
|
854 | *
|
855 | * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
|
856 | * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
|
857 | *
|
858 | * On _Linux_ and _macOS_, icons depend on the application associated with file
|
859 | * mime type.
|
860 | */
|
861 | getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
|
862 | /**
|
863 | * The Graphics Feature Status from `chrome://gpu/`.
|
864 | *
|
865 | * **Note:** This information is only usable after the `gpu-info-update` event is
|
866 | * emitted.
|
867 | */
|
868 | getGPUFeatureStatus(): GPUFeatureStatus;
|
869 | /**
|
870 | * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
|
871 | * containing all the GPU Information as in chromium's GPUInfo object. This
|
872 | * includes the version and driver information that's shown on `chrome://gpu` page.
|
873 | *
|
874 | * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
|
875 | * fewer attributes than when requested with `complete`. Here's an example of basic
|
876 | * response:
|
877 | *
|
878 | * Using `basic` should be preferred if only basic information like `vendorId` or
|
879 | * `driverId` is needed.
|
880 | */
|
881 | getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
|
882 | /**
|
883 | * * `minItems` Integer - The minimum number of items that will be shown in the
|
884 | * Jump List (for a more detailed description of this value see the MSDN docs).
|
885 | * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
|
886 | * correspond to items that the user has explicitly removed from custom categories
|
887 | * in the Jump List. These items must not be re-added to the Jump List in the
|
888 | * **next** call to `app.setJumpList()`, Windows will not display any custom
|
889 | * category that contains any of the removed items.
|
890 | *
|
891 | * @platform win32
|
892 | */
|
893 | getJumpListSettings(): JumpListSettings;
|
894 | /**
|
895 | * The current application locale. Possible return values are documented here.
|
896 | *
|
897 | * To set the locale, you'll want to use a command line switch at app startup,
|
898 | * which may be found here.
|
899 | *
|
900 | * **Note:** When distributing your packaged app, you have to also ship the
|
901 | * `locales` folder.
|
902 | *
|
903 | * **Note:** On Windows, you have to call it after the `ready` events gets emitted.
|
904 | */
|
905 | getLocale(): string;
|
906 | /**
|
907 | * User operating system's locale two-letter ISO 3166 country code. The value is
|
908 | * taken from native OS APIs.
|
909 | *
|
910 | **Note:** When unable to detect locale country code, it returns empty string.
|
911 | */
|
912 | getLocaleCountryCode(): string;
|
913 | /**
|
914 | * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
|
915 | * you need to pass the same arguments here for `openAtLogin` to be set correctly.
|
916 | *
|
917 | *
|
918 | * * `openAtLogin` Boolean - `true` if the app is set to open at login.
|
919 | * * `openAsHidden` Boolean _macOS_ - `true` if the app is set to open as hidden at
|
920 | * login. This setting is not available on MAS builds.
|
921 | * * `wasOpenedAtLogin` Boolean _macOS_ - `true` if the app was opened at login
|
922 | * automatically. This setting is not available on MAS builds.
|
923 | * * `wasOpenedAsHidden` Boolean _macOS_ - `true` if the app was opened as a hidden
|
924 | * login item. This indicates that the app should not open any windows at startup.
|
925 | * This setting is not available on MAS builds.
|
926 | * * `restoreState` Boolean _macOS_ - `true` if the app was opened as a login item
|
927 | * that should restore the state from the previous session. This indicates that the
|
928 | * app should restore the windows that were open the last time the app was closed.
|
929 | * This setting is not available on MAS builds.
|
930 | *
|
931 | * @platform darwin,win32
|
932 | */
|
933 | getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
|
934 | /**
|
935 | * The current application's name, which is the name in the application's
|
936 | * `package.json` file.
|
937 | *
|
938 | * Usually the `name` field of `package.json` is a short lowercase name, according
|
939 | * to the npm modules spec. You should usually also specify a `productName` field,
|
940 | * which is your application's full capitalized name, and which will be preferred
|
941 | * over `name` by Electron.
|
942 | */
|
943 | getName(): string;
|
944 | /**
|
945 | * A path to a special directory or file associated with `name`. On failure, an
|
946 | * `Error` is thrown.
|
947 | *
|
948 | * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
|
949 | * called first, a default log directory will be created equivalent to calling
|
950 | * `app.setAppLogsPath()` without a `path` parameter.
|
951 | */
|
952 | getPath(name: 'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'pepperFlashSystemPlugin' | 'crashDumps'): string;
|
953 | /**
|
954 | * The version of the loaded application. If no version is found in the
|
955 | * application's `package.json` file, the version of the current bundle or
|
956 | * executable is returned.
|
957 | */
|
958 | getVersion(): string;
|
959 | /**
|
960 | * This method returns whether or not this instance of your app is currently
|
961 | * holding the single instance lock. You can request the lock with
|
962 | * `app.requestSingleInstanceLock()` and release with
|
963 | * `app.releaseSingleInstanceLock()`
|
964 | */
|
965 | hasSingleInstanceLock(): boolean;
|
966 | /**
|
967 | * Hides all application windows without minimizing them.
|
968 | *
|
969 | * @platform darwin
|
970 | */
|
971 | hide(): void;
|
972 | /**
|
973 | * Imports the certificate in pkcs12 format into the platform certificate store.
|
974 | * `callback` is called with the `result` of import operation, a value of `0`
|
975 | * indicates success while any other value indicates failure according to Chromium
|
976 | * net_error_list.
|
977 | *
|
978 | * @platform linux
|
979 | */
|
980 | importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
|
981 | /**
|
982 | * Invalidates the current Handoff user activity.
|
983 | *
|
984 | * @platform darwin
|
985 | */
|
986 | invalidateCurrentActivity(): void;
|
987 | /**
|
988 | * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
|
989 | * will return `true` if the use of assistive technologies, such as screen readers,
|
990 | * has been detected. See
|
991 | * https://www.chromium.org/developers/design-documents/accessibility for more
|
992 | * details.
|
993 | *
|
994 | * @platform darwin,win32
|
995 | */
|
996 | isAccessibilitySupportEnabled(): boolean;
|
997 | /**
|
998 | * Whether the current executable is the default handler for a protocol (aka URI
|
999 | * scheme).
|
1000 | *
|
1001 | * **Note:** On macOS, you can use this method to check if the app has been
|
1002 | * registered as the default protocol handler for a protocol. You can also verify
|
1003 | * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
|
1004 | * macOS machine. Please refer to Apple's documentation for details.
|
1005 | *
|
1006 | * The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
|
1007 | * internally.
|
1008 | */
|
1009 | isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
|
1010 | /**
|
1011 | * whether or not the current OS version allows for native emoji pickers.
|
1012 | */
|
1013 | isEmojiPanelSupported(): boolean;
|
1014 | /**
|
1015 | * Whether the application is currently running from the systems Application
|
1016 | * folder. Use in combination with `app.moveToApplicationsFolder()`
|
1017 | *
|
1018 | * @platform darwin
|
1019 | */
|
1020 | isInApplicationsFolder(): boolean;
|
1021 | /**
|
1022 | * `true` if Electron has finished initializing, `false` otherwise. See also
|
1023 | * `app.whenReady()`.
|
1024 | */
|
1025 | isReady(): boolean;
|
1026 | /**
|
1027 | * whether `Secure Keyboard Entry` is enabled.
|
1028 | *
|
1029 | By default this API will return `false`.
|
1030 | *
|
1031 | * @platform darwin
|
1032 | */
|
1033 | isSecureKeyboardEntryEnabled(): boolean;
|
1034 | /**
|
1035 | * Whether the current desktop environment is Unity launcher.
|
1036 | *
|
1037 | * @platform linux
|
1038 | */
|
1039 | isUnityRunning(): boolean;
|
1040 | /**
|
1041 | * Whether the move was successful. Please note that if the move is successful,
|
1042 | * your application will quit and relaunch.
|
1043 | *
|
1044 | * No confirmation dialog will be presented by default. If you wish to allow the
|
1045 | * user to confirm the operation, you may do so using the `dialog` API.
|
1046 | *
|
1047 | * **NOTE:** This method throws errors if anything other than the user causes the
|
1048 | * move to fail. For instance if the user cancels the authorization dialog, this
|
1049 | * method returns false. If we fail to perform the copy, then this method will
|
1050 | * throw an error. The message in the error should be informative and tell you
|
1051 | * exactly what went wrong.
|
1052 | *
|
1053 | * By default, if an app of the same name as the one being moved exists in the
|
1054 | * Applications directory and is _not_ running, the existing app will be trashed
|
1055 | * and the active app moved into its place. If it _is_ running, the pre-existing
|
1056 | * running app will assume focus and the the previously active app will quit
|
1057 | * itself. This behavior can be changed by providing the optional conflict handler,
|
1058 | * where the boolean returned by the handler determines whether or not the move
|
1059 | * conflict is resolved with default behavior. i.e. returning `false` will ensure
|
1060 | * no further action is taken, returning `true` will result in the default behavior
|
1061 | * and the method continuing.
|
1062 | *
|
1063 | * For example:
|
1064 | *
|
1065 | * Would mean that if an app already exists in the user directory, if the user
|
1066 | * chooses to 'Continue Move' then the function would continue with its default
|
1067 | * behavior and the existing app will be trashed and the active app moved into its
|
1068 | * place.
|
1069 | *
|
1070 | * @platform darwin
|
1071 | */
|
1072 | moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
|
1073 | /**
|
1074 | * Try to close all windows. The `before-quit` event will be emitted first. If all
|
1075 | * windows are successfully closed, the `will-quit` event will be emitted and by
|
1076 | * default the application will terminate.
|
1077 | *
|
1078 | * This method guarantees that all `beforeunload` and `unload` event handlers are
|
1079 | * correctly executed. It is possible that a window cancels the quitting by
|
1080 | * returning `false` in the `beforeunload` event handler.
|
1081 | */
|
1082 | quit(): void;
|
1083 | /**
|
1084 | * Relaunches the app when current instance exits.
|
1085 | *
|
1086 | * By default, the new instance will use the same working directory and command
|
1087 | * line arguments with current instance. When `args` is specified, the `args` will
|
1088 | * be passed as command line arguments instead. When `execPath` is specified, the
|
1089 | * `execPath` will be executed for relaunch instead of current app.
|
1090 | *
|
1091 | * Note that this method does not quit the app when executed, you have to call
|
1092 | * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
|
1093 | *
|
1094 | * When `app.relaunch` is called for multiple times, multiple instances will be
|
1095 | * started after current instance exited.
|
1096 | *
|
1097 | * An example of restarting current instance immediately and adding a new command
|
1098 | * line argument to the new instance:
|
1099 | */
|
1100 | relaunch(options?: RelaunchOptions): void;
|
1101 | /**
|
1102 | * Releases all locks that were created by `requestSingleInstanceLock`. This will
|
1103 | * allow multiple instances of the application to once again run side by side.
|
1104 | */
|
1105 | releaseSingleInstanceLock(): void;
|
1106 | /**
|
1107 | * Whether the call succeeded.
|
1108 | *
|
1109 | * This method checks if the current executable as the default handler for a
|
1110 | * protocol (aka URI scheme). If so, it will remove the app as the default handler.
|
1111 | *
|
1112 | * @platform darwin,win32
|
1113 | */
|
1114 | removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
|
1115 | /**
|
1116 | * The return value of this method indicates whether or not this instance of your
|
1117 | * application successfully obtained the lock. If it failed to obtain the lock,
|
1118 | * you can assume that another instance of your application is already running with
|
1119 | * the lock and exit immediately.
|
1120 | *
|
1121 | * I.e. This method returns `true` if your process is the primary instance of your
|
1122 | * application and your app should continue loading. It returns `false` if your
|
1123 | * process should immediately quit as it has sent its parameters to another
|
1124 | * instance that has already acquired the lock.
|
1125 | *
|
1126 | * On macOS, the system enforces single instance automatically when users try to
|
1127 | * open a second instance of your app in Finder, and the `open-file` and `open-url`
|
1128 | * events will be emitted for that. However when users start your app in command
|
1129 | * line, the system's single instance mechanism will be bypassed, and you have to
|
1130 | * use this method to ensure single instance.
|
1131 | *
|
1132 | * An example of activating the window of primary instance when a second instance
|
1133 | * starts:
|
1134 | */
|
1135 | requestSingleInstanceLock(): boolean;
|
1136 | /**
|
1137 | * Marks the current Handoff user activity as inactive without invalidating it.
|
1138 | *
|
1139 | * @platform darwin
|
1140 | */
|
1141 | resignCurrentActivity(): void;
|
1142 | /**
|
1143 | * Set the about panel options. This will override the values defined in the app's
|
1144 | * `.plist` file on macOS. See the Apple docs for more details. On Linux, values
|
1145 | * must be set in order to be shown; there are no defaults.
|
1146 | *
|
1147 | * If you do not set `credits` but still wish to surface them in your app, AppKit
|
1148 | * will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in
|
1149 | * that order, in the bundle returned by the NSBundle class method main. The first
|
1150 | * file found is used, and if none is found, the info area is left blank. See Apple
|
1151 | * documentation for more information.
|
1152 | */
|
1153 | setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
|
1154 | /**
|
1155 | * Manually enables Chrome's accessibility support, allowing to expose
|
1156 | * accessibility switch to users in application settings. See Chromium's
|
1157 | * accessibility docs for more details. Disabled by default.
|
1158 | *
|
1159 | * This API must be called after the `ready` event is emitted.
|
1160 | *
|
1161 | * **Note:** Rendering accessibility tree can significantly affect the performance
|
1162 | * of your app. It should not be enabled by default.
|
1163 | *
|
1164 | * @platform darwin,win32
|
1165 | */
|
1166 | setAccessibilitySupportEnabled(enabled: boolean): void;
|
1167 | /**
|
1168 | * Sets the activation policy for a given app.
|
1169 | *
|
1170 | * Activation policy types:
|
1171 | *
|
1172 | * * 'regular' - The application is an ordinary app that appears in the Dock and
|
1173 | * may have a user interface.
|
1174 | * * 'accessory' - The application doesn’t appear in the Dock and doesn’t have a
|
1175 | * menu bar, but it may be activated programmatically or by clicking on one of its
|
1176 | * windows.
|
1177 | * * 'prohibited' - The application doesn’t appear in the Dock and may not create
|
1178 | * windows or be activated.
|
1179 | *
|
1180 | * @platform darwin
|
1181 | */
|
1182 | setActivationPolicy(policy: 'regular' | 'accessory' | 'prohibited'): void;
|
1183 | /**
|
1184 | * Sets or creates a directory your app's logs which can then be manipulated with
|
1185 | * `app.getPath()` or `app.setPath(pathName, newPath)`.
|
1186 | *
|
1187 | * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
|
1188 | * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
|
1189 | * `userData` directory on _Linux_ and _Windows_.
|
1190 | */
|
1191 | setAppLogsPath(path?: string): void;
|
1192 | /**
|
1193 | * Changes the Application User Model ID to `id`.
|
1194 | *
|
1195 | * @platform win32
|
1196 | */
|
1197 | setAppUserModelId(id: string): void;
|
1198 | /**
|
1199 | * Whether the call succeeded.
|
1200 | *
|
1201 | * Sets the current executable as the default handler for a protocol (aka URI
|
1202 | * scheme). It allows you to integrate your app deeper into the operating system.
|
1203 | * Once registered, all links with `your-protocol://` will be opened with the
|
1204 | * current executable. The whole link, including protocol, will be passed to your
|
1205 | * application as a parameter.
|
1206 | *
|
1207 | * **Note:** On macOS, you can only register protocols that have been added to your
|
1208 | * app's `info.plist`, which cannot be modified at runtime. However, you can change
|
1209 | * the file during build time via Electron Forge, Electron Packager, or by editing
|
1210 | * `info.plist` with a text editor. Please refer to Apple's documentation for
|
1211 | * details.
|
1212 | *
|
1213 | * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
|
1214 | * will return `true` for all calls but the registry key it sets won't be
|
1215 | * accessible by other applications. In order to register your Windows Store
|
1216 | * application as a default protocol handler you must declare the protocol in your
|
1217 | * manifest.
|
1218 | *
|
1219 | * The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme`
|
1220 | * internally.
|
1221 | */
|
1222 | setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
|
1223 | /**
|
1224 | * Whether the call succeeded.
|
1225 | *
|
1226 | * Sets the counter badge for current app. Setting the count to `0` will hide the
|
1227 | * badge.
|
1228 | *
|
1229 | * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
|
1230 | *
|
1231 | * **Note:** Unity launcher requires the existence of a `.desktop` file to work,
|
1232 | * for more information please read Desktop Environment Integration.
|
1233 | *
|
1234 | * @platform linux,darwin
|
1235 | */
|
1236 | setBadgeCount(count: number): boolean;
|
1237 | /**
|
1238 | * Sets or removes a custom Jump List for the application, and returns one of the
|
1239 | * following strings:
|
1240 | *
|
1241 | * * `ok` - Nothing went wrong.
|
1242 | * * `error` - One or more errors occurred, enable runtime logging to figure out
|
1243 | * the likely cause.
|
1244 | * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
|
1245 | * category in the Jump List. Separators are only allowed in the standard `Tasks`
|
1246 | * category.
|
1247 | * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
|
1248 | * Jump List for a file type the app isn't registered to handle.
|
1249 | * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
|
1250 | * Jump List due to user privacy or group policy settings.
|
1251 | *
|
1252 | * If `categories` is `null` the previously set custom Jump List (if any) will be
|
1253 | * replaced by the standard Jump List for the app (managed by Windows).
|
1254 | *
|
1255 | * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
|
1256 | * property set then its `type` is assumed to be `tasks`. If the `name` property is
|
1257 | * set but the `type` property is omitted then the `type` is assumed to be
|
1258 | * `custom`.
|
1259 | *
|
1260 | * **Note:** Users can remove items from custom categories, and Windows will not
|
1261 | * allow a removed item to be added back into a custom category until **after** the
|
1262 | * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
|
1263 | * removed item to a custom category earlier than that will result in the entire
|
1264 | * custom category being omitted from the Jump List. The list of removed items can
|
1265 | * be obtained using `app.getJumpListSettings()`.
|
1266 | *
|
1267 | Here's a very simple example of creating a custom Jump List:
|
1268 | *
|
1269 | * @platform win32
|
1270 | */
|
1271 | setJumpList(categories: (JumpListCategory[]) | (null)): void;
|
1272 | /**
|
1273 | * Set the app's login item settings.
|
1274 | *
|
1275 | * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
|
1276 | * want to set the launch path to Update.exe, and pass arguments that specify your
|
1277 | * application name. For example:
|
1278 | *
|
1279 | * @platform darwin,win32
|
1280 | */
|
1281 | setLoginItemSettings(settings: Settings): void;
|
1282 | /**
|
1283 | * Overrides the current application's name.
|
1284 | *
|
1285 | * **Note:** This function overrides the name used internally by Electron; it does
|
1286 | * not affect the name that the OS uses.
|
1287 | */
|
1288 | setName(name: string): void;
|
1289 | /**
|
1290 | * Overrides the `path` to a special directory or file associated with `name`. If
|
1291 | * the path specifies a directory that does not exist, an `Error` is thrown. In
|
1292 | * that case, the directory should be created with `fs.mkdirSync` or similar.
|
1293 | *
|
1294 | * You can only override paths of a `name` defined in `app.getPath`.
|
1295 | *
|
1296 | * By default, web pages' cookies and caches will be stored under the `userData`
|
1297 | * directory. If you want to change this location, you have to override the
|
1298 | * `userData` path before the `ready` event of the `app` module is emitted.
|
1299 | */
|
1300 | setPath(name: string, path: string): void;
|
1301 | /**
|
1302 | * Set the `Secure Keyboard Entry` is enabled in your application.
|
1303 | *
|
1304 | * By using this API, important information such as password and other sensitive
|
1305 | * information can be prevented from being intercepted by other processes.
|
1306 | *
|
1307 | * See Apple's documentation for more details.
|
1308 | *
|
1309 | * **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it
|
1310 | * when it is no longer needed.
|
1311 | *
|
1312 | * @platform darwin
|
1313 | */
|
1314 | setSecureKeyboardEntryEnabled(enabled: boolean): void;
|
1315 | /**
|
1316 | * Creates an `NSUserActivity` and sets it as the current activity. The activity is
|
1317 | * eligible for Handoff to another device afterward.
|
1318 | *
|
1319 | * @platform darwin
|
1320 | */
|
1321 | setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
|
1322 | /**
|
1323 | * Adds `tasks` to the Tasks category of the Jump List on Windows.
|
1324 | *
|
1325 | * `tasks` is an array of `Task` objects.
|
1326 | *
|
1327 | * Whether the call succeeded.
|
1328 | *
|
1329 | * **Note:** If you'd like to customize the Jump List even more use
|
1330 | * `app.setJumpList(categories)` instead.
|
1331 | *
|
1332 | * @platform win32
|
1333 | */
|
1334 | setUserTasks(tasks: Task[]): boolean;
|
1335 | /**
|
1336 | * Shows application windows after they were hidden. Does not automatically focus
|
1337 | * them.
|
1338 | *
|
1339 | * @platform darwin
|
1340 | */
|
1341 | show(): void;
|
1342 | /**
|
1343 | * Show the app's about panel options. These options can be overridden with
|
1344 | * `app.setAboutPanelOptions(options)`.
|
1345 | */
|
1346 | showAboutPanel(): void;
|
1347 | /**
|
1348 | * Show the platform's native emoji picker.
|
1349 | *
|
1350 | * @platform darwin,win32
|
1351 | */
|
1352 | showEmojiPanel(): void;
|
1353 | /**
|
1354 | * This function **must** be called once you have finished accessing the security
|
1355 | * scoped file. If you do not remember to stop accessing the bookmark, kernel
|
1356 | * resources will be leaked and your app will lose its ability to reach outside the
|
1357 | * sandbox completely, until your app is restarted.
|
1358 | *
|
1359 | * Start accessing a security scoped resource. With this method Electron
|
1360 | * applications that are packaged for the Mac App Store may reach outside their
|
1361 | * sandbox to access files chosen by the user. See Apple's documentation for a
|
1362 | * description of how this system works.
|
1363 | *
|
1364 | * @platform mas
|
1365 | */
|
1366 | startAccessingSecurityScopedResource(bookmarkData: string): Function;
|
1367 | /**
|
1368 | * Updates the current activity if its type matches `type`, merging the entries
|
1369 | * from `userInfo` into its current `userInfo` dictionary.
|
1370 | *
|
1371 | * @platform darwin
|
1372 | */
|
1373 | updateCurrentActivity(type: string, userInfo: any): void;
|
1374 | /**
|
1375 | * fulfilled when Electron is initialized. May be used as a convenient alternative
|
1376 | * to checking `app.isReady()` and subscribing to the `ready` event if the app is
|
1377 | * not ready yet.
|
1378 | */
|
1379 | whenReady(): Promise<void>;
|
1380 | /**
|
1381 | * A `Boolean` property that's `true` if Chrome's accessibility support is enabled,
|
1382 | * `false` otherwise. This property will be `true` if the use of assistive
|
1383 | * technologies, such as screen readers, has been detected. Setting this property
|
1384 | * to `true` manually enables Chrome's accessibility support, allowing developers
|
1385 | * to expose accessibility switch to users in application settings.
|
1386 | *
|
1387 | * See Chromium's accessibility docs for more details. Disabled by default.
|
1388 | *
|
1389 | * This API must be called after the `ready` event is emitted.
|
1390 | *
|
1391 | * **Note:** Rendering accessibility tree can significantly affect the performance
|
1392 | * of your app. It should not be enabled by default.
|
1393 | *
|
1394 | * @platform darwin,win32
|
1395 | */
|
1396 | accessibilitySupportEnabled: boolean;
|
1397 | /**
|
1398 | * A `Boolean` which when `true` disables the overrides that Electron has in place
|
1399 | * to ensure renderer processes are restarted on every navigation. The current
|
1400 | * default value for this property is `true`.
|
1401 | *
|
1402 | * The intention is for these overrides to become disabled by default and then at
|
1403 | * some point in the future this property will be removed. This property impacts
|
1404 | * which native modules you can use in the renderer process. For more information
|
1405 | * on the direction Electron is going with renderer process restarts and usage of
|
1406 | * native modules in the renderer process please check out this Tracking Issue.
|
1407 | */
|
1408 | allowRendererProcessReuse: boolean;
|
1409 | /**
|
1410 | * A `Menu | null` property that returns `Menu` if one has been set and `null`
|
1411 | * otherwise. Users can pass a Menu to set this property.
|
1412 | */
|
1413 | applicationMenu: (Menu) | (null);
|
1414 | /**
|
1415 | * An `Integer` property that returns the badge count for current app. Setting the
|
1416 | * count to `0` will hide the badge.
|
1417 | *
|
1418 | * On macOS, setting this with any nonzero integer shows on the dock icon. On
|
1419 | * Linux, this property only works for Unity launcher.
|
1420 | *
|
1421 | * **Note:** Unity launcher requires the existence of a `.desktop` file to work,
|
1422 | * for more information please read Desktop Environment Integration.
|
1423 | *
|
1424 | * **Note:** On macOS, you need to ensure that your application has the permission
|
1425 | * to display notifications for this property to take effect.
|
1426 | *
|
1427 | * @platform linux,darwin
|
1428 | */
|
1429 | badgeCount: number;
|
1430 | /**
|
1431 | * A `CommandLine` object that allows you to read and manipulate the command line
|
1432 | * arguments that Chromium uses.
|
1433 | *
|
1434 | */
|
1435 | readonly commandLine: CommandLine;
|
1436 | /**
|
1437 | * A `Dock` `| undefined` object that allows you to perform actions on your app
|
1438 | * icon in the user's dock on macOS.
|
1439 | *
|
1440 | * @platform darwin
|
1441 | */
|
1442 | readonly dock: Dock;
|
1443 | /**
|
1444 | * A `Boolean` property that returns `true` if the app is packaged, `false`
|
1445 | * otherwise. For many apps, this property can be used to distinguish development
|
1446 | * and production environments.
|
1447 | *
|
1448 | */
|
1449 | readonly isPackaged: boolean;
|
1450 | /**
|
1451 | * A `String` property that indicates the current application's name, which is the
|
1452 | * name in the application's `package.json` file.
|
1453 | *
|
1454 | * Usually the `name` field of `package.json` is a short lowercase name, according
|
1455 | * to the npm modules spec. You should usually also specify a `productName` field,
|
1456 | * which is your application's full capitalized name, and which will be preferred
|
1457 | * over `name` by Electron.
|
1458 | */
|
1459 | name: string;
|
1460 | /**
|
1461 | * A `String` which is the user agent string Electron will use as a global
|
1462 | * fallback.
|
1463 | *
|
1464 | * This is the user agent that will be used when no user agent is set at the
|
1465 | * `webContents` or `session` level. It is useful for ensuring that your entire
|
1466 | * app has the same user agent. Set to a custom value as early as possible in your
|
1467 | * app's initialization to ensure that your overridden value is used.
|
1468 | */
|
1469 | userAgentFallback: string;
|
1470 | }
|
1471 |
|
1472 | interface AutoUpdater extends NodeJS.EventEmitter {
|
1473 |
|
1474 | // Docs: http://electronjs.org/docs/api/auto-updater
|
1475 |
|
1476 | /**
|
1477 | * This event is emitted after a user calls `quitAndInstall()`.
|
1478 | *
|
1479 | * When this API is called, the `before-quit` event is not emitted before all
|
1480 | * windows are closed. As a result you should listen to this event if you wish to
|
1481 | * perform actions before the windows are closed while a process is quitting, as
|
1482 | * well as listening to `before-quit`.
|
1483 | */
|
1484 | on(event: 'before-quit-for-update', listener: Function): this;
|
1485 | once(event: 'before-quit-for-update', listener: Function): this;
|
1486 | addListener(event: 'before-quit-for-update', listener: Function): this;
|
1487 | removeListener(event: 'before-quit-for-update', listener: Function): this;
|
1488 | /**
|
1489 | * Emitted when checking if an update has started.
|
1490 | */
|
1491 | on(event: 'checking-for-update', listener: Function): this;
|
1492 | once(event: 'checking-for-update', listener: Function): this;
|
1493 | addListener(event: 'checking-for-update', listener: Function): this;
|
1494 | removeListener(event: 'checking-for-update', listener: Function): this;
|
1495 | /**
|
1496 | * Emitted when there is an error while updating.
|
1497 | */
|
1498 | on(event: 'error', listener: (error: Error) => void): this;
|
1499 | once(event: 'error', listener: (error: Error) => void): this;
|
1500 | addListener(event: 'error', listener: (error: Error) => void): this;
|
1501 | removeListener(event: 'error', listener: (error: Error) => void): this;
|
1502 | /**
|
1503 | * Emitted when there is an available update. The update is downloaded
|
1504 | * automatically.
|
1505 | */
|
1506 | on(event: 'update-available', listener: Function): this;
|
1507 | once(event: 'update-available', listener: Function): this;
|
1508 | addListener(event: 'update-available', listener: Function): this;
|
1509 | removeListener(event: 'update-available', listener: Function): this;
|
1510 | /**
|
1511 | * Emitted when an update has been downloaded.
|
1512 | *
|
1513 | * On Windows only `releaseName` is available.
|
1514 | *
|
1515 | * **Note:** It is not strictly necessary to handle this event. A successfully
|
1516 | * downloaded update will still be applied the next time the application starts.
|
1517 | */
|
1518 | on(event: 'update-downloaded', listener: (event: Event,
|
1519 | releaseNotes: string,
|
1520 | releaseName: string,
|
1521 | releaseDate: Date,
|
1522 | updateURL: string) => void): this;
|
1523 | once(event: 'update-downloaded', listener: (event: Event,
|
1524 | releaseNotes: string,
|
1525 | releaseName: string,
|
1526 | releaseDate: Date,
|
1527 | updateURL: string) => void): this;
|
1528 | addListener(event: 'update-downloaded', listener: (event: Event,
|
1529 | releaseNotes: string,
|
1530 | releaseName: string,
|
1531 | releaseDate: Date,
|
1532 | updateURL: string) => void): this;
|
1533 | removeListener(event: 'update-downloaded', listener: (event: Event,
|
1534 | releaseNotes: string,
|
1535 | releaseName: string,
|
1536 | releaseDate: Date,
|
1537 | updateURL: string) => void): this;
|
1538 | /**
|
1539 | * Emitted when there is no available update.
|
1540 | */
|
1541 | on(event: 'update-not-available', listener: Function): this;
|
1542 | once(event: 'update-not-available', listener: Function): this;
|
1543 | addListener(event: 'update-not-available', listener: Function): this;
|
1544 | removeListener(event: 'update-not-available', listener: Function): this;
|
1545 | /**
|
1546 | * Asks the server whether there is an update. You must call `setFeedURL` before
|
1547 | * using this API.
|
1548 | */
|
1549 | checkForUpdates(): void;
|
1550 | /**
|
1551 | * The current update feed URL.
|
1552 | */
|
1553 | getFeedURL(): string;
|
1554 | /**
|
1555 | * Restarts the app and installs the update after it has been downloaded. It should
|
1556 | * only be called after `update-downloaded` has been emitted.
|
1557 | *
|
1558 | * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
|
1559 | * windows first, and automatically call `app.quit()` after all windows have been
|
1560 | * closed.
|
1561 | *
|
1562 | * **Note:** It is not strictly necessary to call this function to apply an update,
|
1563 | * as a successfully downloaded update will always be applied the next time the
|
1564 | * application starts.
|
1565 | */
|
1566 | quitAndInstall(): void;
|
1567 | /**
|
1568 | * Sets the `url` and initialize the auto updater.
|
1569 | */
|
1570 | setFeedURL(options: FeedURLOptions): void;
|
1571 | }
|
1572 |
|
1573 | interface BluetoothDevice {
|
1574 |
|
1575 | // Docs: http://electronjs.org/docs/api/structures/bluetooth-device
|
1576 |
|
1577 | deviceId: string;
|
1578 | deviceName: string;
|
1579 | }
|
1580 |
|
1581 | class BrowserView {
|
1582 |
|
1583 | // Docs: http://electronjs.org/docs/api/browser-view
|
1584 |
|
1585 | /**
|
1586 | * BrowserView
|
1587 | */
|
1588 | constructor(options?: BrowserViewConstructorOptions);
|
1589 | /**
|
1590 | * The view with the given `id`.
|
1591 | */
|
1592 | static fromId(id: number): BrowserView;
|
1593 | /**
|
1594 | * The BrowserView that owns the given `webContents` or `null` if the contents are
|
1595 | * not owned by a BrowserView.
|
1596 | */
|
1597 | static fromWebContents(webContents: WebContents): (BrowserView) | (null);
|
1598 | /**
|
1599 | * An array of all opened BrowserViews.
|
1600 | */
|
1601 | static getAllViews(): BrowserView[];
|
1602 | /**
|
1603 | * Force closing the view, the `unload` and `beforeunload` events won't be emitted
|
1604 | * for the web page. After you're done with a view, call this function in order to
|
1605 | * free memory and other resources as soon as possible.
|
1606 | */
|
1607 | destroy(): void;
|
1608 | /**
|
1609 | * The `bounds` of this BrowserView instance as `Object`.
|
1610 | *
|
1611 | * @experimental
|
1612 | */
|
1613 | getBounds(): Rectangle;
|
1614 | /**
|
1615 | * Whether the view is destroyed.
|
1616 | */
|
1617 | isDestroyed(): boolean;
|
1618 | setAutoResize(options: AutoResizeOptions): void;
|
1619 | setBackgroundColor(color: string): void;
|
1620 | /**
|
1621 | * Resizes and moves the view to the supplied bounds relative to the window.
|
1622 | *
|
1623 | * @experimental
|
1624 | */
|
1625 | setBounds(bounds: Rectangle): void;
|
1626 | id: number;
|
1627 | webContents: WebContents;
|
1628 | }
|
1629 |
|
1630 | class BrowserWindow extends NodeEventEmitter {
|
1631 |
|
1632 | // Docs: http://electronjs.org/docs/api/browser-window
|
1633 |
|
1634 | /**
|
1635 | * Emitted when the window is set or unset to show always on top of other windows.
|
1636 | */
|
1637 | on(event: 'always-on-top-changed', listener: (event: Event,
|
1638 | isAlwaysOnTop: boolean) => void): this;
|
1639 | once(event: 'always-on-top-changed', listener: (event: Event,
|
1640 | isAlwaysOnTop: boolean) => void): this;
|
1641 | addListener(event: 'always-on-top-changed', listener: (event: Event,
|
1642 | isAlwaysOnTop: boolean) => void): this;
|
1643 | removeListener(event: 'always-on-top-changed', listener: (event: Event,
|
1644 | isAlwaysOnTop: boolean) => void): this;
|
1645 | /**
|
1646 | * Emitted when an App Command is invoked. These are typically related to keyboard
|
1647 | * media keys or browser commands, as well as the "Back" button built into some
|
1648 | * mice on Windows.
|
1649 | *
|
1650 | * Commands are lowercased, underscores are replaced with hyphens, and the
|
1651 | * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
|
1652 | * emitted as `browser-backward`.
|
1653 | *
|
1654 | * The following app commands are explicitly supported on Linux:
|
1655 | *
|
1656 | * `browser-backward`
|
1657 | * `browser-forward`
|
1658 | *
|
1659 | * @platform win32,linux
|
1660 | */
|
1661 | on(event: 'app-command', listener: (event: Event,
|
1662 | command: string) => void): this;
|
1663 | once(event: 'app-command', listener: (event: Event,
|
1664 | command: string) => void): this;
|
1665 | addListener(event: 'app-command', listener: (event: Event,
|
1666 | command: string) => void): this;
|
1667 | removeListener(event: 'app-command', listener: (event: Event,
|
1668 | command: string) => void): this;
|
1669 | /**
|
1670 | * Emitted when the window loses focus.
|
1671 | */
|
1672 | on(event: 'blur', listener: Function): this;
|
1673 | once(event: 'blur', listener: Function): this;
|
1674 | addListener(event: 'blur', listener: Function): this;
|
1675 | removeListener(event: 'blur', listener: Function): this;
|
1676 | /**
|
1677 | * Emitted when the window is going to be closed. It's emitted before the
|
1678 | * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
|
1679 | * will cancel the close.
|
1680 | *
|
1681 | * Usually you would want to use the `beforeunload` handler to decide whether the
|
1682 | * window should be closed, which will also be called when the window is reloaded.
|
1683 | * In Electron, returning any value other than `undefined` would cancel the close.
|
1684 | * For example:
|
1685 | *
|
1686 | * _**Note**: There is a subtle difference between the behaviors of
|
1687 | * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
|
1688 | * handler)`. It is recommended to always set the `event.returnValue` explicitly,
|
1689 | * instead of only returning a value, as the former works more consistently within
|
1690 | * Electron._
|
1691 | */
|
1692 | on(event: 'close', listener: (event: Event) => void): this;
|
1693 | once(event: 'close', listener: (event: Event) => void): this;
|
1694 | addListener(event: 'close', listener: (event: Event) => void): this;
|
1695 | removeListener(event: 'close', listener: (event: Event) => void): this;
|
1696 | /**
|
1697 | * Emitted when the window is closed. After you have received this event you should
|
1698 | * remove the reference to the window and avoid using it any more.
|
1699 | */
|
1700 | on(event: 'closed', listener: Function): this;
|
1701 | once(event: 'closed', listener: Function): this;
|
1702 | addListener(event: 'closed', listener: Function): this;
|
1703 | removeListener(event: 'closed', listener: Function): this;
|
1704 | /**
|
1705 | * Emitted when the window enters a full-screen state.
|
1706 | */
|
1707 | on(event: 'enter-full-screen', listener: Function): this;
|
1708 | once(event: 'enter-full-screen', listener: Function): this;
|
1709 | addListener(event: 'enter-full-screen', listener: Function): this;
|
1710 | removeListener(event: 'enter-full-screen', listener: Function): this;
|
1711 | /**
|
1712 | * Emitted when the window enters a full-screen state triggered by HTML API.
|
1713 | */
|
1714 | on(event: 'enter-html-full-screen', listener: Function): this;
|
1715 | once(event: 'enter-html-full-screen', listener: Function): this;
|
1716 | addListener(event: 'enter-html-full-screen', listener: Function): this;
|
1717 | removeListener(event: 'enter-html-full-screen', listener: Function): this;
|
1718 | /**
|
1719 | * Emitted when the window gains focus.
|
1720 | */
|
1721 | on(event: 'focus', listener: Function): this;
|
1722 | once(event: 'focus', listener: Function): this;
|
1723 | addListener(event: 'focus', listener: Function): this;
|
1724 | removeListener(event: 'focus', listener: Function): this;
|
1725 | /**
|
1726 | * Emitted when the window is hidden.
|
1727 | */
|
1728 | on(event: 'hide', listener: Function): this;
|
1729 | once(event: 'hide', listener: Function): this;
|
1730 | addListener(event: 'hide', listener: Function): this;
|
1731 | removeListener(event: 'hide', listener: Function): this;
|
1732 | /**
|
1733 | * Emitted when the window leaves a full-screen state.
|
1734 | */
|
1735 | on(event: 'leave-full-screen', listener: Function): this;
|
1736 | once(event: 'leave-full-screen', listener: Function): this;
|
1737 | addListener(event: 'leave-full-screen', listener: Function): this;
|
1738 | removeListener(event: 'leave-full-screen', listener: Function): this;
|
1739 | /**
|
1740 | * Emitted when the window leaves a full-screen state triggered by HTML API.
|
1741 | */
|
1742 | on(event: 'leave-html-full-screen', listener: Function): this;
|
1743 | once(event: 'leave-html-full-screen', listener: Function): this;
|
1744 | addListener(event: 'leave-html-full-screen', listener: Function): this;
|
1745 | removeListener(event: 'leave-html-full-screen', listener: Function): this;
|
1746 | /**
|
1747 | * Emitted when window is maximized.
|
1748 | */
|
1749 | on(event: 'maximize', listener: Function): this;
|
1750 | once(event: 'maximize', listener: Function): this;
|
1751 | addListener(event: 'maximize', listener: Function): this;
|
1752 | removeListener(event: 'maximize', listener: Function): this;
|
1753 | /**
|
1754 | * Emitted when the window is minimized.
|
1755 | */
|
1756 | on(event: 'minimize', listener: Function): this;
|
1757 | once(event: 'minimize', listener: Function): this;
|
1758 | addListener(event: 'minimize', listener: Function): this;
|
1759 | removeListener(event: 'minimize', listener: Function): this;
|
1760 | /**
|
1761 | * Emitted when the window is being moved to a new position.
|
1762 | *
|
1763 | __Note__: On macOS this event is an alias of `moved`.
|
1764 | */
|
1765 | on(event: 'move', listener: Function): this;
|
1766 | once(event: 'move', listener: Function): this;
|
1767 | addListener(event: 'move', listener: Function): this;
|
1768 | removeListener(event: 'move', listener: Function): this;
|
1769 | /**
|
1770 | * Emitted once when the window is moved to a new position.
|
1771 | *
|
1772 | * @platform darwin
|
1773 | */
|
1774 | on(event: 'moved', listener: Function): this;
|
1775 | once(event: 'moved', listener: Function): this;
|
1776 | addListener(event: 'moved', listener: Function): this;
|
1777 | removeListener(event: 'moved', listener: Function): this;
|
1778 | /**
|
1779 | * Emitted when the native new tab button is clicked.
|
1780 | *
|
1781 | * @platform darwin
|
1782 | */
|
1783 | on(event: 'new-window-for-tab', listener: Function): this;
|
1784 | once(event: 'new-window-for-tab', listener: Function): this;
|
1785 | addListener(event: 'new-window-for-tab', listener: Function): this;
|
1786 | removeListener(event: 'new-window-for-tab', listener: Function): this;
|
1787 | /**
|
1788 | * Emitted when the document changed its title, calling `event.preventDefault()`
|
1789 | * will prevent the native window's title from changing. `explicitSet` is false
|
1790 | * when title is synthesized from file URL.
|
1791 | */
|
1792 | on(event: 'page-title-updated', listener: (event: Event,
|
1793 | title: string,
|
1794 | explicitSet: boolean) => void): this;
|
1795 | once(event: 'page-title-updated', listener: (event: Event,
|
1796 | title: string,
|
1797 | explicitSet: boolean) => void): this;
|
1798 | addListener(event: 'page-title-updated', listener: (event: Event,
|
1799 | title: string,
|
1800 | explicitSet: boolean) => void): this;
|
1801 | removeListener(event: 'page-title-updated', listener: (event: Event,
|
1802 | title: string,
|
1803 | explicitSet: boolean) => void): this;
|
1804 | /**
|
1805 | * Emitted when the web page has been rendered (while not being shown) and window
|
1806 | * can be displayed without a visual flash.
|
1807 | *
|
1808 | * Please note that using this event implies that the renderer will be considered
|
1809 | * "visible" and paint even though `show` is false. This event will never fire if
|
1810 | * you use `paintWhenInitiallyHidden: false`
|
1811 | */
|
1812 | on(event: 'ready-to-show', listener: Function): this;
|
1813 | once(event: 'ready-to-show', listener: Function): this;
|
1814 | addListener(event: 'ready-to-show', listener: Function): this;
|
1815 | removeListener(event: 'ready-to-show', listener: Function): this;
|
1816 | /**
|
1817 | * Emitted after the window has been resized.
|
1818 | */
|
1819 | on(event: 'resize', listener: Function): this;
|
1820 | once(event: 'resize', listener: Function): this;
|
1821 | addListener(event: 'resize', listener: Function): this;
|
1822 | removeListener(event: 'resize', listener: Function): this;
|
1823 | /**
|
1824 | * Emitted when the unresponsive web page becomes responsive again.
|
1825 | */
|
1826 | on(event: 'responsive', listener: Function): this;
|
1827 | once(event: 'responsive', listener: Function): this;
|
1828 | addListener(event: 'responsive', listener: Function): this;
|
1829 | removeListener(event: 'responsive', listener: Function): this;
|
1830 | /**
|
1831 | * Emitted when the window is restored from a minimized state.
|
1832 | */
|
1833 | on(event: 'restore', listener: Function): this;
|
1834 | once(event: 'restore', listener: Function): this;
|
1835 | addListener(event: 'restore', listener: Function): this;
|
1836 | removeListener(event: 'restore', listener: Function): this;
|
1837 | /**
|
1838 | * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
|
1839 | * is ended. The `rotation` value on each emission is the angle in degrees rotated
|
1840 | * since the last emission. The last emitted event upon a rotation gesture will
|
1841 | * always be of value `0`. Counter-clockwise rotation values are positive, while
|
1842 | * clockwise ones are negative.
|
1843 | *
|
1844 | * @platform darwin
|
1845 | */
|
1846 | on(event: 'rotate-gesture', listener: (event: Event,
|
1847 | rotation: number) => void): this;
|
1848 | once(event: 'rotate-gesture', listener: (event: Event,
|
1849 | rotation: number) => void): this;
|
1850 | addListener(event: 'rotate-gesture', listener: (event: Event,
|
1851 | rotation: number) => void): this;
|
1852 | removeListener(event: 'rotate-gesture', listener: (event: Event,
|
1853 | rotation: number) => void): this;
|
1854 | /**
|
1855 | * Emitted when scroll wheel event phase has begun.
|
1856 | *
|
1857 | * @platform darwin
|
1858 | */
|
1859 | on(event: 'scroll-touch-begin', listener: Function): this;
|
1860 | once(event: 'scroll-touch-begin', listener: Function): this;
|
1861 | addListener(event: 'scroll-touch-begin', listener: Function): this;
|
1862 | removeListener(event: 'scroll-touch-begin', listener: Function): this;
|
1863 | /**
|
1864 | * Emitted when scroll wheel event phase filed upon reaching the edge of element.
|
1865 | *
|
1866 | * @platform darwin
|
1867 | */
|
1868 | on(event: 'scroll-touch-edge', listener: Function): this;
|
1869 | once(event: 'scroll-touch-edge', listener: Function): this;
|
1870 | addListener(event: 'scroll-touch-edge', listener: Function): this;
|
1871 | removeListener(event: 'scroll-touch-edge', listener: Function): this;
|
1872 | /**
|
1873 | * Emitted when scroll wheel event phase has ended.
|
1874 | *
|
1875 | * @platform darwin
|
1876 | */
|
1877 | on(event: 'scroll-touch-end', listener: Function): this;
|
1878 | once(event: 'scroll-touch-end', listener: Function): this;
|
1879 | addListener(event: 'scroll-touch-end', listener: Function): this;
|
1880 | removeListener(event: 'scroll-touch-end', listener: Function): this;
|
1881 | /**
|
1882 | * Emitted when window session is going to end due to force shutdown or machine
|
1883 | * restart or session log off.
|
1884 | *
|
1885 | * @platform win32
|
1886 | */
|
1887 | on(event: 'session-end', listener: Function): this;
|
1888 | once(event: 'session-end', listener: Function): this;
|
1889 | addListener(event: 'session-end', listener: Function): this;
|
1890 | removeListener(event: 'session-end', listener: Function): this;
|
1891 | /**
|
1892 | * Emitted when the window opens a sheet.
|
1893 | *
|
1894 | * @platform darwin
|
1895 | */
|
1896 | on(event: 'sheet-begin', listener: Function): this;
|
1897 | once(event: 'sheet-begin', listener: Function): this;
|
1898 | addListener(event: 'sheet-begin', listener: Function): this;
|
1899 | removeListener(event: 'sheet-begin', listener: Function): this;
|
1900 | /**
|
1901 | * Emitted when the window has closed a sheet.
|
1902 | *
|
1903 | * @platform darwin
|
1904 | */
|
1905 | on(event: 'sheet-end', listener: Function): this;
|
1906 | once(event: 'sheet-end', listener: Function): this;
|
1907 | addListener(event: 'sheet-end', listener: Function): this;
|
1908 | removeListener(event: 'sheet-end', listener: Function): this;
|
1909 | /**
|
1910 | * Emitted when the window is shown.
|
1911 | */
|
1912 | on(event: 'show', listener: Function): this;
|
1913 | once(event: 'show', listener: Function): this;
|
1914 | addListener(event: 'show', listener: Function): this;
|
1915 | removeListener(event: 'show', listener: Function): this;
|
1916 | /**
|
1917 | * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
|
1918 | * `left`.
|
1919 | *
|
1920 | * The method underlying this event is built to handle older macOS-style trackpad
|
1921 | * swiping, where the content on the screen doesn't move with the swipe. Most macOS
|
1922 | * trackpads are not configured to allow this kind of swiping anymore, so in order
|
1923 | * for it to emit properly the 'Swipe between pages' preference in `System
|
1924 | * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
|
1925 | * fingers'.
|
1926 | *
|
1927 | * @platform darwin
|
1928 | */
|
1929 | on(event: 'swipe', listener: (event: Event,
|
1930 | direction: string) => void): this;
|
1931 | once(event: 'swipe', listener: (event: Event,
|
1932 | direction: string) => void): this;
|
1933 | addListener(event: 'swipe', listener: (event: Event,
|
1934 | direction: string) => void): this;
|
1935 | removeListener(event: 'swipe', listener: (event: Event,
|
1936 | direction: string) => void): this;
|
1937 | /**
|
1938 | * Emitted when the window exits from a maximized state.
|
1939 | */
|
1940 | on(event: 'unmaximize', listener: Function): this;
|
1941 | once(event: 'unmaximize', listener: Function): this;
|
1942 | addListener(event: 'unmaximize', listener: Function): this;
|
1943 | removeListener(event: 'unmaximize', listener: Function): this;
|
1944 | /**
|
1945 | * Emitted when the web page becomes unresponsive.
|
1946 | */
|
1947 | on(event: 'unresponsive', listener: Function): this;
|
1948 | once(event: 'unresponsive', listener: Function): this;
|
1949 | addListener(event: 'unresponsive', listener: Function): this;
|
1950 | removeListener(event: 'unresponsive', listener: Function): this;
|
1951 | /**
|
1952 | * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
|
1953 | * will prevent the window from being moved.
|
1954 | *
|
1955 | * Note that this is only emitted when the window is being resized manually.
|
1956 | * Resizing the window with `setBounds`/`setSize` will not emit this event.
|
1957 | *
|
1958 | * @platform darwin,win32
|
1959 | */
|
1960 | on(event: 'will-move', listener: (event: Event,
|
1961 | /**
|
1962 | * Location the window is being moved to.
|
1963 | */
|
1964 | newBounds: Rectangle) => void): this;
|
1965 | once(event: 'will-move', listener: (event: Event,
|
1966 | /**
|
1967 | * Location the window is being moved to.
|
1968 | */
|
1969 | newBounds: Rectangle) => void): this;
|
1970 | addListener(event: 'will-move', listener: (event: Event,
|
1971 | /**
|
1972 | * Location the window is being moved to.
|
1973 | */
|
1974 | newBounds: Rectangle) => void): this;
|
1975 | removeListener(event: 'will-move', listener: (event: Event,
|
1976 | /**
|
1977 | * Location the window is being moved to.
|
1978 | */
|
1979 | newBounds: Rectangle) => void): this;
|
1980 | /**
|
1981 | * Emitted before the window is resized. Calling `event.preventDefault()` will
|
1982 | * prevent the window from being resized.
|
1983 | *
|
1984 | * Note that this is only emitted when the window is being resized manually.
|
1985 | * Resizing the window with `setBounds`/`setSize` will not emit this event.
|
1986 | *
|
1987 | * @platform darwin,win32
|
1988 | */
|
1989 | on(event: 'will-resize', listener: (event: Event,
|
1990 | /**
|
1991 | * Size the window is being resized to.
|
1992 | */
|
1993 | newBounds: Rectangle) => void): this;
|
1994 | once(event: 'will-resize', listener: (event: Event,
|
1995 | /**
|
1996 | * Size the window is being resized to.
|
1997 | */
|
1998 | newBounds: Rectangle) => void): this;
|
1999 | addListener(event: 'will-resize', listener: (event: Event,
|
2000 | /**
|
2001 | * Size the window is being resized to.
|
2002 | */
|
2003 | newBounds: Rectangle) => void): this;
|
2004 | removeListener(event: 'will-resize', listener: (event: Event,
|
2005 | /**
|
2006 | * Size the window is being resized to.
|
2007 | */
|
2008 | newBounds: Rectangle) => void): this;
|
2009 | /**
|
2010 | * BrowserWindow
|
2011 | */
|
2012 | constructor(options?: BrowserWindowConstructorOptions);
|
2013 | /**
|
2014 | * Adds DevTools extension located at `path`, and returns extension's name.
|
2015 | *
|
2016 | * The extension will be remembered so you only need to call this API once, this
|
2017 | * API is not for programming use. If you try to add an extension that has already
|
2018 | * been loaded, this method will not return and instead log a warning to the
|
2019 | * console.
|
2020 | *
|
2021 | * The method will also not return if the extension's manifest is missing or
|
2022 | * incomplete.
|
2023 | *
|
2024 | * **Note:** This API cannot be called before the `ready` event of the `app` module
|
2025 | * is emitted.
|
2026 | *
|
2027 | **Note:** This method is deprecated. Instead, use `ses.loadExtension(path)`.
|
2028 | *
|
2029 | * @deprecated
|
2030 | */
|
2031 | static addDevToolsExtension(path: string): void;
|
2032 | /**
|
2033 | * Adds Chrome extension located at `path`, and returns extension's name.
|
2034 | *
|
2035 | * The method will also not return if the extension's manifest is missing or
|
2036 | * incomplete.
|
2037 | *
|
2038 | * **Note:** This API cannot be called before the `ready` event of the `app` module
|
2039 | * is emitted.
|
2040 | *
|
2041 | **Note:** This method is deprecated. Instead, use `ses.loadExtension(path)`.
|
2042 | *
|
2043 | * @deprecated
|
2044 | */
|
2045 | static addExtension(path: string): void;
|
2046 | /**
|
2047 | * The window that owns the given `browserView`. If the given view is not attached
|
2048 | * to any window, returns `null`.
|
2049 | */
|
2050 | static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
|
2051 | /**
|
2052 | * The window with the given `id`.
|
2053 | */
|
2054 | static fromId(id: number): (BrowserWindow) | (null);
|
2055 | /**
|
2056 | * The window that owns the given `webContents` or `null` if the contents are not
|
2057 | * owned by a window.
|
2058 | */
|
2059 | static fromWebContents(webContents: WebContents): (BrowserWindow) | (null);
|
2060 | /**
|
2061 | * An array of all opened browser windows.
|
2062 | */
|
2063 | static getAllWindows(): BrowserWindow[];
|
2064 | /**
|
2065 | * The keys are the extension names and each value is an Object containing `name`
|
2066 | * and `version` properties.
|
2067 | *
|
2068 | * To check if a DevTools extension is installed you can run the following:
|
2069 | *
|
2070 | * **Note:** This API cannot be called before the `ready` event of the `app` module
|
2071 | * is emitted.
|
2072 | *
|
2073 | **Note:** This method is deprecated. Instead, use `ses.getAllExtensions()`.
|
2074 | *
|
2075 | * @deprecated
|
2076 | */
|
2077 | static getDevToolsExtensions(): Record<string, ExtensionInfo>;
|
2078 | /**
|
2079 | * The keys are the extension names and each value is an Object containing `name`
|
2080 | * and `version` properties.
|
2081 | *
|
2082 | * **Note:** This API cannot be called before the `ready` event of the `app` module
|
2083 | * is emitted.
|
2084 | *
|
2085 | **Note:** This method is deprecated. Instead, use `ses.getAllExtensions()`.
|
2086 | *
|
2087 | * @deprecated
|
2088 | */
|
2089 | static getExtensions(): Record<string, ExtensionInfo>;
|
2090 | /**
|
2091 | * The window that is focused in this application, otherwise returns `null`.
|
2092 | */
|
2093 | static getFocusedWindow(): (BrowserWindow) | (null);
|
2094 | /**
|
2095 | * Remove a DevTools extension by name.
|
2096 | *
|
2097 | * **Note:** This API cannot be called before the `ready` event of the `app` module
|
2098 | * is emitted.
|
2099 | *
|
2100 | * **Note:** This method is deprecated. Instead, use
|
2101 | * `ses.removeExtension(extension_id)`.
|
2102 | *
|
2103 | * @deprecated
|
2104 | */
|
2105 | static removeDevToolsExtension(name: string): void;
|
2106 | /**
|
2107 | * Remove a Chrome extension by name.
|
2108 | *
|
2109 | * **Note:** This API cannot be called before the `ready` event of the `app` module
|
2110 | * is emitted.
|
2111 | *
|
2112 | * **Note:** This method is deprecated. Instead, use
|
2113 | * `ses.removeExtension(extension_id)`.
|
2114 | *
|
2115 | * @deprecated
|
2116 | */
|
2117 | static removeExtension(name: string): void;
|
2118 | /**
|
2119 | * Replacement API for setBrowserView supporting work with multi browser views.
|
2120 | *
|
2121 | * @experimental
|
2122 | */
|
2123 | addBrowserView(browserView: BrowserView): void;
|
2124 | /**
|
2125 | * Adds a window as a tab on this window, after the tab for the window instance.
|
2126 | *
|
2127 | * @platform darwin
|
2128 | */
|
2129 | addTabbedWindow(browserWindow: BrowserWindow): void;
|
2130 | /**
|
2131 | * Removes focus from the window.
|
2132 | */
|
2133 | blur(): void;
|
2134 | blurWebView(): void;
|
2135 | /**
|
2136 | * Resolves with a NativeImage
|
2137 | *
|
2138 | * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
|
2139 | * whole visible page.
|
2140 | */
|
2141 | capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
|
2142 | /**
|
2143 | * Moves window to the center of the screen.
|
2144 | */
|
2145 | center(): void;
|
2146 | /**
|
2147 | * Try to close the window. This has the same effect as a user manually clicking
|
2148 | * the close button of the window. The web page may cancel the close though. See
|
2149 | * the close event.
|
2150 | */
|
2151 | close(): void;
|
2152 | /**
|
2153 | * Closes the currently open Quick Look panel.
|
2154 | *
|
2155 | * @platform darwin
|
2156 | */
|
2157 | closeFilePreview(): void;
|
2158 | /**
|
2159 | * Force closing the window, the `unload` and `beforeunload` event won't be emitted
|
2160 | * for the web page, and `close` event will also not be emitted for this window,
|
2161 | * but it guarantees the `closed` event will be emitted.
|
2162 | */
|
2163 | destroy(): void;
|
2164 | /**
|
2165 | * Starts or stops flashing the window to attract user's attention.
|
2166 | */
|
2167 | flashFrame(flag: boolean): void;
|
2168 | /**
|
2169 | * Focuses on the window.
|
2170 | */
|
2171 | focus(): void;
|
2172 | focusOnWebView(): void;
|
2173 | /**
|
2174 | * Gets the background color of the window. See Setting `backgroundColor`.
|
2175 | */
|
2176 | getBackgroundColor(): string;
|
2177 | /**
|
2178 | * The `bounds` of the window as `Object`.
|
2179 | */
|
2180 | getBounds(): Rectangle;
|
2181 | /**
|
2182 | * The `BrowserView` attached to `win`. Returns `null` if one is not attached.
|
2183 | * Throws an error if multiple `BrowserView`s are attached.
|
2184 | *
|
2185 | * @experimental
|
2186 | */
|
2187 | getBrowserView(): (BrowserView) | (null);
|
2188 | /**
|
2189 | * an array of all BrowserViews that have been attached with `addBrowserView` or
|
2190 | * `setBrowserView`.
|
2191 | *
|
2192 | * **Note:** The BrowserView API is currently experimental and may change or be
|
2193 | * removed in future Electron releases.
|
2194 | *
|
2195 | * @experimental
|
2196 | */
|
2197 | getBrowserViews(): BrowserView[];
|
2198 | /**
|
2199 | * All child windows.
|
2200 | */
|
2201 | getChildWindows(): BrowserWindow[];
|
2202 | /**
|
2203 | * The `bounds` of the window's client area as `Object`.
|
2204 | */
|
2205 | getContentBounds(): Rectangle;
|
2206 | /**
|
2207 | * Contains the window's client area's width and height.
|
2208 | */
|
2209 | getContentSize(): number[];
|
2210 | /**
|
2211 | * Contains the window's maximum width and height.
|
2212 | */
|
2213 | getMaximumSize(): number[];
|
2214 | /**
|
2215 | * Window id in the format of DesktopCapturerSource's id. For example
|
2216 | * "window:1234:0".
|
2217 | *
|
2218 | * More precisely the format is `window:id:other_id` where `id` is `HWND` on
|
2219 | * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
|
2220 | * Linux. `other_id` is used to identify web contents (tabs) so within the same top
|
2221 | * level window.
|
2222 | */
|
2223 | getMediaSourceId(): string;
|
2224 | /**
|
2225 | * Contains the window's minimum width and height.
|
2226 | */
|
2227 | getMinimumSize(): number[];
|
2228 | /**
|
2229 | * The platform-specific handle of the window.
|
2230 | *
|
2231 | * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
|
2232 | * `Window` (`unsigned long`) on Linux.
|
2233 | */
|
2234 | getNativeWindowHandle(): Buffer;
|
2235 | /**
|
2236 | * Contains the window bounds of the normal state
|
2237 | *
|
2238 | * **Note:** whatever the current state of the window : maximized, minimized or in
|
2239 | * fullscreen, this function always returns the position and size of the window in
|
2240 | * normal state. In normal state, getBounds and getNormalBounds returns the same
|
2241 | * `Rectangle`.
|
2242 | */
|
2243 | getNormalBounds(): Rectangle;
|
2244 | /**
|
2245 | * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
|
2246 | * 1.
|
2247 | */
|
2248 | getOpacity(): number;
|
2249 | /**
|
2250 | * The parent window.
|
2251 | */
|
2252 | getParentWindow(): BrowserWindow;
|
2253 | /**
|
2254 | * Contains the window's current position.
|
2255 | */
|
2256 | getPosition(): number[];
|
2257 | /**
|
2258 | * The pathname of the file the window represents.
|
2259 | *
|
2260 | * @platform darwin
|
2261 | */
|
2262 | getRepresentedFilename(): string;
|
2263 | /**
|
2264 | * Contains the window's width and height.
|
2265 | */
|
2266 | getSize(): number[];
|
2267 | /**
|
2268 | * The title of the native window.
|
2269 | *
|
2270 | * **Note:** The title of the web page can be different from the title of the
|
2271 | * native window.
|
2272 | */
|
2273 | getTitle(): string;
|
2274 | /**
|
2275 | * The current position for the traffic light buttons. Can only be used with
|
2276 | * `titleBarStyle` set to `hidden`.
|
2277 | *
|
2278 | * @platform darwin
|
2279 | */
|
2280 | getTrafficLightPosition(): Point;
|
2281 | /**
|
2282 | * Whether the window has a shadow.
|
2283 | */
|
2284 | hasShadow(): boolean;
|
2285 | /**
|
2286 | * Hides the window.
|
2287 | */
|
2288 | hide(): void;
|
2289 | /**
|
2290 | * Hooks a windows message. The `callback` is called when the message is received
|
2291 | * in the WndProc.
|
2292 | *
|
2293 | * @platform win32
|
2294 | */
|
2295 | hookWindowMessage(message: number, callback: () => void): void;
|
2296 | /**
|
2297 | * Whether the window is always on top of other windows.
|
2298 | */
|
2299 | isAlwaysOnTop(): boolean;
|
2300 | /**
|
2301 | * Whether the window can be manually closed by user.
|
2302 | *
|
2303 | On Linux always returns `true`.
|
2304 | *
|
2305 | * @platform darwin,win32
|
2306 | */
|
2307 | isClosable(): boolean;
|
2308 | /**
|
2309 | * Whether the window is destroyed.
|
2310 | */
|
2311 | isDestroyed(): boolean;
|
2312 | /**
|
2313 | * Whether the window's document has been edited.
|
2314 | *
|
2315 | * @platform darwin
|
2316 | */
|
2317 | isDocumentEdited(): boolean;
|
2318 | /**
|
2319 | * Returns Boolean - whether the window is enabled.
|
2320 | */
|
2321 | isEnabled(): void;
|
2322 | /**
|
2323 | * Whether the window is focused.
|
2324 | */
|
2325 | isFocused(): boolean;
|
2326 | /**
|
2327 | * Whether the window is in fullscreen mode.
|
2328 | */
|
2329 | isFullScreen(): boolean;
|
2330 | /**
|
2331 | * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
|
2332 | * window.
|
2333 | */
|
2334 | isFullScreenable(): boolean;
|
2335 | /**
|
2336 | * Whether the window is in kiosk mode.
|
2337 | */
|
2338 | isKiosk(): boolean;
|
2339 | /**
|
2340 | * Whether the window can be manually maximized by user.
|
2341 | *
|
2342 | On Linux always returns `true`.
|
2343 | *
|
2344 | * @platform darwin,win32
|
2345 | */
|
2346 | isMaximizable(): boolean;
|
2347 | /**
|
2348 | * Whether the window is maximized.
|
2349 | */
|
2350 | isMaximized(): boolean;
|
2351 | /**
|
2352 | * Whether menu bar automatically hides itself.
|
2353 | */
|
2354 | isMenuBarAutoHide(): boolean;
|
2355 | /**
|
2356 | * Whether the menu bar is visible.
|
2357 | */
|
2358 | isMenuBarVisible(): boolean;
|
2359 | /**
|
2360 | * Whether the window can be manually minimized by the user.
|
2361 | *
|
2362 | On Linux always returns `true`.
|
2363 | *
|
2364 | * @platform darwin,win32
|
2365 | */
|
2366 | isMinimizable(): boolean;
|
2367 | /**
|
2368 | * Whether the window is minimized.
|
2369 | */
|
2370 | isMinimized(): boolean;
|
2371 | /**
|
2372 | * Whether current window is a modal window.
|
2373 | */
|
2374 | isModal(): boolean;
|
2375 | /**
|
2376 | * Whether the window can be moved by user.
|
2377 |
|
2378 | On Linux always returns `true`.
|
2379 | *
|
2380 | * @platform darwin,win32
|
2381 | */
|
2382 | isMovable(): boolean;
|
2383 | /**
|
2384 | * Whether the window is in normal state (not maximized, not minimized, not in
|
2385 | * fullscreen mode).
|
2386 | */
|
2387 | isNormal(): boolean;
|
2388 | /**
|
2389 | * Whether the window can be manually resized by the user.
|
2390 | */
|
2391 | isResizable(): boolean;
|
2392 | /**
|
2393 | * Whether the window is in simple (pre-Lion) fullscreen mode.
|
2394 | *
|
2395 | * @platform darwin
|
2396 | */
|
2397 | isSimpleFullScreen(): boolean;
|
2398 | /**
|
2399 | * Whether the window is visible to the user.
|
2400 | */
|
2401 | isVisible(): boolean;
|
2402 | /**
|
2403 | * Whether the window is visible on all workspaces.
|
2404 | *
|
2405 | **Note:** This API always returns false on Windows.
|
2406 | */
|
2407 | isVisibleOnAllWorkspaces(): boolean;
|
2408 | /**
|
2409 | * `true` or `false` depending on whether the message is hooked.
|
2410 | *
|
2411 | * @platform win32
|
2412 | */
|
2413 | isWindowMessageHooked(message: number): boolean;
|
2414 | /**
|
2415 | * the promise will resolve when the page has finished loading (see
|
2416 | * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
|
2417 | *
|
2418 | * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
|
2419 | * relative to the root of your application. See the `webContents` docs for more
|
2420 | * information.
|
2421 | */
|
2422 | loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
|
2423 | /**
|
2424 | * the promise will resolve when the page has finished loading (see
|
2425 | * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
|
2426 | *
|
2427 | * Same as `webContents.loadURL(url[, options])`.
|
2428 | *
|
2429 | * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
|
2430 | * file using the `file://` protocol.
|
2431 | *
|
2432 | * To ensure that file URLs are properly formatted, it is recommended to use Node's
|
2433 | * `url.format` method:
|
2434 | *
|
2435 | * You can load a URL using a `POST` request with URL-encoded data by doing the
|
2436 | * following:
|
2437 | */
|
2438 | loadURL(url: string, options?: LoadURLOptions): Promise<void>;
|
2439 | /**
|
2440 | * Maximizes the window. This will also show (but not focus) the window if it isn't
|
2441 | * being displayed already.
|
2442 | */
|
2443 | maximize(): void;
|
2444 | /**
|
2445 | * Merges all windows into one window with multiple tabs when native tabs are
|
2446 | * enabled and there is more than one open window.
|
2447 | *
|
2448 | * @platform darwin
|
2449 | */
|
2450 | mergeAllWindows(): void;
|
2451 | /**
|
2452 | * Minimizes the window. On some platforms the minimized window will be shown in
|
2453 | * the Dock.
|
2454 | */
|
2455 | minimize(): void;
|
2456 | /**
|
2457 | * Moves window above the source window in the sense of z-order. If the
|
2458 | * `mediaSourceId` is not of type window or if the window does not exist then this
|
2459 | * method throws an error.
|
2460 | */
|
2461 | moveAbove(mediaSourceId: string): void;
|
2462 | /**
|
2463 | * Moves the current tab into a new window if native tabs are enabled and there is
|
2464 | * more than one tab in the current window.
|
2465 | *
|
2466 | * @platform darwin
|
2467 | */
|
2468 | moveTabToNewWindow(): void;
|
2469 | /**
|
2470 | * Moves window to top(z-order) regardless of focus
|
2471 | */
|
2472 | moveTop(): void;
|
2473 | /**
|
2474 | * Uses Quick Look to preview a file at a given path.
|
2475 | *
|
2476 | * @platform darwin
|
2477 | */
|
2478 | previewFile(path: string, displayName?: string): void;
|
2479 | /**
|
2480 | * Same as `webContents.reload`.
|
2481 | */
|
2482 | reload(): void;
|
2483 | removeBrowserView(browserView: BrowserView): void;
|
2484 | /**
|
2485 | * Remove the window's menu bar.
|
2486 | *
|
2487 | * @platform linux,win32
|
2488 | */
|
2489 | removeMenu(): void;
|
2490 | /**
|
2491 | * Restores the window from minimized state to its previous state.
|
2492 | */
|
2493 | restore(): void;
|
2494 | /**
|
2495 | * Selects the next tab when native tabs are enabled and there are other tabs in
|
2496 | * the window.
|
2497 | *
|
2498 | * @platform darwin
|
2499 | */
|
2500 | selectNextTab(): void;
|
2501 | /**
|
2502 | * Selects the previous tab when native tabs are enabled and there are other tabs
|
2503 | * in the window.
|
2504 | *
|
2505 | * @platform darwin
|
2506 | */
|
2507 | selectPreviousTab(): void;
|
2508 | /**
|
2509 | * Sets whether the window should show always on top of other windows. After
|
2510 | * setting this, the window is still a normal window, not a toolbox window which
|
2511 | * can not be focused on.
|
2512 | */
|
2513 | setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
|
2514 | /**
|
2515 | * Sets the properties for the window's taskbar button.
|
2516 | *
|
2517 | * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
|
2518 | * together. If one of those properties is not set, then neither will be used.
|
2519 | *
|
2520 | * @platform win32
|
2521 | */
|
2522 | setAppDetails(options: AppDetailsOptions): void;
|
2523 | /**
|
2524 | * This will make a window maintain an aspect ratio. The extra size allows a
|
2525 | * developer to have space, specified in pixels, not included within the aspect
|
2526 | * ratio calculations. This API already takes into account the difference between a
|
2527 | * window's size and its content size.
|
2528 | *
|
2529 | * Consider a normal window with an HD video player and associated controls.
|
2530 | * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
|
2531 | * on the right edge and 50 pixels of controls below the player. In order to
|
2532 | * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
|
2533 | * the player itself we would call this function with arguments of 16/9 and {
|
2534 | * width: 40, height: 50 }. The second argument doesn't care where the extra width
|
2535 | * and height are within the content view--only that they exist. Sum any extra
|
2536 | * width and height areas you have within the overall content view.
|
2537 | *
|
2538 | * @platform darwin,linux
|
2539 | */
|
2540 | setAspectRatio(aspectRatio: number, extraSize?: Size): void;
|
2541 | /**
|
2542 | * Controls whether to hide cursor when typing.
|
2543 | *
|
2544 | * @platform darwin
|
2545 | */
|
2546 | setAutoHideCursor(autoHide: boolean): void;
|
2547 | /**
|
2548 | * Sets whether the window menu bar should hide itself automatically. Once set the
|
2549 | * menu bar will only show when users press the single `Alt` key.
|
2550 | *
|
2551 | * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
|
2552 | * hide it immediately.
|
2553 | */
|
2554 | setAutoHideMenuBar(hide: boolean): void;
|
2555 | /**
|
2556 | * Sets the background color of the window. See Setting `backgroundColor`.
|
2557 | */
|
2558 | setBackgroundColor(backgroundColor: string): void;
|
2559 | /**
|
2560 | * Resizes and moves the window to the supplied bounds. Any properties that are not
|
2561 | * supplied will default to their current values.
|
2562 | */
|
2563 | setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
|
2564 | setBrowserView(browserView: (BrowserView) | (null)): void;
|
2565 | /**
|
2566 | * Sets whether the window can be manually closed by user. On Linux does nothing.
|
2567 | *
|
2568 | * @platform darwin,win32
|
2569 | */
|
2570 | setClosable(closable: boolean): void;
|
2571 | /**
|
2572 | * Resizes and moves the window's client area (e.g. the web page) to the supplied
|
2573 | * bounds.
|
2574 | */
|
2575 | setContentBounds(bounds: Rectangle, animate?: boolean): void;
|
2576 | /**
|
2577 | * Prevents the window contents from being captured by other apps.
|
2578 | *
|
2579 | * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
|
2580 | * it calls SetWindowDisplayAffinity with `WDA_MONITOR`.
|
2581 | *
|
2582 | * @platform darwin,win32
|
2583 | */
|
2584 | setContentProtection(enable: boolean): void;
|
2585 | /**
|
2586 | * Resizes the window's client area (e.g. the web page) to `width` and `height`.
|
2587 | */
|
2588 | setContentSize(width: number, height: number, animate?: boolean): void;
|
2589 | /**
|
2590 | * Specifies whether the window’s document has been edited, and the icon in title
|
2591 | * bar will become gray when set to `true`.
|
2592 | *
|
2593 | * @platform darwin
|
2594 | */
|
2595 | setDocumentEdited(edited: boolean): void;
|
2596 | /**
|
2597 | * Disable or enable the window.
|
2598 | */
|
2599 | setEnabled(enable: boolean): void;
|
2600 | /**
|
2601 | * Changes whether the window can be focused.
|
2602 | *
|
2603 | On macOS it does not remove the focus from the window.
|
2604 | *
|
2605 | * @platform darwin,win32
|
2606 | */
|
2607 | setFocusable(focusable: boolean): void;
|
2608 | /**
|
2609 | * Sets whether the window should be in fullscreen mode.
|
2610 | */
|
2611 | setFullScreen(flag: boolean): void;
|
2612 | /**
|
2613 | * Sets whether the maximize/zoom window button toggles fullscreen mode or
|
2614 | * maximizes the window.
|
2615 | */
|
2616 | setFullScreenable(fullscreenable: boolean): void;
|
2617 | /**
|
2618 | * Sets whether the window should have a shadow.
|
2619 | */
|
2620 | setHasShadow(hasShadow: boolean): void;
|
2621 | /**
|
2622 | * Changes window icon.
|
2623 | *
|
2624 | * @platform win32,linux
|
2625 | */
|
2626 | setIcon(icon: (NativeImage) | (string)): void;
|
2627 | /**
|
2628 | * Makes the window ignore all mouse events.
|
2629 | *
|
2630 | * All mouse events happened in this window will be passed to the window below this
|
2631 | * window, but if this window has focus, it will still receive keyboard events.
|
2632 | */
|
2633 | setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
|
2634 | /**
|
2635 | * Enters or leaves kiosk mode.
|
2636 | */
|
2637 | setKiosk(flag: boolean): void;
|
2638 | /**
|
2639 | * Sets whether the window can be manually maximized by user. On Linux does
|
2640 | * nothing.
|
2641 | *
|
2642 | * @platform darwin,win32
|
2643 | */
|
2644 | setMaximizable(maximizable: boolean): void;
|
2645 | /**
|
2646 | * Sets the maximum size of window to `width` and `height`.
|
2647 | */
|
2648 | setMaximumSize(width: number, height: number): void;
|
2649 | /**
|
2650 | * Sets the `menu` as the window's menu bar.
|
2651 | *
|
2652 | * @platform linux,win32
|
2653 | */
|
2654 | setMenu(menu: (Menu) | (null)): void;
|
2655 | /**
|
2656 | * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
|
2657 | * can still bring up the menu bar by pressing the single `Alt` key.
|
2658 | *
|
2659 | * @platform win32,linux
|
2660 | */
|
2661 | setMenuBarVisibility(visible: boolean): void;
|
2662 | /**
|
2663 | * Sets whether the window can be manually minimized by user. On Linux does
|
2664 | * nothing.
|
2665 | *
|
2666 | * @platform darwin,win32
|
2667 | */
|
2668 | setMinimizable(minimizable: boolean): void;
|
2669 | /**
|
2670 | * Sets the minimum size of window to `width` and `height`.
|
2671 | */
|
2672 | setMinimumSize(width: number, height: number): void;
|
2673 | /**
|
2674 | * Sets whether the window can be moved by user. On Linux does nothing.
|
2675 | *
|
2676 | * @platform darwin,win32
|
2677 | */
|
2678 | setMovable(movable: boolean): void;
|
2679 | /**
|
2680 | * Sets the opacity of the window. On Linux, does nothing. Out of bound number
|
2681 | * values are clamped to the [0, 1] range.
|
2682 | *
|
2683 | * @platform win32,darwin
|
2684 | */
|
2685 | setOpacity(opacity: number): void;
|
2686 | /**
|
2687 | * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
|
2688 | * convey some sort of application status or to passively notify the user.
|
2689 | *
|
2690 | * @platform win32
|
2691 | */
|
2692 | setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
|
2693 | /**
|
2694 | * Sets `parent` as current window's parent window, passing `null` will turn
|
2695 | * current window into a top-level window.
|
2696 | */
|
2697 | setParentWindow(parent: (BrowserWindow) | (null)): void;
|
2698 | /**
|
2699 | * Moves window to `x` and `y`.
|
2700 | */
|
2701 | setPosition(x: number, y: number, animate?: boolean): void;
|
2702 | /**
|
2703 | * Sets progress value in progress bar. Valid range is [0, 1.0].
|
2704 | *
|
2705 | * Remove progress bar when progress < 0; Change to indeterminate mode when
|
2706 | * progress > 1.
|
2707 | *
|
2708 | * On Linux platform, only supports Unity desktop environment, you need to specify
|
2709 | * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
|
2710 | * it will assume `{app.name}.desktop`.
|
2711 | *
|
2712 | * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
|
2713 | * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
|
2714 | * mode set (but with a value within the valid range), `normal` will be assumed.
|
2715 | */
|
2716 | setProgressBar(progress: number, options?: ProgressBarOptions): void;
|
2717 | /**
|
2718 | * Sets the pathname of the file the window represents, and the icon of the file
|
2719 | * will show in window's title bar.
|
2720 | *
|
2721 | * @platform darwin
|
2722 | */
|
2723 | setRepresentedFilename(filename: string): void;
|
2724 | /**
|
2725 | * Sets whether the window can be manually resized by the user.
|
2726 | */
|
2727 | setResizable(resizable: boolean): void;
|
2728 | /**
|
2729 | * Setting a window shape determines the area within the window where the system
|
2730 | * permits drawing and user interaction. Outside of the given region, no pixels
|
2731 | * will be drawn and no mouse events will be registered. Mouse events outside of
|
2732 | * the region will not be received by that window, but will fall through to
|
2733 | * whatever is behind the window.
|
2734 | *
|
2735 | * @experimental
|
2736 | * @platform win32,linux
|
2737 | */
|
2738 | setShape(rects: Rectangle[]): void;
|
2739 | /**
|
2740 | * Changes the attachment point for sheets on macOS. By default, sheets are
|
2741 | * attached just below the window frame, but you may want to display them beneath a
|
2742 | * HTML-rendered toolbar. For example:
|
2743 | *
|
2744 | * @platform darwin
|
2745 | */
|
2746 | setSheetOffset(offsetY: number, offsetX?: number): void;
|
2747 | /**
|
2748 | * Enters or leaves simple fullscreen mode.
|
2749 | *
|
2750 | * Simple fullscreen mode emulates the native fullscreen behavior found in versions
|
2751 | * of macOS prior to Lion (10.7).
|
2752 | *
|
2753 | * @platform darwin
|
2754 | */
|
2755 | setSimpleFullScreen(flag: boolean): void;
|
2756 | /**
|
2757 | * Resizes the window to `width` and `height`. If `width` or `height` are below any
|
2758 | * set minimum size constraints the window will snap to its minimum size.
|
2759 | */
|
2760 | setSize(width: number, height: number, animate?: boolean): void;
|
2761 | /**
|
2762 | * Makes the window not show in the taskbar.
|
2763 | */
|
2764 | setSkipTaskbar(skip: boolean): void;
|
2765 | /**
|
2766 | * Whether the buttons were added successfully
|
2767 | *
|
2768 | * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
|
2769 | * of a window in a taskbar button layout. Returns a `Boolean` object indicates
|
2770 | * whether the thumbnail has been added successfully.
|
2771 | *
|
2772 | * The number of buttons in thumbnail toolbar should be no greater than 7 due to
|
2773 | * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
|
2774 | * removed due to the platform's limitation. But you can call the API with an empty
|
2775 | * array to clean the buttons.
|
2776 | *
|
2777 | * The `buttons` is an array of `Button` objects:
|
2778 | *
|
2779 | * * `Button` Object
|
2780 | * * `icon` NativeImage - The icon showing in thumbnail toolbar.
|
2781 | * * `click` Function
|
2782 | * * `tooltip` String (optional) - The text of the button's tooltip.
|
2783 | * * `flags` String[] (optional) - Control specific states and behaviors of the
|
2784 | * button. By default, it is `['enabled']`.
|
2785 | *
|
2786 | * The `flags` is an array that can include following `String`s:
|
2787 | *
|
2788 | * * `enabled` - The button is active and available to the user.
|
2789 | * * `disabled` - The button is disabled. It is present, but has a visual state
|
2790 | * indicating it will not respond to user action.
|
2791 | * * `dismissonclick` - When the button is clicked, the thumbnail window closes
|
2792 | * immediately.
|
2793 | * * `nobackground` - Do not draw a button border, use only the image.
|
2794 | * * `hidden` - The button is not shown to the user.
|
2795 | * * `noninteractive` - The button is enabled but not interactive; no pressed
|
2796 | * button state is drawn. This value is intended for instances where the button is
|
2797 | * used in a notification.
|
2798 | *
|
2799 | * @platform win32
|
2800 | */
|
2801 | setThumbarButtons(buttons: ThumbarButton[]): boolean;
|
2802 | /**
|
2803 | * Sets the region of the window to show as the thumbnail image displayed when
|
2804 | * hovering over the window in the taskbar. You can reset the thumbnail to be the
|
2805 | * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
|
2806 | * }`.
|
2807 | *
|
2808 | * @platform win32
|
2809 | */
|
2810 | setThumbnailClip(region: Rectangle): void;
|
2811 | /**
|
2812 | * Sets the toolTip that is displayed when hovering over the window thumbnail in
|
2813 | * the taskbar.
|
2814 | *
|
2815 | * @platform win32
|
2816 | */
|
2817 | setThumbnailToolTip(toolTip: string): void;
|
2818 | /**
|
2819 | * Changes the title of native window to `title`.
|
2820 | */
|
2821 | setTitle(title: string): void;
|
2822 | /**
|
2823 | * Sets the touchBar layout for the current window. Specifying `null` or
|
2824 | * `undefined` clears the touch bar. This method only has an effect if the machine
|
2825 | * has a touch bar and is running on macOS 10.12.1+.
|
2826 | *
|
2827 | * **Note:** The TouchBar API is currently experimental and may change or be
|
2828 | * removed in future Electron releases.
|
2829 | *
|
2830 | * @platform darwin
|
2831 | */
|
2832 | setTouchBar(touchBar: (TouchBar) | (null)): void;
|
2833 | /**
|
2834 | * Set a custom position for the traffic light buttons. Can only be used with
|
2835 | * `titleBarStyle` set to `hidden`.
|
2836 | *
|
2837 | * @platform darwin
|
2838 | */
|
2839 | setTrafficLightPosition(position: Point): void;
|
2840 | /**
|
2841 | * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
|
2842 | * will remove the vibrancy effect on the window.
|
2843 | *
|
2844 | * Note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
|
2845 | * have been deprecated and will be removed in an upcoming version of macOS.
|
2846 | *
|
2847 | * @platform darwin
|
2848 | */
|
2849 | 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;
|
2850 | /**
|
2851 | * Sets whether the window should be visible on all workspaces.
|
2852 | *
|
2853 | **Note:** This API does nothing on Windows.
|
2854 | */
|
2855 | setVisibleOnAllWorkspaces(visible: boolean): void;
|
2856 | /**
|
2857 | * Sets whether the window traffic light buttons should be visible.
|
2858 | *
|
2859 | This cannot be called when `titleBarStyle` is set to `customButtonsOnHover`.
|
2860 | *
|
2861 | * @platform darwin
|
2862 | */
|
2863 | setWindowButtonVisibility(visible: boolean): void;
|
2864 | /**
|
2865 | * Shows and gives focus to the window.
|
2866 | */
|
2867 | show(): void;
|
2868 | /**
|
2869 | * Same as `webContents.showDefinitionForSelection()`.
|
2870 | *
|
2871 | * @platform darwin
|
2872 | */
|
2873 | showDefinitionForSelection(): void;
|
2874 | /**
|
2875 | * Shows the window but doesn't focus on it.
|
2876 | */
|
2877 | showInactive(): void;
|
2878 | /**
|
2879 | * Toggles the visibility of the tab bar if native tabs are enabled and there is
|
2880 | * only one tab in the current window.
|
2881 | *
|
2882 | * @platform darwin
|
2883 | */
|
2884 | toggleTabBar(): void;
|
2885 | /**
|
2886 | * Unhooks all of the window messages.
|
2887 | *
|
2888 | * @platform win32
|
2889 | */
|
2890 | unhookAllWindowMessages(): void;
|
2891 | /**
|
2892 | * Unhook the window message.
|
2893 | *
|
2894 | * @platform win32
|
2895 | */
|
2896 | unhookWindowMessage(message: number): void;
|
2897 | /**
|
2898 | * Unmaximizes the window.
|
2899 | */
|
2900 | unmaximize(): void;
|
2901 | accessibleTitle: string;
|
2902 | autoHideMenuBar: boolean;
|
2903 | closable: boolean;
|
2904 | documentEdited: boolean;
|
2905 | excludedFromShownWindowsMenu: boolean;
|
2906 | fullScreen: boolean;
|
2907 | fullScreenable: boolean;
|
2908 | readonly id: number;
|
2909 | kiosk: boolean;
|
2910 | maximizable: boolean;
|
2911 | menuBarVisible: boolean;
|
2912 | minimizable: boolean;
|
2913 | movable: boolean;
|
2914 | representedFilename: string;
|
2915 | resizable: boolean;
|
2916 | shadow: boolean;
|
2917 | simpleFullScreen: boolean;
|
2918 | title: string;
|
2919 | visibleOnAllWorkspaces: boolean;
|
2920 | readonly webContents: WebContents;
|
2921 | }
|
2922 |
|
2923 | class BrowserWindowProxy {
|
2924 |
|
2925 | // Docs: http://electronjs.org/docs/api/browser-window-proxy
|
2926 |
|
2927 | /**
|
2928 | * Removes focus from the child window.
|
2929 | */
|
2930 | blur(): void;
|
2931 | /**
|
2932 | * Forcefully closes the child window without calling its unload event.
|
2933 | */
|
2934 | close(): void;
|
2935 | /**
|
2936 | * Evaluates the code in the child window.
|
2937 | */
|
2938 | eval(code: string): void;
|
2939 | /**
|
2940 | * Focuses the child window (brings the window to front).
|
2941 | */
|
2942 | focus(): void;
|
2943 | /**
|
2944 | * Sends a message to the child window with the specified origin or `*` for no
|
2945 | * origin preference.
|
2946 | *
|
2947 | * In addition to these methods, the child window implements `window.opener` object
|
2948 | * with no properties and a single method.
|
2949 | */
|
2950 | postMessage(message: any, targetOrigin: string): void;
|
2951 | /**
|
2952 | * Invokes the print dialog on the child window.
|
2953 | */
|
2954 | print(): void;
|
2955 | closed: boolean;
|
2956 | }
|
2957 |
|
2958 | interface Certificate {
|
2959 |
|
2960 | // Docs: http://electronjs.org/docs/api/structures/certificate
|
2961 |
|
2962 | /**
|
2963 | * PEM encoded data
|
2964 | */
|
2965 | data: string;
|
2966 | /**
|
2967 | * Fingerprint of the certificate
|
2968 | */
|
2969 | fingerprint: string;
|
2970 | /**
|
2971 | * Issuer principal
|
2972 | */
|
2973 | issuer: CertificatePrincipal;
|
2974 | /**
|
2975 | * Issuer certificate (if not self-signed)
|
2976 | */
|
2977 | issuerCert: Certificate;
|
2978 | /**
|
2979 | * Issuer's Common Name
|
2980 | */
|
2981 | issuerName: string;
|
2982 | /**
|
2983 | * Hex value represented string
|
2984 | */
|
2985 | serialNumber: string;
|
2986 | /**
|
2987 | * Subject principal
|
2988 | */
|
2989 | subject: CertificatePrincipal;
|
2990 | /**
|
2991 | * Subject's Common Name
|
2992 | */
|
2993 | subjectName: string;
|
2994 | /**
|
2995 | * End date of the certificate being valid in seconds
|
2996 | */
|
2997 | validExpiry: number;
|
2998 | /**
|
2999 | * Start date of the certificate being valid in seconds
|
3000 | */
|
3001 | validStart: number;
|
3002 | }
|
3003 |
|
3004 | interface CertificatePrincipal {
|
3005 |
|
3006 | // Docs: http://electronjs.org/docs/api/structures/certificate-principal
|
3007 |
|
3008 | /**
|
3009 | * Common Name.
|
3010 | */
|
3011 | commonName: string;
|
3012 | /**
|
3013 | * Country or region.
|
3014 | */
|
3015 | country: string;
|
3016 | /**
|
3017 | * Locality.
|
3018 | */
|
3019 | locality: string;
|
3020 | /**
|
3021 | * Organization names.
|
3022 | */
|
3023 | organizations: string[];
|
3024 | /**
|
3025 | * Organization Unit names.
|
3026 | */
|
3027 | organizationUnits: string[];
|
3028 | /**
|
3029 | * State or province.
|
3030 | */
|
3031 | state: string;
|
3032 | }
|
3033 |
|
3034 | class ClientRequest extends NodeEventEmitter {
|
3035 |
|
3036 | // Docs: http://electronjs.org/docs/api/client-request
|
3037 |
|
3038 | /**
|
3039 | * Emitted when the `request` is aborted. The `abort` event will not be fired if
|
3040 | * the `request` is already closed.
|
3041 | */
|
3042 | on(event: 'abort', listener: Function): this;
|
3043 | once(event: 'abort', listener: Function): this;
|
3044 | addListener(event: 'abort', listener: Function): this;
|
3045 | removeListener(event: 'abort', listener: Function): this;
|
3046 | /**
|
3047 | * Emitted as the last event in the HTTP request-response transaction. The `close`
|
3048 | * event indicates that no more events will be emitted on either the `request` or
|
3049 | * `response` objects.
|
3050 | */
|
3051 | on(event: 'close', listener: Function): this;
|
3052 | once(event: 'close', listener: Function): this;
|
3053 | addListener(event: 'close', listener: Function): this;
|
3054 | removeListener(event: 'close', listener: Function): this;
|
3055 | /**
|
3056 | * Emitted when the `net` module fails to issue a network request. Typically when
|
3057 | * the `request` object emits an `error` event, a `close` event will subsequently
|
3058 | * follow and no response object will be provided.
|
3059 | */
|
3060 | on(event: 'error', listener: (
|
3061 | /**
|
3062 | * an error object providing some information about the failure.
|
3063 | */
|
3064 | error: Error) => void): this;
|
3065 | once(event: 'error', listener: (
|
3066 | /**
|
3067 | * an error object providing some information about the failure.
|
3068 | */
|
3069 | error: Error) => void): this;
|
3070 | addListener(event: 'error', listener: (
|
3071 | /**
|
3072 | * an error object providing some information about the failure.
|
3073 | */
|
3074 | error: Error) => void): this;
|
3075 | removeListener(event: 'error', listener: (
|
3076 | /**
|
3077 | * an error object providing some information about the failure.
|
3078 | */
|
3079 | error: Error) => void): this;
|
3080 | /**
|
3081 | * Emitted just after the last chunk of the `request`'s data has been written into
|
3082 | * the `request` object.
|
3083 | */
|
3084 | on(event: 'finish', listener: Function): this;
|
3085 | once(event: 'finish', listener: Function): this;
|
3086 | addListener(event: 'finish', listener: Function): this;
|
3087 | removeListener(event: 'finish', listener: Function): this;
|
3088 | /**
|
3089 | * Emitted when an authenticating proxy is asking for user credentials.
|
3090 | *
|
3091 | * The `callback` function is expected to be called back with user credentials:
|
3092 | *
|
3093 | * * `username` String
|
3094 | * * `password` String
|
3095 | *
|
3096 | * Providing empty credentials will cancel the request and report an authentication
|
3097 | * error on the response object:
|
3098 | */
|
3099 | on(event: 'login', listener: (authInfo: AuthInfo,
|
3100 | callback: (username?: string, password?: string) => void) => void): this;
|
3101 | once(event: 'login', listener: (authInfo: AuthInfo,
|
3102 | callback: (username?: string, password?: string) => void) => void): this;
|
3103 | addListener(event: 'login', listener: (authInfo: AuthInfo,
|
3104 | callback: (username?: string, password?: string) => void) => void): this;
|
3105 | removeListener(event: 'login', listener: (authInfo: AuthInfo,
|
3106 | callback: (username?: string, password?: string) => void) => void): this;
|
3107 | /**
|
3108 | * Emitted when the server returns a redirect response (e.g. 301 Moved
|
3109 | * Permanently). Calling `request.followRedirect` will continue with the
|
3110 | * redirection. If this event is handled, `request.followRedirect` must be called
|
3111 | * **synchronously**, otherwise the request will be cancelled.
|
3112 | */
|
3113 | on(event: 'redirect', listener: (statusCode: number,
|
3114 | method: string,
|
3115 | redirectUrl: string,
|
3116 | responseHeaders: Record<string, string[]>) => void): this;
|
3117 | once(event: 'redirect', listener: (statusCode: number,
|
3118 | method: string,
|
3119 | redirectUrl: string,
|
3120 | responseHeaders: Record<string, string[]>) => void): this;
|
3121 | addListener(event: 'redirect', listener: (statusCode: number,
|
3122 | method: string,
|
3123 | redirectUrl: string,
|
3124 | responseHeaders: Record<string, string[]>) => void): this;
|
3125 | removeListener(event: 'redirect', listener: (statusCode: number,
|
3126 | method: string,
|
3127 | redirectUrl: string,
|
3128 | responseHeaders: Record<string, string[]>) => void): this;
|
3129 | on(event: 'response', listener: (
|
3130 | /**
|
3131 | * An object representing the HTTP response message.
|
3132 | */
|
3133 | response: IncomingMessage) => void): this;
|
3134 | once(event: 'response', listener: (
|
3135 | /**
|
3136 | * An object representing the HTTP response message.
|
3137 | */
|
3138 | response: IncomingMessage) => void): this;
|
3139 | addListener(event: 'response', listener: (
|
3140 | /**
|
3141 | * An object representing the HTTP response message.
|
3142 | */
|
3143 | response: IncomingMessage) => void): this;
|
3144 | removeListener(event: 'response', listener: (
|
3145 | /**
|
3146 | * An object representing the HTTP response message.
|
3147 | */
|
3148 | response: IncomingMessage) => void): this;
|
3149 | /**
|
3150 | * ClientRequest
|
3151 | */
|
3152 | constructor(options: (ClientRequestConstructorOptions) | (string));
|
3153 | /**
|
3154 | * Cancels an ongoing HTTP transaction. If the request has already emitted the
|
3155 | * `close` event, the abort operation will have no effect. Otherwise an ongoing
|
3156 | * event will emit `abort` and `close` events. Additionally, if there is an ongoing
|
3157 | * response object,it will emit the `aborted` event.
|
3158 | */
|
3159 | abort(): void;
|
3160 | /**
|
3161 | * Sends the last chunk of the request data. Subsequent write or end operations
|
3162 | * will not be allowed. The `finish` event is emitted just after the end operation.
|
3163 | */
|
3164 | end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): void;
|
3165 | /**
|
3166 | * Continues any pending redirection. Can only be called during a `'redirect'`
|
3167 | * event.
|
3168 | */
|
3169 | followRedirect(): void;
|
3170 | /**
|
3171 | * The value of a previously set extra header name.
|
3172 | */
|
3173 | getHeader(name: string): string;
|
3174 | /**
|
3175 | * * `active` Boolean - Whether the request is currently active. If this is false
|
3176 | * no other properties will be set
|
3177 | * * `started` Boolean - Whether the upload has started. If this is false both
|
3178 | * `current` and `total` will be set to 0.
|
3179 | * * `current` Integer - The number of bytes that have been uploaded so far
|
3180 | * * `total` Integer - The number of bytes that will be uploaded this request
|
3181 | *
|
3182 | * You can use this method in conjunction with `POST` requests to get the progress
|
3183 | * of a file upload or other data transfer.
|
3184 | */
|
3185 | getUploadProgress(): UploadProgress;
|
3186 | /**
|
3187 | * Removes a previously set extra header name. This method can be called only
|
3188 | * before first write. Trying to call it after the first write will throw an error.
|
3189 | */
|
3190 | removeHeader(name: string): void;
|
3191 | /**
|
3192 | * Adds an extra HTTP header. The header name will be issued as-is without
|
3193 | * lowercasing. It can be called only before first write. Calling this method after
|
3194 | * the first write will throw an error. If the passed value is not a `String`, its
|
3195 | * `toString()` method will be called to obtain the final value.
|
3196 | */
|
3197 | setHeader(name: string, value: string): void;
|
3198 | /**
|
3199 | * `callback` is essentially a dummy function introduced in the purpose of keeping
|
3200 | * similarity with the Node.js API. It is called asynchronously in the next tick
|
3201 | * after `chunk` content have been delivered to the Chromium networking layer.
|
3202 | * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
|
3203 | * content have been flushed on the wire before `callback` is called.
|
3204 | *
|
3205 | * Adds a chunk of data to the request body. The first write operation may cause
|
3206 | * the request headers to be issued on the wire. After the first write operation,
|
3207 | * it is not allowed to add or remove a custom header.
|
3208 | */
|
3209 | write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
|
3210 | chunkedEncoding: boolean;
|
3211 | }
|
3212 |
|
3213 | interface Clipboard {
|
3214 |
|
3215 | // Docs: http://electronjs.org/docs/api/clipboard
|
3216 |
|
3217 | /**
|
3218 | * An array of supported formats for the clipboard `type`.
|
3219 | */
|
3220 | availableFormats(type?: 'selection' | 'clipboard'): string[];
|
3221 | /**
|
3222 | * Clears the clipboard content.
|
3223 | */
|
3224 | clear(type?: 'selection' | 'clipboard'): void;
|
3225 | /**
|
3226 | * Whether the clipboard supports the specified `format`.
|
3227 | *
|
3228 | * @experimental
|
3229 | */
|
3230 | has(format: string, type?: 'selection' | 'clipboard'): boolean;
|
3231 | /**
|
3232 | * Reads `format` type from the clipboard.
|
3233 | *
|
3234 | * @experimental
|
3235 | */
|
3236 | read(format: string): string;
|
3237 | /**
|
3238 | * * `title` String
|
3239 | * * `url` String
|
3240 | *
|
3241 | * Returns an Object containing `title` and `url` keys representing the bookmark in
|
3242 | * the clipboard. The `title` and `url` values will be empty strings when the
|
3243 | * bookmark is unavailable.
|
3244 | *
|
3245 | * @platform darwin,win32
|
3246 | */
|
3247 | readBookmark(): ReadBookmark;
|
3248 | /**
|
3249 | * Reads `format` type from the clipboard.
|
3250 | *
|
3251 | * @experimental
|
3252 | */
|
3253 | readBuffer(format: string): Buffer;
|
3254 | /**
|
3255 | * The text on the find pasteboard, which is the pasteboard that holds information
|
3256 | * about the current state of the active application’s find panel.
|
3257 | *
|
3258 | * This method uses synchronous IPC when called from the renderer process. The
|
3259 | * cached value is reread from the find pasteboard whenever the application is
|
3260 | * activated.
|
3261 | *
|
3262 | * @platform darwin
|
3263 | */
|
3264 | readFindText(): string;
|
3265 | /**
|
3266 | * The content in the clipboard as markup.
|
3267 | */
|
3268 | readHTML(type?: 'selection' | 'clipboard'): string;
|
3269 | /**
|
3270 | * The image content in the clipboard.
|
3271 | */
|
3272 | readImage(type?: 'selection' | 'clipboard'): NativeImage;
|
3273 | /**
|
3274 | * The content in the clipboard as RTF.
|
3275 | */
|
3276 | readRTF(type?: 'selection' | 'clipboard'): string;
|
3277 | /**
|
3278 | * The content in the clipboard as plain text.
|
3279 | */
|
3280 | readText(type?: 'selection' | 'clipboard'): string;
|
3281 | /**
|
3282 | * Writes `data` to the clipboard.
|
3283 | */
|
3284 | write(data: Data, type?: 'selection' | 'clipboard'): void;
|
3285 | /**
|
3286 | * Writes the `title` and `url` into the clipboard as a bookmark.
|
3287 | *
|
3288 | * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
|
3289 | * can use `clipboard.write` to write both a bookmark and fallback text to the
|
3290 | * clipboard.
|
3291 | *
|
3292 | * @platform darwin,win32
|
3293 | */
|
3294 | writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
|
3295 | /**
|
3296 | * Writes the `buffer` into the clipboard as `format`.
|
3297 | *
|
3298 | * @experimental
|
3299 | */
|
3300 | writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
|
3301 | /**
|
3302 | * Writes the `text` into the find pasteboard (the pasteboard that holds
|
3303 | * information about the current state of the active application’s find panel) as
|
3304 | * plain text. This method uses synchronous IPC when called from the renderer
|
3305 | * process.
|
3306 | *
|
3307 | * @platform darwin
|
3308 | */
|
3309 | writeFindText(text: string): void;
|
3310 | /**
|
3311 | * Writes `markup` to the clipboard.
|
3312 | */
|
3313 | writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
|
3314 | /**
|
3315 | * Writes `image` to the clipboard.
|
3316 | */
|
3317 | writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
|
3318 | /**
|
3319 | * Writes the `text` into the clipboard in RTF.
|
3320 | */
|
3321 | writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
|
3322 | /**
|
3323 | * Writes the `text` into the clipboard as plain text.
|
3324 | */
|
3325 | writeText(text: string, type?: 'selection' | 'clipboard'): void;
|
3326 | }
|
3327 |
|
3328 | class CommandLine {
|
3329 |
|
3330 | // Docs: http://electronjs.org/docs/api/command-line
|
3331 |
|
3332 | /**
|
3333 | * Append an argument to Chromium's command line. The argument will be quoted
|
3334 | * correctly. Switches will precede arguments regardless of appending order.
|
3335 | *
|
3336 | * If you're appending an argument like `--switch=value`, consider using
|
3337 | * `appendSwitch('switch', 'value')` instead.
|
3338 | *
|
3339 | * **Note:** This will not affect `process.argv`. The intended usage of this
|
3340 | * function is to control Chromium's behavior.
|
3341 | */
|
3342 | appendArgument(value: string): void;
|
3343 | /**
|
3344 | * Append a switch (with optional `value`) to Chromium's command line.
|
3345 | *
|
3346 | * **Note:** This will not affect `process.argv`. The intended usage of this
|
3347 | * function is to control Chromium's behavior.
|
3348 | */
|
3349 | appendSwitch(the_switch: string, value?: string): void;
|
3350 | /**
|
3351 | * The command-line switch value.
|
3352 | *
|
3353 | * **Note:** When the switch is not present or has no value, it returns empty
|
3354 | * string.
|
3355 | */
|
3356 | getSwitchValue(the_switch: string): string;
|
3357 | /**
|
3358 | * Whether the command-line switch is present.
|
3359 | */
|
3360 | hasSwitch(the_switch: string): boolean;
|
3361 | }
|
3362 |
|
3363 | interface ContentTracing {
|
3364 |
|
3365 | // Docs: http://electronjs.org/docs/api/content-tracing
|
3366 |
|
3367 | /**
|
3368 | * resolves with an array of category groups once all child processes have
|
3369 | * acknowledged the `getCategories` request
|
3370 | *
|
3371 | * Get a set of category groups. The category groups can change as new code paths
|
3372 | * are reached. See also the list of built-in tracing categories.
|
3373 | *
|
3374 | * > **NOTE:** Electron adds a non-default tracing category called `"electron"`.
|
3375 | * This category can be used to capture Electron-specific tracing events.
|
3376 | */
|
3377 | getCategories(): Promise<string[]>;
|
3378 | /**
|
3379 | * Resolves with an object containing the `value` and `percentage` of trace buffer
|
3380 | * maximum usage
|
3381 | *
|
3382 | * * `value` Number
|
3383 | * * `percentage` Number
|
3384 | *
|
3385 | * Get the maximum usage across processes of trace buffer as a percentage of the
|
3386 | * full state.
|
3387 | */
|
3388 | getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
|
3389 | /**
|
3390 | * resolved once all child processes have acknowledged the `startRecording`
|
3391 | * request.
|
3392 | *
|
3393 | * Start recording on all processes.
|
3394 | *
|
3395 | * Recording begins immediately locally and asynchronously on child processes as
|
3396 | * soon as they receive the EnableRecording request.
|
3397 | *
|
3398 | * If a recording is already running, the promise will be immediately resolved, as
|
3399 | * only one trace operation can be in progress at a time.
|
3400 | */
|
3401 | startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
|
3402 | /**
|
3403 | * resolves with a path to a file that contains the traced data once all child
|
3404 | * processes have acknowledged the `stopRecording` request
|
3405 | *
|
3406 | * Stop recording on all processes.
|
3407 | *
|
3408 | * Child processes typically cache trace data and only rarely flush and send trace
|
3409 | * data back to the main process. This helps to minimize the runtime overhead of
|
3410 | * tracing since sending trace data over IPC can be an expensive operation. So, to
|
3411 | * end tracing, Chromium asynchronously asks all child processes to flush any
|
3412 | * pending trace data.
|
3413 | *
|
3414 | * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
|
3415 | * or not provided, trace data will be written to a temporary file, and the path
|
3416 | * will be returned in the promise.
|
3417 | */
|
3418 | stopRecording(resultFilePath?: string): Promise<string>;
|
3419 | }
|
3420 |
|
3421 | interface ContextBridge extends NodeJS.EventEmitter {
|
3422 |
|
3423 | // Docs: http://electronjs.org/docs/api/context-bridge
|
3424 |
|
3425 | exposeInMainWorld(apiKey: string, api: Record<string, any>): void;
|
3426 | }
|
3427 |
|
3428 | interface Cookie {
|
3429 |
|
3430 | // Docs: http://electronjs.org/docs/api/structures/cookie
|
3431 |
|
3432 | /**
|
3433 | * The domain of the cookie; this will be normalized with a preceding dot so that
|
3434 | * it's also valid for subdomains.
|
3435 | */
|
3436 | domain?: string;
|
3437 | /**
|
3438 | * The expiration date of the cookie as the number of seconds since the UNIX epoch.
|
3439 | * Not provided for session cookies.
|
3440 | */
|
3441 | expirationDate?: number;
|
3442 | /**
|
3443 | * Whether the cookie is a host-only cookie; this will only be `true` if no domain
|
3444 | * was passed.
|
3445 | */
|
3446 | hostOnly?: boolean;
|
3447 | /**
|
3448 | * Whether the cookie is marked as HTTP only.
|
3449 | */
|
3450 | httpOnly?: boolean;
|
3451 | /**
|
3452 | * The name of the cookie.
|
3453 | */
|
3454 | name: string;
|
3455 | /**
|
3456 | * The path of the cookie.
|
3457 | */
|
3458 | path?: string;
|
3459 | /**
|
3460 | * The Same Site policy applied to this cookie. Can be `unspecified`,
|
3461 | * `no_restriction`, `lax` or `strict`.
|
3462 | */
|
3463 | sameSite: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
|
3464 | /**
|
3465 | * Whether the cookie is marked as secure.
|
3466 | */
|
3467 | secure?: boolean;
|
3468 | /**
|
3469 | * Whether the cookie is a session cookie or a persistent cookie with an expiration
|
3470 | * date.
|
3471 | */
|
3472 | session?: boolean;
|
3473 | /**
|
3474 | * The value of the cookie.
|
3475 | */
|
3476 | value: string;
|
3477 | }
|
3478 |
|
3479 | class Cookies extends NodeEventEmitter {
|
3480 |
|
3481 | // Docs: http://electronjs.org/docs/api/cookies
|
3482 |
|
3483 | /**
|
3484 | * Emitted when a cookie is changed because it was added, edited, removed, or
|
3485 | * expired.
|
3486 | */
|
3487 | on(event: 'changed', listener: Function): this;
|
3488 | once(event: 'changed', listener: Function): this;
|
3489 | addListener(event: 'changed', listener: Function): this;
|
3490 | removeListener(event: 'changed', listener: Function): this;
|
3491 | /**
|
3492 | * A promise which resolves when the cookie store has been flushed
|
3493 | *
|
3494 | Writes any unwritten cookies data to disk.
|
3495 | */
|
3496 | flushStore(): Promise<void>;
|
3497 | /**
|
3498 | * A promise which resolves an array of cookie objects.
|
3499 | *
|
3500 | * Sends a request to get all cookies matching `filter`, and resolves a promise
|
3501 | * with the response.
|
3502 | */
|
3503 | get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
|
3504 | /**
|
3505 | * A promise which resolves when the cookie has been removed
|
3506 | *
|
3507 | Removes the cookies matching `url` and `name`
|
3508 | */
|
3509 | remove(url: string, name: string): Promise<void>;
|
3510 | /**
|
3511 | * A promise which resolves when the cookie has been set
|
3512 | *
|
3513 | Sets a cookie with `details`.
|
3514 | */
|
3515 | set(details: CookiesSetDetails): Promise<void>;
|
3516 | }
|
3517 |
|
3518 | interface CPUUsage {
|
3519 |
|
3520 | // Docs: http://electronjs.org/docs/api/structures/cpu-usage
|
3521 |
|
3522 | /**
|
3523 | * The number of average idle CPU wakeups per second since the last call to
|
3524 | * getCPUUsage. First call returns 0. Will always return 0 on Windows.
|
3525 | */
|
3526 | idleWakeupsPerSecond: number;
|
3527 | /**
|
3528 | * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
|
3529 | */
|
3530 | percentCPUUsage: number;
|
3531 | }
|
3532 |
|
3533 | interface CrashReport {
|
3534 |
|
3535 | // Docs: http://electronjs.org/docs/api/structures/crash-report
|
3536 |
|
3537 | date: Date;
|
3538 | id: string;
|
3539 | }
|
3540 |
|
3541 | interface CrashReporter {
|
3542 |
|
3543 | // Docs: http://electronjs.org/docs/api/crash-reporter
|
3544 |
|
3545 | /**
|
3546 | * Set an extra parameter to be sent with the crash report. The values specified
|
3547 | * here will be sent in addition to any values set via the `extra` option when
|
3548 | * `start` was called.
|
3549 | *
|
3550 | * Parameters added in this fashion (or via the `extra` parameter to
|
3551 | * `crashReporter.start`) are specific to the calling process. Adding extra
|
3552 | * parameters in the main process will not cause those parameters to be sent along
|
3553 | * with crashes from renderer or other child processes. Similarly, adding extra
|
3554 | * parameters in a renderer process will not result in those parameters being sent
|
3555 | * with crashes that occur in other renderer processes or in the main process.
|
3556 | *
|
3557 | * **Note:** Parameters have limits on the length of the keys and values. Key names
|
3558 | * must be no longer than 39 bytes, and values must be no longer than 127 bytes.
|
3559 | * Keys with names longer than the maximum will be silently ignored. Key values
|
3560 | * longer than the maximum length will be truncated.
|
3561 | */
|
3562 | addExtraParameter(key: string, value: string): void;
|
3563 | /**
|
3564 | * The directory where crashes are temporarily stored before being uploaded.
|
3565 | *
|
3566 | **Note:** This method is deprecated, use `app.getPath('crashDumps')` instead.
|
3567 | *
|
3568 | * @deprecated
|
3569 | */
|
3570 | getCrashesDirectory(): string;
|
3571 | /**
|
3572 | * The date and ID of the last crash report. Only crash reports that have been
|
3573 | * uploaded will be returned; even if a crash report is present on disk it will not
|
3574 | * be returned until it is uploaded. In the case that there are no uploaded
|
3575 | * reports, `null` is returned.
|
3576 | *
|
3577 | **Note:** Calling this method from the renderer process is deprecated.
|
3578 | */
|
3579 | getLastCrashReport(): CrashReport;
|
3580 | /**
|
3581 | * The current 'extra' parameters of the crash reporter.
|
3582 | */
|
3583 | getParameters(): Record<string, string>;
|
3584 | /**
|
3585 | * Returns all uploaded crash reports. Each report contains the date and uploaded
|
3586 | * ID.
|
3587 |
|
3588 | **Note:** Calling this method from the renderer process is deprecated.
|
3589 | */
|
3590 | getUploadedReports(): CrashReport[];
|
3591 | /**
|
3592 | * Whether reports should be submitted to the server. Set through the `start`
|
3593 | * method or `setUploadToServer`.
|
3594 | *
|
3595 | **Note:** Calling this method from the renderer process is deprecated.
|
3596 | */
|
3597 | getUploadToServer(): boolean;
|
3598 | /**
|
3599 | * Remove a extra parameter from the current set of parameters. Future crashes will
|
3600 | * not include this parameter.
|
3601 | */
|
3602 | removeExtraParameter(key: string): void;
|
3603 | /**
|
3604 | * This would normally be controlled by user preferences. This has no effect if
|
3605 | * called before `start` is called.
|
3606 | *
|
3607 | **Note:** Calling this method from the renderer process is deprecated.
|
3608 | */
|
3609 | setUploadToServer(uploadToServer: boolean): void;
|
3610 | /**
|
3611 | * This method must be called before using any other `crashReporter` APIs. Once
|
3612 | * initialized this way, the crashpad handler collects crashes from all
|
3613 | * subsequently created processes. The crash reporter cannot be disabled once
|
3614 | * started.
|
3615 | *
|
3616 | * This method should be called as early as possible in app startup, preferably
|
3617 | * before `app.on('ready')`. If the crash reporter is not initialized at the time a
|
3618 | * renderer process is created, then that renderer process will not be monitored by
|
3619 | * the crash reporter.
|
3620 | *
|
3621 | * **Note:** You can test out the crash reporter by generating a crash using
|
3622 | * `process.crash()`.
|
3623 | *
|
3624 | * **Note:** If you need to send additional/updated `extra` parameters after your
|
3625 | * first call `start` you can call `addExtraParameter`.
|
3626 | *
|
3627 | * **Note:** Parameters passed in `extra`, `globalExtra` or set with
|
3628 | * `addExtraParameter` have limits on the length of the keys and values. Key names
|
3629 | * must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys
|
3630 | * with names longer than the maximum will be silently ignored. Key values longer
|
3631 | * than the maximum length will be truncated.
|
3632 | *
|
3633 | **Note:** Calling this method from the renderer process is deprecated.
|
3634 | */
|
3635 | start(options: CrashReporterStartOptions): void;
|
3636 | }
|
3637 |
|
3638 | interface CustomScheme {
|
3639 |
|
3640 | // Docs: http://electronjs.org/docs/api/structures/custom-scheme
|
3641 |
|
3642 | privileges?: Privileges;
|
3643 | /**
|
3644 | * Custom schemes to be registered with options.
|
3645 | */
|
3646 | scheme: string;
|
3647 | }
|
3648 |
|
3649 | class Debugger extends NodeEventEmitter {
|
3650 |
|
3651 | // Docs: http://electronjs.org/docs/api/debugger
|
3652 |
|
3653 | /**
|
3654 | * Emitted when the debugging session is terminated. This happens either when
|
3655 | * `webContents` is closed or devtools is invoked for the attached `webContents`.
|
3656 | */
|
3657 | on(event: 'detach', listener: (event: Event,
|
3658 | /**
|
3659 | * Reason for detaching debugger.
|
3660 | */
|
3661 | reason: string) => void): this;
|
3662 | once(event: 'detach', listener: (event: Event,
|
3663 | /**
|
3664 | * Reason for detaching debugger.
|
3665 | */
|
3666 | reason: string) => void): this;
|
3667 | addListener(event: 'detach', listener: (event: Event,
|
3668 | /**
|
3669 | * Reason for detaching debugger.
|
3670 | */
|
3671 | reason: string) => void): this;
|
3672 | removeListener(event: 'detach', listener: (event: Event,
|
3673 | /**
|
3674 | * Reason for detaching debugger.
|
3675 | */
|
3676 | reason: string) => void): this;
|
3677 | /**
|
3678 | * Emitted whenever the debugging target issues an instrumentation event.
|
3679 | */
|
3680 | on(event: 'message', listener: (event: Event,
|
3681 | /**
|
3682 | * Method name.
|
3683 | */
|
3684 | method: string,
|
3685 | /**
|
3686 | * Event parameters defined by the 'parameters' attribute in the remote debugging
|
3687 | * protocol.
|
3688 | */
|
3689 | params: any,
|
3690 | /**
|
3691 | * Unique identifier of attached debugging session, will match the value sent from
|
3692 | * `debugger.sendCommand`.
|
3693 | */
|
3694 | sessionId: string) => void): this;
|
3695 | once(event: 'message', listener: (event: Event,
|
3696 | /**
|
3697 | * Method name.
|
3698 | */
|
3699 | method: string,
|
3700 | /**
|
3701 | * Event parameters defined by the 'parameters' attribute in the remote debugging
|
3702 | * protocol.
|
3703 | */
|
3704 | params: any,
|
3705 | /**
|
3706 | * Unique identifier of attached debugging session, will match the value sent from
|
3707 | * `debugger.sendCommand`.
|
3708 | */
|
3709 | sessionId: string) => void): this;
|
3710 | addListener(event: 'message', listener: (event: Event,
|
3711 | /**
|
3712 | * Method name.
|
3713 | */
|
3714 | method: string,
|
3715 | /**
|
3716 | * Event parameters defined by the 'parameters' attribute in the remote debugging
|
3717 | * protocol.
|
3718 | */
|
3719 | params: any,
|
3720 | /**
|
3721 | * Unique identifier of attached debugging session, will match the value sent from
|
3722 | * `debugger.sendCommand`.
|
3723 | */
|
3724 | sessionId: string) => void): this;
|
3725 | removeListener(event: 'message', listener: (event: Event,
|
3726 | /**
|
3727 | * Method name.
|
3728 | */
|
3729 | method: string,
|
3730 | /**
|
3731 | * Event parameters defined by the 'parameters' attribute in the remote debugging
|
3732 | * protocol.
|
3733 | */
|
3734 | params: any,
|
3735 | /**
|
3736 | * Unique identifier of attached debugging session, will match the value sent from
|
3737 | * `debugger.sendCommand`.
|
3738 | */
|
3739 | sessionId: string) => void): this;
|
3740 | /**
|
3741 | * Attaches the debugger to the `webContents`.
|
3742 | */
|
3743 | attach(protocolVersion?: string): void;
|
3744 | /**
|
3745 | * Detaches the debugger from the `webContents`.
|
3746 | */
|
3747 | detach(): void;
|
3748 | /**
|
3749 | * Whether a debugger is attached to the `webContents`.
|
3750 | */
|
3751 | isAttached(): boolean;
|
3752 | /**
|
3753 | * A promise that resolves with the response defined by the 'returns' attribute of
|
3754 | * the command description in the remote debugging protocol or is rejected
|
3755 | * indicating the failure of the command.
|
3756 | *
|
3757 | Send given command to the debugging target.
|
3758 | */
|
3759 | sendCommand(method: string, commandParams?: any, sessionId?: string): Promise<any>;
|
3760 | }
|
3761 |
|
3762 | interface DesktopCapturer {
|
3763 |
|
3764 | // Docs: http://electronjs.org/docs/api/desktop-capturer
|
3765 |
|
3766 | /**
|
3767 | * Resolves with the identifier of a WebContents stream, this identifier can be
|
3768 | * used with `navigator.mediaDevices.getUserMedia`. The identifier is **only valid
|
3769 | * for 10 seconds**. The identifier may be empty if not requested from a renderer
|
3770 | * process.
|
3771 | */
|
3772 | getMediaSourceIdForWebContents(webContentsId: number): Promise<string>;
|
3773 | /**
|
3774 | * Resolves with an array of `DesktopCapturerSource` objects, each
|
3775 | * `DesktopCapturerSource` represents a screen or an individual window that can be
|
3776 | * captured.
|
3777 | *
|
3778 | * **Note** Capturing the screen contents requires user consent on macOS 10.15
|
3779 | * Catalina or higher, which can detected by
|
3780 | * `systemPreferences.getMediaAccessStatus`.
|
3781 | */
|
3782 | getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
|
3783 | }
|
3784 |
|
3785 | interface DesktopCapturerSource {
|
3786 |
|
3787 | // Docs: http://electronjs.org/docs/api/structures/desktop-capturer-source
|
3788 |
|
3789 | /**
|
3790 | * An icon image of the application that owns the window or null if the source has
|
3791 | * a type screen. The size of the icon is not known in advance and depends on what
|
3792 | * the the application provides.
|
3793 | */
|
3794 | appIcon: NativeImage;
|
3795 | /**
|
3796 | * A unique identifier that will correspond to the `id` of the matching Display
|
3797 | * returned by the Screen API. On some platforms, this is equivalent to the `XX`
|
3798 | * portion of the `id` field above and on others it will differ. It will be an
|
3799 | * empty string if not available.
|
3800 | */
|
3801 | display_id: string;
|
3802 | /**
|
3803 | * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
|
3804 | * constraint when calling [`navigator.webkitGetUserMedia`]. The format of the
|
3805 | * identifier will be `window:XX` or `screen:XX`, where `XX` is a random generated
|
3806 | * number.
|
3807 | */
|
3808 | id: string;
|
3809 | /**
|
3810 | * A screen source will be named either `Entire Screen` or `Screen <index>`, while
|
3811 | * the name of a window source will match the window title.
|
3812 | */
|
3813 | name: string;
|
3814 | /**
|
3815 | * A thumbnail image. **Note:** There is no guarantee that the size of the
|
3816 | * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
|
3817 | * to `desktopCapturer.getSources`. The actual size depends on the scale of the
|
3818 | * screen or window.
|
3819 | */
|
3820 | thumbnail: NativeImage;
|
3821 | }
|
3822 |
|
3823 | interface Dialog {
|
3824 |
|
3825 | // Docs: http://electronjs.org/docs/api/dialog
|
3826 |
|
3827 | /**
|
3828 | * resolves when the certificate trust dialog is shown.
|
3829 | *
|
3830 | * On macOS, this displays a modal dialog that shows a message and certificate
|
3831 | * information, and gives the user the option of trusting/importing the
|
3832 | * certificate. If you provide a `browserWindow` argument the dialog will be
|
3833 | * attached to the parent window, making it modal.
|
3834 | *
|
3835 | * On Windows the options are more limited, due to the Win32 APIs used:
|
3836 | *
|
3837 | * * The `message` argument is not used, as the OS provides its own confirmation
|
3838 | * dialog.
|
3839 | * * The `browserWindow` argument is ignored since it is not possible to make this
|
3840 | * confirmation dialog modal.
|
3841 | *
|
3842 | * @platform darwin,win32
|
3843 | */
|
3844 | showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
|
3845 | /**
|
3846 | * resolves when the certificate trust dialog is shown.
|
3847 | *
|
3848 | * On macOS, this displays a modal dialog that shows a message and certificate
|
3849 | * information, and gives the user the option of trusting/importing the
|
3850 | * certificate. If you provide a `browserWindow` argument the dialog will be
|
3851 | * attached to the parent window, making it modal.
|
3852 | *
|
3853 | * On Windows the options are more limited, due to the Win32 APIs used:
|
3854 | *
|
3855 | * * The `message` argument is not used, as the OS provides its own confirmation
|
3856 | * dialog.
|
3857 | * * The `browserWindow` argument is ignored since it is not possible to make this
|
3858 | * confirmation dialog modal.
|
3859 | *
|
3860 | * @platform darwin,win32
|
3861 | */
|
3862 | showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
|
3863 | /**
|
3864 | * Displays a modal dialog that shows an error message.
|
3865 | *
|
3866 | * This API can be called safely before the `ready` event the `app` module emits,
|
3867 | * it is usually used to report errors in early stage of startup. If called before
|
3868 | * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
|
3869 | * dialog will appear.
|
3870 | */
|
3871 | showErrorBox(title: string, content: string): void;
|
3872 | /**
|
3873 | * resolves with a promise containing the following properties:
|
3874 | *
|
3875 | * * `response` Number - The index of the clicked button.
|
3876 | * * `checkboxChecked` Boolean - The checked state of the checkbox if
|
3877 | * `checkboxLabel` was set. Otherwise `false`.
|
3878 | *
|
3879 | * Shows a message box, it will block the process until the message box is closed.
|
3880 | *
|
3881 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
3882 | * window, making it modal.
|
3883 | */
|
3884 | showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
|
3885 | /**
|
3886 | * resolves with a promise containing the following properties:
|
3887 | *
|
3888 | * * `response` Number - The index of the clicked button.
|
3889 | * * `checkboxChecked` Boolean - The checked state of the checkbox if
|
3890 | * `checkboxLabel` was set. Otherwise `false`.
|
3891 | *
|
3892 | * Shows a message box, it will block the process until the message box is closed.
|
3893 | *
|
3894 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
3895 | * window, making it modal.
|
3896 | */
|
3897 | showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
|
3898 | /**
|
3899 | * the index of the clicked button.
|
3900 | *
|
3901 | * Shows a message box, it will block the process until the message box is closed.
|
3902 | * It returns the index of the clicked button.
|
3903 | *
|
3904 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
3905 | * window, making it modal. If `browserWindow` is not shown dialog will not be
|
3906 | * attached to it. In such case It will be displayed as independed window.
|
3907 | */
|
3908 | showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
|
3909 | /**
|
3910 | * the index of the clicked button.
|
3911 | *
|
3912 | * Shows a message box, it will block the process until the message box is closed.
|
3913 | * It returns the index of the clicked button.
|
3914 | *
|
3915 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
3916 | * window, making it modal. If `browserWindow` is not shown dialog will not be
|
3917 | * attached to it. In such case It will be displayed as independed window.
|
3918 | */
|
3919 | showMessageBoxSync(options: MessageBoxSyncOptions): number;
|
3920 | /**
|
3921 | * Resolve with an object containing the following:
|
3922 | *
|
3923 | * * `canceled` Boolean - whether or not the dialog was canceled.
|
3924 | * * `filePaths` String[] - An array of file paths chosen by the user. If the
|
3925 | * dialog is cancelled this will be an empty array.
|
3926 | * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
|
3927 | * `filePaths` array of base64 encoded strings which contains security scoped
|
3928 | * bookmark data. `securityScopedBookmarks` must be enabled for this to be
|
3929 | * populated. (For return values, see table here.)
|
3930 | *
|
3931 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
3932 | * window, making it modal.
|
3933 | *
|
3934 | * The `filters` specifies an array of file types that can be displayed or selected
|
3935 | * when you want to limit the user to a specific type. For example:
|
3936 | *
|
3937 | * The `extensions` array should contain extensions without wildcards or dots (e.g.
|
3938 | * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
|
3939 | * `'*'` wildcard (no other wildcard is supported).
|
3940 | *
|
3941 | * **Note:** On Windows and Linux an open dialog can not be both a file selector
|
3942 | * and a directory selector, so if you set `properties` to `['openFile',
|
3943 | * 'openDirectory']` on these platforms, a directory selector will be shown.
|
3944 | */
|
3945 | showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
|
3946 | /**
|
3947 | * Resolve with an object containing the following:
|
3948 | *
|
3949 | * * `canceled` Boolean - whether or not the dialog was canceled.
|
3950 | * * `filePaths` String[] - An array of file paths chosen by the user. If the
|
3951 | * dialog is cancelled this will be an empty array.
|
3952 | * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
|
3953 | * `filePaths` array of base64 encoded strings which contains security scoped
|
3954 | * bookmark data. `securityScopedBookmarks` must be enabled for this to be
|
3955 | * populated. (For return values, see table here.)
|
3956 | *
|
3957 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
3958 | * window, making it modal.
|
3959 | *
|
3960 | * The `filters` specifies an array of file types that can be displayed or selected
|
3961 | * when you want to limit the user to a specific type. For example:
|
3962 | *
|
3963 | * The `extensions` array should contain extensions without wildcards or dots (e.g.
|
3964 | * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
|
3965 | * `'*'` wildcard (no other wildcard is supported).
|
3966 | *
|
3967 | * **Note:** On Windows and Linux an open dialog can not be both a file selector
|
3968 | * and a directory selector, so if you set `properties` to `['openFile',
|
3969 | * 'openDirectory']` on these platforms, a directory selector will be shown.
|
3970 | */
|
3971 | showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
|
3972 | /**
|
3973 | * the file paths chosen by the user; if the dialog is cancelled it returns
|
3974 | * `undefined`.
|
3975 | *
|
3976 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
3977 | * window, making it modal.
|
3978 | *
|
3979 | * The `filters` specifies an array of file types that can be displayed or selected
|
3980 | * when you want to limit the user to a specific type. For example:
|
3981 | *
|
3982 | * The `extensions` array should contain extensions without wildcards or dots (e.g.
|
3983 | * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
|
3984 | * `'*'` wildcard (no other wildcard is supported).
|
3985 | *
|
3986 | * **Note:** On Windows and Linux an open dialog can not be both a file selector
|
3987 | * and a directory selector, so if you set `properties` to `['openFile',
|
3988 | * 'openDirectory']` on these platforms, a directory selector will be shown.
|
3989 | */
|
3990 | showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
|
3991 | /**
|
3992 | * the file paths chosen by the user; if the dialog is cancelled it returns
|
3993 | * `undefined`.
|
3994 | *
|
3995 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
3996 | * window, making it modal.
|
3997 | *
|
3998 | * The `filters` specifies an array of file types that can be displayed or selected
|
3999 | * when you want to limit the user to a specific type. For example:
|
4000 | *
|
4001 | * The `extensions` array should contain extensions without wildcards or dots (e.g.
|
4002 | * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
|
4003 | * `'*'` wildcard (no other wildcard is supported).
|
4004 | *
|
4005 | * **Note:** On Windows and Linux an open dialog can not be both a file selector
|
4006 | * and a directory selector, so if you set `properties` to `['openFile',
|
4007 | * 'openDirectory']` on these platforms, a directory selector will be shown.
|
4008 | */
|
4009 | showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
|
4010 | /**
|
4011 | * Resolve with an object containing the following:
|
4012 | *
|
4013 | * * `canceled` Boolean - whether or not the dialog was canceled.
|
4014 | * * `filePath` String (optional) - If the dialog is canceled, this will be
|
4015 | * `undefined`.
|
4016 | * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
|
4017 | * contains the security scoped bookmark data for the saved file.
|
4018 | * `securityScopedBookmarks` must be enabled for this to be present. (For return
|
4019 | * values, see table here.)
|
4020 | *
|
4021 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
4022 | * window, making it modal.
|
4023 | *
|
4024 | * The `filters` specifies an array of file types that can be displayed, see
|
4025 | * `dialog.showOpenDialog` for an example.
|
4026 | *
|
4027 | * **Note:** On macOS, using the asynchronous version is recommended to avoid
|
4028 | * issues when expanding and collapsing the dialog.
|
4029 | */
|
4030 | showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
|
4031 | /**
|
4032 | * Resolve with an object containing the following:
|
4033 | *
|
4034 | * * `canceled` Boolean - whether or not the dialog was canceled.
|
4035 | * * `filePath` String (optional) - If the dialog is canceled, this will be
|
4036 | * `undefined`.
|
4037 | * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
|
4038 | * contains the security scoped bookmark data for the saved file.
|
4039 | * `securityScopedBookmarks` must be enabled for this to be present. (For return
|
4040 | * values, see table here.)
|
4041 | *
|
4042 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
4043 | * window, making it modal.
|
4044 | *
|
4045 | * The `filters` specifies an array of file types that can be displayed, see
|
4046 | * `dialog.showOpenDialog` for an example.
|
4047 | *
|
4048 | * **Note:** On macOS, using the asynchronous version is recommended to avoid
|
4049 | * issues when expanding and collapsing the dialog.
|
4050 | */
|
4051 | showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
|
4052 | /**
|
4053 | * the path of the file chosen by the user; if the dialog is cancelled it returns
|
4054 | * `undefined`.
|
4055 | *
|
4056 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
4057 | * window, making it modal.
|
4058 | *
|
4059 | * The `filters` specifies an array of file types that can be displayed, see
|
4060 | * `dialog.showOpenDialog` for an example.
|
4061 | */
|
4062 | showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined);
|
4063 | /**
|
4064 | * the path of the file chosen by the user; if the dialog is cancelled it returns
|
4065 | * `undefined`.
|
4066 | *
|
4067 | * The `browserWindow` argument allows the dialog to attach itself to a parent
|
4068 | * window, making it modal.
|
4069 | *
|
4070 | * The `filters` specifies an array of file types that can be displayed, see
|
4071 | * `dialog.showOpenDialog` for an example.
|
4072 | */
|
4073 | showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined);
|
4074 | }
|
4075 |
|
4076 | interface Display {
|
4077 |
|
4078 | // Docs: http://electronjs.org/docs/api/structures/display
|
4079 |
|
4080 | /**
|
4081 | * Can be `available`, `unavailable`, `unknown`.
|
4082 | */
|
4083 | accelerometerSupport: ('available' | 'unavailable' | 'unknown');
|
4084 | bounds: Rectangle;
|
4085 | /**
|
4086 | * The number of bits per pixel.
|
4087 | */
|
4088 | colorDepth: number;
|
4089 | /**
|
4090 | * represent a color space (three-dimensional object which contains all realizable
|
4091 | * color combinations) for the purpose of color conversions
|
4092 | */
|
4093 | colorSpace: string;
|
4094 | /**
|
4095 | * The number of bits per color component.
|
4096 | */
|
4097 | depthPerComponent: number;
|
4098 | /**
|
4099 | * Unique identifier associated with the display.
|
4100 | */
|
4101 | id: number;
|
4102 | /**
|
4103 | * `true` for an internal display and `false` for an external display
|
4104 | */
|
4105 | internal: boolean;
|
4106 | /**
|
4107 | * Whether or not the display is a monochrome display.
|
4108 | */
|
4109 | monochrome: boolean;
|
4110 | /**
|
4111 | * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
|
4112 | */
|
4113 | rotation: number;
|
4114 | /**
|
4115 | * Output device's pixel scale factor.
|
4116 | */
|
4117 | scaleFactor: number;
|
4118 | size: Size;
|
4119 | /**
|
4120 | * Can be `available`, `unavailable`, `unknown`.
|
4121 | */
|
4122 | touchSupport: ('available' | 'unavailable' | 'unknown');
|
4123 | workArea: Rectangle;
|
4124 | workAreaSize: Size;
|
4125 | }
|
4126 |
|
4127 | class Dock {
|
4128 |
|
4129 | // Docs: http://electronjs.org/docs/api/dock
|
4130 |
|
4131 | /**
|
4132 | * an ID representing the request.
|
4133 | *
|
4134 | * When `critical` is passed, the dock icon will bounce until either the
|
4135 | * application becomes active or the request is canceled.
|
4136 | *
|
4137 | * When `informational` is passed, the dock icon will bounce for one second.
|
4138 | * However, the request remains active until either the application becomes active
|
4139 | * or the request is canceled.
|
4140 | *
|
4141 | * **Nota Bene:** This method can only be used while the app is not focused; when
|
4142 | * the app is focused it will return -1.
|
4143 | *
|
4144 | * @platform darwin
|
4145 | */
|
4146 | bounce(type?: 'critical' | 'informational'): number;
|
4147 | /**
|
4148 | * Cancel the bounce of `id`.
|
4149 | *
|
4150 | * @platform darwin
|
4151 | */
|
4152 | cancelBounce(id: number): void;
|
4153 | /**
|
4154 | * Bounces the Downloads stack if the filePath is inside the Downloads folder.
|
4155 | *
|
4156 | * @platform darwin
|
4157 | */
|
4158 | downloadFinished(filePath: string): void;
|
4159 | /**
|
4160 | * The badge string of the dock.
|
4161 | *
|
4162 | * @platform darwin
|
4163 | */
|
4164 | getBadge(): string;
|
4165 | /**
|
4166 | * The application's [dock menu][dock-menu].
|
4167 | *
|
4168 | * @platform darwin
|
4169 | */
|
4170 | getMenu(): (Menu) | (null);
|
4171 | /**
|
4172 | * Hides the dock icon.
|
4173 | *
|
4174 | * @platform darwin
|
4175 | */
|
4176 | hide(): void;
|
4177 | /**
|
4178 | * Whether the dock icon is visible.
|
4179 | *
|
4180 | * @platform darwin
|
4181 | */
|
4182 | isVisible(): boolean;
|
4183 | /**
|
4184 | * Sets the string to be displayed in the dock’s badging area.
|
4185 | *
|
4186 | * @platform darwin
|
4187 | */
|
4188 | setBadge(text: string): void;
|
4189 | /**
|
4190 | * Sets the `image` associated with this dock icon.
|
4191 | *
|
4192 | * @platform darwin
|
4193 | */
|
4194 | setIcon(image: (NativeImage) | (string)): void;
|
4195 | /**
|
4196 | * Sets the application's [dock menu][dock-menu].
|
4197 | *
|
4198 | * @platform darwin
|
4199 | */
|
4200 | setMenu(menu: Menu): void;
|
4201 | /**
|
4202 | * Resolves when the dock icon is shown.
|
4203 | *
|
4204 | * @platform darwin
|
4205 | */
|
4206 | show(): Promise<void>;
|
4207 | }
|
4208 |
|
4209 | class DownloadItem extends NodeEventEmitter {
|
4210 |
|
4211 | // Docs: http://electronjs.org/docs/api/download-item
|
4212 |
|
4213 | /**
|
4214 | * Emitted when the download is in a terminal state. This includes a completed
|
4215 | * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
|
4216 | * download that can't be resumed.
|
4217 | *
|
4218 | * The `state` can be one of following:
|
4219 | *
|
4220 | * * `completed` - The download completed successfully.
|
4221 | * * `cancelled` - The download has been cancelled.
|
4222 | * * `interrupted` - The download has interrupted and can not resume.
|
4223 | */
|
4224 | on(event: 'done', listener: (event: Event,
|
4225 | /**
|
4226 | * Can be `completed`, `cancelled` or `interrupted`.
|
4227 | */
|
4228 | state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
|
4229 | once(event: 'done', listener: (event: Event,
|
4230 | /**
|
4231 | * Can be `completed`, `cancelled` or `interrupted`.
|
4232 | */
|
4233 | state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
|
4234 | addListener(event: 'done', listener: (event: Event,
|
4235 | /**
|
4236 | * Can be `completed`, `cancelled` or `interrupted`.
|
4237 | */
|
4238 | state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
|
4239 | removeListener(event: 'done', listener: (event: Event,
|
4240 | /**
|
4241 | * Can be `completed`, `cancelled` or `interrupted`.
|
4242 | */
|
4243 | state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
|
4244 | /**
|
4245 | * Emitted when the download has been updated and is not done.
|
4246 | *
|
4247 | * The `state` can be one of following:
|
4248 | *
|
4249 | * * `progressing` - The download is in-progress.
|
4250 | * * `interrupted` - The download has interrupted and can be resumed.
|
4251 | */
|
4252 | on(event: 'updated', listener: (event: Event,
|
4253 | /**
|
4254 | * Can be `progressing` or `interrupted`.
|
4255 | */
|
4256 | state: ('progressing' | 'interrupted')) => void): this;
|
4257 | once(event: 'updated', listener: (event: Event,
|
4258 | /**
|
4259 | * Can be `progressing` or `interrupted`.
|
4260 | */
|
4261 | state: ('progressing' | 'interrupted')) => void): this;
|
4262 | addListener(event: 'updated', listener: (event: Event,
|
4263 | /**
|
4264 | * Can be `progressing` or `interrupted`.
|
4265 | */
|
4266 | state: ('progressing' | 'interrupted')) => void): this;
|
4267 | removeListener(event: 'updated', listener: (event: Event,
|
4268 | /**
|
4269 | * Can be `progressing` or `interrupted`.
|
4270 | */
|
4271 | state: ('progressing' | 'interrupted')) => void): this;
|
4272 | /**
|
4273 | * Cancels the download operation.
|
4274 | */
|
4275 | cancel(): void;
|
4276 | /**
|
4277 | * Whether the download can resume.
|
4278 | */
|
4279 | canResume(): boolean;
|
4280 | /**
|
4281 | * The Content-Disposition field from the response header.
|
4282 | */
|
4283 | getContentDisposition(): string;
|
4284 | /**
|
4285 | * ETag header value.
|
4286 | */
|
4287 | getETag(): string;
|
4288 | /**
|
4289 | * The file name of the download item.
|
4290 | *
|
4291 | * **Note:** The file name is not always the same as the actual one saved in local
|
4292 | * disk. If user changes the file name in a prompted download saving dialog, the
|
4293 | * actual name of saved file will be different.
|
4294 | */
|
4295 | getFilename(): string;
|
4296 | /**
|
4297 | * Last-Modified header value.
|
4298 | */
|
4299 | getLastModifiedTime(): string;
|
4300 | /**
|
4301 | * The files mime type.
|
4302 | */
|
4303 | getMimeType(): string;
|
4304 | /**
|
4305 | * The received bytes of the download item.
|
4306 | */
|
4307 | getReceivedBytes(): number;
|
4308 | /**
|
4309 | * Returns the object previously set by
|
4310 | * `downloadItem.setSaveDialogOptions(options)`.
|
4311 | */
|
4312 | getSaveDialogOptions(): SaveDialogOptions;
|
4313 | /**
|
4314 | * The save path of the download item. This will be either the path set via
|
4315 | * `downloadItem.setSavePath(path)` or the path selected from the shown save
|
4316 | * dialog.
|
4317 | */
|
4318 | getSavePath(): string;
|
4319 | /**
|
4320 | * Number of seconds since the UNIX epoch when the download was started.
|
4321 | */
|
4322 | getStartTime(): number;
|
4323 | /**
|
4324 | * The current state. Can be `progressing`, `completed`, `cancelled` or
|
4325 | * `interrupted`.
|
4326 | *
|
4327 | * **Note:** The following methods are useful specifically to resume a `cancelled`
|
4328 | * item when session is restarted.
|
4329 | */
|
4330 | getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
|
4331 | /**
|
4332 | * The total size in bytes of the download item.
|
4333 | *
|
4334 | If the size is unknown, it returns 0.
|
4335 | */
|
4336 | getTotalBytes(): number;
|
4337 | /**
|
4338 | * The origin URL where the item is downloaded from.
|
4339 | */
|
4340 | getURL(): string;
|
4341 | /**
|
4342 | * The complete URL chain of the item including any redirects.
|
4343 | */
|
4344 | getURLChain(): string[];
|
4345 | /**
|
4346 | * Whether the download has user gesture.
|
4347 | */
|
4348 | hasUserGesture(): boolean;
|
4349 | /**
|
4350 | * Whether the download is paused.
|
4351 | */
|
4352 | isPaused(): boolean;
|
4353 | /**
|
4354 | * Pauses the download.
|
4355 | */
|
4356 | pause(): void;
|
4357 | /**
|
4358 | * Resumes the download that has been paused.
|
4359 | *
|
4360 | * **Note:** To enable resumable downloads the server you are downloading from must
|
4361 | * support range requests and provide both `Last-Modified` and `ETag` header
|
4362 | * values. Otherwise `resume()` will dismiss previously received bytes and restart
|
4363 | * the download from the beginning.
|
4364 | */
|
4365 | resume(): void;
|
4366 | /**
|
4367 | * This API allows the user to set custom options for the save dialog that opens
|
4368 | * for the download item by default. The API is only available in session's
|
4369 | * `will-download` callback function.
|
4370 | */
|
4371 | setSaveDialogOptions(options: SaveDialogOptions): void;
|
4372 | /**
|
4373 | * The API is only available in session's `will-download` callback function. If
|
4374 | * user doesn't set the save path via the API, Electron will use the original
|
4375 | * routine to determine the save path; this usually prompts a save dialog.
|
4376 | */
|
4377 | setSavePath(path: string): void;
|
4378 | savePath: string;
|
4379 | }
|
4380 |
|
4381 | interface Event extends GlobalEvent {
|
4382 |
|
4383 | // Docs: http://electronjs.org/docs/api/structures/event
|
4384 |
|
4385 | preventDefault: (() => void);
|
4386 | }
|
4387 |
|
4388 | interface Extension {
|
4389 |
|
4390 | // Docs: http://electronjs.org/docs/api/structures/extension
|
4391 |
|
4392 | id: string;
|
4393 | /**
|
4394 | * Copy of the extension's manifest data.
|
4395 | */
|
4396 | manifest: any;
|
4397 | name: string;
|
4398 | /**
|
4399 | * The extension's file path.
|
4400 | */
|
4401 | path: string;
|
4402 | /**
|
4403 | * The extension's `chrome-extension://` URL.
|
4404 | */
|
4405 | url: string;
|
4406 | version: string;
|
4407 | }
|
4408 |
|
4409 | interface ExtensionInfo {
|
4410 |
|
4411 | // Docs: http://electronjs.org/docs/api/structures/extension-info
|
4412 |
|
4413 | name: string;
|
4414 | version: string;
|
4415 | }
|
4416 |
|
4417 | interface FileFilter {
|
4418 |
|
4419 | // Docs: http://electronjs.org/docs/api/structures/file-filter
|
4420 |
|
4421 | extensions: string[];
|
4422 | name: string;
|
4423 | }
|
4424 |
|
4425 | interface FilePathWithHeaders {
|
4426 |
|
4427 | // Docs: http://electronjs.org/docs/api/structures/file-path-with-headers
|
4428 |
|
4429 | /**
|
4430 | * Additional headers to be sent.
|
4431 | */
|
4432 | headers?: Record<string, string>;
|
4433 | /**
|
4434 | * The path to the file to send.
|
4435 | */
|
4436 | path: string;
|
4437 | }
|
4438 |
|
4439 | interface GlobalShortcut {
|
4440 |
|
4441 | // Docs: http://electronjs.org/docs/api/global-shortcut
|
4442 |
|
4443 | /**
|
4444 | * Whether this application has registered `accelerator`.
|
4445 | *
|
4446 | * When the accelerator is already taken by other applications, this call will
|
4447 | * still return `false`. This behavior is intended by operating systems, since they
|
4448 | * don't want applications to fight for global shortcuts.
|
4449 | */
|
4450 | isRegistered(accelerator: Accelerator): boolean;
|
4451 | /**
|
4452 | * Whether or not the shortcut was registered successfully.
|
4453 | *
|
4454 | * Registers a global shortcut of `accelerator`. The `callback` is called when the
|
4455 | * registered shortcut is pressed by the user.
|
4456 | *
|
4457 | * When the accelerator is already taken by other applications, this call will
|
4458 | * silently fail. This behavior is intended by operating systems, since they don't
|
4459 | * want applications to fight for global shortcuts.
|
4460 | *
|
4461 | * The following accelerators will not be registered successfully on macOS 10.14
|
4462 | * Mojave unless the app has been authorized as a trusted accessibility client:
|
4463 | *
|
4464 | * * "Media Play/Pause"
|
4465 | * * "Media Next Track"
|
4466 | * "Media Previous Track"
|
4467 | * "Media Stop"
|
4468 | */
|
4469 | register(accelerator: Accelerator, callback: () => void): boolean;
|
4470 | /**
|
4471 | * Registers a global shortcut of all `accelerator` items in `accelerators`. The
|
4472 | * `callback` is called when any of the registered shortcuts are pressed by the
|
4473 | * user.
|
4474 | *
|
4475 | * When a given accelerator is already taken by other applications, this call will
|
4476 | * silently fail. This behavior is intended by operating systems, since they don't
|
4477 | * want applications to fight for global shortcuts.
|
4478 | *
|
4479 | * The following accelerators will not be registered successfully on macOS 10.14
|
4480 | * Mojave unless the app has been authorized as a trusted accessibility client:
|
4481 | *
|
4482 | * * "Media Play/Pause"
|
4483 | * * "Media Next Track"
|
4484 | * "Media Previous Track"
|
4485 | * "Media Stop"
|
4486 | */
|
4487 | registerAll(accelerators: string[], callback: () => void): void;
|
4488 | /**
|
4489 | * Unregisters the global shortcut of `accelerator`.
|
4490 | */
|
4491 | unregister(accelerator: Accelerator): void;
|
4492 | /**
|
4493 | * Unregisters all of the global shortcuts.
|
4494 | */
|
4495 | unregisterAll(): void;
|
4496 | }
|
4497 |
|
4498 | interface GPUFeatureStatus {
|
4499 |
|
4500 | // Docs: http://electronjs.org/docs/api/structures/gpu-feature-status
|
4501 |
|
4502 | /**
|
4503 | * Canvas.
|
4504 | */
|
4505 | '2d_canvas': string;
|
4506 | /**
|
4507 | * Flash.
|
4508 | */
|
4509 | flash_3d: string;
|
4510 | /**
|
4511 | * Flash Stage3D.
|
4512 | */
|
4513 | flash_stage3d: string;
|
4514 | /**
|
4515 | * Flash Stage3D Baseline profile.
|
4516 | */
|
4517 | flash_stage3d_baseline: string;
|
4518 | /**
|
4519 | * Compositing.
|
4520 | */
|
4521 | gpu_compositing: string;
|
4522 | /**
|
4523 | * Multiple Raster Threads.
|
4524 | */
|
4525 | multiple_raster_threads: string;
|
4526 | /**
|
4527 | * Native GpuMemoryBuffers.
|
4528 | */
|
4529 | native_gpu_memory_buffers: string;
|
4530 | /**
|
4531 | * Rasterization.
|
4532 | */
|
4533 | rasterization: string;
|
4534 | /**
|
4535 | * Video Decode.
|
4536 | */
|
4537 | video_decode: string;
|
4538 | /**
|
4539 | * Video Encode.
|
4540 | */
|
4541 | video_encode: string;
|
4542 | /**
|
4543 | * VPx Video Decode.
|
4544 | */
|
4545 | vpx_decode: string;
|
4546 | /**
|
4547 | * WebGL.
|
4548 | */
|
4549 | webgl: string;
|
4550 | /**
|
4551 | * WebGL2.
|
4552 | */
|
4553 | webgl2: string;
|
4554 | }
|
4555 |
|
4556 | interface InAppPurchase extends NodeJS.EventEmitter {
|
4557 |
|
4558 | // Docs: http://electronjs.org/docs/api/in-app-purchase
|
4559 |
|
4560 | on(event: 'transactions-updated', listener: Function): this;
|
4561 | once(event: 'transactions-updated', listener: Function): this;
|
4562 | addListener(event: 'transactions-updated', listener: Function): this;
|
4563 | removeListener(event: 'transactions-updated', listener: Function): this;
|
4564 | /**
|
4565 | * whether a user can make a payment.
|
4566 | */
|
4567 | canMakePayments(): boolean;
|
4568 | /**
|
4569 | * Completes all pending transactions.
|
4570 | */
|
4571 | finishAllTransactions(): void;
|
4572 | /**
|
4573 | * Completes the pending transactions corresponding to the date.
|
4574 | */
|
4575 | finishTransactionByDate(date: string): void;
|
4576 | /**
|
4577 | * Resolves with an array of `Product` objects.
|
4578 | *
|
4579 | Retrieves the product descriptions.
|
4580 | */
|
4581 | getProducts(productIDs: string[]): Promise<Electron.Product[]>;
|
4582 | /**
|
4583 | * the path to the receipt.
|
4584 | */
|
4585 | getReceiptURL(): string;
|
4586 | /**
|
4587 | * Returns `true` if the product is valid and added to the payment queue.
|
4588 | *
|
4589 | * You should listen for the `transactions-updated` event as soon as possible and
|
4590 | * certainly before you call `purchaseProduct`.
|
4591 | */
|
4592 | purchaseProduct(productID: string, quantity?: number): Promise<boolean>;
|
4593 | /**
|
4594 | * Restores finished transactions. This method can be called either to install
|
4595 | * purchases on additional devices, or to restore purchases for an application that
|
4596 | * the user deleted and reinstalled.
|
4597 | *
|
4598 | * The payment queue delivers a new transaction for each previously completed
|
4599 | * transaction that can be restored. Each transaction includes a copy of the
|
4600 | * original transaction.
|
4601 | */
|
4602 | restoreCompletedTransactions(): void;
|
4603 | }
|
4604 |
|
4605 | class IncomingMessage extends NodeEventEmitter {
|
4606 |
|
4607 | // Docs: http://electronjs.org/docs/api/incoming-message
|
4608 |
|
4609 | /**
|
4610 | * Emitted when a request has been canceled during an ongoing HTTP transaction.
|
4611 | */
|
4612 | on(event: 'aborted', listener: Function): this;
|
4613 | once(event: 'aborted', listener: Function): this;
|
4614 | addListener(event: 'aborted', listener: Function): this;
|
4615 | removeListener(event: 'aborted', listener: Function): this;
|
4616 | /**
|
4617 | * The `data` event is the usual method of transferring response data into
|
4618 | * applicative code.
|
4619 | */
|
4620 | on(event: 'data', listener: (
|
4621 | /**
|
4622 | * A chunk of response body's data.
|
4623 | */
|
4624 | chunk: Buffer) => void): this;
|
4625 | once(event: 'data', listener: (
|
4626 | /**
|
4627 | * A chunk of response body's data.
|
4628 | */
|
4629 | chunk: Buffer) => void): this;
|
4630 | addListener(event: 'data', listener: (
|
4631 | /**
|
4632 | * A chunk of response body's data.
|
4633 | */
|
4634 | chunk: Buffer) => void): this;
|
4635 | removeListener(event: 'data', listener: (
|
4636 | /**
|
4637 | * A chunk of response body's data.
|
4638 | */
|
4639 | chunk: Buffer) => void): this;
|
4640 | /**
|
4641 | * Indicates that response body has ended.
|
4642 | */
|
4643 | on(event: 'end', listener: Function): this;
|
4644 | once(event: 'end', listener: Function): this;
|
4645 | addListener(event: 'end', listener: Function): this;
|
4646 | removeListener(event: 'end', listener: Function): this;
|
4647 | /**
|
4648 | * Returns:
|
4649 | *
|
4650 | * `error` Error - Typically holds an error string identifying failure root cause.
|
4651 | *
|
4652 | * Emitted when an error was encountered while streaming response data events. For
|
4653 | * instance, if the server closes the underlying while the response is still
|
4654 | * streaming, an `error` event will be emitted on the response object and a `close`
|
4655 | * event will subsequently follow on the request object.
|
4656 | */
|
4657 | on(event: 'error', listener: Function): this;
|
4658 | once(event: 'error', listener: Function): this;
|
4659 | addListener(event: 'error', listener: Function): this;
|
4660 | removeListener(event: 'error', listener: Function): this;
|
4661 | headers: Record<string, (string) | (string[])>;
|
4662 | httpVersion: string;
|
4663 | httpVersionMajor: number;
|
4664 | httpVersionMinor: number;
|
4665 | statusCode: number;
|
4666 | statusMessage: string;
|
4667 | }
|
4668 |
|
4669 | interface InputEvent {
|
4670 |
|
4671 | // Docs: http://electronjs.org/docs/api/structures/input-event
|
4672 |
|
4673 | /**
|
4674 | * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
|
4675 | * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
|
4676 | * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
|
4677 | */
|
4678 | modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
|
4679 | }
|
4680 |
|
4681 | interface IOCounters {
|
4682 |
|
4683 | // Docs: http://electronjs.org/docs/api/structures/io-counters
|
4684 |
|
4685 | /**
|
4686 | * Then number of I/O other operations.
|
4687 | */
|
4688 | otherOperationCount: number;
|
4689 | /**
|
4690 | * Then number of I/O other transfers.
|
4691 | */
|
4692 | otherTransferCount: number;
|
4693 | /**
|
4694 | * The number of I/O read operations.
|
4695 | */
|
4696 | readOperationCount: number;
|
4697 | /**
|
4698 | * The number of I/O read transfers.
|
4699 | */
|
4700 | readTransferCount: number;
|
4701 | /**
|
4702 | * The number of I/O write operations.
|
4703 | */
|
4704 | writeOperationCount: number;
|
4705 | /**
|
4706 | * The number of I/O write transfers.
|
4707 | */
|
4708 | writeTransferCount: number;
|
4709 | }
|
4710 |
|
4711 | interface IpcMain extends NodeJS.EventEmitter {
|
4712 |
|
4713 | // Docs: http://electronjs.org/docs/api/ipc-main
|
4714 |
|
4715 | /**
|
4716 | * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
|
4717 | * renderer calls `ipcRenderer.invoke(channel, ...args)`.
|
4718 | *
|
4719 | * If `listener` returns a Promise, the eventual result of the promise will be
|
4720 | * returned as a reply to the remote caller. Otherwise, the return value of the
|
4721 | * listener will be used as the value of the reply.
|
4722 | *
|
4723 | * The `event` that is passed as the first argument to the handler is the same as
|
4724 | * that passed to a regular event listener. It includes information about which
|
4725 | * WebContents is the source of the invoke request.
|
4726 | */
|
4727 | handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
|
4728 | /**
|
4729 | * Handles a single `invoke`able IPC message, then removes the listener. See
|
4730 | * `ipcMain.handle(channel, listener)`.
|
4731 | */
|
4732 | handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
|
4733 | /**
|
4734 | * Listens to `channel`, when a new message arrives `listener` would be called with
|
4735 | * `listener(event, args...)`.
|
4736 | */
|
4737 | on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
|
4738 | /**
|
4739 | * Adds a one time `listener` function for the event. This `listener` is invoked
|
4740 | * only the next time a message is sent to `channel`, after which it is removed.
|
4741 | */
|
4742 | once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
|
4743 | /**
|
4744 | * Removes listeners of the specified `channel`.
|
4745 | */
|
4746 | removeAllListeners(channel?: string): this;
|
4747 | /**
|
4748 | * Removes any handler for `channel`, if present.
|
4749 | */
|
4750 | removeHandler(channel: string): void;
|
4751 | /**
|
4752 | * Removes the specified `listener` from the listener array for the specified
|
4753 | * `channel`.
|
4754 | */
|
4755 | removeListener(channel: string, listener: (...args: any[]) => void): this;
|
4756 | }
|
4757 |
|
4758 | interface IpcMainEvent extends Event {
|
4759 |
|
4760 | // Docs: http://electronjs.org/docs/api/structures/ipc-main-event
|
4761 |
|
4762 | /**
|
4763 | * The ID of the renderer frame that sent this message
|
4764 | */
|
4765 | frameId: number;
|
4766 | /**
|
4767 | * A list of MessagePorts that were transferred with this message
|
4768 | */
|
4769 | ports: MessagePortMain[];
|
4770 | /**
|
4771 | * A function that will send an IPC message to the renderer frame that sent the
|
4772 | * original message that you are currently handling. You should use this method to
|
4773 | * "reply" to the sent message in order to guarantee the reply will go to the
|
4774 | * correct process and frame.
|
4775 | */
|
4776 | reply: Function;
|
4777 | /**
|
4778 | * Set this to the value to be returned in a synchronous message
|
4779 | */
|
4780 | returnValue: any;
|
4781 | /**
|
4782 | * Returns the `webContents` that sent the message
|
4783 | */
|
4784 | sender: WebContents;
|
4785 | }
|
4786 |
|
4787 | interface IpcMainInvokeEvent extends Event {
|
4788 |
|
4789 | // Docs: http://electronjs.org/docs/api/structures/ipc-main-invoke-event
|
4790 |
|
4791 | /**
|
4792 | * The ID of the renderer frame that sent this message
|
4793 | */
|
4794 | frameId: number;
|
4795 | /**
|
4796 | * Returns the `webContents` that sent the message
|
4797 | */
|
4798 | sender: WebContents;
|
4799 | }
|
4800 |
|
4801 | interface IpcRenderer extends NodeJS.EventEmitter {
|
4802 |
|
4803 | // Docs: http://electronjs.org/docs/api/ipc-renderer
|
4804 |
|
4805 | /**
|
4806 | * Resolves with the response from the main process.
|
4807 | *
|
4808 | * Send a message to the main process via `channel` and expect a result
|
4809 | * asynchronously. Arguments will be serialized with the Structured Clone
|
4810 | * Algorithm, just like `window.postMessage`, so prototype chains will not be
|
4811 | * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
|
4812 | * an exception.
|
4813 | *
|
4814 | * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
|
4815 | * Electron objects is deprecated, and will begin throwing an exception starting
|
4816 | * with Electron 9.
|
4817 | *
|
4818 | * The main process should listen for `channel` with `ipcMain.handle()`.
|
4819 | *
|
4820 | * For example:
|
4821 | *
|
4822 | * If you need to transfer a `MessagePort` to the main process, use
|
4823 | * `ipcRenderer.postMessage`.
|
4824 | *
|
4825 | If you do not need a respons to the message, consider using `ipcRenderer.send`.
|
4826 | */
|
4827 | invoke(channel: string, ...args: any[]): Promise<any>;
|
4828 | /**
|
4829 | * Listens to `channel`, when a new message arrives `listener` would be called with
|
4830 | * `listener(event, args...)`.
|
4831 | */
|
4832 | on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
|
4833 | /**
|
4834 | * Adds a one time `listener` function for the event. This `listener` is invoked
|
4835 | * only the next time a message is sent to `channel`, after which it is removed.
|
4836 | */
|
4837 | once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
|
4838 | /**
|
4839 | * Send a message to the main process, optionally transferring ownership of zero or
|
4840 | * more `MessagePort` objects.
|
4841 | *
|
4842 | * The transferred `MessagePort` objects will be available in the main process as
|
4843 | * `MessagePortMain` objects by accessing the `ports` property of the emitted
|
4844 | * event.
|
4845 | *
|
4846 | * For example:
|
4847 | *
|
4848 | * For more information on using `MessagePort` and `MessageChannel`, see the MDN
|
4849 | * documentation.
|
4850 | */
|
4851 | postMessage(channel: string, message: any, transfer?: MessagePort[]): void;
|
4852 | /**
|
4853 | * Removes all listeners, or those of the specified `channel`.
|
4854 | */
|
4855 | removeAllListeners(channel: string): this;
|
4856 | /**
|
4857 | * Removes the specified `listener` from the listener array for the specified
|
4858 | * `channel`.
|
4859 | */
|
4860 | removeListener(channel: string, listener: (...args: any[]) => void): this;
|
4861 | /**
|
4862 | * Send an asynchronous message to the main process via `channel`, along with
|
4863 | * arguments. Arguments will be serialized with the Structured Clone Algorithm,
|
4864 | * just like `window.postMessage`, so prototype chains will not be included.
|
4865 | * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
|
4866 | * exception.
|
4867 | *
|
4868 | * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
|
4869 | * Electron objects is deprecated, and will begin throwing an exception starting
|
4870 | * with Electron 9.
|
4871 | *
|
4872 | * The main process handles it by listening for `channel` with the `ipcMain`
|
4873 | * module.
|
4874 | *
|
4875 | * If you need to transfer a `MessagePort` to the main process, use
|
4876 | * `ipcRenderer.postMessage`.
|
4877 | *
|
4878 | * If you want to receive a single response from the main process, like the result
|
4879 | * of a method call, consider using `ipcRenderer.invoke`.
|
4880 | */
|
4881 | send(channel: string, ...args: any[]): void;
|
4882 | /**
|
4883 | * The value sent back by the `ipcMain` handler.
|
4884 | *
|
4885 | * Send a message to the main process via `channel` and expect a result
|
4886 | * synchronously. Arguments will be serialized with the Structured Clone Algorithm,
|
4887 | * just like `window.postMessage`, so prototype chains will not be included.
|
4888 | * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
|
4889 | * exception.
|
4890 | *
|
4891 | * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
|
4892 | * Electron objects is deprecated, and will begin throwing an exception starting
|
4893 | * with Electron 9.
|
4894 | *
|
4895 | * The main process handles it by listening for `channel` with `ipcMain` module,
|
4896 | * and replies by setting `event.returnValue`.
|
4897 | *
|
4898 | * > :warning: **WARNING**: Sending a synchronous message will block the whole
|
4899 | * renderer process until the reply is received, so use this method only as a last
|
4900 | * resort. It's much better to use the asynchronous version, `invoke()`.
|
4901 | */
|
4902 | sendSync(channel: string, ...args: any[]): any;
|
4903 | /**
|
4904 | * Sends a message to a window with `webContentsId` via `channel`.
|
4905 | */
|
4906 | sendTo(webContentsId: number, channel: string, ...args: any[]): void;
|
4907 | /**
|
4908 | * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
|
4909 | * the host page instead of the main process.
|
4910 | */
|
4911 | sendToHost(channel: string, ...args: any[]): void;
|
4912 | }
|
4913 |
|
4914 | interface IpcRendererEvent extends Event {
|
4915 |
|
4916 | // Docs: http://electronjs.org/docs/api/structures/ipc-renderer-event
|
4917 |
|
4918 | /**
|
4919 | * A list of MessagePorts that were transferred with this message
|
4920 | */
|
4921 | ports: MessagePort[];
|
4922 | /**
|
4923 | * The `IpcRenderer` instance that emitted the event originally
|
4924 | */
|
4925 | sender: IpcRenderer;
|
4926 | /**
|
4927 | * The `webContents.id` that sent the message, you can call
|
4928 | * `event.sender.sendTo(event.senderId, ...)` to reply to the message, see
|
4929 | * ipcRenderer.sendTo for more information. This only applies to messages sent from
|
4930 | * a different renderer. Messages sent directly from the main process set
|
4931 | * `event.senderId` to `0`.
|
4932 | */
|
4933 | senderId: number;
|
4934 | }
|
4935 |
|
4936 | interface JumpListCategory {
|
4937 |
|
4938 | // Docs: http://electronjs.org/docs/api/structures/jump-list-category
|
4939 |
|
4940 | /**
|
4941 | * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
|
4942 | * should be omitted.
|
4943 | */
|
4944 | items?: JumpListItem[];
|
4945 | /**
|
4946 | * Must be set if `type` is `custom`, otherwise it should be omitted.
|
4947 | */
|
4948 | name?: string;
|
4949 | /**
|
4950 | * One of the following:
|
4951 | */
|
4952 | type?: ('tasks' | 'frequent' | 'recent' | 'custom');
|
4953 | }
|
4954 |
|
4955 | interface JumpListItem {
|
4956 |
|
4957 | // Docs: http://electronjs.org/docs/api/structures/jump-list-item
|
4958 |
|
4959 | /**
|
4960 | * The command line arguments when `program` is executed. Should only be set if
|
4961 | * `type` is `task`.
|
4962 | */
|
4963 | args?: string;
|
4964 | /**
|
4965 | * Description of the task (displayed in a tooltip). Should only be set if `type`
|
4966 | * is `task`.
|
4967 | */
|
4968 | description?: string;
|
4969 | /**
|
4970 | * The index of the icon in the resource file. If a resource file contains multiple
|
4971 | * icons this value can be used to specify the zero-based index of the icon that
|
4972 | * should be displayed for this task. If a resource file contains only one icon,
|
4973 | * this property should be set to zero.
|
4974 | */
|
4975 | iconIndex?: number;
|
4976 | /**
|
4977 | * The absolute path to an icon to be displayed in a Jump List, which can be an
|
4978 | * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
|
4979 | * can usually specify `process.execPath` to show the program icon.
|
4980 | */
|
4981 | iconPath?: string;
|
4982 | /**
|
4983 | * Path of the file to open, should only be set if `type` is `file`.
|
4984 | */
|
4985 | path?: string;
|
4986 | /**
|
4987 | * Path of the program to execute, usually you should specify `process.execPath`
|
4988 | * which opens the current program. Should only be set if `type` is `task`.
|
4989 | */
|
4990 | program?: string;
|
4991 | /**
|
4992 | * The text to be displayed for the item in the Jump List. Should only be set if
|
4993 | * `type` is `task`.
|
4994 | */
|
4995 | title?: string;
|
4996 | /**
|
4997 | * One of the following:
|
4998 | */
|
4999 | type?: ('task' | 'separator' | 'file');
|
5000 | /**
|
5001 | * The working directory. Default is empty.
|
5002 | */
|
5003 | workingDirectory?: string;
|
5004 | }
|
5005 |
|
5006 | interface KeyboardEvent extends Event {
|
5007 |
|
5008 | // Docs: http://electronjs.org/docs/api/structures/keyboard-event
|
5009 |
|
5010 | /**
|
5011 | * whether an Alt key was used in an accelerator to trigger the Event
|
5012 | */
|
5013 | altKey?: boolean;
|
5014 | /**
|
5015 | * whether the Control key was used in an accelerator to trigger the Event
|
5016 | */
|
5017 | ctrlKey?: boolean;
|
5018 | /**
|
5019 | * whether a meta key was used in an accelerator to trigger the Event
|
5020 | */
|
5021 | metaKey?: boolean;
|
5022 | /**
|
5023 | * whether a Shift key was used in an accelerator to trigger the Event
|
5024 | */
|
5025 | shiftKey?: boolean;
|
5026 | /**
|
5027 | * whether an accelerator was used to trigger the event as opposed to another user
|
5028 | * gesture like mouse click
|
5029 | */
|
5030 | triggeredByAccelerator?: boolean;
|
5031 | }
|
5032 |
|
5033 | interface KeyboardInputEvent extends InputEvent {
|
5034 |
|
5035 | // Docs: http://electronjs.org/docs/api/structures/keyboard-input-event
|
5036 |
|
5037 | /**
|
5038 | * The character that will be sent as the keyboard event. Should only use the valid
|
5039 | * key codes in Accelerator.
|
5040 | */
|
5041 | keyCode: string;
|
5042 | /**
|
5043 | * The type of the event, can be `keyDown`, `keyUp` or `char`.
|
5044 | */
|
5045 | type: ('keyDown' | 'keyUp' | 'char');
|
5046 | }
|
5047 |
|
5048 | interface MemoryInfo {
|
5049 |
|
5050 | // Docs: http://electronjs.org/docs/api/structures/memory-info
|
5051 |
|
5052 | /**
|
5053 | * The maximum amount of memory that has ever been pinned to actual physical RAM.
|
5054 | */
|
5055 | peakWorkingSetSize: number;
|
5056 | /**
|
5057 | * The amount of memory not shared by other processes, such as JS heap or HTML
|
5058 | * content.
|
5059 | *
|
5060 | * @platform win32
|
5061 | */
|
5062 | privateBytes?: number;
|
5063 | /**
|
5064 | * The amount of memory currently pinned to actual physical RAM.
|
5065 | */
|
5066 | workingSetSize: number;
|
5067 | }
|
5068 |
|
5069 | interface MemoryUsageDetails {
|
5070 |
|
5071 | // Docs: http://electronjs.org/docs/api/structures/memory-usage-details
|
5072 |
|
5073 | count: number;
|
5074 | liveSize: number;
|
5075 | size: number;
|
5076 | }
|
5077 |
|
5078 | class Menu {
|
5079 |
|
5080 | // Docs: http://electronjs.org/docs/api/menu
|
5081 |
|
5082 | /**
|
5083 | * Emitted when a popup is closed either manually or with `menu.closePopup()`.
|
5084 | */
|
5085 | on(event: 'menu-will-close', listener: (event: Event) => void): this;
|
5086 | once(event: 'menu-will-close', listener: (event: Event) => void): this;
|
5087 | addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
|
5088 | removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
|
5089 | /**
|
5090 | * Emitted when `menu.popup()` is called.
|
5091 | */
|
5092 | on(event: 'menu-will-show', listener: (event: Event) => void): this;
|
5093 | once(event: 'menu-will-show', listener: (event: Event) => void): this;
|
5094 | addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
|
5095 | removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
|
5096 | /**
|
5097 | * Menu
|
5098 | */
|
5099 | constructor();
|
5100 | /**
|
5101 | * Generally, the `template` is an array of `options` for constructing a MenuItem.
|
5102 | * The usage can be referenced above.
|
5103 | *
|
5104 | * You can also attach other fields to the element of the `template` and they will
|
5105 | * become properties of the constructed menu items.
|
5106 | */
|
5107 | static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
|
5108 | /**
|
5109 | * The application menu, if set, or `null`, if not set.
|
5110 | *
|
5111 | * **Note:** The returned `Menu` instance doesn't support dynamic addition or
|
5112 | * removal of menu items. Instance properties can still be dynamically modified.
|
5113 | */
|
5114 | static getApplicationMenu(): (Menu) | (null);
|
5115 | /**
|
5116 | * Sends the `action` to the first responder of application. This is used for
|
5117 | * emulating default macOS menu behaviors. Usually you would use the `role`
|
5118 | * property of a `MenuItem`.
|
5119 | *
|
5120 | * See the macOS Cocoa Event Handling Guide for more information on macOS' native
|
5121 | * actions.
|
5122 | *
|
5123 | * @platform darwin
|
5124 | */
|
5125 | static sendActionToFirstResponder(action: string): void;
|
5126 | /**
|
5127 | * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
|
5128 | * will be set as each window's top menu.
|
5129 | *
|
5130 | * Also on Windows and Linux, you can use a `&` in the top-level item name to
|
5131 | * indicate which letter should get a generated accelerator. For example, using
|
5132 | * `&File` for the file menu would result in a generated `Alt-F` accelerator that
|
5133 | * opens the associated menu. The indicated character in the button label gets an
|
5134 | * underline. The `&` character is not displayed on the button label.
|
5135 | *
|
5136 | * Passing `null` will suppress the default menu. On Windows and Linux, this has
|
5137 | * the additional effect of removing the menu bar from the window.
|
5138 | *
|
5139 | * **Note:** The default menu will be created automatically if the app does not set
|
5140 | * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
|
5141 | * `Help`.
|
5142 | */
|
5143 | static setApplicationMenu(menu: (Menu) | (null)): void;
|
5144 | /**
|
5145 | * Appends the `menuItem` to the menu.
|
5146 | */
|
5147 | append(menuItem: MenuItem): void;
|
5148 | /**
|
5149 | * Closes the context menu in the `browserWindow`.
|
5150 | */
|
5151 | closePopup(browserWindow?: BrowserWindow): void;
|
5152 | /**
|
5153 | * the item with the specified `id`
|
5154 | */
|
5155 | getMenuItemById(id: string): (MenuItem) | (null);
|
5156 | /**
|
5157 | * Inserts the `menuItem` to the `pos` position of the menu.
|
5158 | */
|
5159 | insert(pos: number, menuItem: MenuItem): void;
|
5160 | /**
|
5161 | * Pops up this menu as a context menu in the `BrowserWindow`.
|
5162 | */
|
5163 | popup(options?: PopupOptions): void;
|
5164 | items: MenuItem[];
|
5165 | }
|
5166 |
|
5167 | class MenuItem {
|
5168 |
|
5169 | // Docs: http://electronjs.org/docs/api/menu-item
|
5170 |
|
5171 | /**
|
5172 | * MenuItem
|
5173 | */
|
5174 | constructor(options: MenuItemConstructorOptions);
|
5175 | accelerator?: Accelerator;
|
5176 | checked: boolean;
|
5177 | click: Function;
|
5178 | commandId: number;
|
5179 | enabled: boolean;
|
5180 | icon?: (NativeImage) | (string);
|
5181 | id: string;
|
5182 | label: string;
|
5183 | menu: Menu;
|
5184 | registerAccelerator: boolean;
|
5185 | 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');
|
5186 | sublabel: string;
|
5187 | submenu?: Menu;
|
5188 | toolTip: string;
|
5189 | type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
|
5190 | visible: boolean;
|
5191 | }
|
5192 |
|
5193 | class MessageChannelMain extends NodeEventEmitter {
|
5194 |
|
5195 | // Docs: http://electronjs.org/docs/api/message-channel-main
|
5196 |
|
5197 | port1: MessagePortMain;
|
5198 | port2: MessagePortMain;
|
5199 | }
|
5200 |
|
5201 | class MessagePortMain extends NodeEventEmitter {
|
5202 |
|
5203 | // Docs: http://electronjs.org/docs/api/message-port-main
|
5204 |
|
5205 | /**
|
5206 | * Emitted when the remote end of a MessagePortMain object becomes disconnected.
|
5207 | */
|
5208 | on(event: 'close', listener: Function): this;
|
5209 | once(event: 'close', listener: Function): this;
|
5210 | addListener(event: 'close', listener: Function): this;
|
5211 | removeListener(event: 'close', listener: Function): this;
|
5212 | /**
|
5213 | * Emitted when a MessagePortMain object receives a message.
|
5214 | */
|
5215 | on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
|
5216 | once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
|
5217 | addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
|
5218 | removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
|
5219 | /**
|
5220 | * Disconnects the port, so it is no longer active.
|
5221 | */
|
5222 | close(): void;
|
5223 | /**
|
5224 | * Sends a message from the port, and optionally, transfers ownership of objects to
|
5225 | * other browsing contexts.
|
5226 | */
|
5227 | postMessage(message: any, transfer?: MessagePortMain[]): void;
|
5228 | /**
|
5229 | * Starts the sending of messages queued on the port. Messages will be queued until
|
5230 | * this method is called.
|
5231 | */
|
5232 | start(): void;
|
5233 | }
|
5234 |
|
5235 | interface MimeTypedBuffer {
|
5236 |
|
5237 | // Docs: http://electronjs.org/docs/api/structures/mime-typed-buffer
|
5238 |
|
5239 | /**
|
5240 | * Charset of the buffer.
|
5241 | */
|
5242 | charset?: string;
|
5243 | /**
|
5244 | * The actual Buffer content.
|
5245 | */
|
5246 | data: Buffer;
|
5247 | /**
|
5248 | * MIME type of the buffer.
|
5249 | */
|
5250 | mimeType?: string;
|
5251 | }
|
5252 |
|
5253 | interface MouseInputEvent extends InputEvent {
|
5254 |
|
5255 | // Docs: http://electronjs.org/docs/api/structures/mouse-input-event
|
5256 |
|
5257 | /**
|
5258 | * The button pressed, can be `left`, `middle`, `right`.
|
5259 | */
|
5260 | button?: ('left' | 'middle' | 'right');
|
5261 | clickCount?: number;
|
5262 | globalX?: number;
|
5263 | globalY?: number;
|
5264 | movementX?: number;
|
5265 | movementY?: number;
|
5266 | /**
|
5267 | * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
|
5268 | * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
|
5269 | */
|
5270 | type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
|
5271 | x: number;
|
5272 | y: number;
|
5273 | }
|
5274 |
|
5275 | interface MouseWheelInputEvent extends MouseInputEvent {
|
5276 |
|
5277 | // Docs: http://electronjs.org/docs/api/structures/mouse-wheel-input-event
|
5278 |
|
5279 | accelerationRatioX?: number;
|
5280 | accelerationRatioY?: number;
|
5281 | canScroll?: boolean;
|
5282 | deltaX?: number;
|
5283 | deltaY?: number;
|
5284 | hasPreciseScrollingDeltas?: boolean;
|
5285 | /**
|
5286 | * The type of the event, can be `mouseWheel`.
|
5287 | */
|
5288 | type: ('mouseWheel');
|
5289 | wheelTicksX?: number;
|
5290 | wheelTicksY?: number;
|
5291 | }
|
5292 |
|
5293 | class NativeImage {
|
5294 |
|
5295 | // Docs: http://electronjs.org/docs/api/native-image
|
5296 |
|
5297 | /**
|
5298 | * Creates an empty `NativeImage` instance.
|
5299 | */
|
5300 | static createEmpty(): NativeImage;
|
5301 | /**
|
5302 | * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
|
5303 | * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
|
5304 | */
|
5305 | static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
|
5306 | /**
|
5307 | * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
|
5308 | * JPEG first.
|
5309 | */
|
5310 | static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
|
5311 | /**
|
5312 | * Creates a new `NativeImage` instance from `dataURL`.
|
5313 | */
|
5314 | static createFromDataURL(dataURL: string): NativeImage;
|
5315 | /**
|
5316 | * Creates a new `NativeImage` instance from the NSImage that maps to the given
|
5317 | * image name. See `System Icons` for a list of possible values.
|
5318 | *
|
5319 | * The `hslShift` is applied to the image with the following rules:
|
5320 | *
|
5321 | * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
|
5322 | * and 360 on the hue color wheel (red).
|
5323 | * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
|
5324 | * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
|
5325 | * saturate the image.
|
5326 | * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
|
5327 | * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
|
5328 | * leave unchanged. 1 = full lightness (make all pixels white).
|
5329 | *
|
5330 | * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
|
5331 | * 0]` will make the image completely black.
|
5332 | *
|
5333 | * In some cases, the `NSImageName` doesn't match its string representation; one
|
5334 | * example of this is `NSFolderImageName`, whose string representation would
|
5335 | * actually be `NSFolder`. Therefore, you'll need to determine the correct string
|
5336 | * representation for your image before passing it in. This can be done with the
|
5337 | * following:
|
5338 | *
|
5339 | * `echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME);
|
5340 | * }' | clang -otest -x objective-c -framework Cocoa - && ./test`
|
5341 | *
|
5342 | where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
|
5343 | *
|
5344 | * @platform darwin
|
5345 | */
|
5346 | static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
|
5347 | /**
|
5348 | * Creates a new `NativeImage` instance from a file located at `path`. This method
|
5349 | * returns an empty image if the `path` does not exist, cannot be read, or is not a
|
5350 | * valid image.
|
5351 | */
|
5352 | static createFromPath(path: string): NativeImage;
|
5353 | /**
|
5354 | * Add an image representation for a specific scale factor. This can be used to
|
5355 | * explicitly add different scale factor representations to an image. This can be
|
5356 | * called on empty images.
|
5357 | */
|
5358 | addRepresentation(options: AddRepresentationOptions): void;
|
5359 | /**
|
5360 | * The cropped image.
|
5361 | */
|
5362 | crop(rect: Rectangle): NativeImage;
|
5363 | /**
|
5364 | * The image's aspect ratio.
|
5365 | *
|
5366 | * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
|
5367 | * the image representation most closely matching the passed value.
|
5368 | */
|
5369 | getAspectRatio(scaleFactor?: number): number;
|
5370 | /**
|
5371 | * A Buffer that contains the image's raw bitmap pixel data.
|
5372 | *
|
5373 | * The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does
|
5374 | * not copy the bitmap data, so you have to use the returned Buffer immediately in
|
5375 | * current event loop tick; otherwise the data might be changed or destroyed.
|
5376 | */
|
5377 | getBitmap(options?: BitmapOptions): Buffer;
|
5378 | /**
|
5379 | * A Buffer that stores C pointer to underlying native handle of the image. On
|
5380 | * macOS, a pointer to `NSImage` instance would be returned.
|
5381 | *
|
5382 | * Notice that the returned pointer is a weak pointer to the underlying native
|
5383 | * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
|
5384 | * instance is kept around.
|
5385 | *
|
5386 | * @platform darwin
|
5387 | */
|
5388 | getNativeHandle(): Buffer;
|
5389 | /**
|
5390 | * An array of all scale factors corresponding to representations for a given
|
5391 | * nativeImage.
|
5392 | */
|
5393 | getScaleFactors(): number[];
|
5394 | /**
|
5395 | * If `scaleFactor` is passed, this will return the size corresponding to the image
|
5396 | * representation most closely matching the passed value.
|
5397 | */
|
5398 | getSize(scaleFactor?: number): Size;
|
5399 | /**
|
5400 | * Whether the image is empty.
|
5401 | */
|
5402 | isEmpty(): boolean;
|
5403 | /**
|
5404 | * Whether the image is a template image.
|
5405 | */
|
5406 | isTemplateImage(): boolean;
|
5407 | /**
|
5408 | * The resized image.
|
5409 | *
|
5410 | * If only the `height` or the `width` are specified then the current aspect ratio
|
5411 | * will be preserved in the resized image.
|
5412 | */
|
5413 | resize(options: ResizeOptions): NativeImage;
|
5414 | /**
|
5415 | * Marks the image as a template image.
|
5416 | */
|
5417 | setTemplateImage(option: boolean): void;
|
5418 | /**
|
5419 | * A Buffer that contains a copy of the image's raw bitmap pixel data.
|
5420 | */
|
5421 | toBitmap(options?: ToBitmapOptions): Buffer;
|
5422 | /**
|
5423 | * The data URL of the image.
|
5424 | */
|
5425 | toDataURL(options?: ToDataURLOptions): string;
|
5426 | /**
|
5427 | * A Buffer that contains the image's `JPEG` encoded data.
|
5428 | */
|
5429 | toJPEG(quality: number): Buffer;
|
5430 | /**
|
5431 | * A Buffer that contains the image's `PNG` encoded data.
|
5432 | */
|
5433 | toPNG(options?: ToPNGOptions): Buffer;
|
5434 | isMacTemplateImage: boolean;
|
5435 | }
|
5436 |
|
5437 | interface NativeTheme extends NodeJS.EventEmitter {
|
5438 |
|
5439 | // Docs: http://electronjs.org/docs/api/native-theme
|
5440 |
|
5441 | /**
|
5442 | * Emitted when something in the underlying NativeTheme has changed. This normally
|
5443 | * means that either the value of `shouldUseDarkColors`,
|
5444 | * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
|
5445 | * will have to check them to determine which one has changed.
|
5446 | */
|
5447 | on(event: 'updated', listener: Function): this;
|
5448 | once(event: 'updated', listener: Function): this;
|
5449 | addListener(event: 'updated', listener: Function): this;
|
5450 | removeListener(event: 'updated', listener: Function): this;
|
5451 | /**
|
5452 | * A `Boolean` for if the OS / Chromium currently has a dark mode enabled or is
|
5453 | * being instructed to show a dark-style UI. If you want to modify this value you
|
5454 | * should use `themeSource` below.
|
5455 | *
|
5456 | */
|
5457 | readonly shouldUseDarkColors: boolean;
|
5458 | /**
|
5459 | * A `Boolean` for if the OS / Chromium currently has high-contrast mode enabled or
|
5460 | * is being instructed to show a high-constrast UI.
|
5461 | *
|
5462 | * @platform darwin,win32
|
5463 | */
|
5464 | readonly shouldUseHighContrastColors: boolean;
|
5465 | /**
|
5466 | * A `Boolean` for if the OS / Chromium currently has an inverted color scheme or
|
5467 | * is being instructed to use an inverted color scheme.
|
5468 | *
|
5469 | * @platform darwin,win32
|
5470 | */
|
5471 | readonly shouldUseInvertedColorScheme: boolean;
|
5472 | /**
|
5473 | * A `String` property that can be `system`, `light` or `dark`. It is used to
|
5474 | * override and supersede the value that Chromium has chosen to use internally.
|
5475 | *
|
5476 | * Setting this property to `system` will remove the override and everything will
|
5477 | * be reset to the OS default. By default `themeSource` is `system`.
|
5478 | *
|
5479 | * Settings this property to `dark` will have the following effects:
|
5480 | *
|
5481 | * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
|
5482 | * * Any UI Electron renders on Linux and Windows including context menus,
|
5483 | * devtools, etc. will use the dark UI.
|
5484 | * * Any UI the OS renders on macOS including menus, window frames, etc. will use
|
5485 | * the dark UI.
|
5486 | * * The `prefers-color-scheme` CSS query will match `dark` mode.
|
5487 | * * The `updated` event will be emitted
|
5488 | *
|
5489 | * Settings this property to `light` will have the following effects:
|
5490 | *
|
5491 | * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
|
5492 | * * Any UI Electron renders on Linux and Windows including context menus,
|
5493 | * devtools, etc. will use the light UI.
|
5494 | * * Any UI the OS renders on macOS including menus, window frames, etc. will use
|
5495 | * the light UI.
|
5496 | * * The `prefers-color-scheme` CSS query will match `light` mode.
|
5497 | * * The `updated` event will be emitted
|
5498 | *
|
5499 | * The usage of this property should align with a classic "dark mode" state machine
|
5500 | * in your application where the user has three options.
|
5501 | *
|
5502 | * * `Follow OS` --> `themeSource = 'system'`
|
5503 | * * `Dark Mode` --> `themeSource = 'dark'`
|
5504 | * * `Light Mode` --> `themeSource = 'light'`
|
5505 | *
|
5506 | * Your application should then always use `shouldUseDarkColors` to determine what
|
5507 | * CSS to apply.
|
5508 | */
|
5509 | themeSource: ('system' | 'light' | 'dark');
|
5510 | }
|
5511 |
|
5512 | interface Net {
|
5513 |
|
5514 | // Docs: http://electronjs.org/docs/api/net
|
5515 |
|
5516 | /**
|
5517 | * Creates a `ClientRequest` instance using the provided `options` which are
|
5518 | * directly forwarded to the `ClientRequest` constructor. The `net.request` method
|
5519 | * would be used to issue both secure and insecure HTTP requests according to the
|
5520 | * specified protocol scheme in the `options` object.
|
5521 | */
|
5522 | request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
|
5523 | }
|
5524 |
|
5525 | interface NetLog {
|
5526 |
|
5527 | // Docs: http://electronjs.org/docs/api/net-log
|
5528 |
|
5529 | /**
|
5530 | * resolves when the net log has begun recording.
|
5531 | *
|
5532 | Starts recording network events to `path`.
|
5533 | */
|
5534 | startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
|
5535 | /**
|
5536 | * resolves when the net log has been flushed to disk.
|
5537 | *
|
5538 | * Stops recording network events. If not called, net logging will automatically
|
5539 | * end when app quits.
|
5540 | */
|
5541 | stopLogging(): Promise<void>;
|
5542 | /**
|
5543 | * A `Boolean` property that indicates whether network logs are currently being
|
5544 | * recorded.
|
5545 | *
|
5546 | */
|
5547 | readonly currentlyLogging: boolean;
|
5548 | }
|
5549 |
|
5550 | interface NewWindowWebContentsEvent extends Event {
|
5551 |
|
5552 | // Docs: http://electronjs.org/docs/api/structures/new-window-web-contents-event
|
5553 |
|
5554 | newGuest?: BrowserWindow;
|
5555 | }
|
5556 |
|
5557 | class Notification extends NodeEventEmitter {
|
5558 |
|
5559 | // Docs: http://electronjs.org/docs/api/notification
|
5560 |
|
5561 | on(event: 'action', listener: (event: Event,
|
5562 | /**
|
5563 | * The index of the action that was activated.
|
5564 | */
|
5565 | index: number) => void): this;
|
5566 | once(event: 'action', listener: (event: Event,
|
5567 | /**
|
5568 | * The index of the action that was activated.
|
5569 | */
|
5570 | index: number) => void): this;
|
5571 | addListener(event: 'action', listener: (event: Event,
|
5572 | /**
|
5573 | * The index of the action that was activated.
|
5574 | */
|
5575 | index: number) => void): this;
|
5576 | removeListener(event: 'action', listener: (event: Event,
|
5577 | /**
|
5578 | * The index of the action that was activated.
|
5579 | */
|
5580 | index: number) => void): this;
|
5581 | /**
|
5582 | * Emitted when the notification is clicked by the user.
|
5583 | */
|
5584 | on(event: 'click', listener: (event: Event) => void): this;
|
5585 | once(event: 'click', listener: (event: Event) => void): this;
|
5586 | addListener(event: 'click', listener: (event: Event) => void): this;
|
5587 | removeListener(event: 'click', listener: (event: Event) => void): this;
|
5588 | /**
|
5589 | * Emitted when the notification is closed by manual intervention from the user.
|
5590 | *
|
5591 | * This event is not guaranteed to be emitted in all cases where the notification
|
5592 | * is closed.
|
5593 | */
|
5594 | on(event: 'close', listener: (event: Event) => void): this;
|
5595 | once(event: 'close', listener: (event: Event) => void): this;
|
5596 | addListener(event: 'close', listener: (event: Event) => void): this;
|
5597 | removeListener(event: 'close', listener: (event: Event) => void): this;
|
5598 | /**
|
5599 | * Emitted when the user clicks the "Reply" button on a notification with
|
5600 | * `hasReply: true`.
|
5601 | *
|
5602 | * @platform darwin
|
5603 | */
|
5604 | on(event: 'reply', listener: (event: Event,
|
5605 | /**
|
5606 | * The string the user entered into the inline reply field.
|
5607 | */
|
5608 | reply: string) => void): this;
|
5609 | once(event: 'reply', listener: (event: Event,
|
5610 | /**
|
5611 | * The string the user entered into the inline reply field.
|
5612 | */
|
5613 | reply: string) => void): this;
|
5614 | addListener(event: 'reply', listener: (event: Event,
|
5615 | /**
|
5616 | * The string the user entered into the inline reply field.
|
5617 | */
|
5618 | reply: string) => void): this;
|
5619 | removeListener(event: 'reply', listener: (event: Event,
|
5620 | /**
|
5621 | * The string the user entered into the inline reply field.
|
5622 | */
|
5623 | reply: string) => void): this;
|
5624 | /**
|
5625 | * Emitted when the notification is shown to the user, note this could be fired
|
5626 | * multiple times as a notification can be shown multiple times through the
|
5627 | * `show()` method.
|
5628 | */
|
5629 | on(event: 'show', listener: (event: Event) => void): this;
|
5630 | once(event: 'show', listener: (event: Event) => void): this;
|
5631 | addListener(event: 'show', listener: (event: Event) => void): this;
|
5632 | removeListener(event: 'show', listener: (event: Event) => void): this;
|
5633 | /**
|
5634 | * Notification
|
5635 | */
|
5636 | constructor(options?: NotificationConstructorOptions);
|
5637 | /**
|
5638 | * Whether or not desktop notifications are supported on the current system
|
5639 | */
|
5640 | static isSupported(): boolean;
|
5641 | /**
|
5642 | * Dismisses the notification.
|
5643 | */
|
5644 | close(): void;
|
5645 | /**
|
5646 | * Immediately shows the notification to the user, please note this means unlike
|
5647 | * the HTML5 Notification implementation, instantiating a `new Notification` does
|
5648 | * not immediately show it to the user, you need to call this method before the OS
|
5649 | * will display it.
|
5650 | *
|
5651 | * If the notification has been shown before, this method will dismiss the
|
5652 | * previously shown notification and create a new one with identical properties.
|
5653 | */
|
5654 | show(): void;
|
5655 | actions: NotificationAction[];
|
5656 | body: string;
|
5657 | closeButtonText: string;
|
5658 | hasReply: boolean;
|
5659 | replyPlaceholder: string;
|
5660 | silent: boolean;
|
5661 | sound: string;
|
5662 | subtitle: string;
|
5663 | timeoutType: ('default' | 'never');
|
5664 | title: string;
|
5665 | urgency: ('normal' | 'critical' | 'low');
|
5666 | }
|
5667 |
|
5668 | interface NotificationAction {
|
5669 |
|
5670 | // Docs: http://electronjs.org/docs/api/structures/notification-action
|
5671 |
|
5672 | /**
|
5673 | * The label for the given action.
|
5674 | */
|
5675 | text?: string;
|
5676 | /**
|
5677 | * The type of action, can be `button`.
|
5678 | */
|
5679 | type: ('button');
|
5680 | }
|
5681 |
|
5682 | interface Point {
|
5683 |
|
5684 | // Docs: http://electronjs.org/docs/api/structures/point
|
5685 |
|
5686 | x: number;
|
5687 | y: number;
|
5688 | }
|
5689 |
|
5690 | interface PostBody {
|
5691 |
|
5692 | // Docs: http://electronjs.org/docs/api/structures/post-body
|
5693 |
|
5694 | /**
|
5695 | * The boundary used to separate multiple parts of the message. Only valid when
|
5696 | * `contentType` is `multipart/form-data`.
|
5697 | */
|
5698 | boundary?: string;
|
5699 | /**
|
5700 | * The `content-type` header used for the data. One of
|
5701 | * `application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to the
|
5702 | * `enctype` attribute of the submitted HTML form.
|
5703 | */
|
5704 | contentType: string;
|
5705 | /**
|
5706 | * The post data to be sent to the new window.
|
5707 | */
|
5708 | data: Array<PostData>;
|
5709 | }
|
5710 |
|
5711 | interface PostData {
|
5712 |
|
5713 | // Docs: http://electronjs.org/docs/api/structures/post-data
|
5714 |
|
5715 | /**
|
5716 | * The `UUID` of the `Blob` being uploaded. Required for the `blob` type.
|
5717 | */
|
5718 | blobUUID?: string;
|
5719 | /**
|
5720 | * The raw bytes of the post data in a `Buffer`. Required for the `rawData` type.
|
5721 | */
|
5722 | bytes?: string;
|
5723 | /**
|
5724 | * The path of the file being uploaded. Required for the `file` type.
|
5725 | */
|
5726 | filePath?: string;
|
5727 | /**
|
5728 | * The length of the file being uploaded, in bytes. If set to `-1`, the whole file
|
5729 | * will be uploaded. Only valid for `file` types.
|
5730 | */
|
5731 | length?: number;
|
5732 | /**
|
5733 | * The modification time of the file represented by a double, which is the number
|
5734 | * of seconds since the `UNIX Epoch` (Jan 1, 1970). Only valid for `file` types.
|
5735 | */
|
5736 | modificationTime?: number;
|
5737 | /**
|
5738 | * The offset from the beginning of the file being uploaded, in bytes. Only valid
|
5739 | * for `file` types.
|
5740 | */
|
5741 | offset?: number;
|
5742 | /**
|
5743 | * One of the following:
|
5744 | */
|
5745 | type: ('rawData' | 'file' | 'blob');
|
5746 | }
|
5747 |
|
5748 | interface PowerMonitor extends NodeJS.EventEmitter {
|
5749 |
|
5750 | // Docs: http://electronjs.org/docs/api/power-monitor
|
5751 |
|
5752 | /**
|
5753 | * Emitted when the system is about to lock the screen.
|
5754 | *
|
5755 | * @platform darwin,win32
|
5756 | */
|
5757 | on(event: 'lock-screen', listener: Function): this;
|
5758 | once(event: 'lock-screen', listener: Function): this;
|
5759 | addListener(event: 'lock-screen', listener: Function): this;
|
5760 | removeListener(event: 'lock-screen', listener: Function): this;
|
5761 | /**
|
5762 | * Emitted when the system changes to AC power.
|
5763 | *
|
5764 | * @platform win32
|
5765 | */
|
5766 | on(event: 'on-ac', listener: Function): this;
|
5767 | once(event: 'on-ac', listener: Function): this;
|
5768 | addListener(event: 'on-ac', listener: Function): this;
|
5769 | removeListener(event: 'on-ac', listener: Function): this;
|
5770 | /**
|
5771 | * Emitted when system changes to battery power.
|
5772 | *
|
5773 | * @platform win32
|
5774 | */
|
5775 | on(event: 'on-battery', listener: Function): this;
|
5776 | once(event: 'on-battery', listener: Function): this;
|
5777 | addListener(event: 'on-battery', listener: Function): this;
|
5778 | removeListener(event: 'on-battery', listener: Function): this;
|
5779 | /**
|
5780 | * Emitted when system is resuming.
|
5781 | */
|
5782 | on(event: 'resume', listener: Function): this;
|
5783 | once(event: 'resume', listener: Function): this;
|
5784 | addListener(event: 'resume', listener: Function): this;
|
5785 | removeListener(event: 'resume', listener: Function): this;
|
5786 | /**
|
5787 | * Emitted when the system is about to reboot or shut down. If the event handler
|
5788 | * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
|
5789 | * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
|
5790 | * should exit as soon as possible by calling something like `app.quit()`.
|
5791 | *
|
5792 | * @platform linux,darwin
|
5793 | */
|
5794 | on(event: 'shutdown', listener: Function): this;
|
5795 | once(event: 'shutdown', listener: Function): this;
|
5796 | addListener(event: 'shutdown', listener: Function): this;
|
5797 | removeListener(event: 'shutdown', listener: Function): this;
|
5798 | /**
|
5799 | * Emitted when the system is suspending.
|
5800 | */
|
5801 | on(event: 'suspend', listener: Function): this;
|
5802 | once(event: 'suspend', listener: Function): this;
|
5803 | addListener(event: 'suspend', listener: Function): this;
|
5804 | removeListener(event: 'suspend', listener: Function): this;
|
5805 | /**
|
5806 | * Emitted as soon as the systems screen is unlocked.
|
5807 | *
|
5808 | * @platform darwin,win32
|
5809 | */
|
5810 | on(event: 'unlock-screen', listener: Function): this;
|
5811 | once(event: 'unlock-screen', listener: Function): this;
|
5812 | addListener(event: 'unlock-screen', listener: Function): this;
|
5813 | removeListener(event: 'unlock-screen', listener: Function): this;
|
5814 | /**
|
5815 | * The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
|
5816 | *
|
5817 | * Calculate the system idle state. `idleThreshold` is the amount of time (in
|
5818 | * seconds) before considered idle. `locked` is available on supported systems
|
5819 | * only.
|
5820 | */
|
5821 | getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
|
5822 | /**
|
5823 | * Idle time in seconds
|
5824 |
|
5825 | Calculate system idle time in seconds.
|
5826 | */
|
5827 | getSystemIdleTime(): number;
|
5828 | }
|
5829 |
|
5830 | interface PowerSaveBlocker {
|
5831 |
|
5832 | // Docs: http://electronjs.org/docs/api/power-save-blocker
|
5833 |
|
5834 | /**
|
5835 | * Whether the corresponding `powerSaveBlocker` has started.
|
5836 | */
|
5837 | isStarted(id: number): boolean;
|
5838 | /**
|
5839 | * The blocker ID that is assigned to this power blocker.
|
5840 | *
|
5841 | * Starts preventing the system from entering lower-power mode. Returns an integer
|
5842 | * identifying the power save blocker.
|
5843 | *
|
5844 | * **Note:** `prevent-display-sleep` has higher precedence over
|
5845 | * `prevent-app-suspension`. Only the highest precedence type takes effect. In
|
5846 | * other words, `prevent-display-sleep` always takes precedence over
|
5847 | * `prevent-app-suspension`.
|
5848 | *
|
5849 | * For example, an API calling A requests for `prevent-app-suspension`, and another
|
5850 | * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
|
5851 | * used until B stops its request. After that, `prevent-app-suspension` is used.
|
5852 | */
|
5853 | start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
|
5854 | /**
|
5855 | * Stops the specified power save blocker.
|
5856 | */
|
5857 | stop(id: number): void;
|
5858 | }
|
5859 |
|
5860 | interface PrinterInfo {
|
5861 |
|
5862 | // Docs: http://electronjs.org/docs/api/structures/printer-info
|
5863 |
|
5864 | /**
|
5865 | * a longer description of the printer's type.
|
5866 | */
|
5867 | description: string;
|
5868 | /**
|
5869 | * the name of the printer as shown in Print Preview.
|
5870 | */
|
5871 | displayName: string;
|
5872 | /**
|
5873 | * whether or not a given printer is set as the default printer on the OS.
|
5874 | */
|
5875 | isDefault: boolean;
|
5876 | /**
|
5877 | * the name of the printer as understood by the OS.
|
5878 | */
|
5879 | name: string;
|
5880 | /**
|
5881 | * an object containing a variable number of platform-specific printer information.
|
5882 | */
|
5883 | options: Options;
|
5884 | /**
|
5885 | * the current status of the printer.
|
5886 | */
|
5887 | status: number;
|
5888 | }
|
5889 |
|
5890 | interface ProcessMemoryInfo {
|
5891 |
|
5892 | // Docs: http://electronjs.org/docs/api/structures/process-memory-info
|
5893 |
|
5894 | /**
|
5895 | * The amount of memory not shared by other processes, such as JS heap or HTML
|
5896 | * content in Kilobytes.
|
5897 | */
|
5898 | private: number;
|
5899 | /**
|
5900 | * The amount of memory currently pinned to actual physical RAM in Kilobytes.
|
5901 | *
|
5902 | * @platform linux,win32
|
5903 | */
|
5904 | residentSet: number;
|
5905 | /**
|
5906 | * The amount of memory shared between processes, typically memory consumed by the
|
5907 | * Electron code itself in Kilobytes.
|
5908 | */
|
5909 | shared: number;
|
5910 | }
|
5911 |
|
5912 | interface ProcessMetric {
|
5913 |
|
5914 | // Docs: http://electronjs.org/docs/api/structures/process-metric
|
5915 |
|
5916 | /**
|
5917 | * CPU usage of the process.
|
5918 | */
|
5919 | cpu: CPUUsage;
|
5920 | /**
|
5921 | * Creation time for this process. The time is represented as number of
|
5922 | * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
|
5923 | * is useful to use both the `pid` and the `creationTime` to uniquely identify a
|
5924 | * process.
|
5925 | */
|
5926 | creationTime: number;
|
5927 | /**
|
5928 | * One of the following values:
|
5929 | *
|
5930 | * @platform win32
|
5931 | */
|
5932 | integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
|
5933 | /**
|
5934 | * Memory information for the process.
|
5935 | */
|
5936 | memory: MemoryInfo;
|
5937 | /**
|
5938 | * The name of the process. i.e. for plugins it might be Flash. Examples for
|
5939 | * utility: `Audio Service`, `Content Decryption Module Service`, `Network
|
5940 | * Service`, `Video Capture`, etc.
|
5941 | */
|
5942 | name?: string;
|
5943 | /**
|
5944 | * Process id of the process.
|
5945 | */
|
5946 | pid: number;
|
5947 | /**
|
5948 | * Whether the process is sandboxed on OS level.
|
5949 | *
|
5950 | * @platform darwin,win32
|
5951 | */
|
5952 | sandboxed?: boolean;
|
5953 | /**
|
5954 | * Process type. One of the following values:
|
5955 | */
|
5956 | type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
|
5957 | }
|
5958 |
|
5959 | interface Product {
|
5960 |
|
5961 | // Docs: http://electronjs.org/docs/api/structures/product
|
5962 |
|
5963 | /**
|
5964 | * The total size of the content, in bytes.
|
5965 | */
|
5966 | contentLengths: number[];
|
5967 | /**
|
5968 | * A string that identifies the version of the content.
|
5969 | */
|
5970 | contentVersion: string;
|
5971 | /**
|
5972 | * The locale formatted price of the product.
|
5973 | */
|
5974 | formattedPrice: string;
|
5975 | /**
|
5976 | * A Boolean value that indicates whether the App Store has downloadable content
|
5977 | * for this product. `true` if at least one file has been associated with the
|
5978 | * product.
|
5979 | */
|
5980 | isDownloadable: boolean;
|
5981 | /**
|
5982 | * A description of the product.
|
5983 | */
|
5984 | localizedDescription: string;
|
5985 | /**
|
5986 | * The name of the product.
|
5987 | */
|
5988 | localizedTitle: string;
|
5989 | /**
|
5990 | * The cost of the product in the local currency.
|
5991 | */
|
5992 | price: number;
|
5993 | /**
|
5994 | * The string that identifies the product to the Apple App Store.
|
5995 | */
|
5996 | productIdentifier: string;
|
5997 | }
|
5998 |
|
5999 | interface Protocol {
|
6000 |
|
6001 | // Docs: http://electronjs.org/docs/api/protocol
|
6002 |
|
6003 | /**
|
6004 | * Whether the protocol was successfully intercepted
|
6005 | *
|
6006 | * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
|
6007 | * which sends a `Buffer` as a response.
|
6008 | */
|
6009 | interceptBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
|
6010 | /**
|
6011 | * Whether the protocol was successfully intercepted
|
6012 | *
|
6013 | * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
|
6014 | * which sends a file as a response.
|
6015 | */
|
6016 | interceptFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
|
6017 | /**
|
6018 | * Whether the protocol was successfully intercepted
|
6019 | *
|
6020 | * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
|
6021 | * which sends a new HTTP request as a response.
|
6022 | */
|
6023 | interceptHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
|
6024 | /**
|
6025 | * Whether the protocol was successfully intercepted
|
6026 | *
|
6027 | * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
|
6028 | * protocol handler.
|
6029 | */
|
6030 | interceptStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
|
6031 | /**
|
6032 | * Whether the protocol was successfully intercepted
|
6033 | *
|
6034 | * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
|
6035 | * which sends a `String` as a response.
|
6036 | */
|
6037 | interceptStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
|
6038 | /**
|
6039 | * Whether `scheme` is already intercepted.
|
6040 | */
|
6041 | isProtocolIntercepted(scheme: string): boolean;
|
6042 | /**
|
6043 | * Whether `scheme` is already registered.
|
6044 | */
|
6045 | isProtocolRegistered(scheme: string): boolean;
|
6046 | /**
|
6047 | * Whether the protocol was successfully registered
|
6048 | *
|
6049 | * Registers a protocol of `scheme` that will send a `Buffer` as a response.
|
6050 | *
|
6051 | * The usage is the same with `registerFileProtocol`, except that the `callback`
|
6052 | * should be called with either a `Buffer` object or an object that has the `data`
|
6053 | * property.
|
6054 |
|
6055 | Example:
|
6056 | */
|
6057 | registerBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
|
6058 | /**
|
6059 | * Whether the protocol was successfully registered
|
6060 | *
|
6061 | * Registers a protocol of `scheme` that will send a file as the response. The
|
6062 | * `handler` will be called with `request` and `callback` where `request` is an
|
6063 | * incoming request for the `scheme`.
|
6064 | *
|
6065 | * To handle the `request`, the `callback` should be called with either the file's
|
6066 | * path or an object that has a `path` property, e.g. `callback(filePath)` or
|
6067 | * `callback({ path: filePath })`. The `filePath` must be an absolute path.
|
6068 | *
|
6069 | * By default the `scheme` is treated like `http:`, which is parsed differently
|
6070 | * from protocols that follow the "generic URI syntax" like `file:`.
|
6071 | */
|
6072 | registerFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
|
6073 | /**
|
6074 | * Whether the protocol was successfully registered
|
6075 | *
|
6076 | * Registers a protocol of `scheme` that will send an HTTP request as a response.
|
6077 | *
|
6078 | * The usage is the same with `registerFileProtocol`, except that the `callback`
|
6079 | * should be called with an object that has the `url` property.
|
6080 | */
|
6081 | registerHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
|
6082 | /**
|
6083 | * **Note:** This method can only be used before the `ready` event of the `app`
|
6084 | * module gets emitted and can be called only once.
|
6085 | *
|
6086 | * Registers the `scheme` as standard, secure, bypasses content security policy for
|
6087 | * resources, allows registering ServiceWorker, supports fetch API, and streaming
|
6088 | * video/audio. Specify a privilege with the value of `true` to enable the
|
6089 | * capability.
|
6090 | *
|
6091 | * An example of registering a privileged scheme, that bypasses Content Security
|
6092 | * Policy:
|
6093 | *
|
6094 | * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
|
6095 | * `http` and `https` are standard schemes, while `file` is not.
|
6096 | *
|
6097 | * Registering a scheme as standard allows relative and absolute resources to be
|
6098 | * resolved correctly when served. Otherwise the scheme will behave like the `file`
|
6099 | * protocol, but without the ability to resolve relative URLs.
|
6100 | *
|
6101 | * For example when you load following page with custom protocol without
|
6102 | * registering it as standard scheme, the image will not be loaded because
|
6103 | * non-standard schemes can not recognize relative URLs:
|
6104 | *
|
6105 | * Registering a scheme as standard will allow access to files through the
|
6106 | * FileSystem API. Otherwise the renderer will throw a security error for the
|
6107 | * scheme.
|
6108 | *
|
6109 | * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
|
6110 | * cookies) are disabled for non standard schemes. So in general if you want to
|
6111 | * register a custom protocol to replace the `http` protocol, you have to register
|
6112 | * it as a standard scheme.
|
6113 | *
|
6114 | * Protocols that use streams (http and stream protocols) should set `stream:
|
6115 | * true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
|
6116 | * their responses by default. The `stream` flag configures those elements to
|
6117 | * correctly expect streaming responses.
|
6118 | */
|
6119 | registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
|
6120 | /**
|
6121 | * Whether the protocol was successfully registered
|
6122 | *
|
6123 | * Registers a protocol of `scheme` that will send a stream as a response.
|
6124 | *
|
6125 | * The usage is the same with `registerFileProtocol`, except that the `callback`
|
6126 | * should be called with either a `ReadableStream` object or an object that has the
|
6127 | * `data` property.
|
6128 | *
|
6129 | * Example:
|
6130 | *
|
6131 | * It is possible to pass any object that implements the readable stream API (emits
|
6132 | * `data`/`end`/`error` events). For example, here's how a file could be returned:
|
6133 | */
|
6134 | registerStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
|
6135 | /**
|
6136 | * Whether the protocol was successfully registered
|
6137 | *
|
6138 | * Registers a protocol of `scheme` that will send a `String` as a response.
|
6139 | *
|
6140 | * The usage is the same with `registerFileProtocol`, except that the `callback`
|
6141 | * should be called with either a `String` or an object that has the `data`
|
6142 | * property.
|
6143 | */
|
6144 | registerStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
|
6145 | /**
|
6146 | * Whether the protocol was successfully unintercepted
|
6147 | *
|
6148 | Remove the interceptor installed for `scheme` and restore its original handler.
|
6149 | */
|
6150 | uninterceptProtocol(scheme: string): boolean;
|
6151 | /**
|
6152 | * Whether the protocol was successfully unregistered
|
6153 | *
|
6154 | Unregisters the custom protocol of `scheme`.
|
6155 | */
|
6156 | unregisterProtocol(scheme: string): boolean;
|
6157 | }
|
6158 |
|
6159 | interface ProtocolRequest {
|
6160 |
|
6161 | // Docs: http://electronjs.org/docs/api/structures/protocol-request
|
6162 |
|
6163 | headers: Record<string, string>;
|
6164 | method: string;
|
6165 | referrer: string;
|
6166 | uploadData?: UploadData[];
|
6167 | url: string;
|
6168 | }
|
6169 |
|
6170 | interface ProtocolResponse {
|
6171 |
|
6172 | // Docs: http://electronjs.org/docs/api/structures/protocol-response
|
6173 |
|
6174 | /**
|
6175 | * The charset of response body, default is `"utf-8"`.
|
6176 | */
|
6177 | charset?: string;
|
6178 | /**
|
6179 | * The response body. When returning stream as response, this is a Node.js readable
|
6180 | * stream representing the response body. When returning `Buffer` as response, this
|
6181 | * is a `Buffer`. When returning `String` as response, this is a `String`. This is
|
6182 | * ignored for other types of responses.
|
6183 | */
|
6184 | data?: (Buffer) | (string) | (NodeJS.ReadableStream);
|
6185 | /**
|
6186 | * When assigned, the `request` will fail with the `error` number . For the
|
6187 | * available error numbers you can use, please see the net error list.
|
6188 | */
|
6189 | error?: number;
|
6190 | /**
|
6191 | * An object containing the response headers. The keys must be String, and values
|
6192 | * must be either String or Array of String.
|
6193 | */
|
6194 | headers?: Record<string, (string) | (string[])>;
|
6195 | /**
|
6196 | * The HTTP `method`. This is only used for file and URL responses.
|
6197 | */
|
6198 | method?: string;
|
6199 | /**
|
6200 | * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
|
6201 | * would implicitly set the `content-type` header in response, but if
|
6202 | * `content-type` is already set in `headers`, the `mimeType` would be ignored.
|
6203 | */
|
6204 | mimeType?: string;
|
6205 | /**
|
6206 | * Path to the file which would be sent as response body. This is only used for
|
6207 | * file responses.
|
6208 | */
|
6209 | path?: string;
|
6210 | /**
|
6211 | * The `referrer` URL. This is only used for file and URL responses.
|
6212 | */
|
6213 | referrer?: string;
|
6214 | /**
|
6215 | * The session used for requesting URL, by default the HTTP request will reuse the
|
6216 | * current session. Setting `session` to `null` would use a random independent
|
6217 | * session. This is only used for URL responses.
|
6218 | */
|
6219 | session?: Session;
|
6220 | /**
|
6221 | * The HTTP response code, default is 200.
|
6222 | */
|
6223 | statusCode?: number;
|
6224 | /**
|
6225 | * The data used as upload data. This is only used for URL responses when `method`
|
6226 | * is `"POST"`.
|
6227 | */
|
6228 | uploadData?: ProtocolResponseUploadData;
|
6229 | /**
|
6230 | * Download the `url` and pipe the result as response body. This is only used for
|
6231 | * URL responses.
|
6232 | */
|
6233 | url?: string;
|
6234 | }
|
6235 |
|
6236 | interface ProtocolResponseUploadData {
|
6237 |
|
6238 | // Docs: http://electronjs.org/docs/api/structures/protocol-response-upload-data
|
6239 |
|
6240 | /**
|
6241 | * MIME type of the content.
|
6242 | */
|
6243 | contentType: string;
|
6244 | /**
|
6245 | * Content to be sent.
|
6246 | */
|
6247 | data: (string) | (Buffer);
|
6248 | }
|
6249 |
|
6250 | interface Rectangle {
|
6251 |
|
6252 | // Docs: http://electronjs.org/docs/api/structures/rectangle
|
6253 |
|
6254 | /**
|
6255 | * The height of the rectangle (must be an integer).
|
6256 | */
|
6257 | height: number;
|
6258 | /**
|
6259 | * The width of the rectangle (must be an integer).
|
6260 | */
|
6261 | width: number;
|
6262 | /**
|
6263 | * The x coordinate of the origin of the rectangle (must be an integer).
|
6264 | */
|
6265 | x: number;
|
6266 | /**
|
6267 | * The y coordinate of the origin of the rectangle (must be an integer).
|
6268 | */
|
6269 | y: number;
|
6270 | }
|
6271 |
|
6272 | interface Referrer {
|
6273 |
|
6274 | // Docs: http://electronjs.org/docs/api/structures/referrer
|
6275 |
|
6276 | /**
|
6277 | * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
|
6278 | * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
|
6279 | * See the Referrer-Policy spec for more details on the meaning of these values.
|
6280 | */
|
6281 | policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
|
6282 | /**
|
6283 | * HTTP Referrer URL.
|
6284 | */
|
6285 | url: string;
|
6286 | }
|
6287 |
|
6288 | interface Remote extends RemoteMainInterface {
|
6289 |
|
6290 | // Docs: http://electronjs.org/docs/api/remote
|
6291 |
|
6292 | /**
|
6293 | * The web contents of this web page.
|
6294 | */
|
6295 | getCurrentWebContents(): WebContents;
|
6296 | /**
|
6297 | * The window to which this web page belongs.
|
6298 | *
|
6299 | * **Note:** Do not use `removeAllListeners` on `BrowserWindow`. Use of this can
|
6300 | * remove all `blur` listeners, disable click events on touch bar buttons, and
|
6301 | * other unintended consequences.
|
6302 | */
|
6303 | getCurrentWindow(): BrowserWindow;
|
6304 | /**
|
6305 | * The global variable of `name` (e.g. `global[name]`) in the main process.
|
6306 | */
|
6307 | getGlobal(name: string): any;
|
6308 | /**
|
6309 | * The object returned by `require(module)` in the main process. Modules specified
|
6310 | * by their relative path will resolve relative to the entrypoint of the main
|
6311 | * process.
|
6312 |
|
6313 | e.g.
|
6314 | */
|
6315 | require(module: string): any;
|
6316 | /**
|
6317 | * A `NodeJS.Process` object. The `process` object in the main process. This is
|
6318 | * the same as `remote.getGlobal('process')` but is cached.
|
6319 | *
|
6320 | */
|
6321 | readonly process: NodeJS.Process;
|
6322 | }
|
6323 |
|
6324 | interface Screen extends NodeJS.EventEmitter {
|
6325 |
|
6326 | // Docs: http://electronjs.org/docs/api/screen
|
6327 |
|
6328 | /**
|
6329 | * Emitted when `newDisplay` has been added.
|
6330 | */
|
6331 | on(event: 'display-added', listener: (event: Event,
|
6332 | newDisplay: Display) => void): this;
|
6333 | once(event: 'display-added', listener: (event: Event,
|
6334 | newDisplay: Display) => void): this;
|
6335 | addListener(event: 'display-added', listener: (event: Event,
|
6336 | newDisplay: Display) => void): this;
|
6337 | removeListener(event: 'display-added', listener: (event: Event,
|
6338 | newDisplay: Display) => void): this;
|
6339 | /**
|
6340 | * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
|
6341 | * an array of strings that describe the changes. Possible changes are `bounds`,
|
6342 | * `workArea`, `scaleFactor` and `rotation`.
|
6343 | */
|
6344 | on(event: 'display-metrics-changed', listener: (event: Event,
|
6345 | display: Display,
|
6346 | changedMetrics: string[]) => void): this;
|
6347 | once(event: 'display-metrics-changed', listener: (event: Event,
|
6348 | display: Display,
|
6349 | changedMetrics: string[]) => void): this;
|
6350 | addListener(event: 'display-metrics-changed', listener: (event: Event,
|
6351 | display: Display,
|
6352 | changedMetrics: string[]) => void): this;
|
6353 | removeListener(event: 'display-metrics-changed', listener: (event: Event,
|
6354 | display: Display,
|
6355 | changedMetrics: string[]) => void): this;
|
6356 | /**
|
6357 | * Emitted when `oldDisplay` has been removed.
|
6358 | */
|
6359 | on(event: 'display-removed', listener: (event: Event,
|
6360 | oldDisplay: Display) => void): this;
|
6361 | once(event: 'display-removed', listener: (event: Event,
|
6362 | oldDisplay: Display) => void): this;
|
6363 | addListener(event: 'display-removed', listener: (event: Event,
|
6364 | oldDisplay: Display) => void): this;
|
6365 | removeListener(event: 'display-removed', listener: (event: Event,
|
6366 | oldDisplay: Display) => void): this;
|
6367 | /**
|
6368 | * Converts a screen DIP point to a screen physical point. The DPI scale is
|
6369 | * performed relative to the display containing the DIP point.
|
6370 | *
|
6371 | * @platform win32
|
6372 | */
|
6373 | dipToScreenPoint(point: Point): Point;
|
6374 | /**
|
6375 | * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
|
6376 | * relative to the display nearest to `window`. If `window` is null, scaling will
|
6377 | * be performed to the display nearest to `rect`.
|
6378 | *
|
6379 | * @platform win32
|
6380 | */
|
6381 | dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
|
6382 | /**
|
6383 | * An array of displays that are currently available.
|
6384 | */
|
6385 | getAllDisplays(): Display[];
|
6386 | /**
|
6387 | * The current absolute position of the mouse pointer.
|
6388 | */
|
6389 | getCursorScreenPoint(): Point;
|
6390 | /**
|
6391 | * The display that most closely intersects the provided bounds.
|
6392 | */
|
6393 | getDisplayMatching(rect: Rectangle): Display;
|
6394 | /**
|
6395 | * The display nearest the specified point.
|
6396 | */
|
6397 | getDisplayNearestPoint(point: Point): Display;
|
6398 | /**
|
6399 | * The primary display.
|
6400 | */
|
6401 | getPrimaryDisplay(): Display;
|
6402 | /**
|
6403 | * Converts a screen physical point to a screen DIP point. The DPI scale is
|
6404 | * performed relative to the display containing the physical point.
|
6405 | *
|
6406 | * @platform win32
|
6407 | */
|
6408 | screenToDipPoint(point: Point): Point;
|
6409 | /**
|
6410 | * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
|
6411 | * relative to the display nearest to `window`. If `window` is null, scaling will
|
6412 | * be performed to the display nearest to `rect`.
|
6413 | *
|
6414 | * @platform win32
|
6415 | */
|
6416 | screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
|
6417 | }
|
6418 |
|
6419 | interface ScrubberItem {
|
6420 |
|
6421 | // Docs: http://electronjs.org/docs/api/structures/scrubber-item
|
6422 |
|
6423 | /**
|
6424 | * The image to appear in this item.
|
6425 | */
|
6426 | icon?: NativeImage;
|
6427 | /**
|
6428 | * The text to appear in this item.
|
6429 | */
|
6430 | label?: string;
|
6431 | }
|
6432 |
|
6433 | interface SegmentedControlSegment {
|
6434 |
|
6435 | // Docs: http://electronjs.org/docs/api/structures/segmented-control-segment
|
6436 |
|
6437 | /**
|
6438 | * Whether this segment is selectable. Default: true.
|
6439 | */
|
6440 | enabled?: boolean;
|
6441 | /**
|
6442 | * The image to appear in this segment.
|
6443 | */
|
6444 | icon?: NativeImage;
|
6445 | /**
|
6446 | * The text to appear in this segment.
|
6447 | */
|
6448 | label?: string;
|
6449 | }
|
6450 |
|
6451 | interface ServiceWorkerInfo {
|
6452 |
|
6453 | // Docs: http://electronjs.org/docs/api/structures/service-worker-info
|
6454 |
|
6455 | /**
|
6456 | * The virtual ID of the process that this service worker is running in. This is
|
6457 | * not an OS level PID. This aligns with the ID set used for
|
6458 | * `webContents.getProcessId()`.
|
6459 | */
|
6460 | renderProcessId: number;
|
6461 | /**
|
6462 | * The base URL that this service worker is active for.
|
6463 | */
|
6464 | scope: string;
|
6465 | /**
|
6466 | * The full URL to the script that this service worker runs
|
6467 | */
|
6468 | scriptUrl: string;
|
6469 | }
|
6470 |
|
6471 | class ServiceWorkers extends NodeEventEmitter {
|
6472 |
|
6473 | // Docs: http://electronjs.org/docs/api/service-workers
|
6474 |
|
6475 | /**
|
6476 | * Emitted when a service worker logs something to the console.
|
6477 | */
|
6478 | on(event: 'console-message', listener: (event: Event,
|
6479 | /**
|
6480 | * Information about the console message
|
6481 | */
|
6482 | messageDetails: MessageDetails) => void): this;
|
6483 | once(event: 'console-message', listener: (event: Event,
|
6484 | /**
|
6485 | * Information about the console message
|
6486 | */
|
6487 | messageDetails: MessageDetails) => void): this;
|
6488 | addListener(event: 'console-message', listener: (event: Event,
|
6489 | /**
|
6490 | * Information about the console message
|
6491 | */
|
6492 | messageDetails: MessageDetails) => void): this;
|
6493 | removeListener(event: 'console-message', listener: (event: Event,
|
6494 | /**
|
6495 | * Information about the console message
|
6496 | */
|
6497 | messageDetails: MessageDetails) => void): this;
|
6498 | /**
|
6499 | * A ServiceWorkerInfo object where the keys are the service worker version ID and
|
6500 | * the values are the information about that service worker.
|
6501 | */
|
6502 | getAllRunning(): Record<number, ServiceWorkerInfo>;
|
6503 | /**
|
6504 | * Information about this service worker
|
6505 | *
|
6506 | * If the service worker does not exist or is not running this method will throw an
|
6507 | * exception.
|
6508 | */
|
6509 | getFromVersionID(versionId: number): ServiceWorkerInfo;
|
6510 | }
|
6511 |
|
6512 | class Session extends NodeEventEmitter {
|
6513 |
|
6514 | // Docs: http://electronjs.org/docs/api/session
|
6515 |
|
6516 | /**
|
6517 | * A session instance from `partition` string. When there is an existing `Session`
|
6518 | * with the same `partition`, it will be returned; otherwise a new `Session`
|
6519 | * instance will be created with `options`.
|
6520 | *
|
6521 | * If `partition` starts with `persist:`, the page will use a persistent session
|
6522 | * available to all pages in the app with the same `partition`. if there is no
|
6523 | * `persist:` prefix, the page will use an in-memory session. If the `partition` is
|
6524 | * empty then default session of the app will be returned.
|
6525 | *
|
6526 | * To create a `Session` with `options`, you have to ensure the `Session` with the
|
6527 | * `partition` has never been used before. There is no way to change the `options`
|
6528 | * of an existing `Session` object.
|
6529 | */
|
6530 | static fromPartition(partition: string, options?: FromPartitionOptions): Session;
|
6531 | /**
|
6532 | * A `Session` object, the default session object of the app.
|
6533 | */
|
6534 | static defaultSession: Session;
|
6535 | /**
|
6536 | * Emitted when a render process requests preconnection to a URL, generally due to
|
6537 | * a resource hint.
|
6538 | */
|
6539 | on(event: 'preconnect', listener: (event: Event,
|
6540 | /**
|
6541 | * The URL being requested for preconnection by the renderer.
|
6542 | */
|
6543 | preconnectUrl: string,
|
6544 | /**
|
6545 | * True if the renderer is requesting that the connection include credentials (see
|
6546 | * the spec for more details.)
|
6547 | */
|
6548 | allowCredentials: boolean) => void): this;
|
6549 | once(event: 'preconnect', listener: (event: Event,
|
6550 | /**
|
6551 | * The URL being requested for preconnection by the renderer.
|
6552 | */
|
6553 | preconnectUrl: string,
|
6554 | /**
|
6555 | * True if the renderer is requesting that the connection include credentials (see
|
6556 | * the spec for more details.)
|
6557 | */
|
6558 | allowCredentials: boolean) => void): this;
|
6559 | addListener(event: 'preconnect', listener: (event: Event,
|
6560 | /**
|
6561 | * The URL being requested for preconnection by the renderer.
|
6562 | */
|
6563 | preconnectUrl: string,
|
6564 | /**
|
6565 | * True if the renderer is requesting that the connection include credentials (see
|
6566 | * the spec for more details.)
|
6567 | */
|
6568 | allowCredentials: boolean) => void): this;
|
6569 | removeListener(event: 'preconnect', listener: (event: Event,
|
6570 | /**
|
6571 | * The URL being requested for preconnection by the renderer.
|
6572 | */
|
6573 | preconnectUrl: string,
|
6574 | /**
|
6575 | * True if the renderer is requesting that the connection include credentials (see
|
6576 | * the spec for more details.)
|
6577 | */
|
6578 | allowCredentials: boolean) => void): this;
|
6579 | /**
|
6580 | * Emitted when a hunspell dictionary file starts downloading
|
6581 | */
|
6582 | on(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
|
6583 | /**
|
6584 | * The language code of the dictionary file
|
6585 | */
|
6586 | languageCode: string) => void): this;
|
6587 | once(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
|
6588 | /**
|
6589 | * The language code of the dictionary file
|
6590 | */
|
6591 | languageCode: string) => void): this;
|
6592 | addListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
|
6593 | /**
|
6594 | * The language code of the dictionary file
|
6595 | */
|
6596 | languageCode: string) => void): this;
|
6597 | removeListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
|
6598 | /**
|
6599 | * The language code of the dictionary file
|
6600 | */
|
6601 | languageCode: string) => void): this;
|
6602 | /**
|
6603 | * Emitted when a hunspell dictionary file download fails. For details on the
|
6604 | * failure you should collect a netlog and inspect the download request.
|
6605 | */
|
6606 | on(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
|
6607 | /**
|
6608 | * The language code of the dictionary file
|
6609 | */
|
6610 | languageCode: string) => void): this;
|
6611 | once(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
|
6612 | /**
|
6613 | * The language code of the dictionary file
|
6614 | */
|
6615 | languageCode: string) => void): this;
|
6616 | addListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
|
6617 | /**
|
6618 | * The language code of the dictionary file
|
6619 | */
|
6620 | languageCode: string) => void): this;
|
6621 | removeListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
|
6622 | /**
|
6623 | * The language code of the dictionary file
|
6624 | */
|
6625 | languageCode: string) => void): this;
|
6626 | /**
|
6627 | * Emitted when a hunspell dictionary file has been successfully downloaded
|
6628 | */
|
6629 | on(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
|
6630 | /**
|
6631 | * The language code of the dictionary file
|
6632 | */
|
6633 | languageCode: string) => void): this;
|
6634 | once(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
|
6635 | /**
|
6636 | * The language code of the dictionary file
|
6637 | */
|
6638 | languageCode: string) => void): this;
|
6639 | addListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
|
6640 | /**
|
6641 | * The language code of the dictionary file
|
6642 | */
|
6643 | languageCode: string) => void): this;
|
6644 | removeListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
|
6645 | /**
|
6646 | * The language code of the dictionary file
|
6647 | */
|
6648 | languageCode: string) => void): this;
|
6649 | /**
|
6650 | * Emitted when a hunspell dictionary file has been successfully initialized. This
|
6651 | * occurs after the file has been downloaded.
|
6652 | */
|
6653 | on(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
|
6654 | /**
|
6655 | * The language code of the dictionary file
|
6656 | */
|
6657 | languageCode: string) => void): this;
|
6658 | once(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
|
6659 | /**
|
6660 | * The language code of the dictionary file
|
6661 | */
|
6662 | languageCode: string) => void): this;
|
6663 | addListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
|
6664 | /**
|
6665 | * The language code of the dictionary file
|
6666 | */
|
6667 | languageCode: string) => void): this;
|
6668 | removeListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
|
6669 | /**
|
6670 | * The language code of the dictionary file
|
6671 | */
|
6672 | languageCode: string) => void): this;
|
6673 | /**
|
6674 | * Emitted when Electron is about to download `item` in `webContents`.
|
6675 | *
|
6676 | * Calling `event.preventDefault()` will cancel the download and `item` will not be
|
6677 | * available from next tick of the process.
|
6678 | */
|
6679 | on(event: 'will-download', listener: (event: Event,
|
6680 | item: DownloadItem,
|
6681 | webContents: WebContents) => void): this;
|
6682 | once(event: 'will-download', listener: (event: Event,
|
6683 | item: DownloadItem,
|
6684 | webContents: WebContents) => void): this;
|
6685 | addListener(event: 'will-download', listener: (event: Event,
|
6686 | item: DownloadItem,
|
6687 | webContents: WebContents) => void): this;
|
6688 | removeListener(event: 'will-download', listener: (event: Event,
|
6689 | item: DownloadItem,
|
6690 | webContents: WebContents) => void): this;
|
6691 | /**
|
6692 | * Whether the word was successfully written to the custom dictionary. This API
|
6693 | * will not work on non-persistent (in-memory) sessions.
|
6694 | *
|
6695 | * **Note:** On macOS and Windows 10 this word will be written to the OS custom
|
6696 | * dictionary as well
|
6697 | */
|
6698 | addWordToSpellCheckerDictionary(word: string): boolean;
|
6699 | /**
|
6700 | * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
|
6701 | * authentication.
|
6702 | */
|
6703 | allowNTLMCredentialsForDomains(domains: string): void;
|
6704 | /**
|
6705 | * resolves when the session’s HTTP authentication cache has been cleared.
|
6706 | */
|
6707 | clearAuthCache(): Promise<void>;
|
6708 | /**
|
6709 | * resolves when the cache clear operation is complete.
|
6710 | *
|
6711 | Clears the session’s HTTP cache.
|
6712 | */
|
6713 | clearCache(): Promise<void>;
|
6714 | /**
|
6715 | * Resolves when the operation is complete.
|
6716 |
|
6717 | Clears the host resolver cache.
|
6718 | */
|
6719 | clearHostResolverCache(): Promise<void>;
|
6720 | /**
|
6721 | * resolves when the storage data has been cleared.
|
6722 | */
|
6723 | clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
|
6724 | /**
|
6725 | * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
|
6726 | * The API will generate a DownloadItem that can be accessed with the will-download
|
6727 | * event. The DownloadItem will not have any `WebContents` associated with it and
|
6728 | * the initial state will be `interrupted`. The download will start only when the
|
6729 | * `resume` API is called on the DownloadItem.
|
6730 | */
|
6731 | createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
|
6732 | /**
|
6733 | * Disables any network emulation already active for the `session`. Resets to the
|
6734 | * original network configuration.
|
6735 | */
|
6736 | disableNetworkEmulation(): void;
|
6737 | /**
|
6738 | * Initiates a download of the resource at `url`. The API will generate a
|
6739 | * DownloadItem that can be accessed with the will-download event.
|
6740 | *
|
6741 | * **Note:** This does not perform any security checks that relate to a page's
|
6742 | * origin, unlike `webContents.downloadURL`.
|
6743 | */
|
6744 | downloadURL(url: string): void;
|
6745 | /**
|
6746 | * Emulates network with the given configuration for the `session`.
|
6747 | */
|
6748 | enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
|
6749 | /**
|
6750 | * Writes any unwritten DOMStorage data to disk.
|
6751 | */
|
6752 | flushStorageData(): void;
|
6753 | /**
|
6754 | * A list of all loaded extensions.
|
6755 | *
|
6756 | * **Note:** This API cannot be called before the `ready` event of the `app` module
|
6757 | * is emitted.
|
6758 | */
|
6759 | getAllExtensions(): Extension[];
|
6760 | /**
|
6761 | * resolves with blob data.
|
6762 | */
|
6763 | getBlobData(identifier: string): Promise<Buffer>;
|
6764 | /**
|
6765 | * the session's current cache size, in bytes.
|
6766 | */
|
6767 | getCacheSize(): Promise<number>;
|
6768 | /**
|
6769 | * | `null` - The loaded extension with the given ID.
|
6770 | *
|
6771 | * **Note:** This API cannot be called before the `ready` event of the `app` module
|
6772 | * is emitted.
|
6773 | */
|
6774 | getExtension(extensionId: string): Extension;
|
6775 | /**
|
6776 | * an array of paths to preload scripts that have been registered.
|
6777 | */
|
6778 | getPreloads(): string[];
|
6779 | /**
|
6780 | * An array of language codes the spellchecker is enabled for. If this list is
|
6781 | * empty the spellchecker will fallback to using `en-US`. By default on launch if
|
6782 | * this setting is an empty list Electron will try to populate this setting with
|
6783 | * the current OS locale. This setting is persisted across restarts.
|
6784 | *
|
6785 | * **Note:** On macOS the OS spellchecker is used and has it's own list of
|
6786 | * languages. This API is a no-op on macOS.
|
6787 | */
|
6788 | getSpellCheckerLanguages(): string[];
|
6789 | /**
|
6790 | * The user agent for this session.
|
6791 | */
|
6792 | getUserAgent(): string;
|
6793 | /**
|
6794 | * Whether or not this session is a persistent one. The default `webContents`
|
6795 | * session of a `BrowserWindow` is persistent. When creating a session from a
|
6796 | * partition, session prefixed with `persist:` will be persistent, while others
|
6797 | * will be temporary.
|
6798 | */
|
6799 | isPersistent(): boolean;
|
6800 | /**
|
6801 | * An array of all words in app's custom dictionary. Resolves when the full
|
6802 | * dictionary is loaded from disk.
|
6803 | */
|
6804 | listWordsInSpellCheckerDictionary(): Promise<string[]>;
|
6805 | /**
|
6806 | * resolves when the extension is loaded.
|
6807 | *
|
6808 | * This method will raise an exception if the extension could not be loaded. If
|
6809 | * there are warnings when installing the extension (e.g. if the extension requests
|
6810 | * an API that Electron does not support) then they will be logged to the console.
|
6811 | *
|
6812 | * Note that Electron does not support the full range of Chrome extensions APIs.
|
6813 | * See Supported Extensions APIs for more details on what is supported.
|
6814 | *
|
6815 | * Note that in previous versions of Electron, extensions that were loaded would be
|
6816 | * remembered for future runs of the application. This is no longer the case:
|
6817 | * `loadExtension` must be called on every boot of your app if you want the
|
6818 | * extension to be loaded.
|
6819 | *
|
6820 | * This API does not support loading packed (.crx) extensions.
|
6821 | *
|
6822 | * **Note:** This API cannot be called before the `ready` event of the `app` module
|
6823 | * is emitted.
|
6824 | *
|
6825 | * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
|
6826 | * supported and will throw an error.
|
6827 | */
|
6828 | loadExtension(path: string): Promise<Electron.Extension>;
|
6829 | /**
|
6830 | * Preconnects the given number of sockets to an origin.
|
6831 | */
|
6832 | preconnect(options: PreconnectOptions): void;
|
6833 | /**
|
6834 | * Unloads an extension.
|
6835 | *
|
6836 | * **Note:** This API cannot be called before the `ready` event of the `app` module
|
6837 | * is emitted.
|
6838 | */
|
6839 | removeExtension(extensionId: string): void;
|
6840 | /**
|
6841 | * Whether the word was successfully removed from the custom dictionary. This API
|
6842 | * will not work on non-persistent (in-memory) sessions.
|
6843 | *
|
6844 | * **Note:** On macOS and Windows 10 this word will be removed from the OS custom
|
6845 | * dictionary as well
|
6846 | */
|
6847 | removeWordFromSpellCheckerDictionary(word: string): boolean;
|
6848 | /**
|
6849 | * Resolves with the proxy information for `url`.
|
6850 | */
|
6851 | resolveProxy(url: string): Promise<string>;
|
6852 | /**
|
6853 | * Sets the certificate verify proc for `session`, the `proc` will be called with
|
6854 | * `proc(request, callback)` whenever a server certificate verification is
|
6855 | * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
|
6856 | * rejects it.
|
6857 | *
|
6858 | * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
|
6859 | * verify proc.
|
6860 | */
|
6861 | setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
|
6862 | /**
|
6863 | * Sets download saving directory. By default, the download directory will be the
|
6864 | * `Downloads` under the respective app folder.
|
6865 | */
|
6866 | setDownloadPath(path: string): void;
|
6867 | /**
|
6868 | * Sets the handler which can be used to respond to permission checks for the
|
6869 | * `session`. Returning `true` will allow the permission and `false` will reject
|
6870 | * it. To clear the handler, call `setPermissionCheckHandler(null)`.
|
6871 | */
|
6872 | setPermissionCheckHandler(handler: ((webContents: WebContents, permission: string, requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void;
|
6873 | /**
|
6874 | * Sets the handler which can be used to respond to permission requests for the
|
6875 | * `session`. Calling `callback(true)` will allow the permission and
|
6876 | * `callback(false)` will reject it. To clear the handler, call
|
6877 | * `setPermissionRequestHandler(null)`.
|
6878 | */
|
6879 | setPermissionRequestHandler(handler: ((webContents: WebContents, permission: string, callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void;
|
6880 | /**
|
6881 | * Adds scripts that will be executed on ALL web contents that are associated with
|
6882 | * this session just before normal `preload` scripts run.
|
6883 | */
|
6884 | setPreloads(preloads: string[]): void;
|
6885 | /**
|
6886 | * Resolves when the proxy setting process is complete.
|
6887 | *
|
6888 | * Sets the proxy settings.
|
6889 | *
|
6890 | * When `pacScript` and `proxyRules` are provided together, the `proxyRules` option
|
6891 | * is ignored and `pacScript` configuration is applied.
|
6892 | *
|
6893 | * The `proxyRules` has to follow the rules below:
|
6894 | *
|
6895 | * For example:
|
6896 | *
|
6897 | * * `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
|
6898 | * HTTP proxy `foopy2:80` for `ftp://` URLs.
|
6899 | * * `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
|
6900 | * * `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
|
6901 | * over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
|
6902 | * * `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
|
6903 | * * `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
|
6904 | * over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
|
6905 | * * `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
|
6906 | * proxy if `foopy` is unavailable.
|
6907 | * * `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
|
6908 | * `socks4://foopy2` for all other URLs.
|
6909 | *
|
6910 | * The `proxyBypassRules` is a comma separated list of rules described below:
|
6911 | *
|
6912 | * * `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
|
6913 | *
|
6914 | * Match all hostnames that match the pattern HOSTNAME_PATTERN.
|
6915 | *
|
6916 | * Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
|
6917 | * "https://x.*.y.com:99"
|
6918 | * * `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
|
6919 | *
|
6920 | * Match a particular domain suffix.
|
6921 | *
|
6922 | * Examples: ".google.com", ".com", "http://.google.com"
|
6923 | * * `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
|
6924 | *
|
6925 | * Match URLs which are IP address literals.
|
6926 | *
|
6927 | * Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
|
6928 | * * `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
|
6929 | *
|
6930 | * Match any URL that is to an IP literal that falls between the given range. IP
|
6931 | * range is specified using CIDR notation.
|
6932 | *
|
6933 | * Examples: "192.168.1.1/16", "fefe:13::abc/33".
|
6934 | * * `<local>`
|
6935 | *
|
6936 | * Match local addresses. The meaning of `<local>` is whether the host matches one
|
6937 | * of: "127.0.0.1", "::1", "localhost".
|
6938 | */
|
6939 | setProxy(config: Config): Promise<void>;
|
6940 | /**
|
6941 | * By default Electron will download hunspell dictionaries from the Chromium CDN.
|
6942 | * If you want to override this behavior you can use this API to point the
|
6943 | * dictionary downloader at your own hosted version of the hunspell dictionaries.
|
6944 | * We publish a `hunspell_dictionaries.zip` file with each release which contains
|
6945 | * the files you need to host here, the file server must be **case insensitive**
|
6946 | * you must upload each file twice, once with the case it has in the ZIP file and
|
6947 | * once with the filename as all lower case.
|
6948 | *
|
6949 | * If the files present in `hunspell_dictionaries.zip` are available at
|
6950 | * `https://example.com/dictionaries/language-code.bdic` then you should call this
|
6951 | * api with
|
6952 | * `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`.
|
6953 | * Please note the trailing slash. The URL to the dictionaries is formed as
|
6954 | * `${url}${filename}`.
|
6955 | *
|
6956 | * **Note:** On macOS the OS spellchecker is used and therefore we do not download
|
6957 | * any dictionary files. This API is a no-op on macOS.
|
6958 | */
|
6959 | setSpellCheckerDictionaryDownloadURL(url: string): void;
|
6960 | /**
|
6961 | * The built in spellchecker does not automatically detect what language a user is
|
6962 | * typing in. In order for the spell checker to correctly check their words you
|
6963 | * must call this API with an array of language codes. You can get the list of
|
6964 | * supported language codes with the `ses.availableSpellCheckerLanguages` property.
|
6965 | *
|
6966 | * **Note:** On macOS the OS spellchecker is used and will detect your language
|
6967 | * automatically. This API is a no-op on macOS.
|
6968 | */
|
6969 | setSpellCheckerLanguages(languages: string[]): void;
|
6970 | /**
|
6971 | * Overrides the `userAgent` and `acceptLanguages` for this session.
|
6972 | *
|
6973 | * The `acceptLanguages` must a comma separated ordered list of language codes, for
|
6974 | * example `"en-US,fr,de,ko,zh-CN,ja"`.
|
6975 | *
|
6976 | * This doesn't affect existing `WebContents`, and each `WebContents` can use
|
6977 | * `webContents.setUserAgent` to override the session-wide user agent.
|
6978 | */
|
6979 | setUserAgent(userAgent: string, acceptLanguages?: string): void;
|
6980 | readonly availableSpellCheckerLanguages: string[];
|
6981 | readonly cookies: Cookies;
|
6982 | readonly netLog: NetLog;
|
6983 | readonly protocol: Protocol;
|
6984 | readonly serviceWorkers: ServiceWorkers;
|
6985 | readonly webRequest: WebRequest;
|
6986 | }
|
6987 |
|
6988 | interface SharedWorkerInfo {
|
6989 |
|
6990 | // Docs: http://electronjs.org/docs/api/structures/shared-worker-info
|
6991 |
|
6992 | /**
|
6993 | * The unique id of the shared worker.
|
6994 | */
|
6995 | id: string;
|
6996 | /**
|
6997 | * The url of the shared worker.
|
6998 | */
|
6999 | url: string;
|
7000 | }
|
7001 |
|
7002 | interface Shell {
|
7003 |
|
7004 | // Docs: http://electronjs.org/docs/api/shell
|
7005 |
|
7006 | /**
|
7007 | * Play the beep sound.
|
7008 | */
|
7009 | beep(): void;
|
7010 | /**
|
7011 | * Whether the item was successfully moved to the trash or otherwise deleted.
|
7012 | *
|
7013 | Move the given file to trash and returns a boolean status for the operation.
|
7014 | */
|
7015 | moveItemToTrash(fullPath: string, deleteOnFail?: boolean): boolean;
|
7016 | /**
|
7017 | * Open the given external protocol URL in the desktop's default manner. (For
|
7018 | * example, mailto: URLs in the user's default mail agent).
|
7019 | */
|
7020 | openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
|
7021 | /**
|
7022 | * Resolves with an string containing the error message corresponding to the
|
7023 | * failure if a failure occurred, otherwise "".
|
7024 | *
|
7025 | Open the given file in the desktop's default manner.
|
7026 | */
|
7027 | openPath(path: string): Promise<string>;
|
7028 | /**
|
7029 | * Resolves the shortcut link at `shortcutPath`.
|
7030 | *
|
7031 | An exception will be thrown when any error happens.
|
7032 | *
|
7033 | * @platform win32
|
7034 | */
|
7035 | readShortcutLink(shortcutPath: string): ShortcutDetails;
|
7036 | /**
|
7037 | * Show the given file in a file manager. If possible, select the file.
|
7038 | */
|
7039 | showItemInFolder(fullPath: string): void;
|
7040 | /**
|
7041 | * Whether the shortcut was created successfully.
|
7042 | *
|
7043 | Creates or updates a shortcut link at `shortcutPath`.
|
7044 | *
|
7045 | * @platform win32
|
7046 | */
|
7047 | writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
|
7048 | /**
|
7049 | * Whether the shortcut was created successfully.
|
7050 | *
|
7051 | Creates or updates a shortcut link at `shortcutPath`.
|
7052 | *
|
7053 | * @platform win32
|
7054 | */
|
7055 | writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
|
7056 | }
|
7057 |
|
7058 | interface ShortcutDetails {
|
7059 |
|
7060 | // Docs: http://electronjs.org/docs/api/structures/shortcut-details
|
7061 |
|
7062 | /**
|
7063 | * The Application User Model ID. Default is empty.
|
7064 | */
|
7065 | appUserModelId?: string;
|
7066 | /**
|
7067 | * The arguments to be applied to `target` when launching from this shortcut.
|
7068 | * Default is empty.
|
7069 | */
|
7070 | args?: string;
|
7071 | /**
|
7072 | * The working directory. Default is empty.
|
7073 | */
|
7074 | cwd?: string;
|
7075 | /**
|
7076 | * The description of the shortcut. Default is empty.
|
7077 | */
|
7078 | description?: string;
|
7079 | /**
|
7080 | * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
|
7081 | * together. Default is empty, which uses the target's icon.
|
7082 | */
|
7083 | icon?: string;
|
7084 | /**
|
7085 | * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
|
7086 | */
|
7087 | iconIndex?: number;
|
7088 | /**
|
7089 | * The target to launch from this shortcut.
|
7090 | */
|
7091 | target: string;
|
7092 | }
|
7093 |
|
7094 | interface Size {
|
7095 |
|
7096 | // Docs: http://electronjs.org/docs/api/structures/size
|
7097 |
|
7098 | height: number;
|
7099 | width: number;
|
7100 | }
|
7101 |
|
7102 | interface StreamProtocolResponse {
|
7103 |
|
7104 | // Docs: http://electronjs.org/docs/api/structures/stream-protocol-response
|
7105 |
|
7106 | /**
|
7107 | * A Node.js readable stream representing the response body.
|
7108 | */
|
7109 | data: (NodeJS.ReadableStream) | (null);
|
7110 | /**
|
7111 | * An object containing the response headers.
|
7112 | */
|
7113 | headers?: Record<string, (string) | (string[])>;
|
7114 | /**
|
7115 | * The HTTP response code.
|
7116 | */
|
7117 | statusCode?: number;
|
7118 | }
|
7119 |
|
7120 | interface StringProtocolResponse {
|
7121 |
|
7122 | // Docs: http://electronjs.org/docs/api/structures/string-protocol-response
|
7123 |
|
7124 | /**
|
7125 | * Charset of the response.
|
7126 | */
|
7127 | charset?: string;
|
7128 | /**
|
7129 | * A string representing the response body.
|
7130 | */
|
7131 | data: (string) | (null);
|
7132 | /**
|
7133 | * MIME type of the response.
|
7134 | */
|
7135 | mimeType?: string;
|
7136 | }
|
7137 |
|
7138 | interface SystemPreferences extends NodeJS.EventEmitter {
|
7139 |
|
7140 | // Docs: http://electronjs.org/docs/api/system-preferences
|
7141 |
|
7142 | on(event: 'accent-color-changed', listener: (event: Event,
|
7143 | /**
|
7144 | * The new RGBA color the user assigned to be their system accent color.
|
7145 | */
|
7146 | newColor: string) => void): this;
|
7147 | once(event: 'accent-color-changed', listener: (event: Event,
|
7148 | /**
|
7149 | * The new RGBA color the user assigned to be their system accent color.
|
7150 | */
|
7151 | newColor: string) => void): this;
|
7152 | addListener(event: 'accent-color-changed', listener: (event: Event,
|
7153 | /**
|
7154 | * The new RGBA color the user assigned to be their system accent color.
|
7155 | */
|
7156 | newColor: string) => void): this;
|
7157 | removeListener(event: 'accent-color-changed', listener: (event: Event,
|
7158 | /**
|
7159 | * The new RGBA color the user assigned to be their system accent color.
|
7160 | */
|
7161 | newColor: string) => void): this;
|
7162 | on(event: 'color-changed', listener: (event: Event) => void): this;
|
7163 | once(event: 'color-changed', listener: (event: Event) => void): this;
|
7164 | addListener(event: 'color-changed', listener: (event: Event) => void): this;
|
7165 | removeListener(event: 'color-changed', listener: (event: Event) => void): this;
|
7166 | /**
|
7167 | * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
|
7168 | *
|
7169 | * @deprecated
|
7170 | * @platform win32
|
7171 | */
|
7172 | on(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
|
7173 | /**
|
7174 | * `true` if a high contrast theme is being used, `false` otherwise.
|
7175 | */
|
7176 | highContrastColorScheme: boolean) => void): this;
|
7177 | once(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
|
7178 | /**
|
7179 | * `true` if a high contrast theme is being used, `false` otherwise.
|
7180 | */
|
7181 | highContrastColorScheme: boolean) => void): this;
|
7182 | addListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
|
7183 | /**
|
7184 | * `true` if a high contrast theme is being used, `false` otherwise.
|
7185 | */
|
7186 | highContrastColorScheme: boolean) => void): this;
|
7187 | removeListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
|
7188 | /**
|
7189 | * `true` if a high contrast theme is being used, `false` otherwise.
|
7190 | */
|
7191 | highContrastColorScheme: boolean) => void): this;
|
7192 | /**
|
7193 | * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
|
7194 | *
|
7195 | * @deprecated
|
7196 | * @platform win32
|
7197 | */
|
7198 | on(event: 'inverted-color-scheme-changed', listener: (event: Event,
|
7199 | /**
|
7200 | * `true` if an inverted color scheme (a high contrast color scheme with light text
|
7201 | * and dark backgrounds) is being used, `false` otherwise.
|
7202 | */
|
7203 | invertedColorScheme: boolean) => void): this;
|
7204 | once(event: 'inverted-color-scheme-changed', listener: (event: Event,
|
7205 | /**
|
7206 | * `true` if an inverted color scheme (a high contrast color scheme with light text
|
7207 | * and dark backgrounds) is being used, `false` otherwise.
|
7208 | */
|
7209 | invertedColorScheme: boolean) => void): this;
|
7210 | addListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
|
7211 | /**
|
7212 | * `true` if an inverted color scheme (a high contrast color scheme with light text
|
7213 | * and dark backgrounds) is being used, `false` otherwise.
|
7214 | */
|
7215 | invertedColorScheme: boolean) => void): this;
|
7216 | removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
|
7217 | /**
|
7218 | * `true` if an inverted color scheme (a high contrast color scheme with light text
|
7219 | * and dark backgrounds) is being used, `false` otherwise.
|
7220 | */
|
7221 | invertedColorScheme: boolean) => void): this;
|
7222 | /**
|
7223 | * A promise that resolves with `true` if consent was granted and `false` if it was
|
7224 | * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
|
7225 | * access request was denied and later is changed through the System Preferences
|
7226 | * pane, a restart of the app will be required for the new permissions to take
|
7227 | * effect. If access has already been requested and denied, it _must_ be changed
|
7228 | * through the preference pane; an alert will not pop up and the promise will
|
7229 | * resolve with the existing access status.
|
7230 | *
|
7231 | * **Important:** In order to properly leverage this API, you must set the
|
7232 | * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
|
7233 | * app's `Info.plist` file. The values for these keys will be used to populate the
|
7234 | * permission dialogs so that the user will be properly informed as to the purpose
|
7235 | * of the permission request. See Electron Application Distribution for more
|
7236 | * information about how to set these in the context of Electron.
|
7237 | *
|
7238 | * This user consent was not required until macOS 10.14 Mojave, so this method will
|
7239 | * always return `true` if your system is running 10.13 High Sierra or lower.
|
7240 | *
|
7241 | * @platform darwin
|
7242 | */
|
7243 | askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
|
7244 | /**
|
7245 | * whether or not this device has the ability to use Touch ID.
|
7246 | *
|
7247 | * **NOTE:** This API will return `false` on macOS systems older than Sierra
|
7248 | * 10.12.2.
|
7249 | *
|
7250 | * @platform darwin
|
7251 | */
|
7252 | canPromptTouchID(): boolean;
|
7253 | /**
|
7254 | * The users current system wide accent color preference in RGBA hexadecimal form.
|
7255 | *
|
7256 | This API is only available on macOS 10.14 Mojave or newer.
|
7257 | *
|
7258 | * @platform win32,darwin
|
7259 | */
|
7260 | getAccentColor(): string;
|
7261 | /**
|
7262 | * * `shouldRenderRichAnimation` Boolean - Returns true if rich animations should
|
7263 | * be rendered. Looks at session type (e.g. remote desktop) and accessibility
|
7264 | * settings to give guidance for heavy animations.
|
7265 | * * `scrollAnimationsEnabledBySystem` Boolean - Determines on a per-platform basis
|
7266 | * whether scroll animations (e.g. produced by home/end key) should be enabled.
|
7267 | * * `prefersReducedMotion` Boolean - Determines whether the user desires reduced
|
7268 | * motion based on platform APIs.
|
7269 | *
|
7270 | Returns an object with system animation settings.
|
7271 | */
|
7272 | getAnimationSettings(): AnimationSettings;
|
7273 | /**
|
7274 | * | `null` - Can be `dark`, `light` or `unknown`.
|
7275 | *
|
7276 | * Gets the macOS appearance setting that you have declared you want for your
|
7277 | * application, maps to NSApplication.appearance. You can use the
|
7278 | * `setAppLevelAppearance` API to set this value.
|
7279 | *
|
7280 | * @deprecated
|
7281 | * @platform darwin
|
7282 | */
|
7283 | getAppLevelAppearance(): ('dark' | 'light' | 'unknown');
|
7284 | /**
|
7285 | * The system color setting in RGB hexadecimal form (`#ABCDEF`). See the Windows
|
7286 | * docs and the macOS docs for more details.
|
7287 | *
|
7288 | * The following colors are only available on macOS 10.14: `find-highlight`,
|
7289 | * `selected-content-background`, `separator`,
|
7290 | * `unemphasized-selected-content-background`,
|
7291 | * `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
|
7292 | *
|
7293 | * @platform win32,darwin
|
7294 | */
|
7295 | 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;
|
7296 | /**
|
7297 | * Can be `dark`, `light` or `unknown`.
|
7298 | *
|
7299 | * Gets the macOS appearance setting that is currently applied to your application,
|
7300 | * maps to NSApplication.effectiveAppearance
|
7301 | *
|
7302 | * @platform darwin
|
7303 | */
|
7304 | getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
|
7305 | /**
|
7306 | * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
|
7307 | *
|
7308 | * This user consent was not required on macOS 10.13 High Sierra or lower so this
|
7309 | * method will always return `granted`. macOS 10.14 Mojave or higher requires
|
7310 | * consent for `microphone` and `camera` access. macOS 10.15 Catalina or higher
|
7311 | * requires consent for `screen` access.
|
7312 | *
|
7313 | * Windows 10 has a global setting controlling `microphone` and `camera` access for
|
7314 | * all win32 applications. It will always return `granted` for `screen` and for all
|
7315 | * media types on older versions of Windows.
|
7316 | *
|
7317 | * @platform win32,darwin
|
7318 | */
|
7319 | getMediaAccessStatus(mediaType: 'microphone' | 'camera' | 'screen'): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
|
7320 | /**
|
7321 | * The standard system color formatted as `#RRGGBBAA`.
|
7322 | *
|
7323 | * Returns one of several standard system colors that automatically adapt to
|
7324 | * vibrancy and changes in accessibility settings like 'Increase contrast' and
|
7325 | * 'Reduce transparency'. See Apple Documentation for more details.
|
7326 | *
|
7327 | * @platform darwin
|
7328 | */
|
7329 | getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
|
7330 | /**
|
7331 | * The value of `key` in `NSUserDefaults`.
|
7332 | *
|
7333 | * Some popular `key` and `type`s are:
|
7334 | *
|
7335 | * * `AppleInterfaceStyle`: `string`
|
7336 | * * `AppleAquaColorVariant`: `integer`
|
7337 | * * `AppleHighlightColor`: `string`
|
7338 | * * `AppleShowScrollBars`: `string`
|
7339 | * * `NSNavRecentPlaces`: `array`
|
7340 | * * `NSPreferredWebServices`: `dictionary`
|
7341 | * * `NSUserDictionaryReplacementItems`: `array`
|
7342 | *
|
7343 | * @platform darwin
|
7344 | */
|
7345 | getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any;
|
7346 | /**
|
7347 | * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
|
7348 | *
|
7349 | * An example of using it to determine if you should create a transparent window or
|
7350 | * not (transparent windows won't work correctly when DWM composition is disabled):
|
7351 | *
|
7352 | * @platform win32
|
7353 | */
|
7354 | isAeroGlassEnabled(): boolean;
|
7355 | /**
|
7356 | * Whether the system is in Dark Mode.
|
7357 | *
|
7358 | * **Note:** On macOS 10.15 Catalina in order for this API to return the correct
|
7359 | * value when in the "automatic" dark mode setting you must either have
|
7360 | * `NSRequiresAquaSystemAppearance=false` in your `Info.plist` or be on Electron
|
7361 | * `>=7.0.0`. See the dark mode guide for more information.
|
7362 | *
|
7363 | **Deprecated:** Should use the new `nativeTheme.shouldUseDarkColors` API.
|
7364 | *
|
7365 | * @deprecated
|
7366 | * @platform darwin,win32
|
7367 | */
|
7368 | isDarkMode(): boolean;
|
7369 | /**
|
7370 | * `true` if a high contrast theme is active, `false` otherwise.
|
7371 | *
|
7372 | * **Deprecated:** Should use the new `nativeTheme.shouldUseHighContrastColors`
|
7373 | * API.
|
7374 | *
|
7375 | * @deprecated
|
7376 | * @platform darwin,win32
|
7377 | */
|
7378 | isHighContrastColorScheme(): boolean;
|
7379 | /**
|
7380 | * `true` if an inverted color scheme (a high contrast color scheme with light text
|
7381 | * and dark backgrounds) is active, `false` otherwise.
|
7382 | *
|
7383 | * **Deprecated:** Should use the new `nativeTheme.shouldUseInvertedColorScheme`
|
7384 | * API.
|
7385 | *
|
7386 | * @deprecated
|
7387 | * @platform win32
|
7388 | */
|
7389 | isInvertedColorScheme(): boolean;
|
7390 | /**
|
7391 | * Whether the Swipe between pages setting is on.
|
7392 | *
|
7393 | * @platform darwin
|
7394 | */
|
7395 | isSwipeTrackingFromScrollEventsEnabled(): boolean;
|
7396 | /**
|
7397 | * `true` if the current process is a trusted accessibility client and `false` if
|
7398 | * it is not.
|
7399 | *
|
7400 | * @platform darwin
|
7401 | */
|
7402 | isTrustedAccessibilityClient(prompt: boolean): boolean;
|
7403 | /**
|
7404 | * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
|
7405 | * contains the user information dictionary sent along with the notification.
|
7406 | *
|
7407 | * @platform darwin
|
7408 | */
|
7409 | postLocalNotification(event: string, userInfo: Record<string, any>): void;
|
7410 | /**
|
7411 | * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
|
7412 | * contains the user information dictionary sent along with the notification.
|
7413 | *
|
7414 | * @platform darwin
|
7415 | */
|
7416 | postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
|
7417 | /**
|
7418 | * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
|
7419 | * contains the user information dictionary sent along with the notification.
|
7420 | *
|
7421 | * @platform darwin
|
7422 | */
|
7423 | postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
|
7424 | /**
|
7425 | * resolves if the user has successfully authenticated with Touch ID.
|
7426 | *
|
7427 | * This API itself will not protect your user data; rather, it is a mechanism to
|
7428 | * allow you to do so. Native apps will need to set Access Control Constants like
|
7429 | * `kSecAccessControlUserPresence` on the their keychain entry so that reading it
|
7430 | * would auto-prompt for Touch ID biometric consent. This could be done with
|
7431 | * `node-keytar`, such that one would store an encryption key with `node-keytar`
|
7432 | * and only fetch it if `promptTouchID()` resolves.
|
7433 | *
|
7434 | * **NOTE:** This API will return a rejected Promise on macOS systems older than
|
7435 | * Sierra 10.12.2.
|
7436 | *
|
7437 | * @platform darwin
|
7438 | */
|
7439 | promptTouchID(reason: string): Promise<void>;
|
7440 | /**
|
7441 | * Add the specified defaults to your application's `NSUserDefaults`.
|
7442 | *
|
7443 | * @platform darwin
|
7444 | */
|
7445 | registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
|
7446 | /**
|
7447 | * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
|
7448 | * or global value of a `key` previously set with `setUserDefault`.
|
7449 | *
|
7450 | * @platform darwin
|
7451 | */
|
7452 | removeUserDefault(key: string): void;
|
7453 | /**
|
7454 | * Sets the appearance setting for your application, this should override the
|
7455 | * system default and override the value of `getEffectiveAppearance`.
|
7456 | *
|
7457 | * @deprecated
|
7458 | * @platform darwin
|
7459 | */
|
7460 | setAppLevelAppearance(appearance: (('dark' | 'light')) | (null)): void;
|
7461 | /**
|
7462 | * Set the value of `key` in `NSUserDefaults`.
|
7463 | *
|
7464 | * Note that `type` should match actual type of `value`. An exception is thrown if
|
7465 | * they don't.
|
7466 | *
|
7467 | Some popular `key` and `type`s are:
|
7468 |
|
7469 | * `ApplePressAndHoldEnabled`: `boolean`
|
7470 | *
|
7471 | * @platform darwin
|
7472 | */
|
7473 | setUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary', value: string): void;
|
7474 | /**
|
7475 | * The ID of this subscription
|
7476 | *
|
7477 | * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
|
7478 | * defaults. This is necessary for events such as
|
7479 | * `NSUserDefaultsDidChangeNotification`.
|
7480 | *
|
7481 | * @platform darwin
|
7482 | */
|
7483 | subscribeLocalNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
|
7484 | /**
|
7485 | * The ID of this subscription
|
7486 | *
|
7487 | * Subscribes to native notifications of macOS, `callback` will be called with
|
7488 | * `callback(event, userInfo)` when the corresponding `event` happens. The
|
7489 | * `userInfo` is an Object that contains the user information dictionary sent along
|
7490 | * with the notification. The `object` is the sender of the notification, and only
|
7491 | * supports `NSString` values for now.
|
7492 | *
|
7493 | * The `id` of the subscriber is returned, which can be used to unsubscribe the
|
7494 | * `event`.
|
7495 | *
|
7496 | * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
|
7497 | * values of `event` are:
|
7498 | *
|
7499 | * * `AppleInterfaceThemeChangedNotification`
|
7500 | * * `AppleAquaColorVariantChanged`
|
7501 | * * `AppleColorPreferencesChangedNotification`
|
7502 | * * `AppleShowScrollBarsSettingChanged`
|
7503 | *
|
7504 | * @platform darwin
|
7505 | */
|
7506 | subscribeNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
|
7507 | /**
|
7508 | * Same as `subscribeNotification`, but uses
|
7509 | * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
|
7510 | * such as `NSWorkspaceDidActivateApplicationNotification`.
|
7511 | *
|
7512 | * @platform darwin
|
7513 | */
|
7514 | subscribeWorkspaceNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): void;
|
7515 | /**
|
7516 | * Same as `unsubscribeNotification`, but removes the subscriber from
|
7517 | * `NSNotificationCenter`.
|
7518 | *
|
7519 | * @platform darwin
|
7520 | */
|
7521 | unsubscribeLocalNotification(id: number): void;
|
7522 | /**
|
7523 | * Removes the subscriber with `id`.
|
7524 | *
|
7525 | * @platform darwin
|
7526 | */
|
7527 | unsubscribeNotification(id: number): void;
|
7528 | /**
|
7529 | * Same as `unsubscribeNotification`, but removes the subscriber from
|
7530 | * `NSWorkspace.sharedWorkspace.notificationCenter`.
|
7531 | *
|
7532 | * @platform darwin
|
7533 | */
|
7534 | unsubscribeWorkspaceNotification(id: number): void;
|
7535 | /**
|
7536 | * A `String` property that can be `dark`, `light` or `unknown`. It determines the
|
7537 | * macOS appearance setting for your application. This maps to values in:
|
7538 | * NSApplication.appearance. Setting this will override the system default as well
|
7539 | * as the value of `getEffectiveAppearance`.
|
7540 | *
|
7541 | * Possible values that can be set are `dark` and `light`, and possible return
|
7542 | * values are `dark`, `light`, and `unknown`.
|
7543 | *
|
7544 | This property is only available on macOS 10.14 Mojave or newer.
|
7545 | *
|
7546 | * @platform darwin
|
7547 | */
|
7548 | appLevelAppearance: ('dark' | 'light' | 'unknown');
|
7549 | /**
|
7550 | * A `String` property that can be `dark`, `light` or `unknown`.
|
7551 | *
|
7552 | * Returns the macOS appearance setting that is currently applied to your
|
7553 | * application, maps to NSApplication.effectiveAppearance
|
7554 | *
|
7555 | * @platform darwin
|
7556 | */
|
7557 | readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
|
7558 | }
|
7559 |
|
7560 | interface Task {
|
7561 |
|
7562 | // Docs: http://electronjs.org/docs/api/structures/task
|
7563 |
|
7564 | /**
|
7565 | * The command line arguments when `program` is executed.
|
7566 | */
|
7567 | arguments: string;
|
7568 | /**
|
7569 | * Description of this task.
|
7570 | */
|
7571 | description: string;
|
7572 | /**
|
7573 | * The icon index in the icon file. If an icon file consists of two or more icons,
|
7574 | * set this value to identify the icon. If an icon file consists of one icon, this
|
7575 | * value is 0.
|
7576 | */
|
7577 | iconIndex: number;
|
7578 | /**
|
7579 | * The absolute path to an icon to be displayed in a JumpList, which can be an
|
7580 | * arbitrary resource file that contains an icon. You can usually specify
|
7581 | * `process.execPath` to show the icon of the program.
|
7582 | */
|
7583 | iconPath: string;
|
7584 | /**
|
7585 | * Path of the program to execute, usually you should specify `process.execPath`
|
7586 | * which opens the current program.
|
7587 | */
|
7588 | program: string;
|
7589 | /**
|
7590 | * The string to be displayed in a JumpList.
|
7591 | */
|
7592 | title: string;
|
7593 | /**
|
7594 | * The working directory. Default is empty.
|
7595 | */
|
7596 | workingDirectory?: string;
|
7597 | }
|
7598 |
|
7599 | interface ThumbarButton {
|
7600 |
|
7601 | // Docs: http://electronjs.org/docs/api/structures/thumbar-button
|
7602 |
|
7603 | click: Function;
|
7604 | /**
|
7605 | * Control specific states and behaviors of the button. By default, it is
|
7606 | * `['enabled']`.
|
7607 | */
|
7608 | flags?: string[];
|
7609 | /**
|
7610 | * The icon showing in thumbnail toolbar.
|
7611 | */
|
7612 | icon: NativeImage;
|
7613 | /**
|
7614 | * The text of the button's tooltip.
|
7615 | */
|
7616 | tooltip?: string;
|
7617 | }
|
7618 |
|
7619 | class TouchBar {
|
7620 |
|
7621 | // Docs: http://electronjs.org/docs/api/touch-bar
|
7622 |
|
7623 | /**
|
7624 | * TouchBar
|
7625 | */
|
7626 | constructor(options: TouchBarConstructorOptions);
|
7627 | escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
|
7628 | static TouchBarButton: typeof TouchBarButton;
|
7629 | static TouchBarColorPicker: typeof TouchBarColorPicker;
|
7630 | static TouchBarGroup: typeof TouchBarGroup;
|
7631 | static TouchBarLabel: typeof TouchBarLabel;
|
7632 | static TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
|
7633 | static TouchBarPopover: typeof TouchBarPopover;
|
7634 | static TouchBarScrubber: typeof TouchBarScrubber;
|
7635 | static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
|
7636 | static TouchBarSlider: typeof TouchBarSlider;
|
7637 | static TouchBarSpacer: typeof TouchBarSpacer;
|
7638 | }
|
7639 |
|
7640 | class TouchBarButton {
|
7641 |
|
7642 | // Docs: http://electronjs.org/docs/api/touch-bar-button
|
7643 |
|
7644 | /**
|
7645 | * TouchBarButton
|
7646 | */
|
7647 | constructor(options: TouchBarButtonConstructorOptions);
|
7648 | accessibilityLabel: string;
|
7649 | backgroundColor: string;
|
7650 | enabled: boolean;
|
7651 | icon: NativeImage;
|
7652 | label: string;
|
7653 | }
|
7654 |
|
7655 | class TouchBarColorPicker extends NodeEventEmitter {
|
7656 |
|
7657 | // Docs: http://electronjs.org/docs/api/touch-bar-color-picker
|
7658 |
|
7659 | /**
|
7660 | * TouchBarColorPicker
|
7661 | */
|
7662 | constructor(options: TouchBarColorPickerConstructorOptions);
|
7663 | availableColors: string[];
|
7664 | selectedColor: string;
|
7665 | }
|
7666 |
|
7667 | class TouchBarGroup extends NodeEventEmitter {
|
7668 |
|
7669 | // Docs: http://electronjs.org/docs/api/touch-bar-group
|
7670 |
|
7671 | /**
|
7672 | * TouchBarGroup
|
7673 | */
|
7674 | constructor(options: TouchBarGroupConstructorOptions);
|
7675 | }
|
7676 |
|
7677 | class TouchBarLabel extends NodeEventEmitter {
|
7678 |
|
7679 | // Docs: http://electronjs.org/docs/api/touch-bar-label
|
7680 |
|
7681 | /**
|
7682 | * TouchBarLabel
|
7683 | */
|
7684 | constructor(options: TouchBarLabelConstructorOptions);
|
7685 | accessibilityLabel: string;
|
7686 | label: string;
|
7687 | textColor: string;
|
7688 | }
|
7689 |
|
7690 | class TouchBarOtherItemsProxy extends NodeEventEmitter {
|
7691 |
|
7692 | // Docs: http://electronjs.org/docs/api/touch-bar-other-items-proxy
|
7693 |
|
7694 | /**
|
7695 | * TouchBarOtherItemsProxy
|
7696 | */
|
7697 | constructor();
|
7698 | }
|
7699 |
|
7700 | class TouchBarPopover extends NodeEventEmitter {
|
7701 |
|
7702 | // Docs: http://electronjs.org/docs/api/touch-bar-popover
|
7703 |
|
7704 | /**
|
7705 | * TouchBarPopover
|
7706 | */
|
7707 | constructor(options: TouchBarPopoverConstructorOptions);
|
7708 | icon: NativeImage;
|
7709 | label: string;
|
7710 | }
|
7711 |
|
7712 | class TouchBarScrubber extends NodeEventEmitter {
|
7713 |
|
7714 | // Docs: http://electronjs.org/docs/api/touch-bar-scrubber
|
7715 |
|
7716 | /**
|
7717 | * TouchBarScrubber
|
7718 | */
|
7719 | constructor(options: TouchBarScrubberConstructorOptions);
|
7720 | continuous: boolean;
|
7721 | items: ScrubberItem[];
|
7722 | mode: ('fixed' | 'free');
|
7723 | overlayStyle: ('background' | 'outline' | 'none');
|
7724 | selectedStyle: ('background' | 'outline' | 'none');
|
7725 | showArrowButtons: boolean;
|
7726 | }
|
7727 |
|
7728 | class TouchBarSegmentedControl extends NodeEventEmitter {
|
7729 |
|
7730 | // Docs: http://electronjs.org/docs/api/touch-bar-segmented-control
|
7731 |
|
7732 | /**
|
7733 | * TouchBarSegmentedControl
|
7734 | */
|
7735 | constructor(options: TouchBarSegmentedControlConstructorOptions);
|
7736 | segments: SegmentedControlSegment[];
|
7737 | segmentStyle: string;
|
7738 | selectedIndex: number;
|
7739 | }
|
7740 |
|
7741 | class TouchBarSlider extends NodeEventEmitter {
|
7742 |
|
7743 | // Docs: http://electronjs.org/docs/api/touch-bar-slider
|
7744 |
|
7745 | /**
|
7746 | * TouchBarSlider
|
7747 | */
|
7748 | constructor(options: TouchBarSliderConstructorOptions);
|
7749 | label: string;
|
7750 | maxValue: number;
|
7751 | minValue: number;
|
7752 | value: number;
|
7753 | }
|
7754 |
|
7755 | class TouchBarSpacer extends NodeEventEmitter {
|
7756 |
|
7757 | // Docs: http://electronjs.org/docs/api/touch-bar-spacer
|
7758 |
|
7759 | /**
|
7760 | * TouchBarSpacer
|
7761 | */
|
7762 | constructor(options: TouchBarSpacerConstructorOptions);
|
7763 | }
|
7764 |
|
7765 | interface TraceCategoriesAndOptions {
|
7766 |
|
7767 | // Docs: http://electronjs.org/docs/api/structures/trace-categories-and-options
|
7768 |
|
7769 | /**
|
7770 | * A filter to control what category groups should be traced. A filter can have an
|
7771 | * optional '-' prefix to exclude category groups that contain a matching category.
|
7772 | * Having both included and excluded category patterns in the same list is not
|
7773 | * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
|
7774 | * `-excluded_category1,-excluded_category2`.
|
7775 | */
|
7776 | categoryFilter: string;
|
7777 | /**
|
7778 | * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
|
7779 | * the following strings: `record-until-full`, `record-continuously`,
|
7780 | * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
|
7781 | * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
|
7782 | * modes and hence mutually exclusive. If more than one trace recording modes
|
7783 | * appear in the `traceOptions` string, the last one takes precedence. If none of
|
7784 | * the trace recording modes are specified, recording mode is `record-until-full`.
|
7785 | * The trace option will first be reset to the default option (`record_mode` set to
|
7786 | * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
|
7787 | * before options parsed from `traceOptions` are applied on it.
|
7788 | */
|
7789 | traceOptions: string;
|
7790 | }
|
7791 |
|
7792 | interface TraceConfig {
|
7793 |
|
7794 | // Docs: http://electronjs.org/docs/api/structures/trace-config
|
7795 |
|
7796 | /**
|
7797 | * if true, filter event data according to a specific list of events that have been
|
7798 | * manually vetted to not include any PII. See the implementation in Chromium for
|
7799 | * specifics.
|
7800 | */
|
7801 | enable_argument_filter?: boolean;
|
7802 | /**
|
7803 | * a list of tracing categories to exclude. Can include glob-like patterns using
|
7804 | * `*` at the end of the category name. See tracing categories for the list of
|
7805 | * categories.
|
7806 | */
|
7807 | excluded_categories?: string[];
|
7808 | /**
|
7809 | * a list of histogram names to report with the trace.
|
7810 | */
|
7811 | histogram_names?: string[];
|
7812 | /**
|
7813 | * a list of tracing categories to include. Can include glob-like patterns using
|
7814 | * `*` at the end of the category name. See tracing categories for the list of
|
7815 | * categories.
|
7816 | */
|
7817 | included_categories?: string[];
|
7818 | /**
|
7819 | * a list of process IDs to include in the trace. If not specified, trace all
|
7820 | * processes.
|
7821 | */
|
7822 | included_process_ids?: number[];
|
7823 | /**
|
7824 | * if the `disabled-by-default-memory-infra` category is enabled, this contains
|
7825 | * optional additional configuration for data collection. See the Chromium
|
7826 | * memory-infra docs for more information.
|
7827 | */
|
7828 | memory_dump_config?: Record<string, any>;
|
7829 | /**
|
7830 | * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
|
7831 | * or `trace-to-console`. Defaults to `record-until-full`.
|
7832 | */
|
7833 | recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
|
7834 | /**
|
7835 | * maximum size of the trace recording buffer in events.
|
7836 | */
|
7837 | trace_buffer_size_in_events?: number;
|
7838 | /**
|
7839 | * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
|
7840 | */
|
7841 | trace_buffer_size_in_kb?: number;
|
7842 | }
|
7843 |
|
7844 | interface Transaction {
|
7845 |
|
7846 | // Docs: http://electronjs.org/docs/api/structures/transaction
|
7847 |
|
7848 | /**
|
7849 | * The error code if an error occurred while processing the transaction.
|
7850 | */
|
7851 | errorCode: number;
|
7852 | /**
|
7853 | * The error message if an error occurred while processing the transaction.
|
7854 | */
|
7855 | errorMessage: string;
|
7856 | /**
|
7857 | * The identifier of the restored transaction by the App Store.
|
7858 | */
|
7859 | originalTransactionIdentifier: string;
|
7860 | payment: Payment;
|
7861 | /**
|
7862 | * The date the transaction was added to the App Store’s payment queue.
|
7863 | */
|
7864 | transactionDate: string;
|
7865 | /**
|
7866 | * A string that uniquely identifies a successful payment transaction.
|
7867 | */
|
7868 | transactionIdentifier: string;
|
7869 | /**
|
7870 | * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
|
7871 | * `deferred`.
|
7872 | */
|
7873 | transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
|
7874 | }
|
7875 |
|
7876 | class Tray extends NodeEventEmitter {
|
7877 |
|
7878 | // Docs: http://electronjs.org/docs/api/tray
|
7879 |
|
7880 | /**
|
7881 | * Emitted when the tray balloon is clicked.
|
7882 | *
|
7883 | * @platform win32
|
7884 | */
|
7885 | on(event: 'balloon-click', listener: Function): this;
|
7886 | once(event: 'balloon-click', listener: Function): this;
|
7887 | addListener(event: 'balloon-click', listener: Function): this;
|
7888 | removeListener(event: 'balloon-click', listener: Function): this;
|
7889 | /**
|
7890 | * Emitted when the tray balloon is closed because of timeout or user manually
|
7891 | * closes it.
|
7892 | *
|
7893 | * @platform win32
|
7894 | */
|
7895 | on(event: 'balloon-closed', listener: Function): this;
|
7896 | once(event: 'balloon-closed', listener: Function): this;
|
7897 | addListener(event: 'balloon-closed', listener: Function): this;
|
7898 | removeListener(event: 'balloon-closed', listener: Function): this;
|
7899 | /**
|
7900 | * Emitted when the tray balloon shows.
|
7901 | *
|
7902 | * @platform win32
|
7903 | */
|
7904 | on(event: 'balloon-show', listener: Function): this;
|
7905 | once(event: 'balloon-show', listener: Function): this;
|
7906 | addListener(event: 'balloon-show', listener: Function): this;
|
7907 | removeListener(event: 'balloon-show', listener: Function): this;
|
7908 | /**
|
7909 | * Emitted when the tray icon is clicked.
|
7910 | */
|
7911 | on(event: 'click', listener: (event: KeyboardEvent,
|
7912 | /**
|
7913 | * The bounds of tray icon.
|
7914 | */
|
7915 | bounds: Rectangle,
|
7916 | /**
|
7917 | * The position of the event.
|
7918 | */
|
7919 | position: Point) => void): this;
|
7920 | once(event: 'click', listener: (event: KeyboardEvent,
|
7921 | /**
|
7922 | * The bounds of tray icon.
|
7923 | */
|
7924 | bounds: Rectangle,
|
7925 | /**
|
7926 | * The position of the event.
|
7927 | */
|
7928 | position: Point) => void): this;
|
7929 | addListener(event: 'click', listener: (event: KeyboardEvent,
|
7930 | /**
|
7931 | * The bounds of tray icon.
|
7932 | */
|
7933 | bounds: Rectangle,
|
7934 | /**
|
7935 | * The position of the event.
|
7936 | */
|
7937 | position: Point) => void): this;
|
7938 | removeListener(event: 'click', listener: (event: KeyboardEvent,
|
7939 | /**
|
7940 | * The bounds of tray icon.
|
7941 | */
|
7942 | bounds: Rectangle,
|
7943 | /**
|
7944 | * The position of the event.
|
7945 | */
|
7946 | position: Point) => void): this;
|
7947 | /**
|
7948 | * Emitted when the tray icon is double clicked.
|
7949 | *
|
7950 | * @platform darwin,win32
|
7951 | */
|
7952 | on(event: 'double-click', listener: (event: KeyboardEvent,
|
7953 | /**
|
7954 | * The bounds of tray icon.
|
7955 | */
|
7956 | bounds: Rectangle) => void): this;
|
7957 | once(event: 'double-click', listener: (event: KeyboardEvent,
|
7958 | /**
|
7959 | * The bounds of tray icon.
|
7960 | */
|
7961 | bounds: Rectangle) => void): this;
|
7962 | addListener(event: 'double-click', listener: (event: KeyboardEvent,
|
7963 | /**
|
7964 | * The bounds of tray icon.
|
7965 | */
|
7966 | bounds: Rectangle) => void): this;
|
7967 | removeListener(event: 'double-click', listener: (event: KeyboardEvent,
|
7968 | /**
|
7969 | * The bounds of tray icon.
|
7970 | */
|
7971 | bounds: Rectangle) => void): this;
|
7972 | /**
|
7973 | * Emitted when a drag operation ends on the tray or ends at another location.
|
7974 | *
|
7975 | * @platform darwin
|
7976 | */
|
7977 | on(event: 'drag-end', listener: Function): this;
|
7978 | once(event: 'drag-end', listener: Function): this;
|
7979 | addListener(event: 'drag-end', listener: Function): this;
|
7980 | removeListener(event: 'drag-end', listener: Function): this;
|
7981 | /**
|
7982 | * Emitted when a drag operation enters the tray icon.
|
7983 | *
|
7984 | * @platform darwin
|
7985 | */
|
7986 | on(event: 'drag-enter', listener: Function): this;
|
7987 | once(event: 'drag-enter', listener: Function): this;
|
7988 | addListener(event: 'drag-enter', listener: Function): this;
|
7989 | removeListener(event: 'drag-enter', listener: Function): this;
|
7990 | /**
|
7991 | * Emitted when a drag operation exits the tray icon.
|
7992 | *
|
7993 | * @platform darwin
|
7994 | */
|
7995 | on(event: 'drag-leave', listener: Function): this;
|
7996 | once(event: 'drag-leave', listener: Function): this;
|
7997 | addListener(event: 'drag-leave', listener: Function): this;
|
7998 | removeListener(event: 'drag-leave', listener: Function): this;
|
7999 | /**
|
8000 | * Emitted when any dragged items are dropped on the tray icon.
|
8001 | *
|
8002 | * @platform darwin
|
8003 | */
|
8004 | on(event: 'drop', listener: Function): this;
|
8005 | once(event: 'drop', listener: Function): this;
|
8006 | addListener(event: 'drop', listener: Function): this;
|
8007 | removeListener(event: 'drop', listener: Function): this;
|
8008 | /**
|
8009 | * Emitted when dragged files are dropped in the tray icon.
|
8010 | *
|
8011 | * @platform darwin
|
8012 | */
|
8013 | on(event: 'drop-files', listener: (event: Event,
|
8014 | /**
|
8015 | * The paths of the dropped files.
|
8016 | */
|
8017 | files: string[]) => void): this;
|
8018 | once(event: 'drop-files', listener: (event: Event,
|
8019 | /**
|
8020 | * The paths of the dropped files.
|
8021 | */
|
8022 | files: string[]) => void): this;
|
8023 | addListener(event: 'drop-files', listener: (event: Event,
|
8024 | /**
|
8025 | * The paths of the dropped files.
|
8026 | */
|
8027 | files: string[]) => void): this;
|
8028 | removeListener(event: 'drop-files', listener: (event: Event,
|
8029 | /**
|
8030 | * The paths of the dropped files.
|
8031 | */
|
8032 | files: string[]) => void): this;
|
8033 | /**
|
8034 | * Emitted when dragged text is dropped in the tray icon.
|
8035 | *
|
8036 | * @platform darwin
|
8037 | */
|
8038 | on(event: 'drop-text', listener: (event: Event,
|
8039 | /**
|
8040 | * the dropped text string.
|
8041 | */
|
8042 | text: string) => void): this;
|
8043 | once(event: 'drop-text', listener: (event: Event,
|
8044 | /**
|
8045 | * the dropped text string.
|
8046 | */
|
8047 | text: string) => void): this;
|
8048 | addListener(event: 'drop-text', listener: (event: Event,
|
8049 | /**
|
8050 | * the dropped text string.
|
8051 | */
|
8052 | text: string) => void): this;
|
8053 | removeListener(event: 'drop-text', listener: (event: Event,
|
8054 | /**
|
8055 | * the dropped text string.
|
8056 | */
|
8057 | text: string) => void): this;
|
8058 | /**
|
8059 | * Emitted when the mouse clicks the tray icon.
|
8060 | *
|
8061 | * @platform darwin
|
8062 | */
|
8063 | on(event: 'mouse-down', listener: (event: KeyboardEvent,
|
8064 | /**
|
8065 | * The position of the event.
|
8066 | */
|
8067 | position: Point) => void): this;
|
8068 | once(event: 'mouse-down', listener: (event: KeyboardEvent,
|
8069 | /**
|
8070 | * The position of the event.
|
8071 | */
|
8072 | position: Point) => void): this;
|
8073 | addListener(event: 'mouse-down', listener: (event: KeyboardEvent,
|
8074 | /**
|
8075 | * The position of the event.
|
8076 | */
|
8077 | position: Point) => void): this;
|
8078 | removeListener(event: 'mouse-down', listener: (event: KeyboardEvent,
|
8079 | /**
|
8080 | * The position of the event.
|
8081 | */
|
8082 | position: Point) => void): this;
|
8083 | /**
|
8084 | * Emitted when the mouse enters the tray icon.
|
8085 | *
|
8086 | * @platform darwin
|
8087 | */
|
8088 | on(event: 'mouse-enter', listener: (event: KeyboardEvent,
|
8089 | /**
|
8090 | * The position of the event.
|
8091 | */
|
8092 | position: Point) => void): this;
|
8093 | once(event: 'mouse-enter', listener: (event: KeyboardEvent,
|
8094 | /**
|
8095 | * The position of the event.
|
8096 | */
|
8097 | position: Point) => void): this;
|
8098 | addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
|
8099 | /**
|
8100 | * The position of the event.
|
8101 | */
|
8102 | position: Point) => void): this;
|
8103 | removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
|
8104 | /**
|
8105 | * The position of the event.
|
8106 | */
|
8107 | position: Point) => void): this;
|
8108 | /**
|
8109 | * Emitted when the mouse exits the tray icon.
|
8110 | *
|
8111 | * @platform darwin
|
8112 | */
|
8113 | on(event: 'mouse-leave', listener: (event: KeyboardEvent,
|
8114 | /**
|
8115 | * The position of the event.
|
8116 | */
|
8117 | position: Point) => void): this;
|
8118 | once(event: 'mouse-leave', listener: (event: KeyboardEvent,
|
8119 | /**
|
8120 | * The position of the event.
|
8121 | */
|
8122 | position: Point) => void): this;
|
8123 | addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
|
8124 | /**
|
8125 | * The position of the event.
|
8126 | */
|
8127 | position: Point) => void): this;
|
8128 | removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
|
8129 | /**
|
8130 | * The position of the event.
|
8131 | */
|
8132 | position: Point) => void): this;
|
8133 | /**
|
8134 | * Emitted when the mouse moves in the tray icon.
|
8135 | *
|
8136 | * @platform darwin,win32
|
8137 | */
|
8138 | on(event: 'mouse-move', listener: (event: KeyboardEvent,
|
8139 | /**
|
8140 | * The position of the event.
|
8141 | */
|
8142 | position: Point) => void): this;
|
8143 | once(event: 'mouse-move', listener: (event: KeyboardEvent,
|
8144 | /**
|
8145 | * The position of the event.
|
8146 | */
|
8147 | position: Point) => void): this;
|
8148 | addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
|
8149 | /**
|
8150 | * The position of the event.
|
8151 | */
|
8152 | position: Point) => void): this;
|
8153 | removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
|
8154 | /**
|
8155 | * The position of the event.
|
8156 | */
|
8157 | position: Point) => void): this;
|
8158 | /**
|
8159 | * Emitted when the mouse is released from clicking the tray icon.
|
8160 | *
|
8161 | * Note: This will not be emitted if you have set a context menu for your Tray
|
8162 | * using `tray.setContextMenu`, as a result of macOS-level constraints.
|
8163 | *
|
8164 | * @platform darwin
|
8165 | */
|
8166 | on(event: 'mouse-up', listener: (event: KeyboardEvent,
|
8167 | /**
|
8168 | * The position of the event.
|
8169 | */
|
8170 | position: Point) => void): this;
|
8171 | once(event: 'mouse-up', listener: (event: KeyboardEvent,
|
8172 | /**
|
8173 | * The position of the event.
|
8174 | */
|
8175 | position: Point) => void): this;
|
8176 | addListener(event: 'mouse-up', listener: (event: KeyboardEvent,
|
8177 | /**
|
8178 | * The position of the event.
|
8179 | */
|
8180 | position: Point) => void): this;
|
8181 | removeListener(event: 'mouse-up', listener: (event: KeyboardEvent,
|
8182 | /**
|
8183 | * The position of the event.
|
8184 | */
|
8185 | position: Point) => void): this;
|
8186 | /**
|
8187 | * Emitted when the tray icon is right clicked.
|
8188 | *
|
8189 | * @platform darwin,win32
|
8190 | */
|
8191 | on(event: 'right-click', listener: (event: KeyboardEvent,
|
8192 | /**
|
8193 | * The bounds of tray icon.
|
8194 | */
|
8195 | bounds: Rectangle) => void): this;
|
8196 | once(event: 'right-click', listener: (event: KeyboardEvent,
|
8197 | /**
|
8198 | * The bounds of tray icon.
|
8199 | */
|
8200 | bounds: Rectangle) => void): this;
|
8201 | addListener(event: 'right-click', listener: (event: KeyboardEvent,
|
8202 | /**
|
8203 | * The bounds of tray icon.
|
8204 | */
|
8205 | bounds: Rectangle) => void): this;
|
8206 | removeListener(event: 'right-click', listener: (event: KeyboardEvent,
|
8207 | /**
|
8208 | * The bounds of tray icon.
|
8209 | */
|
8210 | bounds: Rectangle) => void): this;
|
8211 | /**
|
8212 | * Tray
|
8213 | */
|
8214 | constructor(image: (NativeImage) | (string), guid?: string);
|
8215 | /**
|
8216 | * Closes an open context menu, as set by `tray.setContextMenu()`.
|
8217 | *
|
8218 | * @platform darwin,win32
|
8219 | */
|
8220 | closeContextMenu(): void;
|
8221 | /**
|
8222 | * Destroys the tray icon immediately.
|
8223 | */
|
8224 | destroy(): void;
|
8225 | /**
|
8226 | * Displays a tray balloon.
|
8227 | *
|
8228 | * @platform win32
|
8229 | */
|
8230 | displayBalloon(options: DisplayBalloonOptions): void;
|
8231 | /**
|
8232 | * Returns focus to the taskbar notification area. Notification area icons should
|
8233 | * use this message when they have completed their UI operation. For example, if
|
8234 | * the icon displays a shortcut menu, but the user presses ESC to cancel it, use
|
8235 | * `tray.focus()` to return focus to the notification area.
|
8236 | *
|
8237 | * @platform win32
|
8238 | */
|
8239 | focus(): void;
|
8240 | /**
|
8241 | * The `bounds` of this tray icon as `Object`.
|
8242 | *
|
8243 | * @platform darwin,win32
|
8244 | */
|
8245 | getBounds(): Rectangle;
|
8246 | /**
|
8247 | * Whether double click events will be ignored.
|
8248 | *
|
8249 | * @platform darwin
|
8250 | */
|
8251 | getIgnoreDoubleClickEvents(): boolean;
|
8252 | /**
|
8253 | * the title displayed next to the tray icon in the status bar
|
8254 | *
|
8255 | * @platform darwin
|
8256 | */
|
8257 | getTitle(): string;
|
8258 | /**
|
8259 | * Whether the tray icon is destroyed.
|
8260 | */
|
8261 | isDestroyed(): boolean;
|
8262 | /**
|
8263 | * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
|
8264 | * will be shown instead of the tray icon's context menu.
|
8265 | *
|
8266 | The `position` is only available on Windows, and it is (0, 0) by default.
|
8267 | *
|
8268 | * @platform darwin,win32
|
8269 | */
|
8270 | popUpContextMenu(menu?: Menu, position?: Point): void;
|
8271 | /**
|
8272 | * Removes a tray balloon.
|
8273 | *
|
8274 | * @platform win32
|
8275 | */
|
8276 | removeBalloon(): void;
|
8277 | /**
|
8278 | * Sets the context menu for this icon.
|
8279 | */
|
8280 | setContextMenu(menu: (Menu) | (null)): void;
|
8281 | /**
|
8282 | * Sets the option to ignore double click events. Ignoring these events allows you
|
8283 | * to detect every individual click of the tray icon.
|
8284 | *
|
8285 | This value is set to false by default.
|
8286 | *
|
8287 | * @platform darwin
|
8288 | */
|
8289 | setIgnoreDoubleClickEvents(ignore: boolean): void;
|
8290 | /**
|
8291 | * Sets the `image` associated with this tray icon.
|
8292 | */
|
8293 | setImage(image: (NativeImage) | (string)): void;
|
8294 | /**
|
8295 | * Sets the `image` associated with this tray icon when pressed on macOS.
|
8296 | *
|
8297 | * @platform darwin
|
8298 | */
|
8299 | setPressedImage(image: (NativeImage) | (string)): void;
|
8300 | /**
|
8301 | * Sets the title displayed next to the tray icon in the status bar (Support ANSI
|
8302 | * colors).
|
8303 | *
|
8304 | * @platform darwin
|
8305 | */
|
8306 | setTitle(title: string): void;
|
8307 | /**
|
8308 | * Sets the hover text for this tray icon.
|
8309 | */
|
8310 | setToolTip(toolTip: string): void;
|
8311 | }
|
8312 |
|
8313 | interface UploadBlob {
|
8314 |
|
8315 | // Docs: http://electronjs.org/docs/api/structures/upload-blob
|
8316 |
|
8317 | /**
|
8318 | * UUID of blob data to upload.
|
8319 | */
|
8320 | blobUUID: string;
|
8321 | /**
|
8322 | * `blob`.
|
8323 | */
|
8324 | type: string;
|
8325 | }
|
8326 |
|
8327 | interface UploadData {
|
8328 |
|
8329 | // Docs: http://electronjs.org/docs/api/structures/upload-data
|
8330 |
|
8331 | /**
|
8332 | * UUID of blob data. Use ses.getBlobData method to retrieve the data.
|
8333 | */
|
8334 | blobUUID?: string;
|
8335 | /**
|
8336 | * Content being sent.
|
8337 | */
|
8338 | bytes: Buffer;
|
8339 | /**
|
8340 | * Path of file being uploaded.
|
8341 | */
|
8342 | file?: string;
|
8343 | }
|
8344 |
|
8345 | interface UploadFile {
|
8346 |
|
8347 | // Docs: http://electronjs.org/docs/api/structures/upload-file
|
8348 |
|
8349 | /**
|
8350 | * Path of file to be uploaded.
|
8351 | */
|
8352 | filePath: string;
|
8353 | /**
|
8354 | * Number of bytes to read from `offset`. Defaults to `0`.
|
8355 | */
|
8356 | length: number;
|
8357 | /**
|
8358 | * Last Modification time in number of seconds since the UNIX epoch.
|
8359 | */
|
8360 | modificationTime: number;
|
8361 | /**
|
8362 | * Defaults to `0`.
|
8363 | */
|
8364 | offset: number;
|
8365 | /**
|
8366 | * `file`.
|
8367 | */
|
8368 | type: string;
|
8369 | }
|
8370 |
|
8371 | interface UploadRawData {
|
8372 |
|
8373 | // Docs: http://electronjs.org/docs/api/structures/upload-raw-data
|
8374 |
|
8375 | /**
|
8376 | * Data to be uploaded.
|
8377 | */
|
8378 | bytes: Buffer;
|
8379 | /**
|
8380 | * `rawData`.
|
8381 | */
|
8382 | type: string;
|
8383 | }
|
8384 |
|
8385 | class WebContents extends NodeEventEmitter {
|
8386 |
|
8387 | // Docs: http://electronjs.org/docs/api/web-contents
|
8388 |
|
8389 | /**
|
8390 | * A WebContents instance with the given ID.
|
8391 | */
|
8392 | static fromId(id: number): WebContents;
|
8393 | /**
|
8394 | * An array of all `WebContents` instances. This will contain web contents for all
|
8395 | * windows, webviews, opened devtools, and devtools extension background pages.
|
8396 | */
|
8397 | static getAllWebContents(): WebContents[];
|
8398 | /**
|
8399 | * The web contents that is focused in this application, otherwise returns `null`.
|
8400 | */
|
8401 | static getFocusedWebContents(): WebContents;
|
8402 | /**
|
8403 | * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
|
8404 | * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
|
8405 | * menu shortcuts.
|
8406 | *
|
8407 | To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
|
8408 | */
|
8409 | on(event: 'before-input-event', listener: (event: Event,
|
8410 | /**
|
8411 | * Input properties.
|
8412 | */
|
8413 | input: Input) => void): this;
|
8414 | once(event: 'before-input-event', listener: (event: Event,
|
8415 | /**
|
8416 | * Input properties.
|
8417 | */
|
8418 | input: Input) => void): this;
|
8419 | addListener(event: 'before-input-event', listener: (event: Event,
|
8420 | /**
|
8421 | * Input properties.
|
8422 | */
|
8423 | input: Input) => void): this;
|
8424 | removeListener(event: 'before-input-event', listener: (event: Event,
|
8425 | /**
|
8426 | * Input properties.
|
8427 | */
|
8428 | input: Input) => void): this;
|
8429 | /**
|
8430 | * Emitted when failed to verify the `certificate` for `url`.
|
8431 | *
|
8432 | The usage is the same with the `certificate-error` event of `app`.
|
8433 | */
|
8434 | on(event: 'certificate-error', listener: (event: Event,
|
8435 | url: string,
|
8436 | /**
|
8437 | * The error code.
|
8438 | */
|
8439 | error: string,
|
8440 | certificate: Certificate,
|
8441 | callback: (isTrusted: boolean) => void) => void): this;
|
8442 | once(event: 'certificate-error', listener: (event: Event,
|
8443 | url: string,
|
8444 | /**
|
8445 | * The error code.
|
8446 | */
|
8447 | error: string,
|
8448 | certificate: Certificate,
|
8449 | callback: (isTrusted: boolean) => void) => void): this;
|
8450 | addListener(event: 'certificate-error', listener: (event: Event,
|
8451 | url: string,
|
8452 | /**
|
8453 | * The error code.
|
8454 | */
|
8455 | error: string,
|
8456 | certificate: Certificate,
|
8457 | callback: (isTrusted: boolean) => void) => void): this;
|
8458 | removeListener(event: 'certificate-error', listener: (event: Event,
|
8459 | url: string,
|
8460 | /**
|
8461 | * The error code.
|
8462 | */
|
8463 | error: string,
|
8464 | certificate: Certificate,
|
8465 | callback: (isTrusted: boolean) => void) => void): this;
|
8466 | /**
|
8467 | * Emitted when the associated window logs a console message.
|
8468 | */
|
8469 | on(event: 'console-message', listener: (event: Event,
|
8470 | /**
|
8471 | * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
|
8472 | * `error`.
|
8473 | */
|
8474 | level: number,
|
8475 | /**
|
8476 | * The actual console message
|
8477 | */
|
8478 | message: string,
|
8479 | /**
|
8480 | * The line number of the source that triggered this console message
|
8481 | */
|
8482 | line: number,
|
8483 | sourceId: string) => void): this;
|
8484 | once(event: 'console-message', listener: (event: Event,
|
8485 | /**
|
8486 | * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
|
8487 | * `error`.
|
8488 | */
|
8489 | level: number,
|
8490 | /**
|
8491 | * The actual console message
|
8492 | */
|
8493 | message: string,
|
8494 | /**
|
8495 | * The line number of the source that triggered this console message
|
8496 | */
|
8497 | line: number,
|
8498 | sourceId: string) => void): this;
|
8499 | addListener(event: 'console-message', listener: (event: Event,
|
8500 | /**
|
8501 | * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
|
8502 | * `error`.
|
8503 | */
|
8504 | level: number,
|
8505 | /**
|
8506 | * The actual console message
|
8507 | */
|
8508 | message: string,
|
8509 | /**
|
8510 | * The line number of the source that triggered this console message
|
8511 | */
|
8512 | line: number,
|
8513 | sourceId: string) => void): this;
|
8514 | removeListener(event: 'console-message', listener: (event: Event,
|
8515 | /**
|
8516 | * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
|
8517 | * `error`.
|
8518 | */
|
8519 | level: number,
|
8520 | /**
|
8521 | * The actual console message
|
8522 | */
|
8523 | message: string,
|
8524 | /**
|
8525 | * The line number of the source that triggered this console message
|
8526 | */
|
8527 | line: number,
|
8528 | sourceId: string) => void): this;
|
8529 | /**
|
8530 | * Emitted when there is a new context menu that needs to be handled.
|
8531 | */
|
8532 | on(event: 'context-menu', listener: (event: Event,
|
8533 | params: ContextMenuParams) => void): this;
|
8534 | once(event: 'context-menu', listener: (event: Event,
|
8535 | params: ContextMenuParams) => void): this;
|
8536 | addListener(event: 'context-menu', listener: (event: Event,
|
8537 | params: ContextMenuParams) => void): this;
|
8538 | removeListener(event: 'context-menu', listener: (event: Event,
|
8539 | params: ContextMenuParams) => void): this;
|
8540 | /**
|
8541 | * Emitted when the renderer process crashes or is killed.
|
8542 | *
|
8543 | * **Deprecated:** This event is superceded by the `render-process-gone` event
|
8544 | * which contains more information about why the render process dissapeared. It
|
8545 | * isn't always because it crashed. The `killed` boolean can be replaced by
|
8546 | * checking `reason === 'killed'` when you switch to that event.
|
8547 | *
|
8548 | * @deprecated
|
8549 | */
|
8550 | on(event: 'crashed', listener: (event: Event,
|
8551 | killed: boolean) => void): this;
|
8552 | once(event: 'crashed', listener: (event: Event,
|
8553 | killed: boolean) => void): this;
|
8554 | addListener(event: 'crashed', listener: (event: Event,
|
8555 | killed: boolean) => void): this;
|
8556 | removeListener(event: 'crashed', listener: (event: Event,
|
8557 | killed: boolean) => void): this;
|
8558 | /**
|
8559 | * Emitted when the cursor's type changes. The `type` parameter can be `default`,
|
8560 | * `crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
|
8561 | * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
|
8562 | * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
|
8563 | * `row-resize`, `m-panning`, `e-panning`, `n-panning`, `ne-panning`, `nw-panning`,
|
8564 | * `s-panning`, `se-panning`, `sw-panning`, `w-panning`, `move`, `vertical-text`,
|
8565 | * `cell`, `context-menu`, `alias`, `progress`, `nodrop`, `copy`, `none`,
|
8566 | * `not-allowed`, `zoom-in`, `zoom-out`, `grab`, `grabbing` or `custom`.
|
8567 | *
|
8568 | * If the `type` parameter is `custom`, the `image` parameter will hold the custom
|
8569 | * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
|
8570 | * additional information about the custom cursor.
|
8571 | */
|
8572 | on(event: 'cursor-changed', listener: (event: Event,
|
8573 | type: string,
|
8574 | image: NativeImage,
|
8575 | /**
|
8576 | * scaling factor for the custom cursor.
|
8577 | */
|
8578 | scale: number,
|
8579 | /**
|
8580 | * the size of the `image`.
|
8581 | */
|
8582 | size: Size,
|
8583 | /**
|
8584 | * coordinates of the custom cursor's hotspot.
|
8585 | */
|
8586 | hotspot: Point) => void): this;
|
8587 | once(event: 'cursor-changed', listener: (event: Event,
|
8588 | type: string,
|
8589 | image: NativeImage,
|
8590 | /**
|
8591 | * scaling factor for the custom cursor.
|
8592 | */
|
8593 | scale: number,
|
8594 | /**
|
8595 | * the size of the `image`.
|
8596 | */
|
8597 | size: Size,
|
8598 | /**
|
8599 | * coordinates of the custom cursor's hotspot.
|
8600 | */
|
8601 | hotspot: Point) => void): this;
|
8602 | addListener(event: 'cursor-changed', listener: (event: Event,
|
8603 | type: string,
|
8604 | image: NativeImage,
|
8605 | /**
|
8606 | * scaling factor for the custom cursor.
|
8607 | */
|
8608 | scale: number,
|
8609 | /**
|
8610 | * the size of the `image`.
|
8611 | */
|
8612 | size: Size,
|
8613 | /**
|
8614 | * coordinates of the custom cursor's hotspot.
|
8615 | */
|
8616 | hotspot: Point) => void): this;
|
8617 | removeListener(event: 'cursor-changed', listener: (event: Event,
|
8618 | type: string,
|
8619 | image: NativeImage,
|
8620 | /**
|
8621 | * scaling factor for the custom cursor.
|
8622 | */
|
8623 | scale: number,
|
8624 | /**
|
8625 | * the size of the `image`.
|
8626 | */
|
8627 | size: Size,
|
8628 | /**
|
8629 | * coordinates of the custom cursor's hotspot.
|
8630 | */
|
8631 | hotspot: Point) => void): this;
|
8632 | /**
|
8633 | * Emitted when `desktopCapturer.getSources()` is called in the renderer process.
|
8634 | * Calling `event.preventDefault()` will make it return empty sources.
|
8635 | */
|
8636 | on(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
|
8637 | once(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
|
8638 | addListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
|
8639 | removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
|
8640 | /**
|
8641 | * Emitted when `webContents` is destroyed.
|
8642 | */
|
8643 | on(event: 'destroyed', listener: Function): this;
|
8644 | once(event: 'destroyed', listener: Function): this;
|
8645 | addListener(event: 'destroyed', listener: Function): this;
|
8646 | removeListener(event: 'destroyed', listener: Function): this;
|
8647 | /**
|
8648 | * Emitted when DevTools is closed.
|
8649 | */
|
8650 | on(event: 'devtools-closed', listener: Function): this;
|
8651 | once(event: 'devtools-closed', listener: Function): this;
|
8652 | addListener(event: 'devtools-closed', listener: Function): this;
|
8653 | removeListener(event: 'devtools-closed', listener: Function): this;
|
8654 | /**
|
8655 | * Emitted when DevTools is focused / opened.
|
8656 | */
|
8657 | on(event: 'devtools-focused', listener: Function): this;
|
8658 | once(event: 'devtools-focused', listener: Function): this;
|
8659 | addListener(event: 'devtools-focused', listener: Function): this;
|
8660 | removeListener(event: 'devtools-focused', listener: Function): this;
|
8661 | /**
|
8662 | * Emitted when DevTools is opened.
|
8663 | */
|
8664 | on(event: 'devtools-opened', listener: Function): this;
|
8665 | once(event: 'devtools-opened', listener: Function): this;
|
8666 | addListener(event: 'devtools-opened', listener: Function): this;
|
8667 | removeListener(event: 'devtools-opened', listener: Function): this;
|
8668 | /**
|
8669 | * Emitted when the devtools window instructs the webContents to reload
|
8670 | */
|
8671 | on(event: 'devtools-reload-page', listener: Function): this;
|
8672 | once(event: 'devtools-reload-page', listener: Function): this;
|
8673 | addListener(event: 'devtools-reload-page', listener: Function): this;
|
8674 | removeListener(event: 'devtools-reload-page', listener: Function): this;
|
8675 | /**
|
8676 | * Emitted when a `<webview>` has been attached to this web contents.
|
8677 | */
|
8678 | on(event: 'did-attach-webview', listener: (event: Event,
|
8679 | /**
|
8680 | * The guest web contents that is used by the `<webview>`.
|
8681 | */
|
8682 | webContents: WebContents) => void): this;
|
8683 | once(event: 'did-attach-webview', listener: (event: Event,
|
8684 | /**
|
8685 | * The guest web contents that is used by the `<webview>`.
|
8686 | */
|
8687 | webContents: WebContents) => void): this;
|
8688 | addListener(event: 'did-attach-webview', listener: (event: Event,
|
8689 | /**
|
8690 | * The guest web contents that is used by the `<webview>`.
|
8691 | */
|
8692 | webContents: WebContents) => void): this;
|
8693 | removeListener(event: 'did-attach-webview', listener: (event: Event,
|
8694 | /**
|
8695 | * The guest web contents that is used by the `<webview>`.
|
8696 | */
|
8697 | webContents: WebContents) => void): this;
|
8698 | /**
|
8699 | * Emitted when a page's theme color changes. This is usually due to encountering a
|
8700 | * meta tag:
|
8701 | */
|
8702 | on(event: 'did-change-theme-color', listener: (event: Event,
|
8703 | /**
|
8704 | * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
|
8705 | */
|
8706 | color: (string) | (null)) => void): this;
|
8707 | once(event: 'did-change-theme-color', listener: (event: Event,
|
8708 | /**
|
8709 | * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
|
8710 | */
|
8711 | color: (string) | (null)) => void): this;
|
8712 | addListener(event: 'did-change-theme-color', listener: (event: Event,
|
8713 | /**
|
8714 | * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
|
8715 | */
|
8716 | color: (string) | (null)) => void): this;
|
8717 | removeListener(event: 'did-change-theme-color', listener: (event: Event,
|
8718 | /**
|
8719 | * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
|
8720 | */
|
8721 | color: (string) | (null)) => void): this;
|
8722 | /**
|
8723 | * This event is like `did-finish-load` but emitted when the load failed. The full
|
8724 | * list of error codes and their meaning is available here.
|
8725 | */
|
8726 | on(event: 'did-fail-load', listener: (event: Event,
|
8727 | errorCode: number,
|
8728 | errorDescription: string,
|
8729 | validatedURL: string,
|
8730 | isMainFrame: boolean,
|
8731 | frameProcessId: number,
|
8732 | frameRoutingId: number) => void): this;
|
8733 | once(event: 'did-fail-load', listener: (event: Event,
|
8734 | errorCode: number,
|
8735 | errorDescription: string,
|
8736 | validatedURL: string,
|
8737 | isMainFrame: boolean,
|
8738 | frameProcessId: number,
|
8739 | frameRoutingId: number) => void): this;
|
8740 | addListener(event: 'did-fail-load', listener: (event: Event,
|
8741 | errorCode: number,
|
8742 | errorDescription: string,
|
8743 | validatedURL: string,
|
8744 | isMainFrame: boolean,
|
8745 | frameProcessId: number,
|
8746 | frameRoutingId: number) => void): this;
|
8747 | removeListener(event: 'did-fail-load', listener: (event: Event,
|
8748 | errorCode: number,
|
8749 | errorDescription: string,
|
8750 | validatedURL: string,
|
8751 | isMainFrame: boolean,
|
8752 | frameProcessId: number,
|
8753 | frameRoutingId: number) => void): this;
|
8754 | /**
|
8755 | * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
|
8756 | * `window.stop()` was invoked).
|
8757 | */
|
8758 | on(event: 'did-fail-provisional-load', listener: (event: Event,
|
8759 | errorCode: number,
|
8760 | errorDescription: string,
|
8761 | validatedURL: string,
|
8762 | isMainFrame: boolean,
|
8763 | frameProcessId: number,
|
8764 | frameRoutingId: number) => void): this;
|
8765 | once(event: 'did-fail-provisional-load', listener: (event: Event,
|
8766 | errorCode: number,
|
8767 | errorDescription: string,
|
8768 | validatedURL: string,
|
8769 | isMainFrame: boolean,
|
8770 | frameProcessId: number,
|
8771 | frameRoutingId: number) => void): this;
|
8772 | addListener(event: 'did-fail-provisional-load', listener: (event: Event,
|
8773 | errorCode: number,
|
8774 | errorDescription: string,
|
8775 | validatedURL: string,
|
8776 | isMainFrame: boolean,
|
8777 | frameProcessId: number,
|
8778 | frameRoutingId: number) => void): this;
|
8779 | removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
|
8780 | errorCode: number,
|
8781 | errorDescription: string,
|
8782 | validatedURL: string,
|
8783 | isMainFrame: boolean,
|
8784 | frameProcessId: number,
|
8785 | frameRoutingId: number) => void): this;
|
8786 | /**
|
8787 | * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
|
8788 | * spinning, and the `onload` event was dispatched.
|
8789 | */
|
8790 | on(event: 'did-finish-load', listener: Function): this;
|
8791 | once(event: 'did-finish-load', listener: Function): this;
|
8792 | addListener(event: 'did-finish-load', listener: Function): this;
|
8793 | removeListener(event: 'did-finish-load', listener: Function): this;
|
8794 | /**
|
8795 | * Emitted when a frame has done navigation.
|
8796 | */
|
8797 | on(event: 'did-frame-finish-load', listener: (event: Event,
|
8798 | isMainFrame: boolean,
|
8799 | frameProcessId: number,
|
8800 | frameRoutingId: number) => void): this;
|
8801 | once(event: 'did-frame-finish-load', listener: (event: Event,
|
8802 | isMainFrame: boolean,
|
8803 | frameProcessId: number,
|
8804 | frameRoutingId: number) => void): this;
|
8805 | addListener(event: 'did-frame-finish-load', listener: (event: Event,
|
8806 | isMainFrame: boolean,
|
8807 | frameProcessId: number,
|
8808 | frameRoutingId: number) => void): this;
|
8809 | removeListener(event: 'did-frame-finish-load', listener: (event: Event,
|
8810 | isMainFrame: boolean,
|
8811 | frameProcessId: number,
|
8812 | frameRoutingId: number) => void): this;
|
8813 | /**
|
8814 | * Emitted when any frame navigation is done.
|
8815 | *
|
8816 | * This event is not emitted for in-page navigations, such as clicking anchor links
|
8817 | * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
|
8818 | * this purpose.
|
8819 | */
|
8820 | on(event: 'did-frame-navigate', listener: (event: Event,
|
8821 | url: string,
|
8822 | /**
|
8823 | * -1 for non HTTP navigations
|
8824 | */
|
8825 | httpResponseCode: number,
|
8826 | /**
|
8827 | * empty for non HTTP navigations,
|
8828 | */
|
8829 | httpStatusText: string,
|
8830 | isMainFrame: boolean,
|
8831 | frameProcessId: number,
|
8832 | frameRoutingId: number) => void): this;
|
8833 | once(event: 'did-frame-navigate', listener: (event: Event,
|
8834 | url: string,
|
8835 | /**
|
8836 | * -1 for non HTTP navigations
|
8837 | */
|
8838 | httpResponseCode: number,
|
8839 | /**
|
8840 | * empty for non HTTP navigations,
|
8841 | */
|
8842 | httpStatusText: string,
|
8843 | isMainFrame: boolean,
|
8844 | frameProcessId: number,
|
8845 | frameRoutingId: number) => void): this;
|
8846 | addListener(event: 'did-frame-navigate', listener: (event: Event,
|
8847 | url: string,
|
8848 | /**
|
8849 | * -1 for non HTTP navigations
|
8850 | */
|
8851 | httpResponseCode: number,
|
8852 | /**
|
8853 | * empty for non HTTP navigations,
|
8854 | */
|
8855 | httpStatusText: string,
|
8856 | isMainFrame: boolean,
|
8857 | frameProcessId: number,
|
8858 | frameRoutingId: number) => void): this;
|
8859 | removeListener(event: 'did-frame-navigate', listener: (event: Event,
|
8860 | url: string,
|
8861 | /**
|
8862 | * -1 for non HTTP navigations
|
8863 | */
|
8864 | httpResponseCode: number,
|
8865 | /**
|
8866 | * empty for non HTTP navigations,
|
8867 | */
|
8868 | httpStatusText: string,
|
8869 | isMainFrame: boolean,
|
8870 | frameProcessId: number,
|
8871 | frameRoutingId: number) => void): this;
|
8872 | /**
|
8873 | * Emitted when a main frame navigation is done.
|
8874 | *
|
8875 | * This event is not emitted for in-page navigations, such as clicking anchor links
|
8876 | * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
|
8877 | * this purpose.
|
8878 | */
|
8879 | on(event: 'did-navigate', listener: (event: Event,
|
8880 | url: string,
|
8881 | /**
|
8882 | * -1 for non HTTP navigations
|
8883 | */
|
8884 | httpResponseCode: number,
|
8885 | /**
|
8886 | * empty for non HTTP navigations
|
8887 | */
|
8888 | httpStatusText: string) => void): this;
|
8889 | once(event: 'did-navigate', listener: (event: Event,
|
8890 | url: string,
|
8891 | /**
|
8892 | * -1 for non HTTP navigations
|
8893 | */
|
8894 | httpResponseCode: number,
|
8895 | /**
|
8896 | * empty for non HTTP navigations
|
8897 | */
|
8898 | httpStatusText: string) => void): this;
|
8899 | addListener(event: 'did-navigate', listener: (event: Event,
|
8900 | url: string,
|
8901 | /**
|
8902 | * -1 for non HTTP navigations
|
8903 | */
|
8904 | httpResponseCode: number,
|
8905 | /**
|
8906 | * empty for non HTTP navigations
|
8907 | */
|
8908 | httpStatusText: string) => void): this;
|
8909 | removeListener(event: 'did-navigate', listener: (event: Event,
|
8910 | url: string,
|
8911 | /**
|
8912 | * -1 for non HTTP navigations
|
8913 | */
|
8914 | httpResponseCode: number,
|
8915 | /**
|
8916 | * empty for non HTTP navigations
|
8917 | */
|
8918 | httpStatusText: string) => void): this;
|
8919 | /**
|
8920 | * Emitted when an in-page navigation happened in any frame.
|
8921 | *
|
8922 | * When in-page navigation happens, the page URL changes but does not cause
|
8923 | * navigation outside of the page. Examples of this occurring are when anchor links
|
8924 | * are clicked or when the DOM `hashchange` event is triggered.
|
8925 | */
|
8926 | on(event: 'did-navigate-in-page', listener: (event: Event,
|
8927 | url: string,
|
8928 | isMainFrame: boolean,
|
8929 | frameProcessId: number,
|
8930 | frameRoutingId: number) => void): this;
|
8931 | once(event: 'did-navigate-in-page', listener: (event: Event,
|
8932 | url: string,
|
8933 | isMainFrame: boolean,
|
8934 | frameProcessId: number,
|
8935 | frameRoutingId: number) => void): this;
|
8936 | addListener(event: 'did-navigate-in-page', listener: (event: Event,
|
8937 | url: string,
|
8938 | isMainFrame: boolean,
|
8939 | frameProcessId: number,
|
8940 | frameRoutingId: number) => void): this;
|
8941 | removeListener(event: 'did-navigate-in-page', listener: (event: Event,
|
8942 | url: string,
|
8943 | isMainFrame: boolean,
|
8944 | frameProcessId: number,
|
8945 | frameRoutingId: number) => void): this;
|
8946 | /**
|
8947 | * Emitted after a server side redirect occurs during navigation. For example a
|
8948 | * 302 redirect.
|
8949 | *
|
8950 | * This event can not be prevented, if you want to prevent redirects you should
|
8951 | * checkout out the `will-redirect` event above.
|
8952 | */
|
8953 | on(event: 'did-redirect-navigation', listener: (event: Event,
|
8954 | url: string,
|
8955 | isInPlace: boolean,
|
8956 | isMainFrame: boolean,
|
8957 | frameProcessId: number,
|
8958 | frameRoutingId: number) => void): this;
|
8959 | once(event: 'did-redirect-navigation', listener: (event: Event,
|
8960 | url: string,
|
8961 | isInPlace: boolean,
|
8962 | isMainFrame: boolean,
|
8963 | frameProcessId: number,
|
8964 | frameRoutingId: number) => void): this;
|
8965 | addListener(event: 'did-redirect-navigation', listener: (event: Event,
|
8966 | url: string,
|
8967 | isInPlace: boolean,
|
8968 | isMainFrame: boolean,
|
8969 | frameProcessId: number,
|
8970 | frameRoutingId: number) => void): this;
|
8971 | removeListener(event: 'did-redirect-navigation', listener: (event: Event,
|
8972 | url: string,
|
8973 | isInPlace: boolean,
|
8974 | isMainFrame: boolean,
|
8975 | frameProcessId: number,
|
8976 | frameRoutingId: number) => void): this;
|
8977 | /**
|
8978 | * Corresponds to the points in time when the spinner of the tab started spinning.
|
8979 | */
|
8980 | on(event: 'did-start-loading', listener: Function): this;
|
8981 | once(event: 'did-start-loading', listener: Function): this;
|
8982 | addListener(event: 'did-start-loading', listener: Function): this;
|
8983 | removeListener(event: 'did-start-loading', listener: Function): this;
|
8984 | /**
|
8985 | * Emitted when any frame (including main) starts navigating. `isInplace` will be
|
8986 | * `true` for in-page navigations.
|
8987 | */
|
8988 | on(event: 'did-start-navigation', listener: (event: Event,
|
8989 | url: string,
|
8990 | isInPlace: boolean,
|
8991 | isMainFrame: boolean,
|
8992 | frameProcessId: number,
|
8993 | frameRoutingId: number) => void): this;
|
8994 | once(event: 'did-start-navigation', listener: (event: Event,
|
8995 | url: string,
|
8996 | isInPlace: boolean,
|
8997 | isMainFrame: boolean,
|
8998 | frameProcessId: number,
|
8999 | frameRoutingId: number) => void): this;
|
9000 | addListener(event: 'did-start-navigation', listener: (event: Event,
|
9001 | url: string,
|
9002 | isInPlace: boolean,
|
9003 | isMainFrame: boolean,
|
9004 | frameProcessId: number,
|
9005 | frameRoutingId: number) => void): this;
|
9006 | removeListener(event: 'did-start-navigation', listener: (event: Event,
|
9007 | url: string,
|
9008 | isInPlace: boolean,
|
9009 | isMainFrame: boolean,
|
9010 | frameProcessId: number,
|
9011 | frameRoutingId: number) => void): this;
|
9012 | /**
|
9013 | * Corresponds to the points in time when the spinner of the tab stopped spinning.
|
9014 | */
|
9015 | on(event: 'did-stop-loading', listener: Function): this;
|
9016 | once(event: 'did-stop-loading', listener: Function): this;
|
9017 | addListener(event: 'did-stop-loading', listener: Function): this;
|
9018 | removeListener(event: 'did-stop-loading', listener: Function): this;
|
9019 | /**
|
9020 | * Emitted when the document in the given frame is loaded.
|
9021 | */
|
9022 | on(event: 'dom-ready', listener: (event: Event) => void): this;
|
9023 | once(event: 'dom-ready', listener: (event: Event) => void): this;
|
9024 | addListener(event: 'dom-ready', listener: (event: Event) => void): this;
|
9025 | removeListener(event: 'dom-ready', listener: (event: Event) => void): this;
|
9026 | /**
|
9027 | * Emitted when the window enters a full-screen state triggered by HTML API.
|
9028 | */
|
9029 | on(event: 'enter-html-full-screen', listener: Function): this;
|
9030 | once(event: 'enter-html-full-screen', listener: Function): this;
|
9031 | addListener(event: 'enter-html-full-screen', listener: Function): this;
|
9032 | removeListener(event: 'enter-html-full-screen', listener: Function): this;
|
9033 | /**
|
9034 | * Emitted when a result is available for [`webContents.findInPage`] request.
|
9035 | */
|
9036 | on(event: 'found-in-page', listener: (event: Event,
|
9037 | result: Result) => void): this;
|
9038 | once(event: 'found-in-page', listener: (event: Event,
|
9039 | result: Result) => void): this;
|
9040 | addListener(event: 'found-in-page', listener: (event: Event,
|
9041 | result: Result) => void): this;
|
9042 | removeListener(event: 'found-in-page', listener: (event: Event,
|
9043 | result: Result) => void): this;
|
9044 | /**
|
9045 | * Emitted when the renderer process sends an asynchronous message via
|
9046 | * `ipcRenderer.send()`.
|
9047 | */
|
9048 | on(event: 'ipc-message', listener: (event: Event,
|
9049 | channel: string,
|
9050 | ...args: any[]) => void): this;
|
9051 | once(event: 'ipc-message', listener: (event: Event,
|
9052 | channel: string,
|
9053 | ...args: any[]) => void): this;
|
9054 | addListener(event: 'ipc-message', listener: (event: Event,
|
9055 | channel: string,
|
9056 | ...args: any[]) => void): this;
|
9057 | removeListener(event: 'ipc-message', listener: (event: Event,
|
9058 | channel: string,
|
9059 | ...args: any[]) => void): this;
|
9060 | /**
|
9061 | * Emitted when the renderer process sends a synchronous message via
|
9062 | * `ipcRenderer.sendSync()`.
|
9063 | */
|
9064 | on(event: 'ipc-message-sync', listener: (event: Event,
|
9065 | channel: string,
|
9066 | ...args: any[]) => void): this;
|
9067 | once(event: 'ipc-message-sync', listener: (event: Event,
|
9068 | channel: string,
|
9069 | ...args: any[]) => void): this;
|
9070 | addListener(event: 'ipc-message-sync', listener: (event: Event,
|
9071 | channel: string,
|
9072 | ...args: any[]) => void): this;
|
9073 | removeListener(event: 'ipc-message-sync', listener: (event: Event,
|
9074 | channel: string,
|
9075 | ...args: any[]) => void): this;
|
9076 | /**
|
9077 | * Emitted when the window leaves a full-screen state triggered by HTML API.
|
9078 | */
|
9079 | on(event: 'leave-html-full-screen', listener: Function): this;
|
9080 | once(event: 'leave-html-full-screen', listener: Function): this;
|
9081 | addListener(event: 'leave-html-full-screen', listener: Function): this;
|
9082 | removeListener(event: 'leave-html-full-screen', listener: Function): this;
|
9083 | /**
|
9084 | * Emitted when `webContents` wants to do basic auth.
|
9085 | *
|
9086 | The usage is the same with the `login` event of `app`.
|
9087 | */
|
9088 | on(event: 'login', listener: (event: Event,
|
9089 | authenticationResponseDetails: AuthenticationResponseDetails,
|
9090 | authInfo: AuthInfo,
|
9091 | callback: (username?: string, password?: string) => void) => void): this;
|
9092 | once(event: 'login', listener: (event: Event,
|
9093 | authenticationResponseDetails: AuthenticationResponseDetails,
|
9094 | authInfo: AuthInfo,
|
9095 | callback: (username?: string, password?: string) => void) => void): this;
|
9096 | addListener(event: 'login', listener: (event: Event,
|
9097 | authenticationResponseDetails: AuthenticationResponseDetails,
|
9098 | authInfo: AuthInfo,
|
9099 | callback: (username?: string, password?: string) => void) => void): this;
|
9100 | removeListener(event: 'login', listener: (event: Event,
|
9101 | authenticationResponseDetails: AuthenticationResponseDetails,
|
9102 | authInfo: AuthInfo,
|
9103 | callback: (username?: string, password?: string) => void) => void): this;
|
9104 | /**
|
9105 | * Emitted when media is paused or done playing.
|
9106 | */
|
9107 | on(event: 'media-paused', listener: Function): this;
|
9108 | once(event: 'media-paused', listener: Function): this;
|
9109 | addListener(event: 'media-paused', listener: Function): this;
|
9110 | removeListener(event: 'media-paused', listener: Function): this;
|
9111 | /**
|
9112 | * Emitted when media starts playing.
|
9113 | */
|
9114 | on(event: 'media-started-playing', listener: Function): this;
|
9115 | once(event: 'media-started-playing', listener: Function): this;
|
9116 | addListener(event: 'media-started-playing', listener: Function): this;
|
9117 | removeListener(event: 'media-started-playing', listener: Function): this;
|
9118 | /**
|
9119 | * Emitted when the page requests to open a new window for a `url`. It could be
|
9120 | * requested by `window.open` or an external link like `<a target='_blank'>`.
|
9121 | *
|
9122 | * By default a new `BrowserWindow` will be created for the `url`.
|
9123 | *
|
9124 | * Calling `event.preventDefault()` will prevent Electron from automatically
|
9125 | * creating a new `BrowserWindow`. If you call `event.preventDefault()` and
|
9126 | * manually create a new `BrowserWindow` then you must set `event.newGuest` to
|
9127 | * reference the new `BrowserWindow` instance, failing to do so may result in
|
9128 | * unexpected behavior. For example:
|
9129 | */
|
9130 | on(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
|
9131 | url: string,
|
9132 | frameName: string,
|
9133 | /**
|
9134 | * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
|
9135 | * `save-to-disk` and `other`.
|
9136 | */
|
9137 | disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
|
9138 | /**
|
9139 | * The options which will be used for creating the new `BrowserWindow`.
|
9140 | */
|
9141 | options: BrowserWindowConstructorOptions,
|
9142 | /**
|
9143 | * The non-standard features (features not handled by Chromium or Electron) given
|
9144 | * to `window.open()`.
|
9145 | */
|
9146 | additionalFeatures: string[],
|
9147 | /**
|
9148 | * The referrer that will be passed to the new window. May or may not result in the
|
9149 | * `Referer` header being sent, depending on the referrer policy.
|
9150 | */
|
9151 | referrer: Referrer,
|
9152 | /**
|
9153 | * The post data that will be sent to the new window, along with the appropriate
|
9154 | * headers that will be set. If no post data is to be sent, the value will be
|
9155 | * `null`. Only defined when the window is being created by a form that set
|
9156 | * `target=_blank`.
|
9157 | */
|
9158 | postBody: PostBody) => void): this;
|
9159 | once(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
|
9160 | url: string,
|
9161 | frameName: string,
|
9162 | /**
|
9163 | * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
|
9164 | * `save-to-disk` and `other`.
|
9165 | */
|
9166 | disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
|
9167 | /**
|
9168 | * The options which will be used for creating the new `BrowserWindow`.
|
9169 | */
|
9170 | options: BrowserWindowConstructorOptions,
|
9171 | /**
|
9172 | * The non-standard features (features not handled by Chromium or Electron) given
|
9173 | * to `window.open()`.
|
9174 | */
|
9175 | additionalFeatures: string[],
|
9176 | /**
|
9177 | * The referrer that will be passed to the new window. May or may not result in the
|
9178 | * `Referer` header being sent, depending on the referrer policy.
|
9179 | */
|
9180 | referrer: Referrer,
|
9181 | /**
|
9182 | * The post data that will be sent to the new window, along with the appropriate
|
9183 | * headers that will be set. If no post data is to be sent, the value will be
|
9184 | * `null`. Only defined when the window is being created by a form that set
|
9185 | * `target=_blank`.
|
9186 | */
|
9187 | postBody: PostBody) => void): this;
|
9188 | addListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
|
9189 | url: string,
|
9190 | frameName: string,
|
9191 | /**
|
9192 | * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
|
9193 | * `save-to-disk` and `other`.
|
9194 | */
|
9195 | disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
|
9196 | /**
|
9197 | * The options which will be used for creating the new `BrowserWindow`.
|
9198 | */
|
9199 | options: BrowserWindowConstructorOptions,
|
9200 | /**
|
9201 | * The non-standard features (features not handled by Chromium or Electron) given
|
9202 | * to `window.open()`.
|
9203 | */
|
9204 | additionalFeatures: string[],
|
9205 | /**
|
9206 | * The referrer that will be passed to the new window. May or may not result in the
|
9207 | * `Referer` header being sent, depending on the referrer policy.
|
9208 | */
|
9209 | referrer: Referrer,
|
9210 | /**
|
9211 | * The post data that will be sent to the new window, along with the appropriate
|
9212 | * headers that will be set. If no post data is to be sent, the value will be
|
9213 | * `null`. Only defined when the window is being created by a form that set
|
9214 | * `target=_blank`.
|
9215 | */
|
9216 | postBody: PostBody) => void): this;
|
9217 | removeListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
|
9218 | url: string,
|
9219 | frameName: string,
|
9220 | /**
|
9221 | * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
|
9222 | * `save-to-disk` and `other`.
|
9223 | */
|
9224 | disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
|
9225 | /**
|
9226 | * The options which will be used for creating the new `BrowserWindow`.
|
9227 | */
|
9228 | options: BrowserWindowConstructorOptions,
|
9229 | /**
|
9230 | * The non-standard features (features not handled by Chromium or Electron) given
|
9231 | * to `window.open()`.
|
9232 | */
|
9233 | additionalFeatures: string[],
|
9234 | /**
|
9235 | * The referrer that will be passed to the new window. May or may not result in the
|
9236 | * `Referer` header being sent, depending on the referrer policy.
|
9237 | */
|
9238 | referrer: Referrer,
|
9239 | /**
|
9240 | * The post data that will be sent to the new window, along with the appropriate
|
9241 | * headers that will be set. If no post data is to be sent, the value will be
|
9242 | * `null`. Only defined when the window is being created by a form that set
|
9243 | * `target=_blank`.
|
9244 | */
|
9245 | postBody: PostBody) => void): this;
|
9246 | /**
|
9247 | * Emitted when page receives favicon urls.
|
9248 | */
|
9249 | on(event: 'page-favicon-updated', listener: (event: Event,
|
9250 | /**
|
9251 | * Array of URLs.
|
9252 | */
|
9253 | favicons: string[]) => void): this;
|
9254 | once(event: 'page-favicon-updated', listener: (event: Event,
|
9255 | /**
|
9256 | * Array of URLs.
|
9257 | */
|
9258 | favicons: string[]) => void): this;
|
9259 | addListener(event: 'page-favicon-updated', listener: (event: Event,
|
9260 | /**
|
9261 | * Array of URLs.
|
9262 | */
|
9263 | favicons: string[]) => void): this;
|
9264 | removeListener(event: 'page-favicon-updated', listener: (event: Event,
|
9265 | /**
|
9266 | * Array of URLs.
|
9267 | */
|
9268 | favicons: string[]) => void): this;
|
9269 | /**
|
9270 | * Fired when page title is set during navigation. `explicitSet` is false when
|
9271 | * title is synthesized from file url.
|
9272 | */
|
9273 | on(event: 'page-title-updated', listener: (event: Event,
|
9274 | title: string,
|
9275 | explicitSet: boolean) => void): this;
|
9276 | once(event: 'page-title-updated', listener: (event: Event,
|
9277 | title: string,
|
9278 | explicitSet: boolean) => void): this;
|
9279 | addListener(event: 'page-title-updated', listener: (event: Event,
|
9280 | title: string,
|
9281 | explicitSet: boolean) => void): this;
|
9282 | removeListener(event: 'page-title-updated', listener: (event: Event,
|
9283 | title: string,
|
9284 | explicitSet: boolean) => void): this;
|
9285 | /**
|
9286 | * Emitted when a new frame is generated. Only the dirty area is passed in the
|
9287 | * buffer.
|
9288 | */
|
9289 | on(event: 'paint', listener: (event: Event,
|
9290 | dirtyRect: Rectangle,
|
9291 | /**
|
9292 | * The image data of the whole frame.
|
9293 | */
|
9294 | image: NativeImage) => void): this;
|
9295 | once(event: 'paint', listener: (event: Event,
|
9296 | dirtyRect: Rectangle,
|
9297 | /**
|
9298 | * The image data of the whole frame.
|
9299 | */
|
9300 | image: NativeImage) => void): this;
|
9301 | addListener(event: 'paint', listener: (event: Event,
|
9302 | dirtyRect: Rectangle,
|
9303 | /**
|
9304 | * The image data of the whole frame.
|
9305 | */
|
9306 | image: NativeImage) => void): this;
|
9307 | removeListener(event: 'paint', listener: (event: Event,
|
9308 | dirtyRect: Rectangle,
|
9309 | /**
|
9310 | * The image data of the whole frame.
|
9311 | */
|
9312 | image: NativeImage) => void): this;
|
9313 | /**
|
9314 | * Emitted when a plugin process has crashed.
|
9315 | */
|
9316 | on(event: 'plugin-crashed', listener: (event: Event,
|
9317 | name: string,
|
9318 | version: string) => void): this;
|
9319 | once(event: 'plugin-crashed', listener: (event: Event,
|
9320 | name: string,
|
9321 | version: string) => void): this;
|
9322 | addListener(event: 'plugin-crashed', listener: (event: Event,
|
9323 | name: string,
|
9324 | version: string) => void): this;
|
9325 | removeListener(event: 'plugin-crashed', listener: (event: Event,
|
9326 | name: string,
|
9327 | version: string) => void): this;
|
9328 | /**
|
9329 | * Emitted when the preload script `preloadPath` throws an unhandled exception
|
9330 | * `error`.
|
9331 | */
|
9332 | on(event: 'preload-error', listener: (event: Event,
|
9333 | preloadPath: string,
|
9334 | error: Error) => void): this;
|
9335 | once(event: 'preload-error', listener: (event: Event,
|
9336 | preloadPath: string,
|
9337 | error: Error) => void): this;
|
9338 | addListener(event: 'preload-error', listener: (event: Event,
|
9339 | preloadPath: string,
|
9340 | error: Error) => void): this;
|
9341 | removeListener(event: 'preload-error', listener: (event: Event,
|
9342 | preloadPath: string,
|
9343 | error: Error) => void): this;
|
9344 | /**
|
9345 | * Emitted when `remote.getBuiltin()` is called in the renderer process. Calling
|
9346 | * `event.preventDefault()` will prevent the module from being returned. Custom
|
9347 | * value can be returned by setting `event.returnValue`.
|
9348 | */
|
9349 | on(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
|
9350 | moduleName: string) => void): this;
|
9351 | once(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
|
9352 | moduleName: string) => void): this;
|
9353 | addListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
|
9354 | moduleName: string) => void): this;
|
9355 | removeListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
|
9356 | moduleName: string) => void): this;
|
9357 | /**
|
9358 | * Emitted when `remote.getCurrentWebContents()` is called in the renderer process.
|
9359 | * Calling `event.preventDefault()` will prevent the object from being returned.
|
9360 | * Custom value can be returned by setting `event.returnValue`.
|
9361 | */
|
9362 | on(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
|
9363 | once(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
|
9364 | addListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
|
9365 | removeListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
|
9366 | /**
|
9367 | * Emitted when `remote.getCurrentWindow()` is called in the renderer process.
|
9368 | * Calling `event.preventDefault()` will prevent the object from being returned.
|
9369 | * Custom value can be returned by setting `event.returnValue`.
|
9370 | */
|
9371 | on(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
|
9372 | once(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
|
9373 | addListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
|
9374 | removeListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
|
9375 | /**
|
9376 | * Emitted when `remote.getGlobal()` is called in the renderer process. Calling
|
9377 | * `event.preventDefault()` will prevent the global from being returned. Custom
|
9378 | * value can be returned by setting `event.returnValue`.
|
9379 | */
|
9380 | on(event: 'remote-get-global', listener: (event: IpcMainEvent,
|
9381 | globalName: string) => void): this;
|
9382 | once(event: 'remote-get-global', listener: (event: IpcMainEvent,
|
9383 | globalName: string) => void): this;
|
9384 | addListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
|
9385 | globalName: string) => void): this;
|
9386 | removeListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
|
9387 | globalName: string) => void): this;
|
9388 | /**
|
9389 | * Emitted when `remote.require()` is called in the renderer process. Calling
|
9390 | * `event.preventDefault()` will prevent the module from being returned. Custom
|
9391 | * value can be returned by setting `event.returnValue`.
|
9392 | */
|
9393 | on(event: 'remote-require', listener: (event: IpcMainEvent,
|
9394 | moduleName: string) => void): this;
|
9395 | once(event: 'remote-require', listener: (event: IpcMainEvent,
|
9396 | moduleName: string) => void): this;
|
9397 | addListener(event: 'remote-require', listener: (event: IpcMainEvent,
|
9398 | moduleName: string) => void): this;
|
9399 | removeListener(event: 'remote-require', listener: (event: IpcMainEvent,
|
9400 | moduleName: string) => void): this;
|
9401 | /**
|
9402 | * Emitted when the renderer process unexpectedly dissapears. This is normally
|
9403 | * because it was crashed or killed.
|
9404 | */
|
9405 | on(event: 'render-process-gone', listener: (event: Event,
|
9406 | details: Details) => void): this;
|
9407 | once(event: 'render-process-gone', listener: (event: Event,
|
9408 | details: Details) => void): this;
|
9409 | addListener(event: 'render-process-gone', listener: (event: Event,
|
9410 | details: Details) => void): this;
|
9411 | removeListener(event: 'render-process-gone', listener: (event: Event,
|
9412 | details: Details) => void): this;
|
9413 | /**
|
9414 | * Emitted when the unresponsive web page becomes responsive again.
|
9415 | */
|
9416 | on(event: 'responsive', listener: Function): this;
|
9417 | once(event: 'responsive', listener: Function): this;
|
9418 | addListener(event: 'responsive', listener: Function): this;
|
9419 | removeListener(event: 'responsive', listener: Function): this;
|
9420 | /**
|
9421 | * Emitted when bluetooth device needs to be selected on call to
|
9422 | * `navigator.bluetooth.requestDevice`. To use `navigator.bluetooth` api
|
9423 | * `webBluetooth` should be enabled. If `event.preventDefault` is not called, first
|
9424 | * available device will be selected. `callback` should be called with `deviceId`
|
9425 | * to be selected, passing empty string to `callback` will cancel the request.
|
9426 | */
|
9427 | on(event: 'select-bluetooth-device', listener: (event: Event,
|
9428 | devices: BluetoothDevice[],
|
9429 | callback: (deviceId: string) => void) => void): this;
|
9430 | once(event: 'select-bluetooth-device', listener: (event: Event,
|
9431 | devices: BluetoothDevice[],
|
9432 | callback: (deviceId: string) => void) => void): this;
|
9433 | addListener(event: 'select-bluetooth-device', listener: (event: Event,
|
9434 | devices: BluetoothDevice[],
|
9435 | callback: (deviceId: string) => void) => void): this;
|
9436 | removeListener(event: 'select-bluetooth-device', listener: (event: Event,
|
9437 | devices: BluetoothDevice[],
|
9438 | callback: (deviceId: string) => void) => void): this;
|
9439 | /**
|
9440 | * Emitted when a client certificate is requested.
|
9441 | *
|
9442 | The usage is the same with the `select-client-certificate` event of `app`.
|
9443 | */
|
9444 | on(event: 'select-client-certificate', listener: (event: Event,
|
9445 | url: string,
|
9446 | certificateList: Certificate[],
|
9447 | callback: (certificate: Certificate) => void) => void): this;
|
9448 | once(event: 'select-client-certificate', listener: (event: Event,
|
9449 | url: string,
|
9450 | certificateList: Certificate[],
|
9451 | callback: (certificate: Certificate) => void) => void): this;
|
9452 | addListener(event: 'select-client-certificate', listener: (event: Event,
|
9453 | url: string,
|
9454 | certificateList: Certificate[],
|
9455 | callback: (certificate: Certificate) => void) => void): this;
|
9456 | removeListener(event: 'select-client-certificate', listener: (event: Event,
|
9457 | url: string,
|
9458 | certificateList: Certificate[],
|
9459 | callback: (certificate: Certificate) => void) => void): this;
|
9460 | /**
|
9461 | * Emitted when the web page becomes unresponsive.
|
9462 | */
|
9463 | on(event: 'unresponsive', listener: Function): this;
|
9464 | once(event: 'unresponsive', listener: Function): this;
|
9465 | addListener(event: 'unresponsive', listener: Function): this;
|
9466 | removeListener(event: 'unresponsive', listener: Function): this;
|
9467 | /**
|
9468 | * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
|
9469 | */
|
9470 | on(event: 'update-target-url', listener: (event: Event,
|
9471 | url: string) => void): this;
|
9472 | once(event: 'update-target-url', listener: (event: Event,
|
9473 | url: string) => void): this;
|
9474 | addListener(event: 'update-target-url', listener: (event: Event,
|
9475 | url: string) => void): this;
|
9476 | removeListener(event: 'update-target-url', listener: (event: Event,
|
9477 | url: string) => void): this;
|
9478 | /**
|
9479 | * Emitted when a `<webview>`'s web contents is being attached to this web
|
9480 | * contents. Calling `event.preventDefault()` will destroy the guest page.
|
9481 | *
|
9482 | * This event can be used to configure `webPreferences` for the `webContents` of a
|
9483 | * `<webview>` before it's loaded, and provides the ability to set settings that
|
9484 | * can't be set via `<webview>` attributes.
|
9485 | *
|
9486 | * **Note:** The specified `preload` script option will be appear as `preloadURL`
|
9487 | * (not `preload`) in the `webPreferences` object emitted with this event.
|
9488 | */
|
9489 | on(event: 'will-attach-webview', listener: (event: Event,
|
9490 | /**
|
9491 | * The web preferences that will be used by the guest page. This object can be
|
9492 | * modified to adjust the preferences for the guest page.
|
9493 | */
|
9494 | webPreferences: WebPreferences,
|
9495 | /**
|
9496 | * The other `<webview>` parameters such as the `src` URL. This object can be
|
9497 | * modified to adjust the parameters of the guest page.
|
9498 | */
|
9499 | params: Record<string, string>) => void): this;
|
9500 | once(event: 'will-attach-webview', listener: (event: Event,
|
9501 | /**
|
9502 | * The web preferences that will be used by the guest page. This object can be
|
9503 | * modified to adjust the preferences for the guest page.
|
9504 | */
|
9505 | webPreferences: WebPreferences,
|
9506 | /**
|
9507 | * The other `<webview>` parameters such as the `src` URL. This object can be
|
9508 | * modified to adjust the parameters of the guest page.
|
9509 | */
|
9510 | params: Record<string, string>) => void): this;
|
9511 | addListener(event: 'will-attach-webview', listener: (event: Event,
|
9512 | /**
|
9513 | * The web preferences that will be used by the guest page. This object can be
|
9514 | * modified to adjust the preferences for the guest page.
|
9515 | */
|
9516 | webPreferences: WebPreferences,
|
9517 | /**
|
9518 | * The other `<webview>` parameters such as the `src` URL. This object can be
|
9519 | * modified to adjust the parameters of the guest page.
|
9520 | */
|
9521 | params: Record<string, string>) => void): this;
|
9522 | removeListener(event: 'will-attach-webview', listener: (event: Event,
|
9523 | /**
|
9524 | * The web preferences that will be used by the guest page. This object can be
|
9525 | * modified to adjust the preferences for the guest page.
|
9526 | */
|
9527 | webPreferences: WebPreferences,
|
9528 | /**
|
9529 | * The other `<webview>` parameters such as the `src` URL. This object can be
|
9530 | * modified to adjust the parameters of the guest page.
|
9531 | */
|
9532 | params: Record<string, string>) => void): this;
|
9533 | /**
|
9534 | * Emitted when a user or the page wants to start navigation. It can happen when
|
9535 | * the `window.location` object is changed or a user clicks a link in the page.
|
9536 | *
|
9537 | * This event will not emit when the navigation is started programmatically with
|
9538 | * APIs like `webContents.loadURL` and `webContents.back`.
|
9539 | *
|
9540 | * It is also not emitted for in-page navigations, such as clicking anchor links or
|
9541 | * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
|
9542 | * purpose.
|
9543 |
|
9544 | Calling `event.preventDefault()` will prevent the navigation.
|
9545 | */
|
9546 | on(event: 'will-navigate', listener: (event: Event,
|
9547 | url: string) => void): this;
|
9548 | once(event: 'will-navigate', listener: (event: Event,
|
9549 | url: string) => void): this;
|
9550 | addListener(event: 'will-navigate', listener: (event: Event,
|
9551 | url: string) => void): this;
|
9552 | removeListener(event: 'will-navigate', listener: (event: Event,
|
9553 | url: string) => void): this;
|
9554 | /**
|
9555 | * Emitted when a `beforeunload` event handler is attempting to cancel a page
|
9556 | * unload.
|
9557 | *
|
9558 | * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
|
9559 | * and allow the page to be unloaded.
|
9560 | */
|
9561 | on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
|
9562 | once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
|
9563 | addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
|
9564 | removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
|
9565 | /**
|
9566 | * Emitted as a server side redirect occurs during navigation. For example a 302
|
9567 | * redirect.
|
9568 | *
|
9569 | * This event will be emitted after `did-start-navigation` and always before the
|
9570 | * `did-redirect-navigation` event for the same navigation.
|
9571 | *
|
9572 | * Calling `event.preventDefault()` will prevent the navigation (not just the
|
9573 | * redirect).
|
9574 | */
|
9575 | on(event: 'will-redirect', listener: (event: Event,
|
9576 | url: string,
|
9577 | isInPlace: boolean,
|
9578 | isMainFrame: boolean,
|
9579 | frameProcessId: number,
|
9580 | frameRoutingId: number) => void): this;
|
9581 | once(event: 'will-redirect', listener: (event: Event,
|
9582 | url: string,
|
9583 | isInPlace: boolean,
|
9584 | isMainFrame: boolean,
|
9585 | frameProcessId: number,
|
9586 | frameRoutingId: number) => void): this;
|
9587 | addListener(event: 'will-redirect', listener: (event: Event,
|
9588 | url: string,
|
9589 | isInPlace: boolean,
|
9590 | isMainFrame: boolean,
|
9591 | frameProcessId: number,
|
9592 | frameRoutingId: number) => void): this;
|
9593 | removeListener(event: 'will-redirect', listener: (event: Event,
|
9594 | url: string,
|
9595 | isInPlace: boolean,
|
9596 | isMainFrame: boolean,
|
9597 | frameProcessId: number,
|
9598 | frameRoutingId: number) => void): this;
|
9599 | /**
|
9600 | * Emitted when the user is requesting to change the zoom level using the mouse
|
9601 | * wheel.
|
9602 | */
|
9603 | on(event: 'zoom-changed', listener: (event: Event,
|
9604 | /**
|
9605 | * Can be `in` or `out`.
|
9606 | */
|
9607 | zoomDirection: ('in' | 'out')) => void): this;
|
9608 | once(event: 'zoom-changed', listener: (event: Event,
|
9609 | /**
|
9610 | * Can be `in` or `out`.
|
9611 | */
|
9612 | zoomDirection: ('in' | 'out')) => void): this;
|
9613 | addListener(event: 'zoom-changed', listener: (event: Event,
|
9614 | /**
|
9615 | * Can be `in` or `out`.
|
9616 | */
|
9617 | zoomDirection: ('in' | 'out')) => void): this;
|
9618 | removeListener(event: 'zoom-changed', listener: (event: Event,
|
9619 | /**
|
9620 | * Can be `in` or `out`.
|
9621 | */
|
9622 | zoomDirection: ('in' | 'out')) => void): this;
|
9623 | /**
|
9624 | * Adds the specified path to DevTools workspace. Must be used after DevTools
|
9625 | * creation:
|
9626 | */
|
9627 | addWorkSpace(path: string): void;
|
9628 | /**
|
9629 | * Begin subscribing for presentation events and captured frames, the `callback`
|
9630 | * will be called with `callback(image, dirtyRect)` when there is a presentation
|
9631 | * event.
|
9632 | *
|
9633 | * The `image` is an instance of NativeImage that stores the captured frame.
|
9634 | *
|
9635 | * The `dirtyRect` is an object with `x, y, width, height` properties that
|
9636 | * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
|
9637 | * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
|
9638 | */
|
9639 | beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
|
9640 | /**
|
9641 | * Begin subscribing for presentation events and captured frames, the `callback`
|
9642 | * will be called with `callback(image, dirtyRect)` when there is a presentation
|
9643 | * event.
|
9644 | *
|
9645 | * The `image` is an instance of NativeImage that stores the captured frame.
|
9646 | *
|
9647 | * The `dirtyRect` is an object with `x, y, width, height` properties that
|
9648 | * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
|
9649 | * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
|
9650 | */
|
9651 | beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
|
9652 | /**
|
9653 | * Whether the browser can go back to previous web page.
|
9654 | */
|
9655 | canGoBack(): boolean;
|
9656 | /**
|
9657 | * Whether the browser can go forward to next web page.
|
9658 | */
|
9659 | canGoForward(): boolean;
|
9660 | /**
|
9661 | * Whether the web page can go to `offset`.
|
9662 | */
|
9663 | canGoToOffset(offset: number): boolean;
|
9664 | /**
|
9665 | * Resolves with a NativeImage
|
9666 | *
|
9667 | * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
|
9668 | * whole visible page.
|
9669 | */
|
9670 | capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
|
9671 | /**
|
9672 | * Clears the navigation history.
|
9673 | */
|
9674 | clearHistory(): void;
|
9675 | /**
|
9676 | * Closes the devtools.
|
9677 | */
|
9678 | closeDevTools(): void;
|
9679 | /**
|
9680 | * Executes the editing command `copy` in web page.
|
9681 | */
|
9682 | copy(): void;
|
9683 | /**
|
9684 | * Copy the image at the given position to the clipboard.
|
9685 | */
|
9686 | copyImageAt(x: number, y: number): void;
|
9687 | /**
|
9688 | * Executes the editing command `cut` in web page.
|
9689 | */
|
9690 | cut(): void;
|
9691 | /**
|
9692 | * Decrease the capturer count by one. The page will be set to hidden or occluded
|
9693 | * state when its browser window is hidden or occluded and the capturer count
|
9694 | * reaches zero. If you want to decrease the hidden capturer count instead you
|
9695 | * should set `stayHidden` to true.
|
9696 | */
|
9697 | decrementCapturerCount(stayHidden?: boolean): void;
|
9698 | /**
|
9699 | * Executes the editing command `delete` in web page.
|
9700 | */
|
9701 | delete(): void;
|
9702 | /**
|
9703 | * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
|
9704 | */
|
9705 | disableDeviceEmulation(): void;
|
9706 | /**
|
9707 | * Initiates a download of the resource at `url` without navigating. The
|
9708 | * `will-download` event of `session` will be triggered.
|
9709 | */
|
9710 | downloadURL(url: string): void;
|
9711 | /**
|
9712 | * Enable device emulation with the given parameters.
|
9713 | */
|
9714 | enableDeviceEmulation(parameters: Parameters): void;
|
9715 | /**
|
9716 | * End subscribing for frame presentation events.
|
9717 | */
|
9718 | endFrameSubscription(): void;
|
9719 | /**
|
9720 | * A promise that resolves with the result of the executed code or is rejected if
|
9721 | * the result of the code is a rejected promise.
|
9722 | *
|
9723 | * Evaluates `code` in page.
|
9724 | *
|
9725 | * In the browser window some HTML APIs like `requestFullScreen` can only be
|
9726 | * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
|
9727 | * this limitation.
|
9728 |
|
9729 | Code execution will be suspended until web page stop loading.
|
9730 | */
|
9731 | executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
|
9732 | /**
|
9733 | * A promise that resolves with the result of the executed code or is rejected if
|
9734 | * the result of the code is a rejected promise.
|
9735 | *
|
9736 | Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
|
9737 | */
|
9738 | executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
|
9739 | /**
|
9740 | * The request id used for the request.
|
9741 | *
|
9742 | * Starts a request to find all matches for the `text` in the web page. The result
|
9743 | * of the request can be obtained by subscribing to `found-in-page` event.
|
9744 | */
|
9745 | findInPage(text: string, options?: FindInPageOptions): number;
|
9746 | /**
|
9747 | * Focuses the web page.
|
9748 | */
|
9749 | focus(): void;
|
9750 | /**
|
9751 | * Information about all Shared Workers.
|
9752 | */
|
9753 | getAllSharedWorkers(): SharedWorkerInfo[];
|
9754 | /**
|
9755 | * whether or not this WebContents will throttle animations and timers when the
|
9756 | * page becomes backgrounded. This also affects the Page Visibility API.
|
9757 | */
|
9758 | getBackgroundThrottling(): boolean;
|
9759 | /**
|
9760 | * If *offscreen rendering* is enabled returns the current frame rate.
|
9761 | */
|
9762 | getFrameRate(): number;
|
9763 | /**
|
9764 | * The operating system `pid` of the associated renderer process.
|
9765 | */
|
9766 | getOSProcessId(): number;
|
9767 | /**
|
9768 | * Get the system printer list.
|
9769 | */
|
9770 | getPrinters(): PrinterInfo[];
|
9771 | /**
|
9772 | * The Chromium internal `pid` of the associated renderer. Can be compared to the
|
9773 | * `frameProcessId` passed by frame specific navigation events (e.g.
|
9774 | * `did-frame-navigate`)
|
9775 | */
|
9776 | getProcessId(): number;
|
9777 | /**
|
9778 | * The title of the current web page.
|
9779 | */
|
9780 | getTitle(): string;
|
9781 | /**
|
9782 | * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
|
9783 | * `remote`, `webview` or `offscreen`.
|
9784 | */
|
9785 | getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
|
9786 | /**
|
9787 | * The URL of the current web page.
|
9788 | */
|
9789 | getURL(): string;
|
9790 | /**
|
9791 | * The user agent for this web page.
|
9792 | */
|
9793 | getUserAgent(): string;
|
9794 | /**
|
9795 | * Returns the WebRTC IP Handling Policy.
|
9796 | */
|
9797 | getWebRTCIPHandlingPolicy(): string;
|
9798 | /**
|
9799 | * the current zoom factor.
|
9800 | */
|
9801 | getZoomFactor(): number;
|
9802 | /**
|
9803 | * the current zoom level.
|
9804 | */
|
9805 | getZoomLevel(): number;
|
9806 | /**
|
9807 | * Makes the browser go back a web page.
|
9808 | */
|
9809 | goBack(): void;
|
9810 | /**
|
9811 | * Makes the browser go forward a web page.
|
9812 | */
|
9813 | goForward(): void;
|
9814 | /**
|
9815 | * Navigates browser to the specified absolute web page index.
|
9816 | */
|
9817 | goToIndex(index: number): void;
|
9818 | /**
|
9819 | * Navigates to the specified offset from the "current entry".
|
9820 | */
|
9821 | goToOffset(offset: number): void;
|
9822 | /**
|
9823 | * Increase the capturer count by one. The page is considered visible when its
|
9824 | * browser window is hidden and the capturer count is non-zero. If you would like
|
9825 | * the page to stay hidden, you should ensure that `stayHidden` is set to true.
|
9826 | *
|
9827 | This also affects the Page Visibility API.
|
9828 | */
|
9829 | incrementCapturerCount(size?: Size, stayHidden?: boolean): void;
|
9830 | /**
|
9831 | * A promise that resolves with a key for the inserted CSS that can later be used
|
9832 | * to remove the CSS via `contents.removeInsertedCSS(key)`.
|
9833 | *
|
9834 | * Injects CSS into the current web page and returns a unique key for the inserted
|
9835 | * stylesheet.
|
9836 | */
|
9837 | insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
|
9838 | /**
|
9839 | * Inserts `text` to the focused element.
|
9840 | */
|
9841 | insertText(text: string): Promise<void>;
|
9842 | /**
|
9843 | * Starts inspecting element at position (`x`, `y`).
|
9844 | */
|
9845 | inspectElement(x: number, y: number): void;
|
9846 | /**
|
9847 | * Opens the developer tools for the service worker context.
|
9848 | */
|
9849 | inspectServiceWorker(): void;
|
9850 | /**
|
9851 | * Opens the developer tools for the shared worker context.
|
9852 | */
|
9853 | inspectSharedWorker(): void;
|
9854 | /**
|
9855 | * Inspects the shared worker based on its ID.
|
9856 | */
|
9857 | inspectSharedWorkerById(workerId: string): void;
|
9858 | /**
|
9859 | * Schedules a full repaint of the window this web contents is in.
|
9860 | *
|
9861 | * If *offscreen rendering* is enabled invalidates the frame and generates a new
|
9862 | * one through the `'paint'` event.
|
9863 | */
|
9864 | invalidate(): void;
|
9865 | /**
|
9866 | * Whether this page has been muted.
|
9867 | */
|
9868 | isAudioMuted(): boolean;
|
9869 | /**
|
9870 | * Whether this page is being captured. It returns true when the capturer count is
|
9871 | * large then 0.
|
9872 | */
|
9873 | isBeingCaptured(): boolean;
|
9874 | /**
|
9875 | * Whether the renderer process has crashed.
|
9876 | */
|
9877 | isCrashed(): boolean;
|
9878 | /**
|
9879 | * Whether audio is currently playing.
|
9880 | */
|
9881 | isCurrentlyAudible(): boolean;
|
9882 | /**
|
9883 | * Whether the web page is destroyed.
|
9884 | */
|
9885 | isDestroyed(): boolean;
|
9886 | /**
|
9887 | * Whether the devtools view is focused .
|
9888 | */
|
9889 | isDevToolsFocused(): boolean;
|
9890 | /**
|
9891 | * Whether the devtools is opened.
|
9892 | */
|
9893 | isDevToolsOpened(): boolean;
|
9894 | /**
|
9895 | * Whether the web page is focused.
|
9896 | */
|
9897 | isFocused(): boolean;
|
9898 | /**
|
9899 | * Whether web page is still loading resources.
|
9900 | */
|
9901 | isLoading(): boolean;
|
9902 | /**
|
9903 | * Whether the main frame (and not just iframes or frames within it) is still
|
9904 | * loading.
|
9905 | */
|
9906 | isLoadingMainFrame(): boolean;
|
9907 | /**
|
9908 | * Indicates whether *offscreen rendering* is enabled.
|
9909 | */
|
9910 | isOffscreen(): boolean;
|
9911 | /**
|
9912 | * If *offscreen rendering* is enabled returns whether it is currently painting.
|
9913 | */
|
9914 | isPainting(): boolean;
|
9915 | /**
|
9916 | * Whether the web page is waiting for a first-response from the main resource of
|
9917 | * the page.
|
9918 | */
|
9919 | isWaitingForResponse(): boolean;
|
9920 | /**
|
9921 | * the promise will resolve when the page has finished loading (see
|
9922 | * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
|
9923 | *
|
9924 | * Loads the given file in the window, `filePath` should be a path to an HTML file
|
9925 | * relative to the root of your application. For instance an app structure like
|
9926 | * this:
|
9927 |
|
9928 | Would require code like this
|
9929 | */
|
9930 | loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
|
9931 | /**
|
9932 | * the promise will resolve when the page has finished loading (see
|
9933 | * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
|
9934 | * A noop rejection handler is already attached, which avoids unhandled rejection
|
9935 | * errors.
|
9936 | *
|
9937 | * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
|
9938 | * the `http://` or `file://`. If the load should bypass http cache then use the
|
9939 | * `pragma` header to achieve it.
|
9940 | */
|
9941 | loadURL(url: string, options?: LoadURLOptions): Promise<void>;
|
9942 | /**
|
9943 | * Opens the devtools.
|
9944 | *
|
9945 | * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
|
9946 | * explicitly passing an empty `mode` can force using last used dock state.
|
9947 | */
|
9948 | openDevTools(options?: OpenDevToolsOptions): void;
|
9949 | /**
|
9950 | * Executes the editing command `paste` in web page.
|
9951 | */
|
9952 | paste(): void;
|
9953 | /**
|
9954 | * Executes the editing command `pasteAndMatchStyle` in web page.
|
9955 | */
|
9956 | pasteAndMatchStyle(): void;
|
9957 | /**
|
9958 | * Send a message to the renderer process, optionally transferring ownership of
|
9959 | * zero or more [`MessagePortMain`][] objects.
|
9960 | *
|
9961 | * The transferred `MessagePortMain` objects will be available in the renderer
|
9962 | * process by accessing the `ports` property of the emitted event. When they arrive
|
9963 | * in the renderer, they will be native DOM `MessagePort` objects.
|
9964 |
|
9965 | For example:
|
9966 | */
|
9967 | postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
|
9968 | /**
|
9969 | * Prints window's web page. When `silent` is set to `true`, Electron will pick the
|
9970 | * system's default printer if `deviceName` is empty and the default settings for
|
9971 | * printing.
|
9972 | *
|
9973 | * Use `page-break-before: always;` CSS style to force to print to a new page.
|
9974 | *
|
9975 | Example usage:
|
9976 | */
|
9977 | print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void;
|
9978 | /**
|
9979 | * Resolves with the generated PDF data.
|
9980 | *
|
9981 | * Prints window's web page as PDF with Chromium's preview printing custom
|
9982 | * settings.
|
9983 | *
|
9984 | * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
|
9985 | *
|
9986 | * By default, an empty `options` will be regarded as:
|
9987 | *
|
9988 | * Use `page-break-before: always; ` CSS style to force to print to a new page.
|
9989 | *
|
9990 | An example of `webContents.printToPDF`:
|
9991 | */
|
9992 | printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
|
9993 | /**
|
9994 | * Executes the editing command `redo` in web page.
|
9995 | */
|
9996 | redo(): void;
|
9997 | /**
|
9998 | * Reloads the current web page.
|
9999 | */
|
10000 | reload(): void;
|
10001 | /**
|
10002 | * Reloads current page and ignores cache.
|
10003 | */
|
10004 | reloadIgnoringCache(): void;
|
10005 | /**
|
10006 | * Resolves if the removal was successful.
|
10007 | *
|
10008 | * Removes the inserted CSS from the current web page. The stylesheet is identified
|
10009 | * by its key, which is returned from `contents.insertCSS(css)`.
|
10010 | */
|
10011 | removeInsertedCSS(key: string): Promise<void>;
|
10012 | /**
|
10013 | * Removes the specified path from DevTools workspace.
|
10014 | */
|
10015 | removeWorkSpace(path: string): void;
|
10016 | /**
|
10017 | * Executes the editing command `replace` in web page.
|
10018 | */
|
10019 | replace(text: string): void;
|
10020 | /**
|
10021 | * Executes the editing command `replaceMisspelling` in web page.
|
10022 | */
|
10023 | replaceMisspelling(text: string): void;
|
10024 | /**
|
10025 | * resolves if the page is saved.
|
10026 | */
|
10027 | savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
|
10028 | /**
|
10029 | * Executes the editing command `selectAll` in web page.
|
10030 | */
|
10031 | selectAll(): void;
|
10032 | /**
|
10033 | * Send an asynchronous message to the renderer process via `channel`, along with
|
10034 | * arguments. Arguments will be serialized with the Structured Clone Algorithm,
|
10035 | * just like `postMessage`, so prototype chains will not be included. Sending
|
10036 | * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
|
10037 | *
|
10038 | * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
|
10039 | * Electron objects is deprecated, and will begin throwing an exception starting
|
10040 | * with Electron 9.
|
10041 | *
|
10042 | * The renderer process can handle the message by listening to `channel` with the
|
10043 | * `ipcRenderer` module.
|
10044 | *
|
10045 | An example of sending messages from the main process to the renderer process:
|
10046 | */
|
10047 | send(channel: string, ...args: any[]): void;
|
10048 | /**
|
10049 | * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
|
10050 | * contents needs to be focused for `sendInputEvent()` to work.
|
10051 | */
|
10052 | sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
|
10053 | /**
|
10054 | * Send an asynchronous message to a specific frame in a renderer process via
|
10055 | * `channel`, along with arguments. Arguments will be serialized with the
|
10056 | * Structured Clone Algorithm, just like `postMessage`, so prototype chains will
|
10057 | * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
|
10058 | * will throw an exception.
|
10059 | *
|
10060 | * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
|
10061 | * Electron objects is deprecated, and will begin throwing an exception starting
|
10062 | * with Electron 9.
|
10063 | *
|
10064 | * The renderer process can handle the message by listening to `channel` with the
|
10065 | * `ipcRenderer` module.
|
10066 | *
|
10067 | * If you want to get the `frameId` of a given renderer context you should use the
|
10068 | * `webFrame.routingId` value. E.g.
|
10069 | *
|
10070 | You can also read `frameId` from all incoming IPC messages in the main process.
|
10071 | */
|
10072 | sendToFrame(frameId: number, channel: string, ...args: any[]): void;
|
10073 | /**
|
10074 | * Mute the audio on the current web page.
|
10075 | */
|
10076 | setAudioMuted(muted: boolean): void;
|
10077 | /**
|
10078 | * Controls whether or not this WebContents will throttle animations and timers
|
10079 | * when the page becomes backgrounded. This also affects the Page Visibility API.
|
10080 | */
|
10081 | setBackgroundThrottling(allowed: boolean): void;
|
10082 | /**
|
10083 | * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
|
10084 | *
|
10085 | * The `devToolsWebContents` must not have done any navigation, and it should not
|
10086 | * be used for other purposes after the call.
|
10087 | *
|
10088 | * By default Electron manages the devtools by creating an internal `WebContents`
|
10089 | * with native view, which developers have very limited control of. With the
|
10090 | * `setDevToolsWebContents` method, developers can use any `WebContents` to show
|
10091 | * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
|
10092 | * tag.
|
10093 | *
|
10094 | * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
|
10095 | * caller's responsibility to destroy `devToolsWebContents`.
|
10096 | *
|
10097 | * An example of showing devtools in a `<webview>` tag:
|
10098 | *
|
10099 | An example of showing devtools in a `BrowserWindow`:
|
10100 | */
|
10101 | setDevToolsWebContents(devToolsWebContents: WebContents): void;
|
10102 | /**
|
10103 | * If *offscreen rendering* is enabled sets the frame rate to the specified number.
|
10104 | * Only values between 1 and 60 are accepted.
|
10105 | */
|
10106 | setFrameRate(fps: number): void;
|
10107 | /**
|
10108 | * Ignore application menu shortcuts while this web contents is focused.
|
10109 | */
|
10110 | setIgnoreMenuShortcuts(ignore: boolean): void;
|
10111 | /**
|
10112 | * Overrides the user agent for this web page.
|
10113 | */
|
10114 | setUserAgent(userAgent: string): void;
|
10115 | /**
|
10116 | * Sets the maximum and minimum pinch-to-zoom level.
|
10117 | *
|
10118 | * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
|
10119 | * call:
|
10120 | */
|
10121 | setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
|
10122 | /**
|
10123 | * Setting the WebRTC IP handling policy allows you to control which IPs are
|
10124 | * exposed via WebRTC. See BrowserLeaks for more details.
|
10125 | */
|
10126 | setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
|
10127 | /**
|
10128 | * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
|
10129 | * divided by 100, so 300% = 3.0.
|
10130 |
|
10131 | The factor must be greater than 0.0.
|
10132 | */
|
10133 | setZoomFactor(factor: number): void;
|
10134 | /**
|
10135 | * Changes the zoom level to the specified level. The original size is 0 and each
|
10136 | * increment above or below represents zooming 20% larger or smaller to default
|
10137 | * limits of 300% and 50% of original size, respectively. The formula for this is
|
10138 | * `scale := 1.2 ^ level`.
|
10139 | */
|
10140 | setZoomLevel(level: number): void;
|
10141 | /**
|
10142 | * Shows pop-up dictionary that searches the selected word on the page.
|
10143 | *
|
10144 | * @platform darwin
|
10145 | */
|
10146 | showDefinitionForSelection(): void;
|
10147 | /**
|
10148 | * Sets the `item` as dragging item for current drag-drop operation, `file` is the
|
10149 | * absolute path of the file to be dragged, and `icon` is the image showing under
|
10150 | * the cursor when dragging.
|
10151 | */
|
10152 | startDrag(item: Item): void;
|
10153 | /**
|
10154 | * If *offscreen rendering* is enabled and not painting, start painting.
|
10155 | */
|
10156 | startPainting(): void;
|
10157 | /**
|
10158 | * Stops any pending navigation.
|
10159 | */
|
10160 | stop(): void;
|
10161 | /**
|
10162 | * Stops any `findInPage` request for the `webContents` with the provided `action`.
|
10163 | */
|
10164 | stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
|
10165 | /**
|
10166 | * If *offscreen rendering* is enabled and painting, stop painting.
|
10167 | */
|
10168 | stopPainting(): void;
|
10169 | /**
|
10170 | * Indicates whether the snapshot has been created successfully.
|
10171 | *
|
10172 | Takes a V8 heap snapshot and saves it to `filePath`.
|
10173 | */
|
10174 | takeHeapSnapshot(filePath: string): Promise<void>;
|
10175 | /**
|
10176 | * Toggles the developer tools.
|
10177 | */
|
10178 | toggleDevTools(): void;
|
10179 | /**
|
10180 | * Executes the editing command `undo` in web page.
|
10181 | */
|
10182 | undo(): void;
|
10183 | /**
|
10184 | * Executes the editing command `unselect` in web page.
|
10185 | */
|
10186 | unselect(): void;
|
10187 | audioMuted: boolean;
|
10188 | backgroundThrottling: boolean;
|
10189 | readonly debugger: Debugger;
|
10190 | readonly devToolsWebContents: (WebContents) | (null);
|
10191 | frameRate: number;
|
10192 | readonly hostWebContents: WebContents;
|
10193 | readonly id: number;
|
10194 | readonly session: Session;
|
10195 | userAgent: string;
|
10196 | zoomFactor: number;
|
10197 | zoomLevel: number;
|
10198 | }
|
10199 |
|
10200 | interface WebFrame extends NodeJS.EventEmitter {
|
10201 |
|
10202 | // Docs: http://electronjs.org/docs/api/web-frame
|
10203 |
|
10204 | /**
|
10205 | * Attempts to free memory that is no longer being used (like images from a
|
10206 | * previous navigation).
|
10207 | *
|
10208 | * Note that blindly calling this method probably makes Electron slower since it
|
10209 | * will have to refill these emptied caches, you should only call it if an event in
|
10210 | * your app has occurred that makes you think your page is actually using less
|
10211 | * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
|
10212 | * and intend to stay there).
|
10213 | */
|
10214 | clearCache(): void;
|
10215 | /**
|
10216 | * A promise that resolves with the result of the executed code or is rejected if
|
10217 | * execution throws or results in a rejected promise.
|
10218 | *
|
10219 | * Evaluates `code` in page.
|
10220 | *
|
10221 | * In the browser window some HTML APIs like `requestFullScreen` can only be
|
10222 | * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
|
10223 | * this limitation.
|
10224 | */
|
10225 | executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
|
10226 | /**
|
10227 | * A promise that resolves with the result of the executed code or is rejected if
|
10228 | * execution could not start.
|
10229 | *
|
10230 | * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
|
10231 | *
|
10232 | * Note that when the execution of script fails, the returned promise will not
|
10233 | * reject and the `result` would be `undefined`. This is because Chromium does not
|
10234 | * dispatch errors of isolated worlds to foreign worlds.
|
10235 | */
|
10236 | executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
|
10237 | /**
|
10238 | * A child of `webFrame` with the supplied `name`, `null` would be returned if
|
10239 | * there's no such frame or if the frame is not in the current renderer process.
|
10240 | */
|
10241 | findFrameByName(name: string): WebFrame;
|
10242 | /**
|
10243 | * that has the supplied `routingId`, `null` if not found.
|
10244 | */
|
10245 | findFrameByRoutingId(routingId: number): WebFrame;
|
10246 | /**
|
10247 | * The frame element in `webFrame's` document selected by `selector`, `null` would
|
10248 | * be returned if `selector` does not select a frame or if the frame is not in the
|
10249 | * current renderer process.
|
10250 | */
|
10251 | getFrameForSelector(selector: string): WebFrame;
|
10252 | /**
|
10253 | * * `images` MemoryUsageDetails
|
10254 | * * `scripts` MemoryUsageDetails
|
10255 | * * `cssStyleSheets` MemoryUsageDetails
|
10256 | * * `xslStyleSheets` MemoryUsageDetails
|
10257 | * * `fonts` MemoryUsageDetails
|
10258 | * * `other` MemoryUsageDetails
|
10259 | *
|
10260 | * Returns an object describing usage information of Blink's internal memory
|
10261 | * caches.
|
10262 |
|
10263 | This will generate:
|
10264 | */
|
10265 | getResourceUsage(): ResourceUsage;
|
10266 | /**
|
10267 | * The current zoom factor.
|
10268 | */
|
10269 | getZoomFactor(): number;
|
10270 | /**
|
10271 | * The current zoom level.
|
10272 | */
|
10273 | getZoomLevel(): number;
|
10274 | /**
|
10275 | * A key for the inserted CSS that can later be used to remove the CSS via
|
10276 | * `webFrame.removeInsertedCSS(key)`.
|
10277 | *
|
10278 | * Injects CSS into the current web page and returns a unique key for the inserted
|
10279 | * stylesheet.
|
10280 | */
|
10281 | insertCSS(css: string): string;
|
10282 | /**
|
10283 | * Inserts `text` to the focused element.
|
10284 | */
|
10285 | insertText(text: string): void;
|
10286 | /**
|
10287 | * Removes the inserted CSS from the current web page. The stylesheet is identified
|
10288 | * by its key, which is returned from `webFrame.insertCSS(css)`.
|
10289 | */
|
10290 | removeInsertedCSS(key: string): void;
|
10291 | /**
|
10292 | * Set the security origin, content security policy and name of the isolated world.
|
10293 | * Note: If the `csp` is specified, then the `securityOrigin` also has to be
|
10294 | * specified.
|
10295 | */
|
10296 | setIsolatedWorldInfo(worldId: number, info: Info): void;
|
10297 | /**
|
10298 | * Sets a provider for spell checking in input fields and text areas.
|
10299 | *
|
10300 | * If you want to use this method you must disable the builtin spellchecker when
|
10301 | * you construct the window.
|
10302 | *
|
10303 | * The `provider` must be an object that has a `spellCheck` method that accepts an
|
10304 | * array of individual words for spellchecking. The `spellCheck` function runs
|
10305 | * asynchronously and calls the `callback` function with an array of misspelt words
|
10306 | * when complete.
|
10307 |
|
10308 | An example of using node-spellchecker as provider:
|
10309 | */
|
10310 | setSpellCheckProvider(language: string, provider: Provider): void;
|
10311 | /**
|
10312 | * Sets the maximum and minimum pinch-to-zoom level.
|
10313 | *
|
10314 | * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
|
10315 | * call:
|
10316 | */
|
10317 | setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
|
10318 | /**
|
10319 | * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
|
10320 | * divided by 100, so 300% = 3.0.
|
10321 |
|
10322 | The factor must be greater than 0.0.
|
10323 | */
|
10324 | setZoomFactor(factor: number): void;
|
10325 | /**
|
10326 | * Changes the zoom level to the specified level. The original size is 0 and each
|
10327 | * increment above or below represents zooming 20% larger or smaller to default
|
10328 | * limits of 300% and 50% of original size, respectively.
|
10329 | */
|
10330 | setZoomLevel(level: number): void;
|
10331 | /**
|
10332 | * A `WebFrame | null` representing the first child frame of `webFrame`, the
|
10333 | * property would be `null` if `webFrame` has no children or if first child is not
|
10334 | * in the current renderer process.
|
10335 | *
|
10336 | */
|
10337 | readonly firstChild: (WebFrame) | (null);
|
10338 | /**
|
10339 | * A `WebFrame | null` representing next sibling frame, the property would be
|
10340 | * `null` if `webFrame` is the last frame in its parent or if the next sibling is
|
10341 | * not in the current renderer process.
|
10342 | *
|
10343 | */
|
10344 | readonly nextSibling: (WebFrame) | (null);
|
10345 | /**
|
10346 | * A `WebFrame | null` representing the frame which opened `webFrame`, the property
|
10347 | * would be `null` if there's no opener or opener is not in the current renderer
|
10348 | * process.
|
10349 | *
|
10350 | */
|
10351 | readonly opener: (WebFrame) | (null);
|
10352 | /**
|
10353 | * A `WebFrame | null` representing parent frame of `webFrame`, the property would
|
10354 | * be `null` if `webFrame` is top or parent is not in the current renderer process.
|
10355 | *
|
10356 | */
|
10357 | readonly parent: (WebFrame) | (null);
|
10358 | /**
|
10359 | * An `Integer` representing the unique frame id in the current renderer process.
|
10360 | * Distinct WebFrame instances that refer to the same underlying frame will have
|
10361 | * the same `routingId`.
|
10362 | *
|
10363 | */
|
10364 | readonly routingId: number;
|
10365 | /**
|
10366 | * A `WebFrame | null` representing top frame in frame hierarchy to which
|
10367 | * `webFrame` belongs, the property would be `null` if top frame is not in the
|
10368 | * current renderer process.
|
10369 | *
|
10370 | */
|
10371 | readonly top: (WebFrame) | (null);
|
10372 | }
|
10373 |
|
10374 | class WebRequest {
|
10375 |
|
10376 | // Docs: http://electronjs.org/docs/api/web-request
|
10377 |
|
10378 | /**
|
10379 | * The `listener` will be called with `listener(details)` when a server initiated
|
10380 | * redirect is about to occur.
|
10381 | */
|
10382 | onBeforeRedirect(filter: Filter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
|
10383 | /**
|
10384 | * The `listener` will be called with `listener(details)` when a server initiated
|
10385 | * redirect is about to occur.
|
10386 | */
|
10387 | onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
|
10388 | /**
|
10389 | * The `listener` will be called with `listener(details, callback)` when a request
|
10390 | * is about to occur.
|
10391 | *
|
10392 | * The `uploadData` is an array of `UploadData` objects.
|
10393 | *
|
10394 | * The `callback` has to be called with an `response` object.
|
10395 | *
|
10396 | Some examples of valid `urls`:
|
10397 | */
|
10398 | onBeforeRequest(filter: Filter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
|
10399 | /**
|
10400 | * The `listener` will be called with `listener(details, callback)` when a request
|
10401 | * is about to occur.
|
10402 | *
|
10403 | * The `uploadData` is an array of `UploadData` objects.
|
10404 | *
|
10405 | * The `callback` has to be called with an `response` object.
|
10406 | *
|
10407 | Some examples of valid `urls`:
|
10408 | */
|
10409 | onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
|
10410 | /**
|
10411 | * The `listener` will be called with `listener(details, callback)` before sending
|
10412 | * an HTTP request, once the request headers are available. This may occur after a
|
10413 | * TCP connection is made to the server, but before any http data is sent.
|
10414 | *
|
10415 | The `callback` has to be called with a `response` object.
|
10416 | */
|
10417 | onBeforeSendHeaders(filter: Filter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
|
10418 | /**
|
10419 | * The `listener` will be called with `listener(details, callback)` before sending
|
10420 | * an HTTP request, once the request headers are available. This may occur after a
|
10421 | * TCP connection is made to the server, but before any http data is sent.
|
10422 | *
|
10423 | The `callback` has to be called with a `response` object.
|
10424 | */
|
10425 | onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
|
10426 | /**
|
10427 | * The `listener` will be called with `listener(details)` when a request is
|
10428 | * completed.
|
10429 | */
|
10430 | onCompleted(filter: Filter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
|
10431 | /**
|
10432 | * The `listener` will be called with `listener(details)` when a request is
|
10433 | * completed.
|
10434 | */
|
10435 | onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
|
10436 | /**
|
10437 | * The `listener` will be called with `listener(details)` when an error occurs.
|
10438 | */
|
10439 | onErrorOccurred(filter: Filter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
|
10440 | /**
|
10441 | * The `listener` will be called with `listener(details)` when an error occurs.
|
10442 | */
|
10443 | onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
|
10444 | /**
|
10445 | * The `listener` will be called with `listener(details, callback)` when HTTP
|
10446 | * response headers of a request have been received.
|
10447 | *
|
10448 | The `callback` has to be called with a `response` object.
|
10449 | */
|
10450 | onHeadersReceived(filter: Filter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
|
10451 | /**
|
10452 | * The `listener` will be called with `listener(details, callback)` when HTTP
|
10453 | * response headers of a request have been received.
|
10454 | *
|
10455 | The `callback` has to be called with a `response` object.
|
10456 | */
|
10457 | onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
|
10458 | /**
|
10459 | * The `listener` will be called with `listener(details)` when first byte of the
|
10460 | * response body is received. For HTTP requests, this means that the status line
|
10461 | * and response headers are available.
|
10462 | */
|
10463 | onResponseStarted(filter: Filter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
|
10464 | /**
|
10465 | * The `listener` will be called with `listener(details)` when first byte of the
|
10466 | * response body is received. For HTTP requests, this means that the status line
|
10467 | * and response headers are available.
|
10468 | */
|
10469 | onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
|
10470 | /**
|
10471 | * The `listener` will be called with `listener(details)` just before a request is
|
10472 | * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
|
10473 | * response are visible by the time this listener is fired.
|
10474 | */
|
10475 | onSendHeaders(filter: Filter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
|
10476 | /**
|
10477 | * The `listener` will be called with `listener(details)` just before a request is
|
10478 | * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
|
10479 | * response are visible by the time this listener is fired.
|
10480 | */
|
10481 | onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
|
10482 | }
|
10483 |
|
10484 | interface WebSource {
|
10485 |
|
10486 | // Docs: http://electronjs.org/docs/api/structures/web-source
|
10487 |
|
10488 | code: string;
|
10489 | /**
|
10490 | * Default is 1.
|
10491 | */
|
10492 | startLine?: number;
|
10493 | url?: string;
|
10494 | }
|
10495 |
|
10496 | interface WebviewTag extends HTMLElement {
|
10497 |
|
10498 | // Docs: http://electronjs.org/docs/api/webview-tag
|
10499 |
|
10500 | /**
|
10501 | * Fired when a load has committed. This includes navigation within the current
|
10502 | * document as well as subframe document-level loads, but does not include
|
10503 | * asynchronous resource loads.
|
10504 | */
|
10505 | addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
|
10506 | removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
|
10507 | /**
|
10508 | * Fired when the navigation is done, i.e. the spinner of the tab will stop
|
10509 | * spinning, and the `onload` event is dispatched.
|
10510 | */
|
10511 | addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this;
|
10512 | removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this;
|
10513 | /**
|
10514 | * This event is like `did-finish-load`, but fired when the load failed or was
|
10515 | * cancelled, e.g. `window.stop()` is invoked.
|
10516 | */
|
10517 | addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
|
10518 | removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
|
10519 | /**
|
10520 | * Fired when a frame has done navigation.
|
10521 | */
|
10522 | addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
|
10523 | removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
|
10524 | /**
|
10525 | * Corresponds to the points in time when the spinner of the tab starts spinning.
|
10526 | */
|
10527 | addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this;
|
10528 | removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this;
|
10529 | /**
|
10530 | * Corresponds to the points in time when the spinner of the tab stops spinning.
|
10531 | */
|
10532 | addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this;
|
10533 | removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this;
|
10534 | /**
|
10535 | * Fired when document in the given frame is loaded.
|
10536 | */
|
10537 | addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this;
|
10538 | removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this;
|
10539 | /**
|
10540 | * Fired when page title is set during navigation. `explicitSet` is false when
|
10541 | * title is synthesized from file url.
|
10542 | */
|
10543 | addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
|
10544 | removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
|
10545 | /**
|
10546 | * Fired when page receives favicon urls.
|
10547 | */
|
10548 | addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
|
10549 | removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
|
10550 | /**
|
10551 | * Fired when page enters fullscreen triggered by HTML API.
|
10552 | */
|
10553 | addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
|
10554 | removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this;
|
10555 | /**
|
10556 | * Fired when page leaves fullscreen triggered by HTML API.
|
10557 | */
|
10558 | addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
|
10559 | removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this;
|
10560 | /**
|
10561 | * Fired when the guest window logs a console message.
|
10562 | *
|
10563 | * The following example code forwards all log messages to the embedder's console
|
10564 | * without regard for log level or other properties.
|
10565 | */
|
10566 | addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
|
10567 | removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
|
10568 | /**
|
10569 | * Fired when a result is available for `webview.findInPage` request.
|
10570 | */
|
10571 | addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
|
10572 | removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
|
10573 | /**
|
10574 | * Fired when the guest page attempts to open a new browser window.
|
10575 | *
|
10576 | The following example code opens the new url in system's default browser.
|
10577 | */
|
10578 | addEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void, useCapture?: boolean): this;
|
10579 | removeEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void): this;
|
10580 | /**
|
10581 | * Emitted when a user or the page wants to start navigation. It can happen when
|
10582 | * the `window.location` object is changed or a user clicks a link in the page.
|
10583 | *
|
10584 | * This event will not emit when the navigation is started programmatically with
|
10585 | * APIs like `<webview>.loadURL` and `<webview>.back`.
|
10586 | *
|
10587 | * It is also not emitted during in-page navigation, such as clicking anchor links
|
10588 | * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
|
10589 | * this purpose.
|
10590 |
|
10591 | Calling `event.preventDefault()` does __NOT__ have any effect.
|
10592 | */
|
10593 | addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
|
10594 | removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
|
10595 | /**
|
10596 | * Emitted when a navigation is done.
|
10597 | *
|
10598 | * This event is not emitted for in-page navigations, such as clicking anchor links
|
10599 | * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
|
10600 | * this purpose.
|
10601 | */
|
10602 | addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
|
10603 | removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
|
10604 | /**
|
10605 | * Emitted when an in-page navigation happened.
|
10606 | *
|
10607 | * When in-page navigation happens, the page URL changes but does not cause
|
10608 | * navigation outside of the page. Examples of this occurring are when anchor links
|
10609 | * are clicked or when the DOM `hashchange` event is triggered.
|
10610 | */
|
10611 | addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
|
10612 | removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
|
10613 | /**
|
10614 | * Fired when the guest page attempts to close itself.
|
10615 | *
|
10616 | * The following example code navigates the `webview` to `about:blank` when the
|
10617 | * guest attempts to close itself.
|
10618 | */
|
10619 | addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this;
|
10620 | removeEventListener(event: 'close', listener: (event: Event) => void): this;
|
10621 | /**
|
10622 | * Fired when the guest page has sent an asynchronous message to embedder page.
|
10623 | *
|
10624 | * With `sendToHost` method and `ipc-message` event you can communicate between
|
10625 | * guest page and embedder page:
|
10626 | */
|
10627 | addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
|
10628 | removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
|
10629 | /**
|
10630 | * Fired when the renderer process is crashed.
|
10631 | */
|
10632 | addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this;
|
10633 | removeEventListener(event: 'crashed', listener: (event: Event) => void): this;
|
10634 | /**
|
10635 | * Fired when a plugin process is crashed.
|
10636 | */
|
10637 | addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
|
10638 | removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
|
10639 | /**
|
10640 | * Fired when the WebContents is destroyed.
|
10641 | */
|
10642 | addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this;
|
10643 | removeEventListener(event: 'destroyed', listener: (event: Event) => void): this;
|
10644 | /**
|
10645 | * Emitted when media starts playing.
|
10646 | */
|
10647 | addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this;
|
10648 | removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this;
|
10649 | /**
|
10650 | * Emitted when media is paused or done playing.
|
10651 | */
|
10652 | addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this;
|
10653 | removeEventListener(event: 'media-paused', listener: (event: Event) => void): this;
|
10654 | /**
|
10655 | * Emitted when a page's theme color changes. This is usually due to encountering a
|
10656 | * meta tag:
|
10657 | */
|
10658 | addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
|
10659 | removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
|
10660 | /**
|
10661 | * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
|
10662 | */
|
10663 | addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
|
10664 | removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
|
10665 | /**
|
10666 | * Emitted when DevTools is opened.
|
10667 | */
|
10668 | addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this;
|
10669 | removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this;
|
10670 | /**
|
10671 | * Emitted when DevTools is closed.
|
10672 | */
|
10673 | addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this;
|
10674 | removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this;
|
10675 | /**
|
10676 | * Emitted when DevTools is focused / opened.
|
10677 | */
|
10678 | addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this;
|
10679 | removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this;
|
10680 | addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
|
10681 | addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
10682 | removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
|
10683 | removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
10684 | /**
|
10685 | * Whether the guest page can go back.
|
10686 | */
|
10687 | canGoBack(): boolean;
|
10688 | /**
|
10689 | * Whether the guest page can go forward.
|
10690 | */
|
10691 | canGoForward(): boolean;
|
10692 | /**
|
10693 | * Whether the guest page can go to `offset`.
|
10694 | */
|
10695 | canGoToOffset(offset: number): boolean;
|
10696 | /**
|
10697 | * Resolves with a NativeImage
|
10698 | *
|
10699 | * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
|
10700 | * whole visible page.
|
10701 | */
|
10702 | capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
|
10703 | /**
|
10704 | * Clears the navigation history.
|
10705 | */
|
10706 | clearHistory(): void;
|
10707 | /**
|
10708 | * Closes the DevTools window of guest page.
|
10709 | */
|
10710 | closeDevTools(): void;
|
10711 | /**
|
10712 | * Executes editing command `copy` in page.
|
10713 | */
|
10714 | copy(): void;
|
10715 | /**
|
10716 | * Executes editing command `cut` in page.
|
10717 | */
|
10718 | cut(): void;
|
10719 | /**
|
10720 | * Executes editing command `delete` in page.
|
10721 | */
|
10722 | delete(): void;
|
10723 | /**
|
10724 | * Initiates a download of the resource at `url` without navigating.
|
10725 | */
|
10726 | downloadURL(url: string): void;
|
10727 | /**
|
10728 | * A promise that resolves with the result of the executed code or is rejected if
|
10729 | * the result of the code is a rejected promise.
|
10730 | *
|
10731 | * Evaluates `code` in page. If `userGesture` is set, it will create the user
|
10732 | * gesture context in the page. HTML APIs like `requestFullScreen`, which require
|
10733 | * user action, can take advantage of this option for automation.
|
10734 | */
|
10735 | executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
|
10736 | /**
|
10737 | * The request id used for the request.
|
10738 | *
|
10739 | * Starts a request to find all matches for the `text` in the web page. The result
|
10740 | * of the request can be obtained by subscribing to `found-in-page` event.
|
10741 | */
|
10742 | findInPage(text: string, options?: FindInPageOptions): number;
|
10743 | /**
|
10744 | * The title of guest page.
|
10745 | */
|
10746 | getTitle(): string;
|
10747 | /**
|
10748 | * The URL of guest page.
|
10749 | */
|
10750 | getURL(): string;
|
10751 | /**
|
10752 | * The user agent for guest page.
|
10753 | */
|
10754 | getUserAgent(): string;
|
10755 | /**
|
10756 | * The WebContents ID of this `webview`.
|
10757 | */
|
10758 | getWebContentsId(): number;
|
10759 | /**
|
10760 | * the current zoom factor.
|
10761 | */
|
10762 | getZoomFactor(): number;
|
10763 | /**
|
10764 | * the current zoom level.
|
10765 | */
|
10766 | getZoomLevel(): number;
|
10767 | /**
|
10768 | * Makes the guest page go back.
|
10769 | */
|
10770 | goBack(): void;
|
10771 | /**
|
10772 | * Makes the guest page go forward.
|
10773 | */
|
10774 | goForward(): void;
|
10775 | /**
|
10776 | * Navigates to the specified absolute index.
|
10777 | */
|
10778 | goToIndex(index: number): void;
|
10779 | /**
|
10780 | * Navigates to the specified offset from the "current entry".
|
10781 | */
|
10782 | goToOffset(offset: number): void;
|
10783 | /**
|
10784 | * A promise that resolves with a key for the inserted CSS that can later be used
|
10785 | * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
|
10786 | *
|
10787 | * Injects CSS into the current web page and returns a unique key for the inserted
|
10788 | * stylesheet.
|
10789 | */
|
10790 | insertCSS(css: string): Promise<string>;
|
10791 | /**
|
10792 | * Inserts `text` to the focused element.
|
10793 | */
|
10794 | insertText(text: string): Promise<void>;
|
10795 | /**
|
10796 | * Starts inspecting element at position (`x`, `y`) of guest page.
|
10797 | */
|
10798 | inspectElement(x: number, y: number): void;
|
10799 | /**
|
10800 | * Opens the DevTools for the service worker context present in the guest page.
|
10801 | */
|
10802 | inspectServiceWorker(): void;
|
10803 | /**
|
10804 | * Opens the DevTools for the shared worker context present in the guest page.
|
10805 | */
|
10806 | inspectSharedWorker(): void;
|
10807 | /**
|
10808 | * Whether guest page has been muted.
|
10809 | */
|
10810 | isAudioMuted(): boolean;
|
10811 | /**
|
10812 | * Whether the renderer process has crashed.
|
10813 | */
|
10814 | isCrashed(): boolean;
|
10815 | /**
|
10816 | * Whether audio is currently playing.
|
10817 | */
|
10818 | isCurrentlyAudible(): boolean;
|
10819 | /**
|
10820 | * Whether DevTools window of guest page is focused.
|
10821 | */
|
10822 | isDevToolsFocused(): boolean;
|
10823 | /**
|
10824 | * Whether guest page has a DevTools window attached.
|
10825 | */
|
10826 | isDevToolsOpened(): boolean;
|
10827 | /**
|
10828 | * Whether guest page is still loading resources.
|
10829 | */
|
10830 | isLoading(): boolean;
|
10831 | /**
|
10832 | * Whether the main frame (and not just iframes or frames within it) is still
|
10833 | * loading.
|
10834 | */
|
10835 | isLoadingMainFrame(): boolean;
|
10836 | /**
|
10837 | * Whether the guest page is waiting for a first-response for the main resource of
|
10838 | * the page.
|
10839 | */
|
10840 | isWaitingForResponse(): boolean;
|
10841 | /**
|
10842 | * The promise will resolve when the page has finished loading (see
|
10843 | * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
|
10844 | *
|
10845 | * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
|
10846 | * the `http://` or `file://`.
|
10847 | */
|
10848 | loadURL(url: string, options?: LoadURLOptions): Promise<void>;
|
10849 | /**
|
10850 | * Opens a DevTools window for guest page.
|
10851 | */
|
10852 | openDevTools(): void;
|
10853 | /**
|
10854 | * Executes editing command `paste` in page.
|
10855 | */
|
10856 | paste(): void;
|
10857 | /**
|
10858 | * Executes editing command `pasteAndMatchStyle` in page.
|
10859 | */
|
10860 | pasteAndMatchStyle(): void;
|
10861 | /**
|
10862 | * Prints `webview`'s web page. Same as `webContents.print([options])`.
|
10863 | */
|
10864 | print(options?: WebviewTagPrintOptions): Promise<void>;
|
10865 | /**
|
10866 | * Resolves with the generated PDF data.
|
10867 | *
|
10868 | Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
|
10869 | */
|
10870 | printToPDF(options: PrintToPDFOptions): Promise<Uint8Array>;
|
10871 | /**
|
10872 | * Executes editing command `redo` in page.
|
10873 | */
|
10874 | redo(): void;
|
10875 | /**
|
10876 | * Reloads the guest page.
|
10877 | */
|
10878 | reload(): void;
|
10879 | /**
|
10880 | * Reloads the guest page and ignores cache.
|
10881 | */
|
10882 | reloadIgnoringCache(): void;
|
10883 | /**
|
10884 | * Resolves if the removal was successful.
|
10885 | *
|
10886 | * Removes the inserted CSS from the current web page. The stylesheet is identified
|
10887 | * by its key, which is returned from `<webview>.insertCSS(css)`.
|
10888 | */
|
10889 | removeInsertedCSS(key: string): Promise<void>;
|
10890 | /**
|
10891 | * Executes editing command `replace` in page.
|
10892 | */
|
10893 | replace(text: string): void;
|
10894 | /**
|
10895 | * Executes editing command `replaceMisspelling` in page.
|
10896 | */
|
10897 | replaceMisspelling(text: string): void;
|
10898 | /**
|
10899 | * Executes editing command `selectAll` in page.
|
10900 | */
|
10901 | selectAll(): void;
|
10902 | /**
|
10903 | * Send an asynchronous message to renderer process via `channel`, you can also
|
10904 | * send arbitrary arguments. The renderer process can handle the message by
|
10905 | * listening to the `channel` event with the `ipcRenderer` module.
|
10906 | *
|
10907 | See webContents.send for examples.
|
10908 | */
|
10909 | send(channel: string, ...args: any[]): Promise<void>;
|
10910 | /**
|
10911 | * Sends an input `event` to the page.
|
10912 | *
|
10913 | See webContents.sendInputEvent for detailed description of `event` object.
|
10914 | */
|
10915 | sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
|
10916 | /**
|
10917 | * Set guest page muted.
|
10918 | */
|
10919 | setAudioMuted(muted: boolean): void;
|
10920 | /**
|
10921 | * Overrides the user agent for the guest page.
|
10922 | */
|
10923 | setUserAgent(userAgent: string): void;
|
10924 | /**
|
10925 | * Sets the maximum and minimum pinch-to-zoom level.
|
10926 | */
|
10927 | setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
|
10928 | /**
|
10929 | * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
|
10930 | * divided by 100, so 300% = 3.0.
|
10931 | */
|
10932 | setZoomFactor(factor: number): void;
|
10933 | /**
|
10934 | * Changes the zoom level to the specified level. The original size is 0 and each
|
10935 | * increment above or below represents zooming 20% larger or smaller to default
|
10936 | * limits of 300% and 50% of original size, respectively. The formula for this is
|
10937 | * `scale := 1.2 ^ level`.
|
10938 | */
|
10939 | setZoomLevel(level: number): void;
|
10940 | /**
|
10941 | * Shows pop-up dictionary that searches the selected word on the page.
|
10942 | *
|
10943 | * @platform darwin
|
10944 | */
|
10945 | showDefinitionForSelection(): void;
|
10946 | /**
|
10947 | * Stops any pending navigation.
|
10948 | */
|
10949 | stop(): void;
|
10950 | /**
|
10951 | * Stops any `findInPage` request for the `webview` with the provided `action`.
|
10952 | */
|
10953 | stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
|
10954 | /**
|
10955 | * Executes editing command `undo` in page.
|
10956 | */
|
10957 | undo(): void;
|
10958 | /**
|
10959 | * Executes editing command `unselect` in page.
|
10960 | */
|
10961 | unselect(): void;
|
10962 | /**
|
10963 | * A `Boolean`. When this attribute is present the guest page will be allowed to
|
10964 | * open new windows. Popups are disabled by default.
|
10965 | */
|
10966 | allowpopups: boolean;
|
10967 | /**
|
10968 | * A `String` which is a list of strings which specifies the blink features to be
|
10969 | * disabled separated by `,`. The full list of supported feature strings can be
|
10970 | * found in the RuntimeEnabledFeatures.json5 file.
|
10971 | */
|
10972 | disableblinkfeatures: string;
|
10973 | /**
|
10974 | * A `Boolean`. When this attribute is present the guest page will have web
|
10975 | * security disabled. Web security is enabled by default.
|
10976 | */
|
10977 | disablewebsecurity: boolean;
|
10978 | /**
|
10979 | * A `String` which is a list of strings which specifies the blink features to be
|
10980 | * enabled separated by `,`. The full list of supported feature strings can be
|
10981 | * found in the RuntimeEnabledFeatures.json5 file.
|
10982 | */
|
10983 | enableblinkfeatures: string;
|
10984 | /**
|
10985 | * A `Boolean`. When this attribute is `false` the guest page in `webview` will not
|
10986 | * have access to the `remote` module. The remote module is available by default.
|
10987 | */
|
10988 | enableremotemodule: boolean;
|
10989 | /**
|
10990 | * A `String` that sets the referrer URL for the guest page.
|
10991 | */
|
10992 | httpreferrer: string;
|
10993 | /**
|
10994 | * A `Boolean`. When this attribute is present the guest page in `webview` will
|
10995 | * have node integration and can use node APIs like `require` and `process` to
|
10996 | * access low level system resources. Node integration is disabled by default in
|
10997 | * the guest page.
|
10998 | */
|
10999 | nodeintegration: boolean;
|
11000 | /**
|
11001 | * A `Boolean` for the experimental option for enabling NodeJS support in
|
11002 | * sub-frames such as iframes inside the `webview`. All your preloads will load for
|
11003 | * every iframe, you can use `process.isMainFrame` to determine if you are in the
|
11004 | * main frame or not. This option is disabled by default in the guest page.
|
11005 | */
|
11006 | nodeintegrationinsubframes: boolean;
|
11007 | /**
|
11008 | * A `String` that sets the session used by the page. If `partition` starts with
|
11009 | * `persist:`, the page will use a persistent session available to all pages in the
|
11010 | * app with the same `partition`. if there is no `persist:` prefix, the page will
|
11011 | * use an in-memory session. By assigning the same `partition`, multiple pages can
|
11012 | * share the same session. If the `partition` is unset then default session of the
|
11013 | * app will be used.
|
11014 | *
|
11015 | * This value can only be modified before the first navigation, since the session
|
11016 | * of an active renderer process cannot change. Subsequent attempts to modify the
|
11017 | * value will fail with a DOM exception.
|
11018 | */
|
11019 | partition: string;
|
11020 | /**
|
11021 | * A `Boolean`. When this attribute is present the guest page in `webview` will be
|
11022 | * able to use browser plugins. Plugins are disabled by default.
|
11023 | */
|
11024 | plugins: boolean;
|
11025 | /**
|
11026 | * A `String` that specifies a script that will be loaded before other scripts run
|
11027 | * in the guest page. The protocol of script's URL must be either `file:` or
|
11028 | * `asar:`, because it will be loaded by `require` in guest page under the hood.
|
11029 | *
|
11030 | * When the guest page doesn't have node integration this script will still have
|
11031 | * access to all Node APIs, but global objects injected by Node will be deleted
|
11032 | * after this script has finished executing.
|
11033 | *
|
11034 | * **Note:** This option will appear as `preloadURL` (not `preload`) in the
|
11035 | * `webPreferences` specified to the `will-attach-webview` event.
|
11036 | */
|
11037 | preload: string;
|
11038 | /**
|
11039 | * A `String` representing the visible URL. Writing to this attribute initiates
|
11040 | * top-level navigation.
|
11041 | *
|
11042 | * Assigning `src` its own value will reload the current page.
|
11043 | *
|
11044 | * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
|
11045 | * world!`.
|
11046 | */
|
11047 | src: string;
|
11048 | /**
|
11049 | * A `String` that sets the user agent for the guest page before the page is
|
11050 | * navigated to. Once the page is loaded, use the `setUserAgent` method to change
|
11051 | * the user agent.
|
11052 | */
|
11053 | useragent: string;
|
11054 | /**
|
11055 | * A `String` which is a comma separated list of strings which specifies the web
|
11056 | * preferences to be set on the webview. The full list of supported preference
|
11057 | * strings can be found in BrowserWindow.
|
11058 | *
|
11059 | * The string follows the same format as the features string in `window.open`. A
|
11060 | * name by itself is given a `true` boolean value. A preference can be set to
|
11061 | * another value by including an `=`, followed by the value. Special values `yes`
|
11062 | * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
|
11063 | * `false`.
|
11064 | */
|
11065 | webpreferences: string;
|
11066 | }
|
11067 |
|
11068 | interface AboutPanelOptionsOptions {
|
11069 | /**
|
11070 | * The app's name.
|
11071 | */
|
11072 | applicationName?: string;
|
11073 | /**
|
11074 | * The app's version.
|
11075 | */
|
11076 | applicationVersion?: string;
|
11077 | /**
|
11078 | * Copyright information.
|
11079 | */
|
11080 | copyright?: string;
|
11081 | /**
|
11082 | * The app's build version number.
|
11083 | *
|
11084 | * @platform darwin
|
11085 | */
|
11086 | version?: string;
|
11087 | /**
|
11088 | * Credit information.
|
11089 | *
|
11090 | * @platform darwin,win32
|
11091 | */
|
11092 | credits?: string;
|
11093 | /**
|
11094 | * List of app authors.
|
11095 | *
|
11096 | * @platform linux
|
11097 | */
|
11098 | authors?: string[];
|
11099 | /**
|
11100 | * The app's website.
|
11101 | *
|
11102 | * @platform linux
|
11103 | */
|
11104 | website?: string;
|
11105 | /**
|
11106 | * Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as
|
11107 | * 64x64 pixels while retaining aspect ratio.
|
11108 | *
|
11109 | * @platform linux,win32
|
11110 | */
|
11111 | iconPath?: string;
|
11112 | }
|
11113 |
|
11114 | interface AddRepresentationOptions {
|
11115 | /**
|
11116 | * The scale factor to add the image representation for.
|
11117 | */
|
11118 | scaleFactor: number;
|
11119 | /**
|
11120 | * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
|
11121 | */
|
11122 | width?: number;
|
11123 | /**
|
11124 | * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
|
11125 | */
|
11126 | height?: number;
|
11127 | /**
|
11128 | * The buffer containing the raw image data.
|
11129 | */
|
11130 | buffer?: Buffer;
|
11131 | /**
|
11132 | * The data URL containing either a base 64 encoded PNG or JPEG image.
|
11133 | */
|
11134 | dataURL?: string;
|
11135 | }
|
11136 |
|
11137 | interface AnimationSettings {
|
11138 | /**
|
11139 | * Returns true if rich animations should be rendered. Looks at session type (e.g.
|
11140 | * remote desktop) and accessibility settings to give guidance for heavy
|
11141 | * animations.
|
11142 | */
|
11143 | shouldRenderRichAnimation: boolean;
|
11144 | /**
|
11145 | * Determines on a per-platform basis whether scroll animations (e.g. produced by
|
11146 | * home/end key) should be enabled.
|
11147 | */
|
11148 | scrollAnimationsEnabledBySystem: boolean;
|
11149 | /**
|
11150 | * Determines whether the user desires reduced motion based on platform APIs.
|
11151 | */
|
11152 | prefersReducedMotion: boolean;
|
11153 | }
|
11154 |
|
11155 | interface AppDetailsOptions {
|
11156 | /**
|
11157 | * Window's App User Model ID. It has to be set, otherwise the other options will
|
11158 | * have no effect.
|
11159 | */
|
11160 | appId?: string;
|
11161 | /**
|
11162 | * Window's Relaunch Icon.
|
11163 | */
|
11164 | appIconPath?: string;
|
11165 | /**
|
11166 | * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
|
11167 | * Default is `0`.
|
11168 | */
|
11169 | appIconIndex?: number;
|
11170 | /**
|
11171 | * Window's Relaunch Command.
|
11172 | */
|
11173 | relaunchCommand?: string;
|
11174 | /**
|
11175 | * Window's Relaunch Display Name.
|
11176 | */
|
11177 | relaunchDisplayName?: string;
|
11178 | }
|
11179 |
|
11180 | interface ApplicationInfoForProtocolReturnValue {
|
11181 | /**
|
11182 | * the display icon of the app handling the protocol.
|
11183 | */
|
11184 | icon: NativeImage;
|
11185 | /**
|
11186 | * installation path of the app handling the protocol.
|
11187 | */
|
11188 | path: string;
|
11189 | /**
|
11190 | * display name of the app handling the protocol.
|
11191 | */
|
11192 | name: string;
|
11193 | }
|
11194 |
|
11195 | interface AuthenticationResponseDetails {
|
11196 | url: string;
|
11197 | }
|
11198 |
|
11199 | interface AuthInfo {
|
11200 | isProxy: boolean;
|
11201 | scheme: string;
|
11202 | host: string;
|
11203 | port: number;
|
11204 | realm: string;
|
11205 | }
|
11206 |
|
11207 | interface AutoResizeOptions {
|
11208 | /**
|
11209 | * If `true`, the view's width will grow and shrink together with the window.
|
11210 | * `false` by default.
|
11211 | */
|
11212 | width?: boolean;
|
11213 | /**
|
11214 | * If `true`, the view's height will grow and shrink together with the window.
|
11215 | * `false` by default.
|
11216 | */
|
11217 | height?: boolean;
|
11218 | /**
|
11219 | * If `true`, the view's x position and width will grow and shrink proportionally
|
11220 | * with the window. `false` by default.
|
11221 | */
|
11222 | horizontal?: boolean;
|
11223 | /**
|
11224 | * If `true`, the view's y position and height will grow and shrink proportionally
|
11225 | * with the window. `false` by default.
|
11226 | */
|
11227 | vertical?: boolean;
|
11228 | }
|
11229 |
|
11230 | interface BeforeSendResponse {
|
11231 | cancel?: boolean;
|
11232 | /**
|
11233 | * When provided, request will be made with these headers.
|
11234 | */
|
11235 | requestHeaders?: Record<string, (string) | (string[])>;
|
11236 | }
|
11237 |
|
11238 | interface BitmapOptions {
|
11239 | /**
|
11240 | * Defaults to 1.0.
|
11241 | */
|
11242 | scaleFactor?: number;
|
11243 | }
|
11244 |
|
11245 | interface BlinkMemoryInfo {
|
11246 | /**
|
11247 | * Size of all allocated objects in Kilobytes.
|
11248 | */
|
11249 | allocated: number;
|
11250 | /**
|
11251 | * Size of all marked objects in Kilobytes.
|
11252 | */
|
11253 | marked: number;
|
11254 | /**
|
11255 | * Total allocated space in Kilobytes.
|
11256 | */
|
11257 | total: number;
|
11258 | }
|
11259 |
|
11260 | interface BrowserViewConstructorOptions {
|
11261 | /**
|
11262 | * See BrowserWindow.
|
11263 | */
|
11264 | webPreferences?: WebPreferences;
|
11265 | }
|
11266 |
|
11267 | interface BrowserWindowConstructorOptions {
|
11268 | /**
|
11269 | * Window's width in pixels. Default is `800`.
|
11270 | */
|
11271 | width?: number;
|
11272 | /**
|
11273 | * Window's height in pixels. Default is `600`.
|
11274 | */
|
11275 | height?: number;
|
11276 | /**
|
11277 | * (**required** if y is used) Window's left offset from screen. Default is to
|
11278 | * center the window.
|
11279 | */
|
11280 | x?: number;
|
11281 | /**
|
11282 | * (**required** if x is used) Window's top offset from screen. Default is to
|
11283 | * center the window.
|
11284 | */
|
11285 | y?: number;
|
11286 | /**
|
11287 | * The `width` and `height` would be used as web page's size, which means the
|
11288 | * actual window's size will include window frame's size and be slightly larger.
|
11289 | * Default is `false`.
|
11290 | */
|
11291 | useContentSize?: boolean;
|
11292 | /**
|
11293 | * Show window in the center of the screen.
|
11294 | */
|
11295 | center?: boolean;
|
11296 | /**
|
11297 | * Window's minimum width. Default is `0`.
|
11298 | */
|
11299 | minWidth?: number;
|
11300 | /**
|
11301 | * Window's minimum height. Default is `0`.
|
11302 | */
|
11303 | minHeight?: number;
|
11304 | /**
|
11305 | * Window's maximum width. Default is no limit.
|
11306 | */
|
11307 | maxWidth?: number;
|
11308 | /**
|
11309 | * Window's maximum height. Default is no limit.
|
11310 | */
|
11311 | maxHeight?: number;
|
11312 | /**
|
11313 | * Whether window is resizable. Default is `true`.
|
11314 | */
|
11315 | resizable?: boolean;
|
11316 | /**
|
11317 | * Whether window is movable. This is not implemented on Linux. Default is `true`.
|
11318 | */
|
11319 | movable?: boolean;
|
11320 | /**
|
11321 | * Whether window is minimizable. This is not implemented on Linux. Default is
|
11322 | * `true`.
|
11323 | */
|
11324 | minimizable?: boolean;
|
11325 | /**
|
11326 | * Whether window is maximizable. This is not implemented on Linux. Default is
|
11327 | * `true`.
|
11328 | */
|
11329 | maximizable?: boolean;
|
11330 | /**
|
11331 | * Whether window is closable. This is not implemented on Linux. Default is `true`.
|
11332 | */
|
11333 | closable?: boolean;
|
11334 | /**
|
11335 | * Whether the window can be focused. Default is `true`. On Windows setting
|
11336 | * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
|
11337 | * `focusable: false` makes the window stop interacting with wm, so the window will
|
11338 | * always stay on top in all workspaces.
|
11339 | */
|
11340 | focusable?: boolean;
|
11341 | /**
|
11342 | * Whether the window should always stay on top of other windows. Default is
|
11343 | * `false`.
|
11344 | */
|
11345 | alwaysOnTop?: boolean;
|
11346 | /**
|
11347 | * Whether the window should show in fullscreen. When explicitly set to `false` the
|
11348 | * fullscreen button will be hidden or disabled on macOS. Default is `false`.
|
11349 | */
|
11350 | fullscreen?: boolean;
|
11351 | /**
|
11352 | * Whether the window can be put into fullscreen mode. On macOS, also whether the
|
11353 | * maximize/zoom button should toggle full screen mode or maximize window. Default
|
11354 | * is `true`.
|
11355 | */
|
11356 | fullscreenable?: boolean;
|
11357 | /**
|
11358 | * Use pre-Lion fullscreen on macOS. Default is `false`.
|
11359 | */
|
11360 | simpleFullscreen?: boolean;
|
11361 | /**
|
11362 | * Whether to show the window in taskbar. Default is `false`.
|
11363 | */
|
11364 | skipTaskbar?: boolean;
|
11365 | /**
|
11366 | * Whether the window is in kiosk mode. Default is `false`.
|
11367 | */
|
11368 | kiosk?: boolean;
|
11369 | /**
|
11370 | * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
|
11371 | * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
|
11372 | */
|
11373 | title?: string;
|
11374 | /**
|
11375 | * The window icon. On Windows it is recommended to use `ICO` icons to get best
|
11376 | * visual effects, you can also leave it undefined so the executable's icon will be
|
11377 | * used.
|
11378 | */
|
11379 | icon?: (NativeImage) | (string);
|
11380 | /**
|
11381 | * Whether window should be shown when created. Default is `true`.
|
11382 | */
|
11383 | show?: boolean;
|
11384 | /**
|
11385 | * Whether the renderer should be active when `show` is `false` and it has just
|
11386 | * been created. In order for `document.visibilityState` to work correctly on
|
11387 | * first load with `show: false` you should set this to `false`. Setting this to
|
11388 | * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
|
11389 | */
|
11390 | paintWhenInitiallyHidden?: boolean;
|
11391 | /**
|
11392 | * Specify `false` to create a Frameless Window. Default is `true`.
|
11393 | */
|
11394 | frame?: boolean;
|
11395 | /**
|
11396 | * Specify parent window. Default is `null`.
|
11397 | */
|
11398 | parent?: BrowserWindow;
|
11399 | /**
|
11400 | * Whether this is a modal window. This only works when the window is a child
|
11401 | * window. Default is `false`.
|
11402 | */
|
11403 | modal?: boolean;
|
11404 | /**
|
11405 | * Whether the web view accepts a single mouse-down event that simultaneously
|
11406 | * activates the window. Default is `false`.
|
11407 | */
|
11408 | acceptFirstMouse?: boolean;
|
11409 | /**
|
11410 | * Whether to hide cursor when typing. Default is `false`.
|
11411 | */
|
11412 | disableAutoHideCursor?: boolean;
|
11413 | /**
|
11414 | * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
|
11415 | */
|
11416 | autoHideMenuBar?: boolean;
|
11417 | /**
|
11418 | * Enable the window to be resized larger than screen. Only relevant for macOS, as
|
11419 | * other OSes allow larger-than-screen windows by default. Default is `false`.
|
11420 | */
|
11421 | enableLargerThanScreen?: boolean;
|
11422 | /**
|
11423 | * Window's background color as a hexadecimal value, like `#66CD00` or `#FFF` or
|
11424 | * `#80FFFFFF` (alpha in #AARRGGBB format is supported if `transparent` is set to
|
11425 | * `true`). Default is `#FFF` (white).
|
11426 | */
|
11427 | backgroundColor?: string;
|
11428 | /**
|
11429 | * Whether window should have a shadow. Default is `true`.
|
11430 | */
|
11431 | hasShadow?: boolean;
|
11432 | /**
|
11433 | * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
|
11434 | * (fully opaque). This is only implemented on Windows and macOS.
|
11435 | */
|
11436 | opacity?: number;
|
11437 | /**
|
11438 | * Forces using dark theme for the window, only works on some GTK desktop
|
11439 | * environments. Default is `nativeTheme.shouldUseDarkColors`.
|
11440 | */
|
11441 | darkTheme?: boolean;
|
11442 | /**
|
11443 | * Makes the window transparent. Default is `false`. On Windows, does not work
|
11444 | * unless the window is frameless.
|
11445 | */
|
11446 | transparent?: boolean;
|
11447 | /**
|
11448 | * The type of window, default is normal window. See more about this below.
|
11449 | */
|
11450 | type?: string;
|
11451 | /**
|
11452 | * The style of window title bar. Default is `default`. Possible values are:
|
11453 | */
|
11454 | titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
|
11455 | /**
|
11456 | * Set a custom position for the traffic light buttons. Can only be used with
|
11457 | * `titleBarStyle` set to `hidden`
|
11458 | */
|
11459 | trafficLightPosition?: Point;
|
11460 | /**
|
11461 | * Shows the title in the title bar in full screen mode on macOS for all
|
11462 | * `titleBarStyle` options. Default is `false`.
|
11463 | */
|
11464 | fullscreenWindowTitle?: boolean;
|
11465 | /**
|
11466 | * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
|
11467 | * window frame. Setting it to `false` will remove window shadow and window
|
11468 | * animations. Default is `true`.
|
11469 | */
|
11470 | thickFrame?: boolean;
|
11471 | /**
|
11472 | * Add a type of vibrancy effect to the window, only on macOS. Can be
|
11473 | * `appearance-based`, `light`, `dark`, `titlebar`, `selection`, `menu`, `popover`,
|
11474 | * `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`,
|
11475 | * `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please
|
11476 | * note that using `frame: false` in combination with a vibrancy value requires
|
11477 | * that you use a non-default `titleBarStyle` as well. Also note that
|
11478 | * `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` have been
|
11479 | * deprecated and will be removed in an upcoming version of macOS.
|
11480 | */
|
11481 | 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');
|
11482 | /**
|
11483 | * Controls the behavior on macOS when option-clicking the green stoplight button
|
11484 | * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
|
11485 | * will grow to the preferred width of the web page when zoomed, `false` will cause
|
11486 | * it to zoom to the width of the screen. This will also affect the behavior when
|
11487 | * calling `maximize()` directly. Default is `false`.
|
11488 | */
|
11489 | zoomToPageWidth?: boolean;
|
11490 | /**
|
11491 | * Tab group name, allows opening the window as a native tab on macOS 10.12+.
|
11492 | * Windows with the same tabbing identifier will be grouped together. This also
|
11493 | * adds a native new tab button to your window's tab bar and allows your `app` and
|
11494 | * window to receive the `new-window-for-tab` event.
|
11495 | */
|
11496 | tabbingIdentifier?: string;
|
11497 | /**
|
11498 | * Settings of web page's features.
|
11499 | */
|
11500 | webPreferences?: WebPreferences;
|
11501 | }
|
11502 |
|
11503 | interface CertificateTrustDialogOptions {
|
11504 | /**
|
11505 | * The certificate to trust/import.
|
11506 | */
|
11507 | certificate: Certificate;
|
11508 | /**
|
11509 | * The message to display to the user.
|
11510 | */
|
11511 | message: string;
|
11512 | }
|
11513 |
|
11514 | interface ClearStorageDataOptions {
|
11515 | /**
|
11516 | * Should follow `window.location.origin`’s representation `scheme://host:port`.
|
11517 | */
|
11518 | origin?: string;
|
11519 | /**
|
11520 | * The types of storages to clear, can contain: `appcache`, `cookies`,
|
11521 | * `filesystem`, `indexdb`, `localstorage`, `shadercache`, `websql`,
|
11522 | * `serviceworkers`, `cachestorage`. If not specified, clear all storage types.
|
11523 | */
|
11524 | storages?: string[];
|
11525 | /**
|
11526 | * The types of quotas to clear, can contain: `temporary`, `persistent`,
|
11527 | * `syncable`. If not specified, clear all quotas.
|
11528 | */
|
11529 | quotas?: string[];
|
11530 | }
|
11531 |
|
11532 | interface ClientRequestConstructorOptions {
|
11533 | /**
|
11534 | * The HTTP request method. Defaults to the GET method.
|
11535 | */
|
11536 | method?: string;
|
11537 | /**
|
11538 | * The request URL. Must be provided in the absolute form with the protocol scheme
|
11539 | * specified as http or https.
|
11540 | */
|
11541 | url?: string;
|
11542 | /**
|
11543 | * The `Session` instance with which the request is associated.
|
11544 | */
|
11545 | session?: Session;
|
11546 | /**
|
11547 | * The name of the `partition` with which the request is associated. Defaults to
|
11548 | * the empty string. The `session` option prevails on `partition`. Thus if a
|
11549 | * `session` is explicitly specified, `partition` is ignored.
|
11550 | */
|
11551 | partition?: string;
|
11552 | /**
|
11553 | * Whether to send cookies with this request from the provided session. This will
|
11554 | * make the `net` request's cookie behavior match a `fetch` request. Default is
|
11555 | * `false`.
|
11556 | */
|
11557 | useSessionCookies?: boolean;
|
11558 | /**
|
11559 | * The protocol scheme in the form 'scheme:'. Currently supported values are
|
11560 | * 'http:' or 'https:'. Defaults to 'http:'.
|
11561 | */
|
11562 | protocol?: string;
|
11563 | /**
|
11564 | * The server host provided as a concatenation of the hostname and the port number
|
11565 | * 'hostname:port'.
|
11566 | */
|
11567 | host?: string;
|
11568 | /**
|
11569 | * The server host name.
|
11570 | */
|
11571 | hostname?: string;
|
11572 | /**
|
11573 | * The server's listening port number.
|
11574 | */
|
11575 | port?: number;
|
11576 | /**
|
11577 | * The path part of the request URL.
|
11578 | */
|
11579 | path?: string;
|
11580 | /**
|
11581 | * The redirect mode for this request. Should be one of `follow`, `error` or
|
11582 | * `manual`. Defaults to `follow`. When mode is `error`, any redirection will be
|
11583 | * aborted. When mode is `manual` the redirection will be cancelled unless
|
11584 | * `request.followRedirect` is invoked synchronously during the `redirect` event.
|
11585 | */
|
11586 | redirect?: string;
|
11587 | }
|
11588 |
|
11589 | interface Config {
|
11590 | /**
|
11591 | * The URL associated with the PAC file.
|
11592 | */
|
11593 | pacScript?: string;
|
11594 | /**
|
11595 | * Rules indicating which proxies to use.
|
11596 | */
|
11597 | proxyRules?: string;
|
11598 | /**
|
11599 | * Rules indicating which URLs should bypass the proxy settings.
|
11600 | */
|
11601 | proxyBypassRules?: string;
|
11602 | }
|
11603 |
|
11604 | interface ConsoleMessageEvent extends Event {
|
11605 | /**
|
11606 | * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
|
11607 | * `error`.
|
11608 | */
|
11609 | level: number;
|
11610 | /**
|
11611 | * The actual console message
|
11612 | */
|
11613 | message: string;
|
11614 | /**
|
11615 | * The line number of the source that triggered this console message
|
11616 | */
|
11617 | line: number;
|
11618 | sourceId: string;
|
11619 | }
|
11620 |
|
11621 | interface ContextMenuParams {
|
11622 | /**
|
11623 | * x coordinate.
|
11624 | */
|
11625 | x: number;
|
11626 | /**
|
11627 | * y coordinate.
|
11628 | */
|
11629 | y: number;
|
11630 | /**
|
11631 | * URL of the link that encloses the node the context menu was invoked on.
|
11632 | */
|
11633 | linkURL: string;
|
11634 | /**
|
11635 | * Text associated with the link. May be an empty string if the contents of the
|
11636 | * link are an image.
|
11637 | */
|
11638 | linkText: string;
|
11639 | /**
|
11640 | * URL of the top level page that the context menu was invoked on.
|
11641 | */
|
11642 | pageURL: string;
|
11643 | /**
|
11644 | * URL of the subframe that the context menu was invoked on.
|
11645 | */
|
11646 | frameURL: string;
|
11647 | /**
|
11648 | * Source URL for the element that the context menu was invoked on. Elements with
|
11649 | * source URLs are images, audio and video.
|
11650 | */
|
11651 | srcURL: string;
|
11652 | /**
|
11653 | * Type of the node the context menu was invoked on. Can be `none`, `image`,
|
11654 | * `audio`, `video`, `canvas`, `file` or `plugin`.
|
11655 | */
|
11656 | mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
|
11657 | /**
|
11658 | * Whether the context menu was invoked on an image which has non-empty contents.
|
11659 | */
|
11660 | hasImageContents: boolean;
|
11661 | /**
|
11662 | * Whether the context is editable.
|
11663 | */
|
11664 | isEditable: boolean;
|
11665 | /**
|
11666 | * Text of the selection that the context menu was invoked on.
|
11667 | */
|
11668 | selectionText: string;
|
11669 | /**
|
11670 | * Title or alt text of the selection that the context was invoked on.
|
11671 | */
|
11672 | titleText: string;
|
11673 | /**
|
11674 | * The misspelled word under the cursor, if any.
|
11675 | */
|
11676 | misspelledWord: string;
|
11677 | /**
|
11678 | * An array of suggested words to show the user to replace the `misspelledWord`.
|
11679 | * Only available if there is a misspelled word and spellchecker is enabled.
|
11680 | */
|
11681 | dictionarySuggestions: string[];
|
11682 | /**
|
11683 | * The character encoding of the frame on which the menu was invoked.
|
11684 | */
|
11685 | frameCharset: string;
|
11686 | /**
|
11687 | * If the context menu was invoked on an input field, the type of that field.
|
11688 | * Possible values are `none`, `plainText`, `password`, `other`.
|
11689 | */
|
11690 | inputFieldType: string;
|
11691 | /**
|
11692 | * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
|
11693 | * `touch` or `touchMenu`.
|
11694 | */
|
11695 | menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu');
|
11696 | /**
|
11697 | * The flags for the media element the context menu was invoked on.
|
11698 | */
|
11699 | mediaFlags: MediaFlags;
|
11700 | /**
|
11701 | * These flags indicate whether the renderer believes it is able to perform the
|
11702 | * corresponding action.
|
11703 | */
|
11704 | editFlags: EditFlags;
|
11705 | }
|
11706 |
|
11707 | interface CookiesGetFilter {
|
11708 | /**
|
11709 | * Retrieves cookies which are associated with `url`. Empty implies retrieving
|
11710 | * cookies of all URLs.
|
11711 | */
|
11712 | url?: string;
|
11713 | /**
|
11714 | * Filters cookies by name.
|
11715 | */
|
11716 | name?: string;
|
11717 | /**
|
11718 | * Retrieves cookies whose domains match or are subdomains of `domains`.
|
11719 | */
|
11720 | domain?: string;
|
11721 | /**
|
11722 | * Retrieves cookies whose path matches `path`.
|
11723 | */
|
11724 | path?: string;
|
11725 | /**
|
11726 | * Filters cookies by their Secure property.
|
11727 | */
|
11728 | secure?: boolean;
|
11729 | /**
|
11730 | * Filters out session or persistent cookies.
|
11731 | */
|
11732 | session?: boolean;
|
11733 | }
|
11734 |
|
11735 | interface CookiesSetDetails {
|
11736 | /**
|
11737 | * The URL to associate the cookie with. The promise will be rejected if the URL is
|
11738 | * invalid.
|
11739 | */
|
11740 | url: string;
|
11741 | /**
|
11742 | * The name of the cookie. Empty by default if omitted.
|
11743 | */
|
11744 | name?: string;
|
11745 | /**
|
11746 | * The value of the cookie. Empty by default if omitted.
|
11747 | */
|
11748 | value?: string;
|
11749 | /**
|
11750 | * The domain of the cookie; this will be normalized with a preceding dot so that
|
11751 | * it's also valid for subdomains. Empty by default if omitted.
|
11752 | */
|
11753 | domain?: string;
|
11754 | /**
|
11755 | * The path of the cookie. Empty by default if omitted.
|
11756 | */
|
11757 | path?: string;
|
11758 | /**
|
11759 | * Whether the cookie should be marked as Secure. Defaults to false.
|
11760 | */
|
11761 | secure?: boolean;
|
11762 | /**
|
11763 | * Whether the cookie should be marked as HTTP only. Defaults to false.
|
11764 | */
|
11765 | httpOnly?: boolean;
|
11766 | /**
|
11767 | * The expiration date of the cookie as the number of seconds since the UNIX epoch.
|
11768 | * If omitted then the cookie becomes a session cookie and will not be retained
|
11769 | * between sessions.
|
11770 | */
|
11771 | expirationDate?: number;
|
11772 | /**
|
11773 | * The Same Site policy to apply to this cookie. Can be `unspecified`,
|
11774 | * `no_restriction`, `lax` or `strict`. Default is `no_restriction`.
|
11775 | */
|
11776 | sameSite?: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
|
11777 | }
|
11778 |
|
11779 | interface CrashReporterStartOptions {
|
11780 | /**
|
11781 | * URL that crash reports will be sent to as POST.
|
11782 | */
|
11783 | submitURL: string;
|
11784 | /**
|
11785 | * Defaults to `app.name`.
|
11786 | */
|
11787 | productName?: string;
|
11788 | /**
|
11789 | * Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
|
11790 | *
|
11791 | * @deprecated
|
11792 | */
|
11793 | companyName?: string;
|
11794 | /**
|
11795 | * Whether crash reports should be sent to the server. If false, crash reports will
|
11796 | * be collected and stored in the crashes directory, but not uploaded. Default is
|
11797 | * `true`.
|
11798 | */
|
11799 | uploadToServer?: boolean;
|
11800 | /**
|
11801 | * If true, crashes generated in the main process will not be forwarded to the
|
11802 | * system crash handler. Default is `false`.
|
11803 | */
|
11804 | ignoreSystemCrashHandler?: boolean;
|
11805 | /**
|
11806 | * If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
|
11807 | *
|
11808 | * @platform darwin,win32
|
11809 | */
|
11810 | rateLimit?: boolean;
|
11811 | /**
|
11812 | * If true, crash reports will be compressed and uploaded with `Content-Encoding:
|
11813 | * gzip`. Default is `false`.
|
11814 | */
|
11815 | compress?: boolean;
|
11816 | /**
|
11817 | * Extra string key/value annotations that will be sent along with crash reports
|
11818 | * that are generated in the main process. Only string values are supported.
|
11819 | * Crashes generated in child processes will not contain these extra parameters to
|
11820 | * crash reports generated from child processes, call `addExtraParameter` from the
|
11821 | * child process.
|
11822 | */
|
11823 | extra?: Record<string, string>;
|
11824 | /**
|
11825 | * Extra string key/value annotations that will be sent along with any crash
|
11826 | * reports generated in any process. These annotations cannot be changed once the
|
11827 | * crash reporter has been started. If a key is present in both the global extra
|
11828 | * parameters and the process-specific extra parameters, then the global one will
|
11829 | * take precedence. By default, `productName` and the app version are included, as
|
11830 | * well as the Electron version.
|
11831 | */
|
11832 | globalExtra?: Record<string, string>;
|
11833 | }
|
11834 |
|
11835 | interface CreateFromBitmapOptions {
|
11836 | width: number;
|
11837 | height: number;
|
11838 | /**
|
11839 | * Defaults to 1.0.
|
11840 | */
|
11841 | scaleFactor?: number;
|
11842 | }
|
11843 |
|
11844 | interface CreateFromBufferOptions {
|
11845 | /**
|
11846 | * Required for bitmap buffers.
|
11847 | */
|
11848 | width?: number;
|
11849 | /**
|
11850 | * Required for bitmap buffers.
|
11851 | */
|
11852 | height?: number;
|
11853 | /**
|
11854 | * Defaults to 1.0.
|
11855 | */
|
11856 | scaleFactor?: number;
|
11857 | }
|
11858 |
|
11859 | interface CreateInterruptedDownloadOptions {
|
11860 | /**
|
11861 | * Absolute path of the download.
|
11862 | */
|
11863 | path: string;
|
11864 | /**
|
11865 | * Complete URL chain for the download.
|
11866 | */
|
11867 | urlChain: string[];
|
11868 | mimeType?: string;
|
11869 | /**
|
11870 | * Start range for the download.
|
11871 | */
|
11872 | offset: number;
|
11873 | /**
|
11874 | * Total length of the download.
|
11875 | */
|
11876 | length: number;
|
11877 | /**
|
11878 | * Last-Modified header value.
|
11879 | */
|
11880 | lastModified?: string;
|
11881 | /**
|
11882 | * ETag header value.
|
11883 | */
|
11884 | eTag?: string;
|
11885 | /**
|
11886 | * Time when download was started in number of seconds since UNIX epoch.
|
11887 | */
|
11888 | startTime?: number;
|
11889 | }
|
11890 |
|
11891 | interface Data {
|
11892 | text?: string;
|
11893 | html?: string;
|
11894 | image?: NativeImage;
|
11895 | rtf?: string;
|
11896 | /**
|
11897 | * The title of the URL at `text`.
|
11898 | */
|
11899 | bookmark?: string;
|
11900 | }
|
11901 |
|
11902 | interface Details {
|
11903 | /**
|
11904 | * The reason the render process is gone. Possible values:
|
11905 | */
|
11906 | reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failure' | 'integrity-failure');
|
11907 | }
|
11908 |
|
11909 | interface DidChangeThemeColorEvent extends Event {
|
11910 | themeColor: string;
|
11911 | }
|
11912 |
|
11913 | interface DidFailLoadEvent extends Event {
|
11914 | errorCode: number;
|
11915 | errorDescription: string;
|
11916 | validatedURL: string;
|
11917 | isMainFrame: boolean;
|
11918 | }
|
11919 |
|
11920 | interface DidFrameFinishLoadEvent extends Event {
|
11921 | isMainFrame: boolean;
|
11922 | }
|
11923 |
|
11924 | interface DidNavigateEvent extends Event {
|
11925 | url: string;
|
11926 | }
|
11927 |
|
11928 | interface DidNavigateInPageEvent extends Event {
|
11929 | isMainFrame: boolean;
|
11930 | url: string;
|
11931 | }
|
11932 |
|
11933 | interface DisplayBalloonOptions {
|
11934 | /**
|
11935 | * Icon to use when `iconType` is `custom`.
|
11936 | */
|
11937 | icon?: (NativeImage) | (string);
|
11938 | /**
|
11939 | * Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
|
11940 | */
|
11941 | iconType?: ('none' | 'info' | 'warning' | 'error' | 'custom');
|
11942 | title: string;
|
11943 | content: string;
|
11944 | /**
|
11945 | * The large version of the icon should be used. Default is `true`. Maps to
|
11946 | * `NIIF_LARGE_ICON`.
|
11947 | */
|
11948 | largeIcon?: boolean;
|
11949 | /**
|
11950 | * Do not play the associated sound. Default is `false`. Maps to `NIIF_NOSOUND`.
|
11951 | */
|
11952 | noSound?: boolean;
|
11953 | /**
|
11954 | * Do not display the balloon notification if the current user is in "quiet time".
|
11955 | * Default is `false`. Maps to `NIIF_RESPECT_QUIET_TIME`.
|
11956 | */
|
11957 | respectQuietTime?: boolean;
|
11958 | }
|
11959 |
|
11960 | interface EnableNetworkEmulationOptions {
|
11961 | /**
|
11962 | * Whether to emulate network outage. Defaults to false.
|
11963 | */
|
11964 | offline?: boolean;
|
11965 | /**
|
11966 | * RTT in ms. Defaults to 0 which will disable latency throttling.
|
11967 | */
|
11968 | latency?: number;
|
11969 | /**
|
11970 | * Download rate in Bps. Defaults to 0 which will disable download throttling.
|
11971 | */
|
11972 | downloadThroughput?: number;
|
11973 | /**
|
11974 | * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
|
11975 | */
|
11976 | uploadThroughput?: number;
|
11977 | }
|
11978 |
|
11979 | interface FeedURLOptions {
|
11980 | url: string;
|
11981 | /**
|
11982 | * HTTP request headers.
|
11983 | *
|
11984 | * @platform darwin
|
11985 | */
|
11986 | headers?: Record<string, string>;
|
11987 | /**
|
11988 | * Either `json` or `default`, see the Squirrel.Mac README for more information.
|
11989 | *
|
11990 | * @platform darwin
|
11991 | */
|
11992 | serverType?: string;
|
11993 | }
|
11994 |
|
11995 | interface FileIconOptions {
|
11996 | size: ('small' | 'normal' | 'large');
|
11997 | }
|
11998 |
|
11999 | interface Filter {
|
12000 | /**
|
12001 | * Array of URL patterns that will be used to filter out the requests that do not
|
12002 | * match the URL patterns.
|
12003 | */
|
12004 | urls: string[];
|
12005 | }
|
12006 |
|
12007 | interface FindInPageOptions {
|
12008 | /**
|
12009 | * Whether to search forward or backward, defaults to `true`.
|
12010 | */
|
12011 | forward?: boolean;
|
12012 | /**
|
12013 | * Whether the operation is first request or a follow up, defaults to `false`.
|
12014 | */
|
12015 | findNext?: boolean;
|
12016 | /**
|
12017 | * Whether search should be case-sensitive, defaults to `false`.
|
12018 | */
|
12019 | matchCase?: boolean;
|
12020 | /**
|
12021 | * Whether to look only at the start of words. defaults to `false`.
|
12022 | */
|
12023 | wordStart?: boolean;
|
12024 | /**
|
12025 | * When combined with `wordStart`, accepts a match in the middle of a word if the
|
12026 | * match begins with an uppercase letter followed by a lowercase or non-letter.
|
12027 | * Accepts several other intra-word matches, defaults to `false`.
|
12028 | */
|
12029 | medialCapitalAsWordStart?: boolean;
|
12030 | }
|
12031 |
|
12032 | interface FocusOptions {
|
12033 | /**
|
12034 | * Make the receiver the active app even if another app is currently active.
|
12035 | *
|
12036 | * @platform darwin
|
12037 | */
|
12038 | steal: boolean;
|
12039 | }
|
12040 |
|
12041 | interface FoundInPageEvent extends Event {
|
12042 | result: FoundInPageResult;
|
12043 | }
|
12044 |
|
12045 | interface FromPartitionOptions {
|
12046 | /**
|
12047 | * Whether to enable cache.
|
12048 | */
|
12049 | cache: boolean;
|
12050 | }
|
12051 |
|
12052 | interface HeadersReceivedResponse {
|
12053 | cancel?: boolean;
|
12054 | /**
|
12055 | * When provided, the server is assumed to have responded with these headers.
|
12056 | */
|
12057 | responseHeaders?: Record<string, (string) | (string[])>;
|
12058 | /**
|
12059 | * Should be provided when overriding `responseHeaders` to change header status
|
12060 | * otherwise original response header's status will be used.
|
12061 | */
|
12062 | statusLine?: string;
|
12063 | }
|
12064 |
|
12065 | interface HeapStatistics {
|
12066 | totalHeapSize: number;
|
12067 | totalHeapSizeExecutable: number;
|
12068 | totalPhysicalSize: number;
|
12069 | totalAvailableSize: number;
|
12070 | usedHeapSize: number;
|
12071 | heapSizeLimit: number;
|
12072 | mallocedMemory: number;
|
12073 | peakMallocedMemory: number;
|
12074 | doesZapGarbage: boolean;
|
12075 | }
|
12076 |
|
12077 | interface IgnoreMouseEventsOptions {
|
12078 | /**
|
12079 | * If true, forwards mouse move messages to Chromium, enabling mouse related events
|
12080 | * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
|
12081 | * forwarding is always disabled regardless of this value.
|
12082 | *
|
12083 | * @platform darwin,win32
|
12084 | */
|
12085 | forward?: boolean;
|
12086 | }
|
12087 |
|
12088 | interface ImportCertificateOptions {
|
12089 | /**
|
12090 | * Path for the pkcs12 file.
|
12091 | */
|
12092 | certificate: string;
|
12093 | /**
|
12094 | * Passphrase for the certificate.
|
12095 | */
|
12096 | password: string;
|
12097 | }
|
12098 |
|
12099 | interface Info {
|
12100 | /**
|
12101 | * Security origin for the isolated world.
|
12102 | */
|
12103 | securityOrigin?: string;
|
12104 | /**
|
12105 | * Content Security Policy for the isolated world.
|
12106 | */
|
12107 | csp?: string;
|
12108 | /**
|
12109 | * Name for isolated world. Useful in devtools.
|
12110 | */
|
12111 | name?: string;
|
12112 | }
|
12113 |
|
12114 | interface Input {
|
12115 | /**
|
12116 | * Either `keyUp` or `keyDown`.
|
12117 | */
|
12118 | type: string;
|
12119 | /**
|
12120 | * Equivalent to KeyboardEvent.key.
|
12121 | */
|
12122 | key: string;
|
12123 | /**
|
12124 | * Equivalent to KeyboardEvent.code.
|
12125 | */
|
12126 | code: string;
|
12127 | /**
|
12128 | * Equivalent to KeyboardEvent.repeat.
|
12129 | */
|
12130 | isAutoRepeat: boolean;
|
12131 | /**
|
12132 | * Equivalent to KeyboardEvent.isComposing.
|
12133 | */
|
12134 | isComposing: boolean;
|
12135 | /**
|
12136 | * Equivalent to KeyboardEvent.shiftKey.
|
12137 | */
|
12138 | shift: boolean;
|
12139 | /**
|
12140 | * Equivalent to KeyboardEvent.controlKey.
|
12141 | */
|
12142 | control: boolean;
|
12143 | /**
|
12144 | * Equivalent to KeyboardEvent.altKey.
|
12145 | */
|
12146 | alt: boolean;
|
12147 | /**
|
12148 | * Equivalent to KeyboardEvent.metaKey.
|
12149 | */
|
12150 | meta: boolean;
|
12151 | }
|
12152 |
|
12153 | interface InsertCSSOptions {
|
12154 | /**
|
12155 | * Can be either 'user' or 'author'; Specifying 'user' enables you to prevent
|
12156 | * websites from overriding the CSS you insert. Default is 'author'.
|
12157 | */
|
12158 | cssOrigin?: string;
|
12159 | }
|
12160 |
|
12161 | interface IpcMessageEvent extends Event {
|
12162 | channel: string;
|
12163 | args: any[];
|
12164 | }
|
12165 |
|
12166 | interface Item {
|
12167 | /**
|
12168 | * The path(s) to the file(s) being dragged.
|
12169 | */
|
12170 | file: (string[]) | (string);
|
12171 | /**
|
12172 | * The image must be non-empty on macOS.
|
12173 | */
|
12174 | icon: (NativeImage) | (string);
|
12175 | }
|
12176 |
|
12177 | interface JumpListSettings {
|
12178 | /**
|
12179 | * The minimum number of items that will be shown in the Jump List (for a more
|
12180 | * detailed description of this value see the MSDN docs).
|
12181 | */
|
12182 | minItems: number;
|
12183 | /**
|
12184 | * Array of `JumpListItem` objects that correspond to items that the user has
|
12185 | * explicitly removed from custom categories in the Jump List. These items must not
|
12186 | * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
|
12187 | * Windows will not display any custom category that contains any of the removed
|
12188 | * items.
|
12189 | */
|
12190 | removedItems: JumpListItem[];
|
12191 | }
|
12192 |
|
12193 | interface LoadCommitEvent extends Event {
|
12194 | url: string;
|
12195 | isMainFrame: boolean;
|
12196 | }
|
12197 |
|
12198 | interface LoadFileOptions {
|
12199 | /**
|
12200 | * Passed to `url.format()`.
|
12201 | */
|
12202 | query?: Record<string, string>;
|
12203 | /**
|
12204 | * Passed to `url.format()`.
|
12205 | */
|
12206 | search?: string;
|
12207 | /**
|
12208 | * Passed to `url.format()`.
|
12209 | */
|
12210 | hash?: string;
|
12211 | }
|
12212 |
|
12213 | interface LoadURLOptions {
|
12214 | /**
|
12215 | * An HTTP Referrer url.
|
12216 | */
|
12217 | httpReferrer?: (string) | (Referrer);
|
12218 | /**
|
12219 | * A user agent originating the request.
|
12220 | */
|
12221 | userAgent?: string;
|
12222 | /**
|
12223 | * Extra headers separated by "\n"
|
12224 | */
|
12225 | extraHeaders?: string;
|
12226 | postData?: (UploadRawData[]) | (UploadFile[]) | (UploadBlob[]);
|
12227 | /**
|
12228 | * Base url (with trailing path separator) for files to be loaded by the data url.
|
12229 | * This is needed only if the specified `url` is a data url and needs to load other
|
12230 | * files.
|
12231 | */
|
12232 | baseURLForDataURL?: string;
|
12233 | }
|
12234 |
|
12235 | interface LoginItemSettings {
|
12236 | /**
|
12237 | * `true` if the app is set to open at login.
|
12238 | */
|
12239 | openAtLogin: boolean;
|
12240 | /**
|
12241 | * `true` if the app is set to open as hidden at login. This setting is not
|
12242 | * available on MAS builds.
|
12243 | *
|
12244 | * @platform darwin
|
12245 | */
|
12246 | openAsHidden: boolean;
|
12247 | /**
|
12248 | * `true` if the app was opened at login automatically. This setting is not
|
12249 | * available on MAS builds.
|
12250 | *
|
12251 | * @platform darwin
|
12252 | */
|
12253 | wasOpenedAtLogin: boolean;
|
12254 | /**
|
12255 | * `true` if the app was opened as a hidden login item. This indicates that the app
|
12256 | * should not open any windows at startup. This setting is not available on MAS
|
12257 | * builds.
|
12258 | *
|
12259 | * @platform darwin
|
12260 | */
|
12261 | wasOpenedAsHidden: boolean;
|
12262 | /**
|
12263 | * `true` if the app was opened as a login item that should restore the state from
|
12264 | * the previous session. This indicates that the app should restore the windows
|
12265 | * that were open the last time the app was closed. This setting is not available
|
12266 | * on MAS builds.
|
12267 | *
|
12268 | * @platform darwin
|
12269 | */
|
12270 | restoreState: boolean;
|
12271 | }
|
12272 |
|
12273 | interface LoginItemSettingsOptions {
|
12274 | /**
|
12275 | * The executable path to compare against. Defaults to `process.execPath`.
|
12276 | *
|
12277 | * @platform win32
|
12278 | */
|
12279 | path?: string;
|
12280 | /**
|
12281 | * The command-line arguments to compare against. Defaults to an empty array.
|
12282 | *
|
12283 | * @platform win32
|
12284 | */
|
12285 | args?: string[];
|
12286 | }
|
12287 |
|
12288 | interface MenuItemConstructorOptions {
|
12289 | /**
|
12290 | * Will be called with `click(menuItem, browserWindow, event)` when the menu item
|
12291 | * is clicked.
|
12292 | */
|
12293 | click?: (menuItem: MenuItem, browserWindow: (BrowserWindow) | (undefined), event: KeyboardEvent) => void;
|
12294 | /**
|
12295 | * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
|
12296 | * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
|
12297 | * `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`,
|
12298 | * `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
|
12299 | * `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,
|
12300 | * `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`,
|
12301 | * `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
|
12302 | * - Define the action of the menu item, when specified the `click` property will
|
12303 | * be ignored. See roles.
|
12304 | */
|
12305 | 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');
|
12306 | /**
|
12307 | * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
|
12308 | */
|
12309 | type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
|
12310 | label?: string;
|
12311 | sublabel?: string;
|
12312 | /**
|
12313 | * Hover text for this menu item.
|
12314 | *
|
12315 | * @platform darwin
|
12316 | */
|
12317 | toolTip?: string;
|
12318 | accelerator?: Accelerator;
|
12319 | icon?: (NativeImage) | (string);
|
12320 | /**
|
12321 | * If false, the menu item will be greyed out and unclickable.
|
12322 | */
|
12323 | enabled?: boolean;
|
12324 | /**
|
12325 | * default is `true`, and when `false` will prevent the accelerator from triggering
|
12326 | * the item if the item is not visible`.
|
12327 | *
|
12328 | * @platform darwin
|
12329 | */
|
12330 | acceleratorWorksWhenHidden?: boolean;
|
12331 | /**
|
12332 | * If false, the menu item will be entirely hidden.
|
12333 | */
|
12334 | visible?: boolean;
|
12335 | /**
|
12336 | * Should only be specified for `checkbox` or `radio` type menu items.
|
12337 | */
|
12338 | checked?: boolean;
|
12339 | /**
|
12340 | * If false, the accelerator won't be registered with the system, but it will still
|
12341 | * be displayed. Defaults to true.
|
12342 | *
|
12343 | * @platform linux,win32
|
12344 | */
|
12345 | registerAccelerator?: boolean;
|
12346 | /**
|
12347 | * Should be specified for `submenu` type menu items. If `submenu` is specified,
|
12348 | * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
|
12349 | * be automatically converted to one using `Menu.buildFromTemplate`.
|
12350 | */
|
12351 | submenu?: (MenuItemConstructorOptions[]) | (Menu);
|
12352 | /**
|
12353 | * Unique within a single menu. If defined then it can be used as a reference to
|
12354 | * this item by the position attribute.
|
12355 | */
|
12356 | id?: string;
|
12357 | /**
|
12358 | * Inserts this item before the item with the specified label. If the referenced
|
12359 | * item doesn't exist the item will be inserted at the end of the menu. Also
|
12360 | * implies that the menu item in question should be placed in the same “group” as
|
12361 | * the item.
|
12362 | */
|
12363 | before?: string[];
|
12364 | /**
|
12365 | * Inserts this item after the item with the specified label. If the referenced
|
12366 | * item doesn't exist the item will be inserted at the end of the menu.
|
12367 | */
|
12368 | after?: string[];
|
12369 | /**
|
12370 | * Provides a means for a single context menu to declare the placement of their
|
12371 | * containing group before the containing group of the item with the specified
|
12372 | * label.
|
12373 | */
|
12374 | beforeGroupContaining?: string[];
|
12375 | /**
|
12376 | * Provides a means for a single context menu to declare the placement of their
|
12377 | * containing group after the containing group of the item with the specified
|
12378 | * label.
|
12379 | */
|
12380 | afterGroupContaining?: string[];
|
12381 | }
|
12382 |
|
12383 | interface MessageBoxOptions {
|
12384 | /**
|
12385 | * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
|
12386 | * `"question"` displays the same icon as `"info"`, unless you set an icon using
|
12387 | * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
|
12388 | * warning icon.
|
12389 | */
|
12390 | type?: string;
|
12391 | /**
|
12392 | * Array of texts for buttons. On Windows, an empty array will result in one button
|
12393 | * labeled "OK".
|
12394 | */
|
12395 | buttons?: string[];
|
12396 | /**
|
12397 | * Index of the button in the buttons array which will be selected by default when
|
12398 | * the message box opens.
|
12399 | */
|
12400 | defaultId?: number;
|
12401 | /**
|
12402 | * Title of the message box, some platforms will not show it.
|
12403 | */
|
12404 | title?: string;
|
12405 | /**
|
12406 | * Content of the message box.
|
12407 | */
|
12408 | message: string;
|
12409 | /**
|
12410 | * Extra information of the message.
|
12411 | */
|
12412 | detail?: string;
|
12413 | /**
|
12414 | * If provided, the message box will include a checkbox with the given label.
|
12415 | */
|
12416 | checkboxLabel?: string;
|
12417 | /**
|
12418 | * Initial checked state of the checkbox. `false` by default.
|
12419 | */
|
12420 | checkboxChecked?: boolean;
|
12421 | icon?: NativeImage;
|
12422 | /**
|
12423 | * The index of the button to be used to cancel the dialog, via the `Esc` key. By
|
12424 | * default this is assigned to the first button with "cancel" or "no" as the label.
|
12425 | * If no such labeled buttons exist and this option is not set, `0` will be used as
|
12426 | * the return value.
|
12427 | */
|
12428 | cancelId?: number;
|
12429 | /**
|
12430 | * On Windows Electron will try to figure out which one of the `buttons` are common
|
12431 | * buttons (like "Cancel" or "Yes"), and show the others as command links in the
|
12432 | * dialog. This can make the dialog appear in the style of modern Windows apps. If
|
12433 | * you don't like this behavior, you can set `noLink` to `true`.
|
12434 | */
|
12435 | noLink?: boolean;
|
12436 | /**
|
12437 | * Normalize the keyboard access keys across platforms. Default is `false`.
|
12438 | * Enabling this assumes `&` is used in the button labels for the placement of the
|
12439 | * keyboard shortcut access key and labels will be converted so they work correctly
|
12440 | * on each platform, `&` characters are removed on macOS, converted to `_` on
|
12441 | * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
|
12442 | * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
|
12443 | * via `Alt-W` on Windows and Linux.
|
12444 | */
|
12445 | normalizeAccessKeys?: boolean;
|
12446 | }
|
12447 |
|
12448 | interface MessageBoxReturnValue {
|
12449 | /**
|
12450 | * The index of the clicked button.
|
12451 | */
|
12452 | response: number;
|
12453 | /**
|
12454 | * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
|
12455 | */
|
12456 | checkboxChecked: boolean;
|
12457 | }
|
12458 |
|
12459 | interface MessageBoxSyncOptions {
|
12460 | /**
|
12461 | * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
|
12462 | * `"question"` displays the same icon as `"info"`, unless you set an icon using
|
12463 | * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
|
12464 | * warning icon.
|
12465 | */
|
12466 | type?: string;
|
12467 | /**
|
12468 | * Array of texts for buttons. On Windows, an empty array will result in one button
|
12469 | * labeled "OK".
|
12470 | */
|
12471 | buttons?: string[];
|
12472 | /**
|
12473 | * Index of the button in the buttons array which will be selected by default when
|
12474 | * the message box opens.
|
12475 | */
|
12476 | defaultId?: number;
|
12477 | /**
|
12478 | * Title of the message box, some platforms will not show it.
|
12479 | */
|
12480 | title?: string;
|
12481 | /**
|
12482 | * Content of the message box.
|
12483 | */
|
12484 | message: string;
|
12485 | /**
|
12486 | * Extra information of the message.
|
12487 | */
|
12488 | detail?: string;
|
12489 | /**
|
12490 | * If provided, the message box will include a checkbox with the given label.
|
12491 | */
|
12492 | checkboxLabel?: string;
|
12493 | /**
|
12494 | * Initial checked state of the checkbox. `false` by default.
|
12495 | */
|
12496 | checkboxChecked?: boolean;
|
12497 | icon?: (NativeImage) | (string);
|
12498 | /**
|
12499 | * The index of the button to be used to cancel the dialog, via the `Esc` key. By
|
12500 | * default this is assigned to the first button with "cancel" or "no" as the label.
|
12501 | * If no such labeled buttons exist and this option is not set, `0` will be used as
|
12502 | * the return value.
|
12503 | */
|
12504 | cancelId?: number;
|
12505 | /**
|
12506 | * On Windows Electron will try to figure out which one of the `buttons` are common
|
12507 | * buttons (like "Cancel" or "Yes"), and show the others as command links in the
|
12508 | * dialog. This can make the dialog appear in the style of modern Windows apps. If
|
12509 | * you don't like this behavior, you can set `noLink` to `true`.
|
12510 | */
|
12511 | noLink?: boolean;
|
12512 | /**
|
12513 | * Normalize the keyboard access keys across platforms. Default is `false`.
|
12514 | * Enabling this assumes `&` is used in the button labels for the placement of the
|
12515 | * keyboard shortcut access key and labels will be converted so they work correctly
|
12516 | * on each platform, `&` characters are removed on macOS, converted to `_` on
|
12517 | * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
|
12518 | * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
|
12519 | * via `Alt-W` on Windows and Linux.
|
12520 | */
|
12521 | normalizeAccessKeys?: boolean;
|
12522 | }
|
12523 |
|
12524 | interface MessageDetails {
|
12525 | /**
|
12526 | * The actual console message
|
12527 | */
|
12528 | message: string;
|
12529 | /**
|
12530 | * The version ID of the service worker that sent the log message
|
12531 | */
|
12532 | versionId: number;
|
12533 | /**
|
12534 | * The type of source for this message. Can be `javascript`, `xml`, `network`,
|
12535 | * `console-api`, `storage`, `app-cache`, `rendering`, `security`, `deprecation`,
|
12536 | * `worker`, `violation`, `intervention`, `recommendation` or `other`.
|
12537 | */
|
12538 | source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'app-cache' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
|
12539 | /**
|
12540 | * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
|
12541 | * `error`.
|
12542 | */
|
12543 | level: number;
|
12544 | /**
|
12545 | * The URL the message came from
|
12546 | */
|
12547 | sourceUrl: string;
|
12548 | /**
|
12549 | * The line number of the source that triggered this console message
|
12550 | */
|
12551 | lineNumber: number;
|
12552 | }
|
12553 |
|
12554 | interface MessageEvent {
|
12555 | data: any;
|
12556 | ports: MessagePortMain[];
|
12557 | }
|
12558 |
|
12559 | interface MoveToApplicationsFolderOptions {
|
12560 | /**
|
12561 | * A handler for potential conflict in move failure.
|
12562 | */
|
12563 | conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
|
12564 | }
|
12565 |
|
12566 | interface NewWindowEvent extends Event {
|
12567 | url: string;
|
12568 | frameName: string;
|
12569 | /**
|
12570 | * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
|
12571 | * `save-to-disk` and `other`.
|
12572 | */
|
12573 | disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
|
12574 | /**
|
12575 | * The options which should be used for creating the new `BrowserWindow`.
|
12576 | */
|
12577 | options: BrowserWindowConstructorOptions;
|
12578 | }
|
12579 |
|
12580 | interface NotificationConstructorOptions {
|
12581 | /**
|
12582 | * A title for the notification, which will be shown at the top of the notification
|
12583 | * window when it is shown.
|
12584 | */
|
12585 | title: string;
|
12586 | /**
|
12587 | * A subtitle for the notification, which will be displayed below the title.
|
12588 | *
|
12589 | * @platform darwin
|
12590 | */
|
12591 | subtitle?: string;
|
12592 | /**
|
12593 | * The body text of the notification, which will be displayed below the title or
|
12594 | * subtitle.
|
12595 | */
|
12596 | body: string;
|
12597 | /**
|
12598 | * Whether or not to emit an OS notification noise when showing the notification.
|
12599 | */
|
12600 | silent?: boolean;
|
12601 | /**
|
12602 | * An icon to use in the notification.
|
12603 | */
|
12604 | icon?: (string) | (NativeImage);
|
12605 | /**
|
12606 | * Whether or not to add an inline reply option to the notification.
|
12607 | *
|
12608 | * @platform darwin
|
12609 | */
|
12610 | hasReply?: boolean;
|
12611 | /**
|
12612 | * The timeout duration of the notification. Can be 'default' or 'never'.
|
12613 | *
|
12614 | * @platform linux,win32
|
12615 | */
|
12616 | timeoutType?: ('default' | 'never');
|
12617 | /**
|
12618 | * The placeholder to write in the inline reply input field.
|
12619 | *
|
12620 | * @platform darwin
|
12621 | */
|
12622 | replyPlaceholder?: string;
|
12623 | /**
|
12624 | * The name of the sound file to play when the notification is shown.
|
12625 | *
|
12626 | * @platform darwin
|
12627 | */
|
12628 | sound?: string;
|
12629 | /**
|
12630 | * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
|
12631 | *
|
12632 | * @platform linux
|
12633 | */
|
12634 | urgency?: ('normal' | 'critical' | 'low');
|
12635 | /**
|
12636 | * Actions to add to the notification. Please read the available actions and
|
12637 | * limitations in the `NotificationAction` documentation.
|
12638 | *
|
12639 | * @platform darwin
|
12640 | */
|
12641 | actions?: NotificationAction[];
|
12642 | /**
|
12643 | * A custom title for the close button of an alert. An empty string will cause the
|
12644 | * default localized text to be used.
|
12645 | *
|
12646 | * @platform darwin
|
12647 | */
|
12648 | closeButtonText?: string;
|
12649 | }
|
12650 |
|
12651 | interface OnBeforeRedirectListenerDetails {
|
12652 | id: number;
|
12653 | url: string;
|
12654 | method: string;
|
12655 | webContentsId?: number;
|
12656 | resourceType: string;
|
12657 | referrer: string;
|
12658 | timestamp: number;
|
12659 | redirectURL: string;
|
12660 | statusCode: number;
|
12661 | statusLine: string;
|
12662 | /**
|
12663 | * The server IP address that the request was actually sent to.
|
12664 | */
|
12665 | ip?: string;
|
12666 | fromCache: boolean;
|
12667 | responseHeaders?: Record<string, string[]>;
|
12668 | }
|
12669 |
|
12670 | interface OnBeforeRequestListenerDetails {
|
12671 | id: number;
|
12672 | url: string;
|
12673 | method: string;
|
12674 | webContentsId?: number;
|
12675 | resourceType: string;
|
12676 | referrer: string;
|
12677 | timestamp: number;
|
12678 | uploadData: UploadData[];
|
12679 | }
|
12680 |
|
12681 | interface OnBeforeSendHeadersListenerDetails {
|
12682 | id: number;
|
12683 | url: string;
|
12684 | method: string;
|
12685 | webContentsId?: number;
|
12686 | resourceType: string;
|
12687 | referrer: string;
|
12688 | timestamp: number;
|
12689 | requestHeaders: Record<string, string>;
|
12690 | }
|
12691 |
|
12692 | interface OnCompletedListenerDetails {
|
12693 | id: number;
|
12694 | url: string;
|
12695 | method: string;
|
12696 | webContentsId?: number;
|
12697 | resourceType: string;
|
12698 | referrer: string;
|
12699 | timestamp: number;
|
12700 | responseHeaders?: Record<string, string[]>;
|
12701 | fromCache: boolean;
|
12702 | statusCode: number;
|
12703 | statusLine: string;
|
12704 | error: string;
|
12705 | }
|
12706 |
|
12707 | interface OnErrorOccurredListenerDetails {
|
12708 | id: number;
|
12709 | url: string;
|
12710 | method: string;
|
12711 | webContentsId?: number;
|
12712 | resourceType: string;
|
12713 | referrer: string;
|
12714 | timestamp: number;
|
12715 | fromCache: boolean;
|
12716 | /**
|
12717 | * The error description.
|
12718 | */
|
12719 | error: string;
|
12720 | }
|
12721 |
|
12722 | interface OnHeadersReceivedListenerDetails {
|
12723 | id: number;
|
12724 | url: string;
|
12725 | method: string;
|
12726 | webContentsId?: number;
|
12727 | resourceType: string;
|
12728 | referrer: string;
|
12729 | timestamp: number;
|
12730 | statusLine: string;
|
12731 | statusCode: number;
|
12732 | requestHeaders: Record<string, string>;
|
12733 | responseHeaders?: Record<string, string[]>;
|
12734 | }
|
12735 |
|
12736 | interface OnResponseStartedListenerDetails {
|
12737 | id: number;
|
12738 | url: string;
|
12739 | method: string;
|
12740 | webContentsId?: number;
|
12741 | resourceType: string;
|
12742 | referrer: string;
|
12743 | timestamp: number;
|
12744 | responseHeaders?: Record<string, string[]>;
|
12745 | /**
|
12746 | * Indicates whether the response was fetched from disk cache.
|
12747 | */
|
12748 | fromCache: boolean;
|
12749 | statusCode: number;
|
12750 | statusLine: string;
|
12751 | }
|
12752 |
|
12753 | interface OnSendHeadersListenerDetails {
|
12754 | id: number;
|
12755 | url: string;
|
12756 | method: string;
|
12757 | webContentsId?: number;
|
12758 | resourceType: string;
|
12759 | referrer: string;
|
12760 | timestamp: number;
|
12761 | requestHeaders: Record<string, string>;
|
12762 | }
|
12763 |
|
12764 | interface OpenDevToolsOptions {
|
12765 | /**
|
12766 | * Opens the devtools with specified dock state, can be `right`, `bottom`,
|
12767 | * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
|
12768 | * possible to dock back. In `detach` mode it's not.
|
12769 | */
|
12770 | mode: ('right' | 'bottom' | 'undocked' | 'detach');
|
12771 | /**
|
12772 | * Whether to bring the opened devtools window to the foreground. The default is
|
12773 | * `true`.
|
12774 | */
|
12775 | activate?: boolean;
|
12776 | }
|
12777 |
|
12778 | interface OpenDialogOptions {
|
12779 | title?: string;
|
12780 | defaultPath?: string;
|
12781 | /**
|
12782 | * Custom label for the confirmation button, when left empty the default label will
|
12783 | * be used.
|
12784 | */
|
12785 | buttonLabel?: string;
|
12786 | filters?: FileFilter[];
|
12787 | /**
|
12788 | * Contains which features the dialog should use. The following values are
|
12789 | * supported:
|
12790 | */
|
12791 | properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
|
12792 | /**
|
12793 | * Message to display above input boxes.
|
12794 | *
|
12795 | * @platform darwin
|
12796 | */
|
12797 | message?: string;
|
12798 | /**
|
12799 | * Create security scoped bookmarks when packaged for the Mac App Store.
|
12800 | *
|
12801 | * @platform darwin,mas
|
12802 | */
|
12803 | securityScopedBookmarks?: boolean;
|
12804 | }
|
12805 |
|
12806 | interface OpenDialogReturnValue {
|
12807 | /**
|
12808 | * whether or not the dialog was canceled.
|
12809 | */
|
12810 | canceled: boolean;
|
12811 | /**
|
12812 | * An array of file paths chosen by the user. If the dialog is cancelled this will
|
12813 | * be an empty array.
|
12814 | */
|
12815 | filePaths: string[];
|
12816 | /**
|
12817 | * An array matching the `filePaths` array of base64 encoded strings which contains
|
12818 | * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
|
12819 | * this to be populated. (For return values, see table here.)
|
12820 | *
|
12821 | * @platform darwin,mas
|
12822 | */
|
12823 | bookmarks?: string[];
|
12824 | }
|
12825 |
|
12826 | interface OpenDialogSyncOptions {
|
12827 | title?: string;
|
12828 | defaultPath?: string;
|
12829 | /**
|
12830 | * Custom label for the confirmation button, when left empty the default label will
|
12831 | * be used.
|
12832 | */
|
12833 | buttonLabel?: string;
|
12834 | filters?: FileFilter[];
|
12835 | /**
|
12836 | * Contains which features the dialog should use. The following values are
|
12837 | * supported:
|
12838 | */
|
12839 | properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
|
12840 | /**
|
12841 | * Message to display above input boxes.
|
12842 | *
|
12843 | * @platform darwin
|
12844 | */
|
12845 | message?: string;
|
12846 | /**
|
12847 | * Create security scoped bookmarks when packaged for the Mac App Store.
|
12848 | *
|
12849 | * @platform darwin,mas
|
12850 | */
|
12851 | securityScopedBookmarks?: boolean;
|
12852 | }
|
12853 |
|
12854 | interface OpenExternalOptions {
|
12855 | /**
|
12856 | * `true` to bring the opened application to the foreground. The default is `true`.
|
12857 | *
|
12858 | * @platform darwin
|
12859 | */
|
12860 | activate?: boolean;
|
12861 | /**
|
12862 | * The working directory.
|
12863 | *
|
12864 | * @platform win32
|
12865 | */
|
12866 | workingDirectory?: string;
|
12867 | }
|
12868 |
|
12869 | interface Options {
|
12870 | }
|
12871 |
|
12872 | interface PageFaviconUpdatedEvent extends Event {
|
12873 | /**
|
12874 | * Array of URLs.
|
12875 | */
|
12876 | favicons: string[];
|
12877 | }
|
12878 |
|
12879 | interface PageTitleUpdatedEvent extends Event {
|
12880 | title: string;
|
12881 | explicitSet: boolean;
|
12882 | }
|
12883 |
|
12884 | interface Parameters {
|
12885 | /**
|
12886 | * Specify the screen type to emulate (default: `desktop`):
|
12887 | */
|
12888 | screenPosition: ('desktop' | 'mobile');
|
12889 | /**
|
12890 | * Set the emulated screen size (screenPosition == mobile).
|
12891 | */
|
12892 | screenSize: Size;
|
12893 | /**
|
12894 | * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
|
12895 | * 0 }`).
|
12896 | */
|
12897 | viewPosition: Point;
|
12898 | /**
|
12899 | * Set the device scale factor (if zero defaults to original device scale factor)
|
12900 | * (default: `0`).
|
12901 | */
|
12902 | deviceScaleFactor: number;
|
12903 | /**
|
12904 | * Set the emulated view size (empty means no override)
|
12905 | */
|
12906 | viewSize: Size;
|
12907 | /**
|
12908 | * Scale of emulated view inside available space (not in fit to view mode)
|
12909 | * (default: `1`).
|
12910 | */
|
12911 | scale: number;
|
12912 | }
|
12913 |
|
12914 | interface Payment {
|
12915 | /**
|
12916 | * The identifier of the purchased product.
|
12917 | */
|
12918 | productIdentifier: string;
|
12919 | /**
|
12920 | * The quantity purchased.
|
12921 | */
|
12922 | quantity: number;
|
12923 | }
|
12924 |
|
12925 | interface PermissionCheckHandlerHandlerDetails {
|
12926 | /**
|
12927 | * The security orign of the `media` check.
|
12928 | */
|
12929 | securityOrigin: string;
|
12930 | /**
|
12931 | * The type of media access being requested, can be `video`, `audio` or `unknown`
|
12932 | */
|
12933 | mediaType: ('video' | 'audio' | 'unknown');
|
12934 | /**
|
12935 | * The last URL the requesting frame loaded
|
12936 | */
|
12937 | requestingUrl: string;
|
12938 | /**
|
12939 | * Whether the frame making the request is the main frame
|
12940 | */
|
12941 | isMainFrame: boolean;
|
12942 | }
|
12943 |
|
12944 | interface PermissionRequestHandlerHandlerDetails {
|
12945 | /**
|
12946 | * The url of the `openExternal` request.
|
12947 | */
|
12948 | externalURL?: string;
|
12949 | /**
|
12950 | * The types of media access being requested, elements can be `video` or `audio`
|
12951 | */
|
12952 | mediaTypes?: Array<'video' | 'audio'>;
|
12953 | /**
|
12954 | * The last URL the requesting frame loaded
|
12955 | */
|
12956 | requestingUrl: string;
|
12957 | /**
|
12958 | * Whether the frame making the request is the main frame
|
12959 | */
|
12960 | isMainFrame: boolean;
|
12961 | }
|
12962 |
|
12963 | interface PluginCrashedEvent extends Event {
|
12964 | name: string;
|
12965 | version: string;
|
12966 | }
|
12967 |
|
12968 | interface PopupOptions {
|
12969 | /**
|
12970 | * Default is the focused window.
|
12971 | */
|
12972 | window?: BrowserWindow;
|
12973 | /**
|
12974 | * Default is the current mouse cursor position. Must be declared if `y` is
|
12975 | * declared.
|
12976 | */
|
12977 | x?: number;
|
12978 | /**
|
12979 | * Default is the current mouse cursor position. Must be declared if `x` is
|
12980 | * declared.
|
12981 | */
|
12982 | y?: number;
|
12983 | /**
|
12984 | * The index of the menu item to be positioned under the mouse cursor at the
|
12985 | * specified coordinates. Default is -1.
|
12986 | *
|
12987 | * @platform darwin
|
12988 | */
|
12989 | positioningItem?: number;
|
12990 | /**
|
12991 | * Called when menu is closed.
|
12992 | */
|
12993 | callback?: () => void;
|
12994 | }
|
12995 |
|
12996 | interface PreconnectOptions {
|
12997 | /**
|
12998 | * URL for preconnect. Only the origin is relevant for opening the socket.
|
12999 | */
|
13000 | url: string;
|
13001 | /**
|
13002 | * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
|
13003 | */
|
13004 | numSockets?: number;
|
13005 | }
|
13006 |
|
13007 | interface PrintToPDFOptions {
|
13008 | /**
|
13009 | * the header and footer for the PDF.
|
13010 | */
|
13011 | headerFooter?: Record<string, string>;
|
13012 | /**
|
13013 | * `true` for landscape, `false` for portrait.
|
13014 | */
|
13015 | landscape?: boolean;
|
13016 | /**
|
13017 | * Specifies the type of margins to use. Uses 0 for default margin, 1 for no
|
13018 | * margin, and 2 for minimum margin. and `width` in microns.
|
13019 | */
|
13020 | marginsType?: number;
|
13021 | /**
|
13022 | * The scale factor of the web page. Can range from 0 to 100.
|
13023 | */
|
13024 | scaleFactor?: number;
|
13025 | /**
|
13026 | * The page range to print.
|
13027 | */
|
13028 | pageRanges?: Record<string, number>;
|
13029 | /**
|
13030 | * Specify page size of the generated PDF. Can be `A3`, `A4`, `A5`, `Legal`,
|
13031 | * `Letter`, `Tabloid` or an Object containing `height`
|
13032 | */
|
13033 | pageSize?: (string) | (Size);
|
13034 | /**
|
13035 | * Whether to print CSS backgrounds.
|
13036 | */
|
13037 | printBackground?: boolean;
|
13038 | /**
|
13039 | * Whether to print selection only.
|
13040 | */
|
13041 | printSelectionOnly?: boolean;
|
13042 | }
|
13043 |
|
13044 | interface Privileges {
|
13045 | /**
|
13046 | * Default false.
|
13047 | */
|
13048 | standard?: boolean;
|
13049 | /**
|
13050 | * Default false.
|
13051 | */
|
13052 | secure?: boolean;
|
13053 | /**
|
13054 | * Default false.
|
13055 | */
|
13056 | bypassCSP?: boolean;
|
13057 | /**
|
13058 | * Default false.
|
13059 | */
|
13060 | allowServiceWorkers?: boolean;
|
13061 | /**
|
13062 | * Default false.
|
13063 | */
|
13064 | supportFetchAPI?: boolean;
|
13065 | /**
|
13066 | * Default false.
|
13067 | */
|
13068 | corsEnabled?: boolean;
|
13069 | /**
|
13070 | * Default false.
|
13071 | */
|
13072 | stream?: boolean;
|
13073 | }
|
13074 |
|
13075 | interface ProgressBarOptions {
|
13076 | /**
|
13077 | * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
|
13078 | * `paused`.
|
13079 | *
|
13080 | * @platform win32
|
13081 | */
|
13082 | mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
|
13083 | }
|
13084 |
|
13085 | interface Provider {
|
13086 | spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
|
13087 | }
|
13088 |
|
13089 | interface ReadBookmark {
|
13090 | title: string;
|
13091 | url: string;
|
13092 | }
|
13093 |
|
13094 | interface RelaunchOptions {
|
13095 | args?: string[];
|
13096 | execPath?: string;
|
13097 | }
|
13098 |
|
13099 | interface Request {
|
13100 | hostname: string;
|
13101 | certificate: Certificate;
|
13102 | validatedCertificate: Certificate;
|
13103 | /**
|
13104 | * Verification result from chromium.
|
13105 | */
|
13106 | verificationResult: string;
|
13107 | /**
|
13108 | * Error code.
|
13109 | */
|
13110 | errorCode: number;
|
13111 | }
|
13112 |
|
13113 | interface ResizeOptions {
|
13114 | /**
|
13115 | * Defaults to the image's width.
|
13116 | */
|
13117 | width?: number;
|
13118 | /**
|
13119 | * Defaults to the image's height.
|
13120 | */
|
13121 | height?: number;
|
13122 | /**
|
13123 | * The desired quality of the resize image. Possible values are `good`, `better`,
|
13124 | * or `best`. The default is `best`. These values express a desired quality/speed
|
13125 | * tradeoff. They are translated into an algorithm-specific method that depends on
|
13126 | * the capabilities (CPU, GPU) of the underlying platform. It is possible for all
|
13127 | * three methods to be mapped to the same algorithm on a given platform.
|
13128 | */
|
13129 | quality?: string;
|
13130 | }
|
13131 |
|
13132 | interface ResourceUsage {
|
13133 | images: MemoryUsageDetails;
|
13134 | scripts: MemoryUsageDetails;
|
13135 | cssStyleSheets: MemoryUsageDetails;
|
13136 | xslStyleSheets: MemoryUsageDetails;
|
13137 | fonts: MemoryUsageDetails;
|
13138 | other: MemoryUsageDetails;
|
13139 | }
|
13140 |
|
13141 | interface Response {
|
13142 | cancel?: boolean;
|
13143 | /**
|
13144 | * The original request is prevented from being sent or completed and is instead
|
13145 | * redirected to the given URL.
|
13146 | */
|
13147 | redirectURL?: string;
|
13148 | }
|
13149 |
|
13150 | interface Result {
|
13151 | requestId: number;
|
13152 | /**
|
13153 | * Position of the active match.
|
13154 | */
|
13155 | activeMatchOrdinal: number;
|
13156 | /**
|
13157 | * Number of Matches.
|
13158 | */
|
13159 | matches: number;
|
13160 | /**
|
13161 | * Coordinates of first match region.
|
13162 | */
|
13163 | selectionArea: Rectangle;
|
13164 | finalUpdate: boolean;
|
13165 | }
|
13166 |
|
13167 | interface SaveDialogOptions {
|
13168 | title?: string;
|
13169 | /**
|
13170 | * Absolute directory path, absolute file path, or file name to use by default.
|
13171 | */
|
13172 | defaultPath?: string;
|
13173 | /**
|
13174 | * Custom label for the confirmation button, when left empty the default label will
|
13175 | * be used.
|
13176 | */
|
13177 | buttonLabel?: string;
|
13178 | filters?: FileFilter[];
|
13179 | /**
|
13180 | * Message to display above text fields.
|
13181 | *
|
13182 | * @platform darwin
|
13183 | */
|
13184 | message?: string;
|
13185 | /**
|
13186 | * Custom label for the text displayed in front of the filename text field.
|
13187 | *
|
13188 | * @platform darwin
|
13189 | */
|
13190 | nameFieldLabel?: string;
|
13191 | /**
|
13192 | * Show the tags input box, defaults to `true`.
|
13193 | *
|
13194 | * @platform darwin
|
13195 | */
|
13196 | showsTagField?: boolean;
|
13197 | properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
|
13198 | /**
|
13199 | * Create a security scoped bookmark when packaged for the Mac App Store. If this
|
13200 | * option is enabled and the file doesn't already exist a blank file will be
|
13201 | * created at the chosen path.
|
13202 | *
|
13203 | * @platform darwin,mas
|
13204 | */
|
13205 | securityScopedBookmarks?: boolean;
|
13206 | }
|
13207 |
|
13208 | interface SaveDialogReturnValue {
|
13209 | /**
|
13210 | * whether or not the dialog was canceled.
|
13211 | */
|
13212 | canceled: boolean;
|
13213 | /**
|
13214 | * If the dialog is canceled, this will be `undefined`.
|
13215 | */
|
13216 | filePath?: string;
|
13217 | /**
|
13218 | * Base64 encoded string which contains the security scoped bookmark data for the
|
13219 | * saved file. `securityScopedBookmarks` must be enabled for this to be present.
|
13220 | * (For return values, see table here.)
|
13221 | *
|
13222 | * @platform darwin,mas
|
13223 | */
|
13224 | bookmark?: string;
|
13225 | }
|
13226 |
|
13227 | interface SaveDialogSyncOptions {
|
13228 | title?: string;
|
13229 | /**
|
13230 | * Absolute directory path, absolute file path, or file name to use by default.
|
13231 | */
|
13232 | defaultPath?: string;
|
13233 | /**
|
13234 | * Custom label for the confirmation button, when left empty the default label will
|
13235 | * be used.
|
13236 | */
|
13237 | buttonLabel?: string;
|
13238 | filters?: FileFilter[];
|
13239 | /**
|
13240 | * Message to display above text fields.
|
13241 | *
|
13242 | * @platform darwin
|
13243 | */
|
13244 | message?: string;
|
13245 | /**
|
13246 | * Custom label for the text displayed in front of the filename text field.
|
13247 | *
|
13248 | * @platform darwin
|
13249 | */
|
13250 | nameFieldLabel?: string;
|
13251 | /**
|
13252 | * Show the tags input box, defaults to `true`.
|
13253 | *
|
13254 | * @platform darwin
|
13255 | */
|
13256 | showsTagField?: boolean;
|
13257 | properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
|
13258 | /**
|
13259 | * Create a security scoped bookmark when packaged for the Mac App Store. If this
|
13260 | * option is enabled and the file doesn't already exist a blank file will be
|
13261 | * created at the chosen path.
|
13262 | *
|
13263 | * @platform darwin,mas
|
13264 | */
|
13265 | securityScopedBookmarks?: boolean;
|
13266 | }
|
13267 |
|
13268 | interface Settings {
|
13269 | /**
|
13270 | * `true` to open the app at login, `false` to remove the app as a login item.
|
13271 | * Defaults to `false`.
|
13272 | */
|
13273 | openAtLogin?: boolean;
|
13274 | /**
|
13275 | * `true` to open the app as hidden. Defaults to `false`. The user can edit this
|
13276 | * setting from the System Preferences so
|
13277 | * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
|
13278 | * opened to know the current value. This setting is not available on MAS builds.
|
13279 | *
|
13280 | * @platform darwin
|
13281 | */
|
13282 | openAsHidden?: boolean;
|
13283 | /**
|
13284 | * The executable to launch at login. Defaults to `process.execPath`.
|
13285 | *
|
13286 | * @platform win32
|
13287 | */
|
13288 | path?: string;
|
13289 | /**
|
13290 | * The command-line arguments to pass to the executable. Defaults to an empty
|
13291 | * array. Take care to wrap paths in quotes.
|
13292 | *
|
13293 | * @platform win32
|
13294 | */
|
13295 | args?: string[];
|
13296 | }
|
13297 |
|
13298 | interface SourcesOptions {
|
13299 | /**
|
13300 | * An array of Strings that lists the types of desktop sources to be captured,
|
13301 | * available types are `screen` and `window`.
|
13302 | */
|
13303 | types: string[];
|
13304 | /**
|
13305 | * The size that the media source thumbnail should be scaled to. Default is `150` x
|
13306 | * `150`. Set width or height to 0 when you do not need the thumbnails. This will
|
13307 | * save the processing time required for capturing the content of each window and
|
13308 | * screen.
|
13309 | */
|
13310 | thumbnailSize?: Size;
|
13311 | /**
|
13312 | * Set to true to enable fetching window icons. The default value is false. When
|
13313 | * false the appIcon property of the sources return null. Same if a source has the
|
13314 | * type screen.
|
13315 | */
|
13316 | fetchWindowIcons?: boolean;
|
13317 | }
|
13318 |
|
13319 | interface StartLoggingOptions {
|
13320 | /**
|
13321 | * What kinds of data should be captured. By default, only metadata about requests
|
13322 | * will be captured. Setting this to `includeSensitive` will include cookies and
|
13323 | * authentication data. Setting it to `everything` will include all bytes
|
13324 | * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
|
13325 | */
|
13326 | captureMode?: ('default' | 'includeSensitive' | 'everything');
|
13327 | /**
|
13328 | * When the log grows beyond this size, logging will automatically stop. Defaults
|
13329 | * to unlimited.
|
13330 | */
|
13331 | maxFileSize?: number;
|
13332 | }
|
13333 |
|
13334 | interface SystemMemoryInfo {
|
13335 | /**
|
13336 | * The total amount of physical memory in Kilobytes available to the system.
|
13337 | */
|
13338 | total: number;
|
13339 | /**
|
13340 | * The total amount of memory not being used by applications or disk cache.
|
13341 | */
|
13342 | free: number;
|
13343 | /**
|
13344 | * The total amount of swap memory in Kilobytes available to the system.
|
13345 | *
|
13346 | * @platform win32,linux
|
13347 | */
|
13348 | swapTotal: number;
|
13349 | /**
|
13350 | * The free amount of swap memory in Kilobytes available to the system.
|
13351 | *
|
13352 | * @platform win32,linux
|
13353 | */
|
13354 | swapFree: number;
|
13355 | }
|
13356 |
|
13357 | interface ToBitmapOptions {
|
13358 | /**
|
13359 | * Defaults to 1.0.
|
13360 | */
|
13361 | scaleFactor?: number;
|
13362 | }
|
13363 |
|
13364 | interface ToDataURLOptions {
|
13365 | /**
|
13366 | * Defaults to 1.0.
|
13367 | */
|
13368 | scaleFactor?: number;
|
13369 | }
|
13370 |
|
13371 | interface ToPNGOptions {
|
13372 | /**
|
13373 | * Defaults to 1.0.
|
13374 | */
|
13375 | scaleFactor?: number;
|
13376 | }
|
13377 |
|
13378 | interface TouchBarButtonConstructorOptions {
|
13379 | /**
|
13380 | * Button text.
|
13381 | */
|
13382 | label?: string;
|
13383 | /**
|
13384 | * A short description of the button for use by screenreaders like VoiceOver.
|
13385 | */
|
13386 | accessibilityLabel?: string;
|
13387 | /**
|
13388 | * Button background color in hex format, i.e `#ABCDEF`.
|
13389 | */
|
13390 | backgroundColor?: string;
|
13391 | /**
|
13392 | * Button icon.
|
13393 | */
|
13394 | icon?: (NativeImage) | (string);
|
13395 | /**
|
13396 | * Can be `left`, `right` or `overlay`. Defaults to `overlay`.
|
13397 | */
|
13398 | iconPosition?: ('left' | 'right' | 'overlay');
|
13399 | /**
|
13400 | * Function to call when the button is clicked.
|
13401 | */
|
13402 | click?: () => void;
|
13403 | /**
|
13404 | * Whether the button is in an enabled state. Default is `true`.
|
13405 | */
|
13406 | enabled?: boolean;
|
13407 | }
|
13408 |
|
13409 | interface TouchBarColorPickerConstructorOptions {
|
13410 | /**
|
13411 | * Array of hex color strings to appear as possible colors to select.
|
13412 | */
|
13413 | availableColors?: string[];
|
13414 | /**
|
13415 | * The selected hex color in the picker, i.e `#ABCDEF`.
|
13416 | */
|
13417 | selectedColor?: string;
|
13418 | /**
|
13419 | * Function to call when a color is selected.
|
13420 | */
|
13421 | change?: (color: string) => void;
|
13422 | }
|
13423 |
|
13424 | interface TouchBarConstructorOptions {
|
13425 | items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
|
13426 | escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
|
13427 | }
|
13428 |
|
13429 | interface TouchBarGroupConstructorOptions {
|
13430 | /**
|
13431 | * Items to display as a group.
|
13432 | */
|
13433 | items: TouchBar;
|
13434 | }
|
13435 |
|
13436 | interface TouchBarLabelConstructorOptions {
|
13437 | /**
|
13438 | * Text to display.
|
13439 | */
|
13440 | label?: string;
|
13441 | /**
|
13442 | * A short description of the button for use by screenreaders like VoiceOver.
|
13443 | */
|
13444 | accessibilityLabel?: string;
|
13445 | /**
|
13446 | * Hex color of text, i.e `#ABCDEF`.
|
13447 | */
|
13448 | textColor?: string;
|
13449 | }
|
13450 |
|
13451 | interface TouchBarPopoverConstructorOptions {
|
13452 | /**
|
13453 | * Popover button text.
|
13454 | */
|
13455 | label?: string;
|
13456 | /**
|
13457 | * Popover button icon.
|
13458 | */
|
13459 | icon?: NativeImage;
|
13460 | /**
|
13461 | * Items to display in the popover.
|
13462 | */
|
13463 | items: TouchBar;
|
13464 | /**
|
13465 | * `true` to display a close button on the left of the popover, `false` to not show
|
13466 | * it. Default is `true`.
|
13467 | */
|
13468 | showCloseButton?: boolean;
|
13469 | }
|
13470 |
|
13471 | interface TouchBarScrubberConstructorOptions {
|
13472 | /**
|
13473 | * An array of items to place in this scrubber.
|
13474 | */
|
13475 | items: ScrubberItem[];
|
13476 | /**
|
13477 | * Called when the user taps an item that was not the last tapped item.
|
13478 | */
|
13479 | select?: (selectedIndex: number) => void;
|
13480 | /**
|
13481 | * Called when the user taps any item.
|
13482 | */
|
13483 | highlight?: (highlightedIndex: number) => void;
|
13484 | /**
|
13485 | * Selected item style. Can be `background`, `outline` or `none`. Defaults to
|
13486 | * `none`.
|
13487 | */
|
13488 | selectedStyle?: ('background' | 'outline' | 'none');
|
13489 | /**
|
13490 | * Selected overlay item style. Can be `background`, `outline` or `none`. Defaults
|
13491 | * to `none`.
|
13492 | */
|
13493 | overlayStyle?: ('background' | 'outline' | 'none');
|
13494 | /**
|
13495 | * Defaults to `false`.
|
13496 | */
|
13497 | showArrowButtons?: boolean;
|
13498 | /**
|
13499 | * Can be `fixed` or `free`. The default is `free`.
|
13500 | */
|
13501 | mode?: ('fixed' | 'free');
|
13502 | /**
|
13503 | * Defaults to `true`.
|
13504 | */
|
13505 | continuous?: boolean;
|
13506 | }
|
13507 |
|
13508 | interface TouchBarSegmentedControlConstructorOptions {
|
13509 | /**
|
13510 | * Style of the segments:
|
13511 | */
|
13512 | segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
|
13513 | /**
|
13514 | * The selection mode of the control:
|
13515 | */
|
13516 | mode?: ('single' | 'multiple' | 'buttons');
|
13517 | /**
|
13518 | * An array of segments to place in this control.
|
13519 | */
|
13520 | segments: SegmentedControlSegment[];
|
13521 | /**
|
13522 | * The index of the currently selected segment, will update automatically with user
|
13523 | * interaction. When the mode is `multiple` it will be the last selected item.
|
13524 | */
|
13525 | selectedIndex?: number;
|
13526 | /**
|
13527 | * Called when the user selects a new segment.
|
13528 | */
|
13529 | change?: (selectedIndex: number, isSelected: boolean) => void;
|
13530 | }
|
13531 |
|
13532 | interface TouchBarSliderConstructorOptions {
|
13533 | /**
|
13534 | * Label text.
|
13535 | */
|
13536 | label?: string;
|
13537 | /**
|
13538 | * Selected value.
|
13539 | */
|
13540 | value?: number;
|
13541 | /**
|
13542 | * Minimum value.
|
13543 | */
|
13544 | minValue?: number;
|
13545 | /**
|
13546 | * Maximum value.
|
13547 | */
|
13548 | maxValue?: number;
|
13549 | /**
|
13550 | * Function to call when the slider is changed.
|
13551 | */
|
13552 | change?: (newValue: number) => void;
|
13553 | }
|
13554 |
|
13555 | interface TouchBarSpacerConstructorOptions {
|
13556 | /**
|
13557 | * Size of spacer, possible values are:
|
13558 | */
|
13559 | size?: ('small' | 'large' | 'flexible');
|
13560 | }
|
13561 |
|
13562 | interface TraceBufferUsageReturnValue {
|
13563 | value: number;
|
13564 | percentage: number;
|
13565 | }
|
13566 |
|
13567 | interface UpdateTargetUrlEvent extends Event {
|
13568 | url: string;
|
13569 | }
|
13570 |
|
13571 | interface UploadProgress {
|
13572 | /**
|
13573 | * Whether the request is currently active. If this is false no other properties
|
13574 | * will be set
|
13575 | */
|
13576 | active: boolean;
|
13577 | /**
|
13578 | * Whether the upload has started. If this is false both `current` and `total` will
|
13579 | * be set to 0.
|
13580 | */
|
13581 | started: boolean;
|
13582 | /**
|
13583 | * The number of bytes that have been uploaded so far
|
13584 | */
|
13585 | current: number;
|
13586 | /**
|
13587 | * The number of bytes that will be uploaded this request
|
13588 | */
|
13589 | total: number;
|
13590 | }
|
13591 |
|
13592 | interface WebContentsPrintOptions {
|
13593 | /**
|
13594 | * Don't ask user for print settings. Default is `false`.
|
13595 | */
|
13596 | silent?: boolean;
|
13597 | /**
|
13598 | * Prints the background color and image of the web page. Default is `false`.
|
13599 | */
|
13600 | printBackground?: boolean;
|
13601 | /**
|
13602 | * Set the printer device name to use. Must be the system-defined name and not the
|
13603 | * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
|
13604 | */
|
13605 | deviceName?: string;
|
13606 | /**
|
13607 | * Set whether the printed web page will be in color or grayscale. Default is
|
13608 | * `true`.
|
13609 | */
|
13610 | color?: boolean;
|
13611 | margins?: Margins;
|
13612 | /**
|
13613 | * Whether the web page should be printed in landscape mode. Default is `false`.
|
13614 | */
|
13615 | landscape?: boolean;
|
13616 | /**
|
13617 | * The scale factor of the web page.
|
13618 | */
|
13619 | scaleFactor?: number;
|
13620 | /**
|
13621 | * The number of pages to print per page sheet.
|
13622 | */
|
13623 | pagesPerSheet?: number;
|
13624 | /**
|
13625 | * Whether the web page should be collated.
|
13626 | */
|
13627 | collate?: boolean;
|
13628 | /**
|
13629 | * The number of copies of the web page to print.
|
13630 | */
|
13631 | copies?: number;
|
13632 | /**
|
13633 | * The page range to print.
|
13634 | */
|
13635 | pageRanges?: Record<string, number>;
|
13636 | /**
|
13637 | * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
|
13638 | * `longEdge`.
|
13639 | */
|
13640 | duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
|
13641 | dpi?: Record<string, number>;
|
13642 | /**
|
13643 | * String to be printed as page header.
|
13644 | */
|
13645 | header?: string;
|
13646 | /**
|
13647 | * String to be printed as page footer.
|
13648 | */
|
13649 | footer?: string;
|
13650 | /**
|
13651 | * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
|
13652 | * `Letter`, `Tabloid` or an Object containing `height`.
|
13653 | */
|
13654 | pageSize?: (string) | (Size);
|
13655 | }
|
13656 |
|
13657 | interface WebviewTagPrintOptions {
|
13658 | /**
|
13659 | * Don't ask user for print settings. Default is `false`.
|
13660 | */
|
13661 | silent?: boolean;
|
13662 | /**
|
13663 | * Prints the background color and image of the web page. Default is `false`.
|
13664 | */
|
13665 | printBackground?: boolean;
|
13666 | /**
|
13667 | * Set the printer device name to use. Must be the system-defined name and not the
|
13668 | * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
|
13669 | */
|
13670 | deviceName?: string;
|
13671 | /**
|
13672 | * Set whether the printed web page will be in color or grayscale. Default is
|
13673 | * `true`.
|
13674 | */
|
13675 | color?: boolean;
|
13676 | margins?: Margins;
|
13677 | /**
|
13678 | * Whether the web page should be printed in landscape mode. Default is `false`.
|
13679 | */
|
13680 | landscape?: boolean;
|
13681 | /**
|
13682 | * The scale factor of the web page.
|
13683 | */
|
13684 | scaleFactor?: number;
|
13685 | /**
|
13686 | * The number of pages to print per page sheet.
|
13687 | */
|
13688 | pagesPerSheet?: number;
|
13689 | /**
|
13690 | * Whether the web page should be collated.
|
13691 | */
|
13692 | collate?: boolean;
|
13693 | /**
|
13694 | * The number of copies of the web page to print.
|
13695 | */
|
13696 | copies?: number;
|
13697 | /**
|
13698 | * The page range to print.
|
13699 | */
|
13700 | pageRanges?: Record<string, number>;
|
13701 | /**
|
13702 | * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
|
13703 | * `longEdge`.
|
13704 | */
|
13705 | duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
|
13706 | dpi?: Record<string, number>;
|
13707 | /**
|
13708 | * String to be printed as page header.
|
13709 | */
|
13710 | header?: string;
|
13711 | /**
|
13712 | * String to be printed as page footer.
|
13713 | */
|
13714 | footer?: string;
|
13715 | /**
|
13716 | * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
|
13717 | * `Letter`, `Tabloid` or an Object containing `height`.
|
13718 | */
|
13719 | pageSize?: (string) | (Size);
|
13720 | }
|
13721 |
|
13722 | interface WillNavigateEvent extends Event {
|
13723 | url: string;
|
13724 | }
|
13725 |
|
13726 | interface EditFlags {
|
13727 | /**
|
13728 | * Whether the renderer believes it can undo.
|
13729 | */
|
13730 | canUndo: boolean;
|
13731 | /**
|
13732 | * Whether the renderer believes it can redo.
|
13733 | */
|
13734 | canRedo: boolean;
|
13735 | /**
|
13736 | * Whether the renderer believes it can cut.
|
13737 | */
|
13738 | canCut: boolean;
|
13739 | /**
|
13740 | * Whether the renderer believes it can copy
|
13741 | */
|
13742 | canCopy: boolean;
|
13743 | /**
|
13744 | * Whether the renderer believes it can paste.
|
13745 | */
|
13746 | canPaste: boolean;
|
13747 | /**
|
13748 | * Whether the renderer believes it can delete.
|
13749 | */
|
13750 | canDelete: boolean;
|
13751 | /**
|
13752 | * Whether the renderer believes it can select all.
|
13753 | */
|
13754 | canSelectAll: boolean;
|
13755 | }
|
13756 |
|
13757 | interface FoundInPageResult {
|
13758 | requestId: number;
|
13759 | /**
|
13760 | * Position of the active match.
|
13761 | */
|
13762 | activeMatchOrdinal: number;
|
13763 | /**
|
13764 | * Number of Matches.
|
13765 | */
|
13766 | matches: number;
|
13767 | /**
|
13768 | * Coordinates of first match region.
|
13769 | */
|
13770 | selectionArea: Rectangle;
|
13771 | finalUpdate: boolean;
|
13772 | }
|
13773 |
|
13774 | interface Margins {
|
13775 | /**
|
13776 | * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
|
13777 | * you will also need to specify `top`, `bottom`, `left`, and `right`.
|
13778 | */
|
13779 | marginType?: ('default' | 'none' | 'printableArea' | 'custom');
|
13780 | /**
|
13781 | * The top margin of the printed web page, in pixels.
|
13782 | */
|
13783 | top?: number;
|
13784 | /**
|
13785 | * The bottom margin of the printed web page, in pixels.
|
13786 | */
|
13787 | bottom?: number;
|
13788 | /**
|
13789 | * The left margin of the printed web page, in pixels.
|
13790 | */
|
13791 | left?: number;
|
13792 | /**
|
13793 | * The right margin of the printed web page, in pixels.
|
13794 | */
|
13795 | right?: number;
|
13796 | }
|
13797 |
|
13798 | interface MediaFlags {
|
13799 | /**
|
13800 | * Whether the media element has crashed.
|
13801 | */
|
13802 | inError: boolean;
|
13803 | /**
|
13804 | * Whether the media element is paused.
|
13805 | */
|
13806 | isPaused: boolean;
|
13807 | /**
|
13808 | * Whether the media element is muted.
|
13809 | */
|
13810 | isMuted: boolean;
|
13811 | /**
|
13812 | * Whether the media element has audio.
|
13813 | */
|
13814 | hasAudio: boolean;
|
13815 | /**
|
13816 | * Whether the media element is looping.
|
13817 | */
|
13818 | isLooping: boolean;
|
13819 | /**
|
13820 | * Whether the media element's controls are visible.
|
13821 | */
|
13822 | isControlsVisible: boolean;
|
13823 | /**
|
13824 | * Whether the media element's controls are toggleable.
|
13825 | */
|
13826 | canToggleControls: boolean;
|
13827 | /**
|
13828 | * Whether the media element can be rotated.
|
13829 | */
|
13830 | canRotate: boolean;
|
13831 | }
|
13832 |
|
13833 | interface WebPreferences {
|
13834 | /**
|
13835 | * Whether to enable DevTools. If it is set to `false`, can not use
|
13836 | * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
|
13837 | */
|
13838 | devTools?: boolean;
|
13839 | /**
|
13840 | * Whether node integration is enabled. Default is `false`.
|
13841 | */
|
13842 | nodeIntegration?: boolean;
|
13843 | /**
|
13844 | * Whether node integration is enabled in web workers. Default is `false`. More
|
13845 | * about this can be found in Multithreading.
|
13846 | */
|
13847 | nodeIntegrationInWorker?: boolean;
|
13848 | /**
|
13849 | * Experimental option for enabling Node.js support in sub-frames such as iframes
|
13850 | * and child windows. All your preloads will load for every iframe, you can use
|
13851 | * `process.isMainFrame` to determine if you are in the main frame or not.
|
13852 | */
|
13853 | nodeIntegrationInSubFrames?: boolean;
|
13854 | /**
|
13855 | * Specifies a script that will be loaded before other scripts run in the page.
|
13856 | * This script will always have access to node APIs no matter whether node
|
13857 | * integration is turned on or off. The value should be the absolute file path to
|
13858 | * the script. When node integration is turned off, the preload script can
|
13859 | * reintroduce Node global symbols back to the global scope. See example here.
|
13860 | */
|
13861 | preload?: string;
|
13862 | /**
|
13863 | * If set, this will sandbox the renderer associated with the window, making it
|
13864 | * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
|
13865 | * This is not the same as the `nodeIntegration` option and the APIs available to
|
13866 | * the preload script are more limited. Read more about the option here.
|
13867 | */
|
13868 | sandbox?: boolean;
|
13869 | /**
|
13870 | * Whether to enable the `remote` module. Default is `true`.
|
13871 | */
|
13872 | enableRemoteModule?: boolean;
|
13873 | /**
|
13874 | * Sets the session used by the page. Instead of passing the Session object
|
13875 | * directly, you can also choose to use the `partition` option instead, which
|
13876 | * accepts a partition string. When both `session` and `partition` are provided,
|
13877 | * `session` will be preferred. Default is the default session.
|
13878 | */
|
13879 | session?: Session;
|
13880 | /**
|
13881 | * Sets the session used by the page according to the session's partition string.
|
13882 | * If `partition` starts with `persist:`, the page will use a persistent session
|
13883 | * available to all pages in the app with the same `partition`. If there is no
|
13884 | * `persist:` prefix, the page will use an in-memory session. By assigning the same
|
13885 | * `partition`, multiple pages can share the same session. Default is the default
|
13886 | * session.
|
13887 | */
|
13888 | partition?: string;
|
13889 | /**
|
13890 | * When specified, web pages with the same `affinity` will run in the same renderer
|
13891 | * process. Note that due to reusing the renderer process, certain `webPreferences`
|
13892 | * options will also be shared between the web pages even when you specified
|
13893 | * different values for them, including but not limited to `preload`, `sandbox` and
|
13894 | * `nodeIntegration`. So it is suggested to use exact same `webPreferences` for web
|
13895 | * pages with the same `affinity`. _Deprecated_
|
13896 | */
|
13897 | affinity?: string;
|
13898 | /**
|
13899 | * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
|
13900 | */
|
13901 | zoomFactor?: number;
|
13902 | /**
|
13903 | * Enables JavaScript support. Default is `true`.
|
13904 | */
|
13905 | javascript?: boolean;
|
13906 | /**
|
13907 | * When `false`, it will disable the same-origin policy (usually using testing
|
13908 | * websites by people), and set `allowRunningInsecureContent` to `true` if this
|
13909 | * options has not been set by user. Default is `true`.
|
13910 | */
|
13911 | webSecurity?: boolean;
|
13912 | /**
|
13913 | * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
|
13914 | * `false`.
|
13915 | */
|
13916 | allowRunningInsecureContent?: boolean;
|
13917 | /**
|
13918 | * Enables image support. Default is `true`.
|
13919 | */
|
13920 | images?: boolean;
|
13921 | /**
|
13922 | * Make TextArea elements resizable. Default is `true`.
|
13923 | */
|
13924 | textAreasAreResizable?: boolean;
|
13925 | /**
|
13926 | * Enables WebGL support. Default is `true`.
|
13927 | */
|
13928 | webgl?: boolean;
|
13929 | /**
|
13930 | * Whether plugins should be enabled. Default is `false`.
|
13931 | */
|
13932 | plugins?: boolean;
|
13933 | /**
|
13934 | * Enables Chromium's experimental features. Default is `false`.
|
13935 | */
|
13936 | experimentalFeatures?: boolean;
|
13937 | /**
|
13938 | * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
|
13939 | */
|
13940 | scrollBounce?: boolean;
|
13941 | /**
|
13942 | * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
|
13943 | * to enable. The full list of supported feature strings can be found in the
|
13944 | * RuntimeEnabledFeatures.json5 file.
|
13945 | */
|
13946 | enableBlinkFeatures?: string;
|
13947 | /**
|
13948 | * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
|
13949 | * to disable. The full list of supported feature strings can be found in the
|
13950 | * RuntimeEnabledFeatures.json5 file.
|
13951 | */
|
13952 | disableBlinkFeatures?: string;
|
13953 | /**
|
13954 | * Sets the default font for the font-family.
|
13955 | */
|
13956 | defaultFontFamily?: DefaultFontFamily;
|
13957 | /**
|
13958 | * Defaults to `16`.
|
13959 | */
|
13960 | defaultFontSize?: number;
|
13961 | /**
|
13962 | * Defaults to `13`.
|
13963 | */
|
13964 | defaultMonospaceFontSize?: number;
|
13965 | /**
|
13966 | * Defaults to `0`.
|
13967 | */
|
13968 | minimumFontSize?: number;
|
13969 | /**
|
13970 | * Defaults to `ISO-8859-1`.
|
13971 | */
|
13972 | defaultEncoding?: string;
|
13973 | /**
|
13974 | * Whether to throttle animations and timers when the page becomes background. This
|
13975 | * also affects the Page Visibility API. Defaults to `true`.
|
13976 | */
|
13977 | backgroundThrottling?: boolean;
|
13978 | /**
|
13979 | * Whether to enable offscreen rendering for the browser window. Defaults to
|
13980 | * `false`. See the offscreen rendering tutorial for more details.
|
13981 | */
|
13982 | offscreen?: boolean;
|
13983 | /**
|
13984 | * Whether to run Electron APIs and the specified `preload` script in a separate
|
13985 | * JavaScript context. Defaults to `false`. The context that the `preload` script
|
13986 | * runs in will still have full access to the `document` and `window` globals but
|
13987 | * it will use its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.)
|
13988 | * and will be isolated from any changes made to the global environment by the
|
13989 | * loaded page. The Electron API will only be available in the `preload` script and
|
13990 | * not the loaded page. This option should be used when loading potentially
|
13991 | * untrusted remote content to ensure the loaded content cannot tamper with the
|
13992 | * `preload` script and any Electron APIs being used. This option uses the same
|
13993 | * technique used by Chrome Content Scripts. You can access this context in the dev
|
13994 | * tools by selecting the 'Electron Isolated Context' entry in the combo box at the
|
13995 | * top of the Console tab.
|
13996 | */
|
13997 | contextIsolation?: boolean;
|
13998 | /**
|
13999 | * Whether to use native `window.open()`. Defaults to `false`. Child windows will
|
14000 | * always have node integration disabled unless `nodeIntegrationInSubFrames` is
|
14001 | * true. **Note:** This option is currently experimental.
|
14002 | */
|
14003 | nativeWindowOpen?: boolean;
|
14004 | /**
|
14005 | * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
|
14006 | * `preload` script configured for the `<webview>` will have node integration
|
14007 | * enabled when it is executed so you should ensure remote/untrusted content is not
|
14008 | * able to create a `<webview>` tag with a possibly malicious `preload` script. You
|
14009 | * can use the `will-attach-webview` event on webContents to strip away the
|
14010 | * `preload` script and to validate or alter the `<webview>`'s initial settings.
|
14011 | */
|
14012 | webviewTag?: boolean;
|
14013 | /**
|
14014 | * A list of strings that will be appended to `process.argv` in the renderer
|
14015 | * process of this app. Useful for passing small bits of data down to renderer
|
14016 | * process preload scripts.
|
14017 | */
|
14018 | additionalArguments?: string[];
|
14019 | /**
|
14020 | * Whether to enable browser style consecutive dialog protection. Default is
|
14021 | * `false`.
|
14022 | */
|
14023 | safeDialogs?: boolean;
|
14024 | /**
|
14025 | * The message to display when consecutive dialog protection is triggered. If not
|
14026 | * defined the default message would be used, note that currently the default
|
14027 | * message is in English and not localized.
|
14028 | */
|
14029 | safeDialogsMessage?: string;
|
14030 | /**
|
14031 | * Whether to disable dialogs completely. Overrides `safeDialogs`. Default is
|
14032 | * `false`.
|
14033 | */
|
14034 | disableDialogs?: boolean;
|
14035 | /**
|
14036 | * Whether dragging and dropping a file or link onto the page causes a navigation.
|
14037 | * Default is `false`.
|
14038 | */
|
14039 | navigateOnDragDrop?: boolean;
|
14040 | /**
|
14041 | * Autoplay policy to apply to content in the window, can be
|
14042 | * `no-user-gesture-required`, `user-gesture-required`,
|
14043 | * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
|
14044 | */
|
14045 | autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
|
14046 | /**
|
14047 | * Whether to prevent the window from resizing when entering HTML Fullscreen.
|
14048 | * Default is `false`.
|
14049 | */
|
14050 | disableHtmlFullscreenWindowResize?: boolean;
|
14051 | /**
|
14052 | * An alternative title string provided only to accessibility tools such as screen
|
14053 | * readers. This string is not directly visible to users.
|
14054 | */
|
14055 | accessibleTitle?: string;
|
14056 | /**
|
14057 | * Whether to enable the builtin spellchecker. Default is `true`.
|
14058 | */
|
14059 | spellcheck?: boolean;
|
14060 | /**
|
14061 | * Whether to enable the WebSQL api. Default is `true`.
|
14062 | */
|
14063 | enableWebSQL?: boolean;
|
14064 | /**
|
14065 | * Enforces the v8 code caching policy used by blink. Accepted values are
|
14066 | */
|
14067 | v8CacheOptions?: ('none' | 'code' | 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile');
|
14068 | }
|
14069 |
|
14070 | interface DefaultFontFamily {
|
14071 | /**
|
14072 | * Defaults to `Times New Roman`.
|
14073 | */
|
14074 | standard?: string;
|
14075 | /**
|
14076 | * Defaults to `Times New Roman`.
|
14077 | */
|
14078 | serif?: string;
|
14079 | /**
|
14080 | * Defaults to `Arial`.
|
14081 | */
|
14082 | sansSerif?: string;
|
14083 | /**
|
14084 | * Defaults to `Courier New`.
|
14085 | */
|
14086 | monospace?: string;
|
14087 | /**
|
14088 | * Defaults to `Script`.
|
14089 | */
|
14090 | cursive?: string;
|
14091 | /**
|
14092 | * Defaults to `Impact`.
|
14093 | */
|
14094 | fantasy?: string;
|
14095 | }
|
14096 |
|
14097 | interface RemoteMainInterface {
|
14098 | app: App;
|
14099 | autoUpdater: AutoUpdater;
|
14100 | BrowserView: typeof BrowserView;
|
14101 | BrowserWindow: typeof BrowserWindow;
|
14102 | ClientRequest: typeof ClientRequest;
|
14103 | clipboard: Clipboard;
|
14104 | CommandLine: typeof CommandLine;
|
14105 | contentTracing: ContentTracing;
|
14106 | Cookies: typeof Cookies;
|
14107 | crashReporter: CrashReporter;
|
14108 | Debugger: typeof Debugger;
|
14109 | desktopCapturer: DesktopCapturer;
|
14110 | dialog: Dialog;
|
14111 | Dock: typeof Dock;
|
14112 | DownloadItem: typeof DownloadItem;
|
14113 | globalShortcut: GlobalShortcut;
|
14114 | inAppPurchase: InAppPurchase;
|
14115 | IncomingMessage: typeof IncomingMessage;
|
14116 | ipcMain: IpcMain;
|
14117 | Menu: typeof Menu;
|
14118 | MenuItem: typeof MenuItem;
|
14119 | MessageChannelMain: typeof MessageChannelMain;
|
14120 | MessagePortMain: typeof MessagePortMain;
|
14121 | nativeImage: typeof NativeImage;
|
14122 | nativeTheme: NativeTheme;
|
14123 | net: Net;
|
14124 | netLog: NetLog;
|
14125 | Notification: typeof Notification;
|
14126 | powerMonitor: PowerMonitor;
|
14127 | powerSaveBlocker: PowerSaveBlocker;
|
14128 | protocol: Protocol;
|
14129 | screen: Screen;
|
14130 | ServiceWorkers: typeof ServiceWorkers;
|
14131 | session: typeof Session;
|
14132 | shell: Shell;
|
14133 | systemPreferences: SystemPreferences;
|
14134 | TouchBar: typeof TouchBar;
|
14135 | TouchBarButton: typeof TouchBarButton;
|
14136 | TouchBarColorPicker: typeof TouchBarColorPicker;
|
14137 | TouchBarGroup: typeof TouchBarGroup;
|
14138 | TouchBarLabel: typeof TouchBarLabel;
|
14139 | TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
|
14140 | TouchBarPopover: typeof TouchBarPopover;
|
14141 | TouchBarScrubber: typeof TouchBarScrubber;
|
14142 | TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
|
14143 | TouchBarSlider: typeof TouchBarSlider;
|
14144 | TouchBarSpacer: typeof TouchBarSpacer;
|
14145 | Tray: typeof Tray;
|
14146 | webContents: typeof WebContents;
|
14147 | WebRequest: typeof WebRequest;
|
14148 | }
|
14149 |
|
14150 |
|
14151 |
|
14152 | namespace Common {
|
14153 | const clipboard: Clipboard;
|
14154 | const crashReporter: CrashReporter;
|
14155 | const desktopCapturer: DesktopCapturer;
|
14156 | class NativeImage extends Electron.NativeImage {}
|
14157 | type nativeImage = NativeImage;
|
14158 | const nativeImage: typeof NativeImage;
|
14159 | const shell: Shell;
|
14160 | type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
|
14161 | type AddRepresentationOptions = Electron.AddRepresentationOptions;
|
14162 | type AnimationSettings = Electron.AnimationSettings;
|
14163 | type AppDetailsOptions = Electron.AppDetailsOptions;
|
14164 | type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
|
14165 | type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
|
14166 | type AuthInfo = Electron.AuthInfo;
|
14167 | type AutoResizeOptions = Electron.AutoResizeOptions;
|
14168 | type BeforeSendResponse = Electron.BeforeSendResponse;
|
14169 | type BitmapOptions = Electron.BitmapOptions;
|
14170 | type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
|
14171 | type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
|
14172 | type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
|
14173 | type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
|
14174 | type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
|
14175 | type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
|
14176 | type Config = Electron.Config;
|
14177 | type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
|
14178 | type ContextMenuParams = Electron.ContextMenuParams;
|
14179 | type CookiesGetFilter = Electron.CookiesGetFilter;
|
14180 | type CookiesSetDetails = Electron.CookiesSetDetails;
|
14181 | type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
|
14182 | type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
|
14183 | type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
|
14184 | type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
|
14185 | type Data = Electron.Data;
|
14186 | type Details = Electron.Details;
|
14187 | type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
|
14188 | type DidFailLoadEvent = Electron.DidFailLoadEvent;
|
14189 | type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
|
14190 | type DidNavigateEvent = Electron.DidNavigateEvent;
|
14191 | type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
|
14192 | type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
|
14193 | type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
|
14194 | type FeedURLOptions = Electron.FeedURLOptions;
|
14195 | type FileIconOptions = Electron.FileIconOptions;
|
14196 | type Filter = Electron.Filter;
|
14197 | type FindInPageOptions = Electron.FindInPageOptions;
|
14198 | type FocusOptions = Electron.FocusOptions;
|
14199 | type FoundInPageEvent = Electron.FoundInPageEvent;
|
14200 | type FromPartitionOptions = Electron.FromPartitionOptions;
|
14201 | type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
|
14202 | type HeapStatistics = Electron.HeapStatistics;
|
14203 | type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
|
14204 | type ImportCertificateOptions = Electron.ImportCertificateOptions;
|
14205 | type Info = Electron.Info;
|
14206 | type Input = Electron.Input;
|
14207 | type InsertCSSOptions = Electron.InsertCSSOptions;
|
14208 | type IpcMessageEvent = Electron.IpcMessageEvent;
|
14209 | type Item = Electron.Item;
|
14210 | type JumpListSettings = Electron.JumpListSettings;
|
14211 | type LoadCommitEvent = Electron.LoadCommitEvent;
|
14212 | type LoadFileOptions = Electron.LoadFileOptions;
|
14213 | type LoadURLOptions = Electron.LoadURLOptions;
|
14214 | type LoginItemSettings = Electron.LoginItemSettings;
|
14215 | type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
|
14216 | type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
|
14217 | type MessageBoxOptions = Electron.MessageBoxOptions;
|
14218 | type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
|
14219 | type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
|
14220 | type MessageDetails = Electron.MessageDetails;
|
14221 | type MessageEvent = Electron.MessageEvent;
|
14222 | type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
|
14223 | type NewWindowEvent = Electron.NewWindowEvent;
|
14224 | type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
|
14225 | type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
|
14226 | type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
|
14227 | type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
|
14228 | type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
|
14229 | type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
|
14230 | type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
|
14231 | type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
|
14232 | type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
|
14233 | type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
|
14234 | type OpenDialogOptions = Electron.OpenDialogOptions;
|
14235 | type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
|
14236 | type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
|
14237 | type OpenExternalOptions = Electron.OpenExternalOptions;
|
14238 | type Options = Electron.Options;
|
14239 | type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
|
14240 | type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
|
14241 | type Parameters = Electron.Parameters;
|
14242 | type Payment = Electron.Payment;
|
14243 | type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
|
14244 | type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
|
14245 | type PluginCrashedEvent = Electron.PluginCrashedEvent;
|
14246 | type PopupOptions = Electron.PopupOptions;
|
14247 | type PreconnectOptions = Electron.PreconnectOptions;
|
14248 | type PrintToPDFOptions = Electron.PrintToPDFOptions;
|
14249 | type Privileges = Electron.Privileges;
|
14250 | type ProgressBarOptions = Electron.ProgressBarOptions;
|
14251 | type Provider = Electron.Provider;
|
14252 | type ReadBookmark = Electron.ReadBookmark;
|
14253 | type RelaunchOptions = Electron.RelaunchOptions;
|
14254 | type Request = Electron.Request;
|
14255 | type ResizeOptions = Electron.ResizeOptions;
|
14256 | type ResourceUsage = Electron.ResourceUsage;
|
14257 | type Response = Electron.Response;
|
14258 | type Result = Electron.Result;
|
14259 | type SaveDialogOptions = Electron.SaveDialogOptions;
|
14260 | type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
|
14261 | type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
|
14262 | type Settings = Electron.Settings;
|
14263 | type SourcesOptions = Electron.SourcesOptions;
|
14264 | type StartLoggingOptions = Electron.StartLoggingOptions;
|
14265 | type SystemMemoryInfo = Electron.SystemMemoryInfo;
|
14266 | type ToBitmapOptions = Electron.ToBitmapOptions;
|
14267 | type ToDataURLOptions = Electron.ToDataURLOptions;
|
14268 | type ToPNGOptions = Electron.ToPNGOptions;
|
14269 | type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
|
14270 | type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
|
14271 | type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
|
14272 | type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
|
14273 | type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
|
14274 | type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
|
14275 | type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
|
14276 | type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
|
14277 | type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
|
14278 | type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
|
14279 | type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
|
14280 | type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
|
14281 | type UploadProgress = Electron.UploadProgress;
|
14282 | type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
|
14283 | type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
|
14284 | type WillNavigateEvent = Electron.WillNavigateEvent;
|
14285 | type EditFlags = Electron.EditFlags;
|
14286 | type FoundInPageResult = Electron.FoundInPageResult;
|
14287 | type Margins = Electron.Margins;
|
14288 | type MediaFlags = Electron.MediaFlags;
|
14289 | type WebPreferences = Electron.WebPreferences;
|
14290 | type DefaultFontFamily = Electron.DefaultFontFamily;
|
14291 | type BluetoothDevice = Electron.BluetoothDevice;
|
14292 | type Certificate = Electron.Certificate;
|
14293 | type CertificatePrincipal = Electron.CertificatePrincipal;
|
14294 | type Cookie = Electron.Cookie;
|
14295 | type CPUUsage = Electron.CPUUsage;
|
14296 | type CrashReport = Electron.CrashReport;
|
14297 | type CustomScheme = Electron.CustomScheme;
|
14298 | type DesktopCapturerSource = Electron.DesktopCapturerSource;
|
14299 | type Display = Electron.Display;
|
14300 | type Event = Electron.Event;
|
14301 | type Extension = Electron.Extension;
|
14302 | type ExtensionInfo = Electron.ExtensionInfo;
|
14303 | type FileFilter = Electron.FileFilter;
|
14304 | type FilePathWithHeaders = Electron.FilePathWithHeaders;
|
14305 | type GPUFeatureStatus = Electron.GPUFeatureStatus;
|
14306 | type InputEvent = Electron.InputEvent;
|
14307 | type IOCounters = Electron.IOCounters;
|
14308 | type IpcMainEvent = Electron.IpcMainEvent;
|
14309 | type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
|
14310 | type IpcRendererEvent = Electron.IpcRendererEvent;
|
14311 | type JumpListCategory = Electron.JumpListCategory;
|
14312 | type JumpListItem = Electron.JumpListItem;
|
14313 | type KeyboardEvent = Electron.KeyboardEvent;
|
14314 | type KeyboardInputEvent = Electron.KeyboardInputEvent;
|
14315 | type MemoryInfo = Electron.MemoryInfo;
|
14316 | type MemoryUsageDetails = Electron.MemoryUsageDetails;
|
14317 | type MimeTypedBuffer = Electron.MimeTypedBuffer;
|
14318 | type MouseInputEvent = Electron.MouseInputEvent;
|
14319 | type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
|
14320 | type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
|
14321 | type NotificationAction = Electron.NotificationAction;
|
14322 | type Point = Electron.Point;
|
14323 | type PostBody = Electron.PostBody;
|
14324 | type PostData = Electron.PostData;
|
14325 | type PrinterInfo = Electron.PrinterInfo;
|
14326 | type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
|
14327 | type ProcessMetric = Electron.ProcessMetric;
|
14328 | type Product = Electron.Product;
|
14329 | type ProtocolRequest = Electron.ProtocolRequest;
|
14330 | type ProtocolResponse = Electron.ProtocolResponse;
|
14331 | type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
|
14332 | type Rectangle = Electron.Rectangle;
|
14333 | type Referrer = Electron.Referrer;
|
14334 | type ScrubberItem = Electron.ScrubberItem;
|
14335 | type SegmentedControlSegment = Electron.SegmentedControlSegment;
|
14336 | type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
|
14337 | type SharedWorkerInfo = Electron.SharedWorkerInfo;
|
14338 | type ShortcutDetails = Electron.ShortcutDetails;
|
14339 | type Size = Electron.Size;
|
14340 | type StreamProtocolResponse = Electron.StreamProtocolResponse;
|
14341 | type StringProtocolResponse = Electron.StringProtocolResponse;
|
14342 | type Task = Electron.Task;
|
14343 | type ThumbarButton = Electron.ThumbarButton;
|
14344 | type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
|
14345 | type TraceConfig = Electron.TraceConfig;
|
14346 | type Transaction = Electron.Transaction;
|
14347 | type UploadBlob = Electron.UploadBlob;
|
14348 | type UploadData = Electron.UploadData;
|
14349 | type UploadFile = Electron.UploadFile;
|
14350 | type UploadRawData = Electron.UploadRawData;
|
14351 | type WebSource = Electron.WebSource;
|
14352 | }
|
14353 |
|
14354 | namespace Main {
|
14355 | const app: App;
|
14356 | const autoUpdater: AutoUpdater;
|
14357 | class BrowserView extends Electron.BrowserView {}
|
14358 | class BrowserWindow extends Electron.BrowserWindow {}
|
14359 | class ClientRequest extends Electron.ClientRequest {}
|
14360 | class CommandLine extends Electron.CommandLine {}
|
14361 | const contentTracing: ContentTracing;
|
14362 | class Cookies extends Electron.Cookies {}
|
14363 | class Debugger extends Electron.Debugger {}
|
14364 | const dialog: Dialog;
|
14365 | class Dock extends Electron.Dock {}
|
14366 | class DownloadItem extends Electron.DownloadItem {}
|
14367 | const globalShortcut: GlobalShortcut;
|
14368 | const inAppPurchase: InAppPurchase;
|
14369 | class IncomingMessage extends Electron.IncomingMessage {}
|
14370 | const ipcMain: IpcMain;
|
14371 | class Menu extends Electron.Menu {}
|
14372 | class MenuItem extends Electron.MenuItem {}
|
14373 | class MessageChannelMain extends Electron.MessageChannelMain {}
|
14374 | class MessagePortMain extends Electron.MessagePortMain {}
|
14375 | const nativeTheme: NativeTheme;
|
14376 | const net: Net;
|
14377 | const netLog: NetLog;
|
14378 | class Notification extends Electron.Notification {}
|
14379 | const powerMonitor: PowerMonitor;
|
14380 | const powerSaveBlocker: PowerSaveBlocker;
|
14381 | const protocol: Protocol;
|
14382 | const screen: Screen;
|
14383 | class ServiceWorkers extends Electron.ServiceWorkers {}
|
14384 | class Session extends Electron.Session {}
|
14385 | type session = Session;
|
14386 | const session: typeof Session;
|
14387 | const systemPreferences: SystemPreferences;
|
14388 | class TouchBar extends Electron.TouchBar {}
|
14389 | class TouchBarButton extends Electron.TouchBarButton {}
|
14390 | class TouchBarColorPicker extends Electron.TouchBarColorPicker {}
|
14391 | class TouchBarGroup extends Electron.TouchBarGroup {}
|
14392 | class TouchBarLabel extends Electron.TouchBarLabel {}
|
14393 | class TouchBarOtherItemsProxy extends Electron.TouchBarOtherItemsProxy {}
|
14394 | class TouchBarPopover extends Electron.TouchBarPopover {}
|
14395 | class TouchBarScrubber extends Electron.TouchBarScrubber {}
|
14396 | class TouchBarSegmentedControl extends Electron.TouchBarSegmentedControl {}
|
14397 | class TouchBarSlider extends Electron.TouchBarSlider {}
|
14398 | class TouchBarSpacer extends Electron.TouchBarSpacer {}
|
14399 | class Tray extends Electron.Tray {}
|
14400 | class WebContents extends Electron.WebContents {}
|
14401 | type webContents = WebContents;
|
14402 | const webContents: typeof WebContents;
|
14403 | class WebRequest extends Electron.WebRequest {}
|
14404 | type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
|
14405 | type AddRepresentationOptions = Electron.AddRepresentationOptions;
|
14406 | type AnimationSettings = Electron.AnimationSettings;
|
14407 | type AppDetailsOptions = Electron.AppDetailsOptions;
|
14408 | type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
|
14409 | type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
|
14410 | type AuthInfo = Electron.AuthInfo;
|
14411 | type AutoResizeOptions = Electron.AutoResizeOptions;
|
14412 | type BeforeSendResponse = Electron.BeforeSendResponse;
|
14413 | type BitmapOptions = Electron.BitmapOptions;
|
14414 | type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
|
14415 | type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
|
14416 | type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
|
14417 | type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
|
14418 | type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
|
14419 | type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
|
14420 | type Config = Electron.Config;
|
14421 | type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
|
14422 | type ContextMenuParams = Electron.ContextMenuParams;
|
14423 | type CookiesGetFilter = Electron.CookiesGetFilter;
|
14424 | type CookiesSetDetails = Electron.CookiesSetDetails;
|
14425 | type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
|
14426 | type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
|
14427 | type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
|
14428 | type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
|
14429 | type Data = Electron.Data;
|
14430 | type Details = Electron.Details;
|
14431 | type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
|
14432 | type DidFailLoadEvent = Electron.DidFailLoadEvent;
|
14433 | type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
|
14434 | type DidNavigateEvent = Electron.DidNavigateEvent;
|
14435 | type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
|
14436 | type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
|
14437 | type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
|
14438 | type FeedURLOptions = Electron.FeedURLOptions;
|
14439 | type FileIconOptions = Electron.FileIconOptions;
|
14440 | type Filter = Electron.Filter;
|
14441 | type FindInPageOptions = Electron.FindInPageOptions;
|
14442 | type FocusOptions = Electron.FocusOptions;
|
14443 | type FoundInPageEvent = Electron.FoundInPageEvent;
|
14444 | type FromPartitionOptions = Electron.FromPartitionOptions;
|
14445 | type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
|
14446 | type HeapStatistics = Electron.HeapStatistics;
|
14447 | type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
|
14448 | type ImportCertificateOptions = Electron.ImportCertificateOptions;
|
14449 | type Info = Electron.Info;
|
14450 | type Input = Electron.Input;
|
14451 | type InsertCSSOptions = Electron.InsertCSSOptions;
|
14452 | type IpcMessageEvent = Electron.IpcMessageEvent;
|
14453 | type Item = Electron.Item;
|
14454 | type JumpListSettings = Electron.JumpListSettings;
|
14455 | type LoadCommitEvent = Electron.LoadCommitEvent;
|
14456 | type LoadFileOptions = Electron.LoadFileOptions;
|
14457 | type LoadURLOptions = Electron.LoadURLOptions;
|
14458 | type LoginItemSettings = Electron.LoginItemSettings;
|
14459 | type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
|
14460 | type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
|
14461 | type MessageBoxOptions = Electron.MessageBoxOptions;
|
14462 | type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
|
14463 | type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
|
14464 | type MessageDetails = Electron.MessageDetails;
|
14465 | type MessageEvent = Electron.MessageEvent;
|
14466 | type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
|
14467 | type NewWindowEvent = Electron.NewWindowEvent;
|
14468 | type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
|
14469 | type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
|
14470 | type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
|
14471 | type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
|
14472 | type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
|
14473 | type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
|
14474 | type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
|
14475 | type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
|
14476 | type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
|
14477 | type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
|
14478 | type OpenDialogOptions = Electron.OpenDialogOptions;
|
14479 | type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
|
14480 | type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
|
14481 | type OpenExternalOptions = Electron.OpenExternalOptions;
|
14482 | type Options = Electron.Options;
|
14483 | type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
|
14484 | type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
|
14485 | type Parameters = Electron.Parameters;
|
14486 | type Payment = Electron.Payment;
|
14487 | type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
|
14488 | type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
|
14489 | type PluginCrashedEvent = Electron.PluginCrashedEvent;
|
14490 | type PopupOptions = Electron.PopupOptions;
|
14491 | type PreconnectOptions = Electron.PreconnectOptions;
|
14492 | type PrintToPDFOptions = Electron.PrintToPDFOptions;
|
14493 | type Privileges = Electron.Privileges;
|
14494 | type ProgressBarOptions = Electron.ProgressBarOptions;
|
14495 | type Provider = Electron.Provider;
|
14496 | type ReadBookmark = Electron.ReadBookmark;
|
14497 | type RelaunchOptions = Electron.RelaunchOptions;
|
14498 | type Request = Electron.Request;
|
14499 | type ResizeOptions = Electron.ResizeOptions;
|
14500 | type ResourceUsage = Electron.ResourceUsage;
|
14501 | type Response = Electron.Response;
|
14502 | type Result = Electron.Result;
|
14503 | type SaveDialogOptions = Electron.SaveDialogOptions;
|
14504 | type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
|
14505 | type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
|
14506 | type Settings = Electron.Settings;
|
14507 | type SourcesOptions = Electron.SourcesOptions;
|
14508 | type StartLoggingOptions = Electron.StartLoggingOptions;
|
14509 | type SystemMemoryInfo = Electron.SystemMemoryInfo;
|
14510 | type ToBitmapOptions = Electron.ToBitmapOptions;
|
14511 | type ToDataURLOptions = Electron.ToDataURLOptions;
|
14512 | type ToPNGOptions = Electron.ToPNGOptions;
|
14513 | type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
|
14514 | type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
|
14515 | type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
|
14516 | type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
|
14517 | type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
|
14518 | type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
|
14519 | type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
|
14520 | type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
|
14521 | type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
|
14522 | type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
|
14523 | type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
|
14524 | type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
|
14525 | type UploadProgress = Electron.UploadProgress;
|
14526 | type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
|
14527 | type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
|
14528 | type WillNavigateEvent = Electron.WillNavigateEvent;
|
14529 | type EditFlags = Electron.EditFlags;
|
14530 | type FoundInPageResult = Electron.FoundInPageResult;
|
14531 | type Margins = Electron.Margins;
|
14532 | type MediaFlags = Electron.MediaFlags;
|
14533 | type WebPreferences = Electron.WebPreferences;
|
14534 | type DefaultFontFamily = Electron.DefaultFontFamily;
|
14535 | type BluetoothDevice = Electron.BluetoothDevice;
|
14536 | type Certificate = Electron.Certificate;
|
14537 | type CertificatePrincipal = Electron.CertificatePrincipal;
|
14538 | type Cookie = Electron.Cookie;
|
14539 | type CPUUsage = Electron.CPUUsage;
|
14540 | type CrashReport = Electron.CrashReport;
|
14541 | type CustomScheme = Electron.CustomScheme;
|
14542 | type DesktopCapturerSource = Electron.DesktopCapturerSource;
|
14543 | type Display = Electron.Display;
|
14544 | type Event = Electron.Event;
|
14545 | type Extension = Electron.Extension;
|
14546 | type ExtensionInfo = Electron.ExtensionInfo;
|
14547 | type FileFilter = Electron.FileFilter;
|
14548 | type FilePathWithHeaders = Electron.FilePathWithHeaders;
|
14549 | type GPUFeatureStatus = Electron.GPUFeatureStatus;
|
14550 | type InputEvent = Electron.InputEvent;
|
14551 | type IOCounters = Electron.IOCounters;
|
14552 | type IpcMainEvent = Electron.IpcMainEvent;
|
14553 | type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
|
14554 | type IpcRendererEvent = Electron.IpcRendererEvent;
|
14555 | type JumpListCategory = Electron.JumpListCategory;
|
14556 | type JumpListItem = Electron.JumpListItem;
|
14557 | type KeyboardEvent = Electron.KeyboardEvent;
|
14558 | type KeyboardInputEvent = Electron.KeyboardInputEvent;
|
14559 | type MemoryInfo = Electron.MemoryInfo;
|
14560 | type MemoryUsageDetails = Electron.MemoryUsageDetails;
|
14561 | type MimeTypedBuffer = Electron.MimeTypedBuffer;
|
14562 | type MouseInputEvent = Electron.MouseInputEvent;
|
14563 | type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
|
14564 | type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
|
14565 | type NotificationAction = Electron.NotificationAction;
|
14566 | type Point = Electron.Point;
|
14567 | type PostBody = Electron.PostBody;
|
14568 | type PostData = Electron.PostData;
|
14569 | type PrinterInfo = Electron.PrinterInfo;
|
14570 | type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
|
14571 | type ProcessMetric = Electron.ProcessMetric;
|
14572 | type Product = Electron.Product;
|
14573 | type ProtocolRequest = Electron.ProtocolRequest;
|
14574 | type ProtocolResponse = Electron.ProtocolResponse;
|
14575 | type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
|
14576 | type Rectangle = Electron.Rectangle;
|
14577 | type Referrer = Electron.Referrer;
|
14578 | type ScrubberItem = Electron.ScrubberItem;
|
14579 | type SegmentedControlSegment = Electron.SegmentedControlSegment;
|
14580 | type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
|
14581 | type SharedWorkerInfo = Electron.SharedWorkerInfo;
|
14582 | type ShortcutDetails = Electron.ShortcutDetails;
|
14583 | type Size = Electron.Size;
|
14584 | type StreamProtocolResponse = Electron.StreamProtocolResponse;
|
14585 | type StringProtocolResponse = Electron.StringProtocolResponse;
|
14586 | type Task = Electron.Task;
|
14587 | type ThumbarButton = Electron.ThumbarButton;
|
14588 | type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
|
14589 | type TraceConfig = Electron.TraceConfig;
|
14590 | type Transaction = Electron.Transaction;
|
14591 | type UploadBlob = Electron.UploadBlob;
|
14592 | type UploadData = Electron.UploadData;
|
14593 | type UploadFile = Electron.UploadFile;
|
14594 | type UploadRawData = Electron.UploadRawData;
|
14595 | type WebSource = Electron.WebSource;
|
14596 | }
|
14597 |
|
14598 | namespace Renderer {
|
14599 | class BrowserWindowProxy extends Electron.BrowserWindowProxy {}
|
14600 | const contextBridge: ContextBridge;
|
14601 | const ipcRenderer: IpcRenderer;
|
14602 | const remote: Remote;
|
14603 | const webFrame: WebFrame;
|
14604 | const webviewTag: WebviewTag;
|
14605 | type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
|
14606 | type AddRepresentationOptions = Electron.AddRepresentationOptions;
|
14607 | type AnimationSettings = Electron.AnimationSettings;
|
14608 | type AppDetailsOptions = Electron.AppDetailsOptions;
|
14609 | type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
|
14610 | type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
|
14611 | type AuthInfo = Electron.AuthInfo;
|
14612 | type AutoResizeOptions = Electron.AutoResizeOptions;
|
14613 | type BeforeSendResponse = Electron.BeforeSendResponse;
|
14614 | type BitmapOptions = Electron.BitmapOptions;
|
14615 | type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
|
14616 | type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
|
14617 | type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
|
14618 | type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
|
14619 | type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
|
14620 | type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
|
14621 | type Config = Electron.Config;
|
14622 | type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
|
14623 | type ContextMenuParams = Electron.ContextMenuParams;
|
14624 | type CookiesGetFilter = Electron.CookiesGetFilter;
|
14625 | type CookiesSetDetails = Electron.CookiesSetDetails;
|
14626 | type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
|
14627 | type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
|
14628 | type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
|
14629 | type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
|
14630 | type Data = Electron.Data;
|
14631 | type Details = Electron.Details;
|
14632 | type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
|
14633 | type DidFailLoadEvent = Electron.DidFailLoadEvent;
|
14634 | type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
|
14635 | type DidNavigateEvent = Electron.DidNavigateEvent;
|
14636 | type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
|
14637 | type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
|
14638 | type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
|
14639 | type FeedURLOptions = Electron.FeedURLOptions;
|
14640 | type FileIconOptions = Electron.FileIconOptions;
|
14641 | type Filter = Electron.Filter;
|
14642 | type FindInPageOptions = Electron.FindInPageOptions;
|
14643 | type FocusOptions = Electron.FocusOptions;
|
14644 | type FoundInPageEvent = Electron.FoundInPageEvent;
|
14645 | type FromPartitionOptions = Electron.FromPartitionOptions;
|
14646 | type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
|
14647 | type HeapStatistics = Electron.HeapStatistics;
|
14648 | type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
|
14649 | type ImportCertificateOptions = Electron.ImportCertificateOptions;
|
14650 | type Info = Electron.Info;
|
14651 | type Input = Electron.Input;
|
14652 | type InsertCSSOptions = Electron.InsertCSSOptions;
|
14653 | type IpcMessageEvent = Electron.IpcMessageEvent;
|
14654 | type Item = Electron.Item;
|
14655 | type JumpListSettings = Electron.JumpListSettings;
|
14656 | type LoadCommitEvent = Electron.LoadCommitEvent;
|
14657 | type LoadFileOptions = Electron.LoadFileOptions;
|
14658 | type LoadURLOptions = Electron.LoadURLOptions;
|
14659 | type LoginItemSettings = Electron.LoginItemSettings;
|
14660 | type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
|
14661 | type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
|
14662 | type MessageBoxOptions = Electron.MessageBoxOptions;
|
14663 | type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
|
14664 | type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
|
14665 | type MessageDetails = Electron.MessageDetails;
|
14666 | type MessageEvent = Electron.MessageEvent;
|
14667 | type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
|
14668 | type NewWindowEvent = Electron.NewWindowEvent;
|
14669 | type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
|
14670 | type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
|
14671 | type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
|
14672 | type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
|
14673 | type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
|
14674 | type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
|
14675 | type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
|
14676 | type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
|
14677 | type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
|
14678 | type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
|
14679 | type OpenDialogOptions = Electron.OpenDialogOptions;
|
14680 | type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
|
14681 | type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
|
14682 | type OpenExternalOptions = Electron.OpenExternalOptions;
|
14683 | type Options = Electron.Options;
|
14684 | type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
|
14685 | type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
|
14686 | type Parameters = Electron.Parameters;
|
14687 | type Payment = Electron.Payment;
|
14688 | type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
|
14689 | type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
|
14690 | type PluginCrashedEvent = Electron.PluginCrashedEvent;
|
14691 | type PopupOptions = Electron.PopupOptions;
|
14692 | type PreconnectOptions = Electron.PreconnectOptions;
|
14693 | type PrintToPDFOptions = Electron.PrintToPDFOptions;
|
14694 | type Privileges = Electron.Privileges;
|
14695 | type ProgressBarOptions = Electron.ProgressBarOptions;
|
14696 | type Provider = Electron.Provider;
|
14697 | type ReadBookmark = Electron.ReadBookmark;
|
14698 | type RelaunchOptions = Electron.RelaunchOptions;
|
14699 | type Request = Electron.Request;
|
14700 | type ResizeOptions = Electron.ResizeOptions;
|
14701 | type ResourceUsage = Electron.ResourceUsage;
|
14702 | type Response = Electron.Response;
|
14703 | type Result = Electron.Result;
|
14704 | type SaveDialogOptions = Electron.SaveDialogOptions;
|
14705 | type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
|
14706 | type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
|
14707 | type Settings = Electron.Settings;
|
14708 | type SourcesOptions = Electron.SourcesOptions;
|
14709 | type StartLoggingOptions = Electron.StartLoggingOptions;
|
14710 | type SystemMemoryInfo = Electron.SystemMemoryInfo;
|
14711 | type ToBitmapOptions = Electron.ToBitmapOptions;
|
14712 | type ToDataURLOptions = Electron.ToDataURLOptions;
|
14713 | type ToPNGOptions = Electron.ToPNGOptions;
|
14714 | type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
|
14715 | type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
|
14716 | type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
|
14717 | type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
|
14718 | type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
|
14719 | type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
|
14720 | type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
|
14721 | type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
|
14722 | type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
|
14723 | type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
|
14724 | type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
|
14725 | type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
|
14726 | type UploadProgress = Electron.UploadProgress;
|
14727 | type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
|
14728 | type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
|
14729 | type WillNavigateEvent = Electron.WillNavigateEvent;
|
14730 | type EditFlags = Electron.EditFlags;
|
14731 | type FoundInPageResult = Electron.FoundInPageResult;
|
14732 | type Margins = Electron.Margins;
|
14733 | type MediaFlags = Electron.MediaFlags;
|
14734 | type WebPreferences = Electron.WebPreferences;
|
14735 | type DefaultFontFamily = Electron.DefaultFontFamily;
|
14736 | type BluetoothDevice = Electron.BluetoothDevice;
|
14737 | type Certificate = Electron.Certificate;
|
14738 | type CertificatePrincipal = Electron.CertificatePrincipal;
|
14739 | type Cookie = Electron.Cookie;
|
14740 | type CPUUsage = Electron.CPUUsage;
|
14741 | type CrashReport = Electron.CrashReport;
|
14742 | type CustomScheme = Electron.CustomScheme;
|
14743 | type DesktopCapturerSource = Electron.DesktopCapturerSource;
|
14744 | type Display = Electron.Display;
|
14745 | type Event = Electron.Event;
|
14746 | type Extension = Electron.Extension;
|
14747 | type ExtensionInfo = Electron.ExtensionInfo;
|
14748 | type FileFilter = Electron.FileFilter;
|
14749 | type FilePathWithHeaders = Electron.FilePathWithHeaders;
|
14750 | type GPUFeatureStatus = Electron.GPUFeatureStatus;
|
14751 | type InputEvent = Electron.InputEvent;
|
14752 | type IOCounters = Electron.IOCounters;
|
14753 | type IpcMainEvent = Electron.IpcMainEvent;
|
14754 | type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
|
14755 | type IpcRendererEvent = Electron.IpcRendererEvent;
|
14756 | type JumpListCategory = Electron.JumpListCategory;
|
14757 | type JumpListItem = Electron.JumpListItem;
|
14758 | type KeyboardEvent = Electron.KeyboardEvent;
|
14759 | type KeyboardInputEvent = Electron.KeyboardInputEvent;
|
14760 | type MemoryInfo = Electron.MemoryInfo;
|
14761 | type MemoryUsageDetails = Electron.MemoryUsageDetails;
|
14762 | type MimeTypedBuffer = Electron.MimeTypedBuffer;
|
14763 | type MouseInputEvent = Electron.MouseInputEvent;
|
14764 | type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
|
14765 | type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
|
14766 | type NotificationAction = Electron.NotificationAction;
|
14767 | type Point = Electron.Point;
|
14768 | type PostBody = Electron.PostBody;
|
14769 | type PostData = Electron.PostData;
|
14770 | type PrinterInfo = Electron.PrinterInfo;
|
14771 | type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
|
14772 | type ProcessMetric = Electron.ProcessMetric;
|
14773 | type Product = Electron.Product;
|
14774 | type ProtocolRequest = Electron.ProtocolRequest;
|
14775 | type ProtocolResponse = Electron.ProtocolResponse;
|
14776 | type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
|
14777 | type Rectangle = Electron.Rectangle;
|
14778 | type Referrer = Electron.Referrer;
|
14779 | type ScrubberItem = Electron.ScrubberItem;
|
14780 | type SegmentedControlSegment = Electron.SegmentedControlSegment;
|
14781 | type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
|
14782 | type SharedWorkerInfo = Electron.SharedWorkerInfo;
|
14783 | type ShortcutDetails = Electron.ShortcutDetails;
|
14784 | type Size = Electron.Size;
|
14785 | type StreamProtocolResponse = Electron.StreamProtocolResponse;
|
14786 | type StringProtocolResponse = Electron.StringProtocolResponse;
|
14787 | type Task = Electron.Task;
|
14788 | type ThumbarButton = Electron.ThumbarButton;
|
14789 | type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
|
14790 | type TraceConfig = Electron.TraceConfig;
|
14791 | type Transaction = Electron.Transaction;
|
14792 | type UploadBlob = Electron.UploadBlob;
|
14793 | type UploadData = Electron.UploadData;
|
14794 | type UploadFile = Electron.UploadFile;
|
14795 | type UploadRawData = Electron.UploadRawData;
|
14796 | type WebSource = Electron.WebSource;
|
14797 | }
|
14798 |
|
14799 | const app: App;
|
14800 | const autoUpdater: AutoUpdater;
|
14801 | const clipboard: Clipboard;
|
14802 | const contentTracing: ContentTracing;
|
14803 | const contextBridge: ContextBridge;
|
14804 | const crashReporter: CrashReporter;
|
14805 | const desktopCapturer: DesktopCapturer;
|
14806 | const dialog: Dialog;
|
14807 | const globalShortcut: GlobalShortcut;
|
14808 | const inAppPurchase: InAppPurchase;
|
14809 | const ipcMain: IpcMain;
|
14810 | const ipcRenderer: IpcRenderer;
|
14811 | type nativeImage = NativeImage;
|
14812 | const nativeImage: typeof NativeImage;
|
14813 | const nativeTheme: NativeTheme;
|
14814 | const net: Net;
|
14815 | const netLog: NetLog;
|
14816 | const powerMonitor: PowerMonitor;
|
14817 | const powerSaveBlocker: PowerSaveBlocker;
|
14818 | const protocol: Protocol;
|
14819 | const remote: Remote;
|
14820 | const screen: Screen;
|
14821 | type session = Session;
|
14822 | const session: typeof Session;
|
14823 | const shell: Shell;
|
14824 | const systemPreferences: SystemPreferences;
|
14825 | type webContents = WebContents;
|
14826 | const webContents: typeof WebContents;
|
14827 | const webFrame: WebFrame;
|
14828 | const webviewTag: WebviewTag;
|
14829 |
|
14830 | }
|
14831 |
|
14832 | declare module 'electron' {
|
14833 | export = Electron;
|
14834 | }
|
14835 |
|
14836 | declare module 'electron/main' {
|
14837 | export = Electron.Main
|
14838 | }
|
14839 |
|
14840 | declare module 'electron/common' {
|
14841 | export = Electron.Common
|
14842 | }
|
14843 |
|
14844 | declare module 'electron/renderer' {
|
14845 | export = Electron.Renderer
|
14846 | }
|
14847 |
|
14848 | interface NodeRequireFunction {
|
14849 | (moduleName: 'electron'): typeof Electron;
|
14850 | }
|
14851 |
|
14852 | interface File {
|
14853 | /**
|
14854 | * The real path to the file on the users filesystem
|
14855 | */
|
14856 | path: string;
|
14857 | }
|
14858 |
|
14859 | declare module 'original-fs' {
|
14860 | import * as fs from 'fs';
|
14861 | export = fs;
|
14862 | }
|
14863 |
|
14864 | interface Document {
|
14865 | createElement(tagName: 'webview'): Electron.WebviewTag;
|
14866 | }
|
14867 |
|
14868 | declare namespace NodeJS {
|
14869 | interface Process extends NodeJS.EventEmitter {
|
14870 |
|
14871 | // Docs: http://electronjs.org/docs/api/process
|
14872 |
|
14873 | /**
|
14874 | * Emitted when Electron has loaded its internal initialization script and is
|
14875 | * beginning to load the web page or the main script.
|
14876 | *
|
14877 | * It can be used by the preload script to add removed Node global symbols back to
|
14878 | * the global scope when node integration is turned off:
|
14879 | */
|
14880 | on(event: 'loaded', listener: Function): this;
|
14881 | once(event: 'loaded', listener: Function): this;
|
14882 | addListener(event: 'loaded', listener: Function): this;
|
14883 | removeListener(event: 'loaded', listener: Function): this;
|
14884 | /**
|
14885 | * Causes the main thread of the current process crash.
|
14886 | */
|
14887 | crash(): void;
|
14888 | /**
|
14889 | * * `allocated` Integer - Size of all allocated objects in Kilobytes.
|
14890 | * * `marked` Integer - Size of all marked objects in Kilobytes.
|
14891 | * * `total` Integer - Total allocated space in Kilobytes.
|
14892 | *
|
14893 | * Returns an object with Blink memory information. It can be useful for debugging
|
14894 | * rendering / DOM related memory issues. Note that all values are reported in
|
14895 | * Kilobytes.
|
14896 | */
|
14897 | getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
|
14898 | getCPUUsage(): Electron.CPUUsage;
|
14899 | /**
|
14900 | * The number of milliseconds since epoch, or `null` if the information is
|
14901 | * unavailable
|
14902 | *
|
14903 | * Indicates the creation time of the application. The time is represented as
|
14904 | * number of milliseconds since epoch. It returns null if it is unable to get the
|
14905 | * process creation time.
|
14906 | */
|
14907 | getCreationTime(): (number) | (null);
|
14908 | /**
|
14909 | * * `totalHeapSize` Integer
|
14910 | * * `totalHeapSizeExecutable` Integer
|
14911 | * * `totalPhysicalSize` Integer
|
14912 | * * `totalAvailableSize` Integer
|
14913 | * * `usedHeapSize` Integer
|
14914 | * * `heapSizeLimit` Integer
|
14915 | * * `mallocedMemory` Integer
|
14916 | * * `peakMallocedMemory` Integer
|
14917 | * * `doesZapGarbage` Boolean
|
14918 | *
|
14919 | * Returns an object with V8 heap statistics. Note that all statistics are reported
|
14920 | * in Kilobytes.
|
14921 | */
|
14922 | getHeapStatistics(): Electron.HeapStatistics;
|
14923 | getIOCounters(): Electron.IOCounters;
|
14924 | /**
|
14925 | * Resolves with a ProcessMemoryInfo
|
14926 | *
|
14927 | * Returns an object giving memory usage statistics about the current process. Note
|
14928 | * that all statistics are reported in Kilobytes. This api should be called after
|
14929 | * app ready.
|
14930 | *
|
14931 | * Chromium does not provide `residentSet` value for macOS. This is because macOS
|
14932 | * performs in-memory compression of pages that haven't been recently used. As a
|
14933 | * result the resident set size value is not what one would expect. `private`
|
14934 | * memory is more representative of the actual pre-compression memory usage of the
|
14935 | * process on macOS.
|
14936 | */
|
14937 | getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
|
14938 | /**
|
14939 | * * `total` Integer - The total amount of physical memory in Kilobytes available
|
14940 | * to the system.
|
14941 | * * `free` Integer - The total amount of memory not being used by applications or
|
14942 | * disk cache.
|
14943 | * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
|
14944 | * Kilobytes available to the system.
|
14945 | * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
|
14946 | * Kilobytes available to the system.
|
14947 | *
|
14948 | * Returns an object giving memory usage statistics about the entire system. Note
|
14949 | * that all statistics are reported in Kilobytes.
|
14950 | */
|
14951 | getSystemMemoryInfo(): Electron.SystemMemoryInfo;
|
14952 | /**
|
14953 | * The version of the host operating system.
|
14954 | *
|
14955 | * Example:
|
14956 | *
|
14957 | * **Note:** It returns the actual operating system version instead of kernel
|
14958 | * version on macOS unlike `os.release()`.
|
14959 | */
|
14960 | getSystemVersion(): string;
|
14961 | /**
|
14962 | * Causes the main thread of the current process hang.
|
14963 | */
|
14964 | hang(): void;
|
14965 | /**
|
14966 | * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
|
14967 | * whichever is lower for the current process.
|
14968 | *
|
14969 | * @platform darwin,linux
|
14970 | */
|
14971 | setFdLimit(maxDescriptors: number): void;
|
14972 | /**
|
14973 | * Indicates whether the snapshot has been created successfully.
|
14974 | *
|
14975 | Takes a V8 heap snapshot and saves it to `filePath`.
|
14976 | */
|
14977 | takeHeapSnapshot(filePath: string): boolean;
|
14978 | /**
|
14979 | * A `String` representing Chrome's version string.
|
14980 | *
|
14981 | */
|
14982 | readonly chrome: string;
|
14983 | /**
|
14984 | * A `Boolean`. When app is started by being passed as parameter to the default
|
14985 | * app, this property is `true` in the main process, otherwise it is `undefined`.
|
14986 | *
|
14987 | */
|
14988 | readonly defaultApp: boolean;
|
14989 | /**
|
14990 | * A `String` representing Electron's version string.
|
14991 | *
|
14992 | */
|
14993 | readonly electron: string;
|
14994 | /**
|
14995 | * A `Boolean`, `true` when the current renderer context is the "main" renderer
|
14996 | * frame. If you want the ID of the current frame you should use
|
14997 | * `webFrame.routingId`.
|
14998 | *
|
14999 | */
|
15000 | readonly isMainFrame: boolean;
|
15001 | /**
|
15002 | * A `Boolean`. For Mac App Store build, this property is `true`, for other builds
|
15003 | * it is `undefined`.
|
15004 | *
|
15005 | */
|
15006 | readonly mas: boolean;
|
15007 | /**
|
15008 | * A `Boolean` that controls ASAR support inside your application. Setting this to
|
15009 | * `true` will disable the support for `asar` archives in Node's built-in modules.
|
15010 | */
|
15011 | noAsar: boolean;
|
15012 | /**
|
15013 | * A `Boolean` that controls whether or not deprecation warnings are printed to
|
15014 | * `stderr`. Setting this to `true` will silence deprecation warnings. This
|
15015 | * property is used instead of the `--no-deprecation` command line flag.
|
15016 | */
|
15017 | noDeprecation: boolean;
|
15018 | /**
|
15019 | * A `String` representing the path to the resources directory.
|
15020 | *
|
15021 | */
|
15022 | readonly resourcesPath: string;
|
15023 | /**
|
15024 | * A `Boolean`. When the renderer process is sandboxed, this property is `true`,
|
15025 | * otherwise it is `undefined`.
|
15026 | *
|
15027 | */
|
15028 | readonly sandboxed: boolean;
|
15029 | /**
|
15030 | * A `Boolean` that controls whether or not deprecation warnings will be thrown as
|
15031 | * exceptions. Setting this to `true` will throw errors for deprecations. This
|
15032 | * property is used instead of the `--throw-deprecation` command line flag.
|
15033 | */
|
15034 | throwDeprecation: boolean;
|
15035 | /**
|
15036 | * A `Boolean` that controls whether or not deprecations printed to `stderr`
|
15037 | * include their stack trace. Setting this to `true` will print stack traces for
|
15038 | * deprecations. This property is instead of the `--trace-deprecation` command line
|
15039 | * flag.
|
15040 | */
|
15041 | traceDeprecation: boolean;
|
15042 | /**
|
15043 | * A `Boolean` that controls whether or not process warnings printed to `stderr`
|
15044 | * include their stack trace. Setting this to `true` will print stack traces for
|
15045 | * process warnings (including deprecations). This property is instead of the
|
15046 | * `--trace-warnings` command line flag.
|
15047 | */
|
15048 | traceProcessWarnings: boolean;
|
15049 | /**
|
15050 | * A `String` representing the current process's type, can be:
|
15051 | *
|
15052 | * * `browser` - The main process
|
15053 | * * `renderer` - A renderer process
|
15054 | * `worker` - In a web worker
|
15055 | *
|
15056 | */
|
15057 | readonly type: ('browser' | 'renderer' | 'worker');
|
15058 | /**
|
15059 | * A `Boolean`. If the app is running as a Windows Store app (appx), this property
|
15060 | * is `true`, for otherwise it is `undefined`.
|
15061 | *
|
15062 | */
|
15063 | readonly windowsStore: boolean;
|
15064 | }
|
15065 | interface ProcessVersions {
|
15066 | readonly electron: string;
|
15067 | readonly chrome: string;
|
15068 | }
|
15069 | } |
\ | No newline at end of file |