forked from electron-userland/electron-prebuilt-compile
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathelectron.d.ts
More file actions
15004 lines (14481 loc) · 598 KB
/
electron.d.ts
File metadata and controls
15004 lines (14481 loc) · 598 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for Electron 10.1.1
// Project: http://electronjs.org/
// Definitions by: The Electron Team <https://github.com/electron/electron>
// Definitions: https://github.com/electron/electron-typescript-definitions
/// <reference types="node" />
type GlobalEvent = Event;
declare namespace Electron {
const NodeEventEmitter: typeof import('events').EventEmitter;
class Accelerator extends String {
}
interface App extends NodeJS.EventEmitter {
// Docs: http://electronjs.org/docs/api/app
/**
* Emitted when Chrome's accessibility support changes. This event fires when
* assistive technologies, such as screen readers, are enabled or disabled. See
* https://www.chromium.org/developers/design-documents/accessibility for more
* details.
*
* @platform darwin,win32
*/
on(event: 'accessibility-support-changed', listener: (event: Event,
/**
* `true` when Chrome's accessibility support is enabled, `false` otherwise.
*/
accessibilitySupportEnabled: boolean) => void): this;
once(event: 'accessibility-support-changed', listener: (event: Event,
/**
* `true` when Chrome's accessibility support is enabled, `false` otherwise.
*/
accessibilitySupportEnabled: boolean) => void): this;
addListener(event: 'accessibility-support-changed', listener: (event: Event,
/**
* `true` when Chrome's accessibility support is enabled, `false` otherwise.
*/
accessibilitySupportEnabled: boolean) => void): this;
removeListener(event: 'accessibility-support-changed', listener: (event: Event,
/**
* `true` when Chrome's accessibility support is enabled, `false` otherwise.
*/
accessibilitySupportEnabled: boolean) => void): this;
/**
* Emitted when the application is activated. Various actions can trigger this
* event, such as launching the application for the first time, attempting to
* re-launch the application when it's already running, or clicking on the
* application's dock or taskbar icon.
*
* @platform darwin
*/
on(event: 'activate', listener: (event: Event,
hasVisibleWindows: boolean) => void): this;
once(event: 'activate', listener: (event: Event,
hasVisibleWindows: boolean) => void): this;
addListener(event: 'activate', listener: (event: Event,
hasVisibleWindows: boolean) => void): this;
removeListener(event: 'activate', listener: (event: Event,
hasVisibleWindows: boolean) => void): this;
/**
* Emitted during Handoff after an activity from this device was successfully
* resumed on another one.
*
* @platform darwin
*/
on(event: 'activity-was-continued', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
once(event: 'activity-was-continued', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
addListener(event: 'activity-was-continued', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
removeListener(event: 'activity-was-continued', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
/**
* Emitted before the application starts closing its windows. Calling
* `event.preventDefault()` will prevent the default behavior, which is terminating
* the application.
*
* **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
* then `before-quit` is emitted *after* emitting `close` event on all windows and
* closing them.
*
* **Note:** On Windows, this event will not be emitted if the app is closed due to
* a shutdown/restart of the system or a user logout.
*/
on(event: 'before-quit', listener: (event: Event) => void): this;
once(event: 'before-quit', listener: (event: Event) => void): this;
addListener(event: 'before-quit', listener: (event: Event) => void): this;
removeListener(event: 'before-quit', listener: (event: Event) => void): this;
/**
* Emitted when a browserWindow gets blurred.
*/
on(event: 'browser-window-blur', listener: (event: Event,
window: BrowserWindow) => void): this;
once(event: 'browser-window-blur', listener: (event: Event,
window: BrowserWindow) => void): this;
addListener(event: 'browser-window-blur', listener: (event: Event,
window: BrowserWindow) => void): this;
removeListener(event: 'browser-window-blur', listener: (event: Event,
window: BrowserWindow) => void): this;
/**
* Emitted when a new browserWindow is created.
*/
on(event: 'browser-window-created', listener: (event: Event,
window: BrowserWindow) => void): this;
once(event: 'browser-window-created', listener: (event: Event,
window: BrowserWindow) => void): this;
addListener(event: 'browser-window-created', listener: (event: Event,
window: BrowserWindow) => void): this;
removeListener(event: 'browser-window-created', listener: (event: Event,
window: BrowserWindow) => void): this;
/**
* Emitted when a browserWindow gets focused.
*/
on(event: 'browser-window-focus', listener: (event: Event,
window: BrowserWindow) => void): this;
once(event: 'browser-window-focus', listener: (event: Event,
window: BrowserWindow) => void): this;
addListener(event: 'browser-window-focus', listener: (event: Event,
window: BrowserWindow) => void): this;
removeListener(event: 'browser-window-focus', listener: (event: Event,
window: BrowserWindow) => void): this;
/**
* Emitted when failed to verify the `certificate` for `url`, to trust the
* certificate you should prevent the default behavior with
* `event.preventDefault()` and call `callback(true)`.
*/
on(event: 'certificate-error', listener: (event: Event,
webContents: WebContents,
url: string,
/**
* The error code
*/
error: string,
certificate: Certificate,
callback: (isTrusted: boolean) => void) => void): this;
once(event: 'certificate-error', listener: (event: Event,
webContents: WebContents,
url: string,
/**
* The error code
*/
error: string,
certificate: Certificate,
callback: (isTrusted: boolean) => void) => void): this;
addListener(event: 'certificate-error', listener: (event: Event,
webContents: WebContents,
url: string,
/**
* The error code
*/
error: string,
certificate: Certificate,
callback: (isTrusted: boolean) => void) => void): this;
removeListener(event: 'certificate-error', listener: (event: Event,
webContents: WebContents,
url: string,
/**
* The error code
*/
error: string,
certificate: Certificate,
callback: (isTrusted: boolean) => void) => void): this;
/**
* Emitted during Handoff when an activity from a different device wants to be
* resumed. You should call `event.preventDefault()` if you want to handle this
* event.
*
* A user activity can be continued only in an app that has the same developer Team
* ID as the activity's source app and that supports the activity's type. Supported
* activity types are specified in the app's `Info.plist` under the
* `NSUserActivityTypes` key.
*
* @platform darwin
*/
on(event: 'continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo: unknown) => void): this;
once(event: 'continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo: unknown) => void): this;
addListener(event: 'continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo: unknown) => void): this;
removeListener(event: 'continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo: unknown) => void): this;
/**
* Emitted during Handoff when an activity from a different device fails to be
* resumed.
*
* @platform darwin
*/
on(event: 'continue-activity-error', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* A string with the error's localized description.
*/
error: string) => void): this;
once(event: 'continue-activity-error', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* A string with the error's localized description.
*/
error: string) => void): this;
addListener(event: 'continue-activity-error', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* A string with the error's localized description.
*/
error: string) => void): this;
removeListener(event: 'continue-activity-error', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* A string with the error's localized description.
*/
error: string) => void): this;
/**
* Emitted when `desktopCapturer.getSources()` is called in the renderer process of
* `webContents`. Calling `event.preventDefault()` will make it return empty
* sources.
*/
on(event: 'desktop-capturer-get-sources', listener: (event: Event,
webContents: WebContents) => void): this;
once(event: 'desktop-capturer-get-sources', listener: (event: Event,
webContents: WebContents) => void): this;
addListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
webContents: WebContents) => void): this;
removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
webContents: WebContents) => void): this;
/**
* Emitted whenever there is a GPU info update.
*/
on(event: 'gpu-info-update', listener: Function): this;
once(event: 'gpu-info-update', listener: Function): this;
addListener(event: 'gpu-info-update', listener: Function): this;
removeListener(event: 'gpu-info-update', listener: Function): this;
/**
* Emitted when the GPU process crashes or is killed.
*/
on(event: 'gpu-process-crashed', listener: (event: Event,
killed: boolean) => void): this;
once(event: 'gpu-process-crashed', listener: (event: Event,
killed: boolean) => void): this;
addListener(event: 'gpu-process-crashed', listener: (event: Event,
killed: boolean) => void): this;
removeListener(event: 'gpu-process-crashed', listener: (event: Event,
killed: boolean) => void): this;
/**
* Emitted when `webContents` wants to do basic auth.
*
* The default behavior is to cancel all authentications. To override this you
* should prevent the default behavior with `event.preventDefault()` and call
* `callback(username, password)` with the credentials.
*
* If `callback` is called without a username or password, the authentication
* request will be cancelled and the authentication error will be returned to the
* page.
*/
on(event: 'login', listener: (event: Event,
webContents: WebContents,
authenticationResponseDetails: AuthenticationResponseDetails,
authInfo: AuthInfo,
callback: (username?: string, password?: string) => void) => void): this;
once(event: 'login', listener: (event: Event,
webContents: WebContents,
authenticationResponseDetails: AuthenticationResponseDetails,
authInfo: AuthInfo,
callback: (username?: string, password?: string) => void) => void): this;
addListener(event: 'login', listener: (event: Event,
webContents: WebContents,
authenticationResponseDetails: AuthenticationResponseDetails,
authInfo: AuthInfo,
callback: (username?: string, password?: string) => void) => void): this;
removeListener(event: 'login', listener: (event: Event,
webContents: WebContents,
authenticationResponseDetails: AuthenticationResponseDetails,
authInfo: AuthInfo,
callback: (username?: string, password?: string) => void) => void): this;
/**
* Emitted when the user clicks the native macOS new tab button. The new tab button
* is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
*
* @platform darwin
*/
on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
/**
* Emitted when the user wants to open a file with the application. The `open-file`
* event is usually emitted when the application is already open and the OS wants
* to reuse the application to open the file. `open-file` is also emitted when a
* file is dropped onto the dock and the application is not yet running. Make sure
* to listen for the `open-file` event very early in your application startup to
* handle this case (even before the `ready` event is emitted).
*
* You should call `event.preventDefault()` if you want to handle this event.
*
* On Windows, you have to parse `process.argv` (in the main process) to get the
* filepath.
*
* @platform darwin
*/
on(event: 'open-file', listener: (event: Event,
path: string) => void): this;
once(event: 'open-file', listener: (event: Event,
path: string) => void): this;
addListener(event: 'open-file', listener: (event: Event,
path: string) => void): this;
removeListener(event: 'open-file', listener: (event: Event,
path: string) => void): this;
/**
* Emitted when the user wants to open a URL with the application. Your
* application's `Info.plist` file must define the URL scheme within the
* `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
*
You should call `event.preventDefault()` if you want to handle this event.
*
* @platform darwin
*/
on(event: 'open-url', listener: (event: Event,
url: string) => void): this;
once(event: 'open-url', listener: (event: Event,
url: string) => void): this;
addListener(event: 'open-url', listener: (event: Event,
url: string) => void): this;
removeListener(event: 'open-url', listener: (event: Event,
url: string) => void): this;
/**
* Emitted when the application is quitting.
*
* **Note:** On Windows, this event will not be emitted if the app is closed due to
* a shutdown/restart of the system or a user logout.
*/
on(event: 'quit', listener: (event: Event,
exitCode: number) => void): this;
once(event: 'quit', listener: (event: Event,
exitCode: number) => void): this;
addListener(event: 'quit', listener: (event: Event,
exitCode: number) => void): this;
removeListener(event: 'quit', listener: (event: Event,
exitCode: number) => void): this;
/**
* Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
* holds the `userInfo` of the `NSUserNotification` that was used to open the
* application, if it was launched from Notification Center. You can also call
* `app.isReady()` to check if this event has already fired and `app.whenReady()`
* to get a Promise that is fulfilled when Electron is initialized.
*/
on(event: 'ready', listener: (launchInfo: unknown) => void): this;
once(event: 'ready', listener: (launchInfo: unknown) => void): this;
addListener(event: 'ready', listener: (launchInfo: unknown) => void): this;
removeListener(event: 'ready', listener: (launchInfo: unknown) => void): this;
/**
* Emitted when `remote.getBuiltin()` is called in the renderer process of
* `webContents`. Calling `event.preventDefault()` will prevent the module from
* being returned. Custom value can be returned by setting `event.returnValue`.
*/
on(event: 'remote-get-builtin', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
once(event: 'remote-get-builtin', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
addListener(event: 'remote-get-builtin', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
removeListener(event: 'remote-get-builtin', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
/**
* Emitted when `remote.getCurrentWebContents()` is called in the renderer process
* of `webContents`. Calling `event.preventDefault()` will prevent the object from
* being returned. Custom value can be returned by setting `event.returnValue`.
*/
on(event: 'remote-get-current-web-contents', listener: (event: Event,
webContents: WebContents) => void): this;
once(event: 'remote-get-current-web-contents', listener: (event: Event,
webContents: WebContents) => void): this;
addListener(event: 'remote-get-current-web-contents', listener: (event: Event,
webContents: WebContents) => void): this;
removeListener(event: 'remote-get-current-web-contents', listener: (event: Event,
webContents: WebContents) => void): this;
/**
* Emitted when `remote.getCurrentWindow()` is called in the renderer process of
* `webContents`. Calling `event.preventDefault()` will prevent the object from
* being returned. Custom value can be returned by setting `event.returnValue`.
*/
on(event: 'remote-get-current-window', listener: (event: Event,
webContents: WebContents) => void): this;
once(event: 'remote-get-current-window', listener: (event: Event,
webContents: WebContents) => void): this;
addListener(event: 'remote-get-current-window', listener: (event: Event,
webContents: WebContents) => void): this;
removeListener(event: 'remote-get-current-window', listener: (event: Event,
webContents: WebContents) => void): this;
/**
* Emitted when `remote.getGlobal()` is called in the renderer process of
* `webContents`. Calling `event.preventDefault()` will prevent the global from
* being returned. Custom value can be returned by setting `event.returnValue`.
*/
on(event: 'remote-get-global', listener: (event: Event,
webContents: WebContents,
globalName: string) => void): this;
once(event: 'remote-get-global', listener: (event: Event,
webContents: WebContents,
globalName: string) => void): this;
addListener(event: 'remote-get-global', listener: (event: Event,
webContents: WebContents,
globalName: string) => void): this;
removeListener(event: 'remote-get-global', listener: (event: Event,
webContents: WebContents,
globalName: string) => void): this;
/**
* Emitted when `remote.require()` is called in the renderer process of
* `webContents`. Calling `event.preventDefault()` will prevent the module from
* being returned. Custom value can be returned by setting `event.returnValue`.
*/
on(event: 'remote-require', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
once(event: 'remote-require', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
addListener(event: 'remote-require', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
removeListener(event: 'remote-require', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
/**
* Emitted when the renderer process unexpectedly dissapears. This is normally
* because it was crashed or killed.
*/
on(event: 'render-process-gone', listener: (event: Event,
webContents: WebContents,
details: Details) => void): this;
once(event: 'render-process-gone', listener: (event: Event,
webContents: WebContents,
details: Details) => void): this;
addListener(event: 'render-process-gone', listener: (event: Event,
webContents: WebContents,
details: Details) => void): this;
removeListener(event: 'render-process-gone', listener: (event: Event,
webContents: WebContents,
details: Details) => void): this;
on(event: 'renderer-process-crashed', listener: (event: Event,
webContents: WebContents,
killed: boolean) => void): this;
once(event: 'renderer-process-crashed', listener: (event: Event,
webContents: WebContents,
killed: boolean) => void): this;
addListener(event: 'renderer-process-crashed', listener: (event: Event,
webContents: WebContents,
killed: boolean) => void): this;
removeListener(event: 'renderer-process-crashed', listener: (event: Event,
webContents: WebContents,
killed: boolean) => void): this;
/**
* This event will be emitted inside the primary instance of your application when
* a second instance has been executed and calls `app.requestSingleInstanceLock()`.
*
* `argv` is an Array of the second instance's command line arguments, and
* `workingDirectory` is its current working directory. Usually applications
* respond to this by making their primary window focused and non-minimized.
*
* **Note:** If the second instance is started by a different user than the first,
* the `argv` array will not include the arguments.
*
* This event is guaranteed to be emitted after the `ready` event of `app` gets
* emitted.
*
* **Note:** Extra command line arguments might be added by Chromium, such as
* `--original-process-start-time`.
*/
on(event: 'second-instance', listener: (event: Event,
/**
* An array of the second instance's command line arguments
*/
argv: string[],
/**
* The second instance's working directory
*/
workingDirectory: string) => void): this;
once(event: 'second-instance', listener: (event: Event,
/**
* An array of the second instance's command line arguments
*/
argv: string[],
/**
* The second instance's working directory
*/
workingDirectory: string) => void): this;
addListener(event: 'second-instance', listener: (event: Event,
/**
* An array of the second instance's command line arguments
*/
argv: string[],
/**
* The second instance's working directory
*/
workingDirectory: string) => void): this;
removeListener(event: 'second-instance', listener: (event: Event,
/**
* An array of the second instance's command line arguments
*/
argv: string[],
/**
* The second instance's working directory
*/
workingDirectory: string) => void): this;
/**
* Emitted when a client certificate is requested.
*
* The `url` corresponds to the navigation entry requesting the client certificate
* and `callback` can be called with an entry filtered from the list. Using
* `event.preventDefault()` prevents the application from using the first
* certificate from the store.
*/
on(event: 'select-client-certificate', listener: (event: Event,
webContents: WebContents,
url: string,
certificateList: Certificate[],
callback: (certificate?: Certificate) => void) => void): this;
once(event: 'select-client-certificate', listener: (event: Event,
webContents: WebContents,
url: string,
certificateList: Certificate[],
callback: (certificate?: Certificate) => void) => void): this;
addListener(event: 'select-client-certificate', listener: (event: Event,
webContents: WebContents,
url: string,
certificateList: Certificate[],
callback: (certificate?: Certificate) => void) => void): this;
removeListener(event: 'select-client-certificate', listener: (event: Event,
webContents: WebContents,
url: string,
certificateList: Certificate[],
callback: (certificate?: Certificate) => void) => void): this;
/**
* Emitted when Electron has created a new `session`.
*/
on(event: 'session-created', listener: (session: Session) => void): this;
once(event: 'session-created', listener: (session: Session) => void): this;
addListener(event: 'session-created', listener: (session: Session) => void): this;
removeListener(event: 'session-created', listener: (session: Session) => void): this;
/**
* Emitted when Handoff is about to be resumed on another device. If you need to
* update the state to be transferred, you should call `event.preventDefault()`
* immediately, construct a new `userInfo` dictionary and call
* `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
* fail and `continue-activity-error` will be called.
*
* @platform darwin
*/
on(event: 'update-activity-state', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
once(event: 'update-activity-state', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
addListener(event: 'update-activity-state', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
removeListener(event: 'update-activity-state', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
/**
* Emitted when a new webContents is created.
*/
on(event: 'web-contents-created', listener: (event: Event,
webContents: WebContents) => void): this;
once(event: 'web-contents-created', listener: (event: Event,
webContents: WebContents) => void): this;
addListener(event: 'web-contents-created', listener: (event: Event,
webContents: WebContents) => void): this;
removeListener(event: 'web-contents-created', listener: (event: Event,
webContents: WebContents) => void): this;
/**
* Emitted during Handoff before an activity from a different device wants to be
* resumed. You should call `event.preventDefault()` if you want to handle this
* event.
*
* @platform darwin
*/
on(event: 'will-continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string) => void): this;
once(event: 'will-continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string) => void): this;
addListener(event: 'will-continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string) => void): this;
removeListener(event: 'will-continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string) => void): this;
/**
* Emitted when the application has finished basic startup. On Windows and Linux,
* the `will-finish-launching` event is the same as the `ready` event; on macOS,
* this event represents the `applicationWillFinishLaunching` notification of
* `NSApplication`. You would usually set up listeners for the `open-file` and
* `open-url` events here, and start the crash reporter and auto updater.
*
In most cases, you should do everything in the `ready` event handler.
*/
on(event: 'will-finish-launching', listener: Function): this;
once(event: 'will-finish-launching', listener: Function): this;
addListener(event: 'will-finish-launching', listener: Function): this;
removeListener(event: 'will-finish-launching', listener: Function): this;
/**
* Emitted when all windows have been closed and the application will quit. Calling
* `event.preventDefault()` will prevent the default behavior, which is terminating
* the application.
*
* See the description of the `window-all-closed` event for the differences between
* the `will-quit` and `window-all-closed` events.
*
* **Note:** On Windows, this event will not be emitted if the app is closed due to
* a shutdown/restart of the system or a user logout.
*/
on(event: 'will-quit', listener: (event: Event) => void): this;
once(event: 'will-quit', listener: (event: Event) => void): this;
addListener(event: 'will-quit', listener: (event: Event) => void): this;
removeListener(event: 'will-quit', listener: (event: Event) => void): this;
/**
* Emitted when all windows have been closed.
*
* If you do not subscribe to this event and all windows are closed, the default
* behavior is to quit the app; however, if you subscribe, you control whether the
* app quits or not. If the user pressed `Cmd + Q`, or the developer called
* `app.quit()`, Electron will first try to close all the windows and then emit the
* `will-quit` event, and in this case the `window-all-closed` event would not be
* emitted.
*/
on(event: 'window-all-closed', listener: Function): this;
once(event: 'window-all-closed', listener: Function): this;
addListener(event: 'window-all-closed', listener: Function): this;
removeListener(event: 'window-all-closed', listener: Function): this;
/**
* Adds `path` to the recent documents list.
*
* This list is managed by the OS. On Windows, you can visit the list from the task
* bar, and on macOS, you can visit it from dock menu.
*
* @platform darwin,win32
*/
addRecentDocument(path: string): void;
/**
* Clears the recent documents list.
*
* @platform darwin,win32
*/
clearRecentDocuments(): void;
/**
* By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
* basis if the GPU processes crashes too frequently. This function disables that
* behavior.
This method can only be called before app is ready.
*/
disableDomainBlockingFor3DAPIs(): void;
/**
* Disables hardware acceleration for current app.
*
This method can only be called before app is ready.
*/
disableHardwareAcceleration(): void;
/**
* Enables full sandbox mode on the app. This means that all renderers will be
* launched sandboxed, regardless of the value of the `sandbox` flag in
* WebPreferences.
This method can only be called before app is ready.
*/
enableSandbox(): void;
/**
* Exits immediately with `exitCode`. `exitCode` defaults to 0.
*
* All windows will be closed immediately without asking the user, and the
* `before-quit` and `will-quit` events will not be emitted.
*/
exit(exitCode?: number): void;
/**
* On Linux, focuses on the first visible window. On macOS, makes the application
* the active app. On Windows, focuses on the application's first window.
*
You should seek to use the `steal` option as sparingly as possible.
*/
focus(options?: FocusOptions): void;
/**
* Name of the application handling the protocol, or an empty string if there is no
* handler. For instance, if Electron is the default handler of the URL, this could
* be `Electron` on Windows and Mac. However, don't rely on the precise format
* which is not guaranteed to remain unchanged. Expect a different format on Linux,
* possibly with a `.desktop` suffix.
*
* This method returns the application name of the default handler for the protocol
* (aka URI scheme) of a URL.
*/
getApplicationNameForProtocol(url: string): string;
/**
* Array of `ProcessMetric` objects that correspond to memory and CPU usage
* statistics of all the processes associated with the app.
*/
getAppMetrics(): ProcessMetric[];
/**
* The current application directory.
*/
getAppPath(): string;
/**
* The current value displayed in the counter badge.
*
* @platform linux,darwin
*/
getBadgeCount(): number;
/**
* The type of the currently running activity.
*
* @platform darwin
*/
getCurrentActivityType(): string;
/**
* fulfilled with the app's icon, which is a NativeImage.
*
* Fetches a path's associated icon.
*
* On _Windows_, there a 2 kinds of icons:
*
* * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
* * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
*
* On _Linux_ and _macOS_, icons depend on the application associated with file
* mime type.
*/
getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
/**
* The Graphics Feature Status from `chrome://gpu/`.
*
* **Note:** This information is only usable after the `gpu-info-update` event is
* emitted.
*/
getGPUFeatureStatus(): GPUFeatureStatus;
/**
* For `infoType` equal to `complete`: Promise is fulfilled with `Object`
* containing all the GPU Information as in chromium's GPUInfo object. This
* includes the version and driver information that's shown on `chrome://gpu` page.
*
* For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
* fewer attributes than when requested with `complete`. Here's an example of basic
* response:
*
* Using `basic` should be preferred if only basic information like `vendorId` or
* `driverId` is needed.
*/
getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
/**
* * `minItems` Integer - The minimum number of items that will be shown in the
* Jump List (for a more detailed description of this value see the MSDN docs).
* * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
* correspond to items that the user has explicitly removed from custom categories
* in the Jump List. These items must not be re-added to the Jump List in the
* **next** call to `app.setJumpList()`, Windows will not display any custom
* category that contains any of the removed items.
*
* @platform win32
*/
getJumpListSettings(): JumpListSettings;
/**
* The current application locale. Possible return values are documented here.
*
* To set the locale, you'll want to use a command line switch at app startup,
* which may be found here.
*
* **Note:** When distributing your packaged app, you have to also ship the
* `locales` folder.
*
* **Note:** On Windows, you have to call it after the `ready` events gets emitted.
*/
getLocale(): string;
/**
* User operating system's locale two-letter ISO 3166 country code. The value is
* taken from native OS APIs.
*
**Note:** When unable to detect locale country code, it returns empty string.
*/
getLocaleCountryCode(): string;
/**
* If you provided `path` and `args` options to `app.setLoginItemSettings`, then
* you need to pass the same arguments here for `openAtLogin` to be set correctly.
*
*
* * `openAtLogin` Boolean - `true` if the app is set to open at login.
* * `openAsHidden` Boolean _macOS_ - `true` if the app is set to open as hidden at
* login. This setting is not available on MAS builds.
* * `wasOpenedAtLogin` Boolean _macOS_ - `true` if the app was opened at login
* automatically. This setting is not available on MAS builds.
* * `wasOpenedAsHidden` Boolean _macOS_ - `true` if the app was opened as a hidden
* login item. This indicates that the app should not open any windows at startup.
* This setting is not available on MAS builds.
* * `restoreState` Boolean _macOS_ - `true` if the app was opened as a login item
* that should restore the state from the previous session. This indicates that the
* app should restore the windows that were open the last time the app was closed.
* This setting is not available on MAS builds.
*
* @platform darwin,win32
*/
getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
/**
* The current application's name, which is the name in the application's
* `package.json` file.
*
* Usually the `name` field of `package.json` is a short lowercase name, according
* to the npm modules spec. You should usually also specify a `productName` field,
* which is your application's full capitalized name, and which will be preferred
* over `name` by Electron.
*/
getName(): string;
/**
* A path to a special directory or file associated with `name`. On failure, an
* `Error` is thrown.
*
* If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
* called first, a default log directory will be created equivalent to calling
* `app.setAppLogsPath()` without a `path` parameter.
*/
getPath(name: 'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'pepperFlashSystemPlugin' | 'crashDumps'): string;
/**
* The version of the loaded application. If no version is found in the
* application's `package.json` file, the version of the current bundle or
* executable is returned.
*/
getVersion(): string;
/**
* This method returns whether or not this instance of your app is currently
* holding the single instance lock. You can request the lock with
* `app.requestSingleInstanceLock()` and release with
* `app.releaseSingleInstanceLock()`
*/
hasSingleInstanceLock(): boolean;
/**
* Hides all application windows without minimizing them.
*
* @platform darwin
*/
hide(): void;
/**
* Imports the certificate in pkcs12 format into the platform certificate store.
* `callback` is called with the `result` of import operation, a value of `0`
* indicates success while any other value indicates failure according to Chromium
* net_error_list.
*
* @platform linux
*/
importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
/**
* Invalidates the current Handoff user activity.
*
* @platform darwin
*/
invalidateCurrentActivity(): void;
/**
* `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
* will return `true` if the use of assistive technologies, such as screen readers,
* has been detected. See
* https://www.chromium.org/developers/design-documents/accessibility for more
* details.
*
* @platform darwin,win32
*/
isAccessibilitySupportEnabled(): boolean;
/**
* Whether the current executable is the default handler for a protocol (aka URI
* scheme).
*
* **Note:** On macOS, you can use this method to check if the app has been
* registered as the default protocol handler for a protocol. You can also verify
* this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
* macOS machine. Please refer to Apple's documentation for details.
*
* The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
* internally.
*/
isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
/**
* whether or not the current OS version allows for native emoji pickers.
*/
isEmojiPanelSupported(): boolean;
/**
* Whether the application is currently running from the systems Application
* folder. Use in combination with `app.moveToApplicationsFolder()`
*
* @platform darwin
*/
isInApplicationsFolder(): boolean;
/**
* `true` if Electron has finished initializing, `false` otherwise. See also
* `app.whenReady()`.
*/