electron 14.0.0 → 14.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/electron.d.ts +157 -7
  2. package/package.json +1 -1
package/electron.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for Electron 14.0.0
1
+ // Type definitions for Electron 14.1.1
2
2
  // Project: http://electronjs.org/
3
3
  // Definitions by: The Electron Team <https://github.com/electron/electron>
4
4
  // Definitions: https://github.com/electron/electron-typescript-definitions
@@ -2469,8 +2469,8 @@ declare namespace Electron {
2469
2469
  * and height are within the content view--only that they exist. Sum any extra
2470
2470
  * width and height areas you have within the overall content view.
2471
2471
  *
2472
- * The aspect ratio is not respected when window is resized programmingly with APIs
2473
- * like `win.setSize`.
2472
+ * The aspect ratio is not respected when window is resized programmatically with
2473
+ * APIs like `win.setSize`.
2474
2474
  */
2475
2475
  setAspectRatio(aspectRatio: number, extraSize?: Size): void;
2476
2476
  /**
@@ -4701,6 +4701,37 @@ declare namespace Electron {
4701
4701
  webgl2: string;
4702
4702
  }
4703
4703
 
4704
+ interface HIDDevice {
4705
+
4706
+ // Docs: https://electronjs.org/docs/api/structures/hid-device
4707
+
4708
+ /**
4709
+ * Unique identifier for the device.
4710
+ */
4711
+ deviceId: string;
4712
+ /**
4713
+ * Unique identifier for the HID interface. A device may have multiple HID
4714
+ * interfaces.
4715
+ */
4716
+ guid?: string;
4717
+ /**
4718
+ * Name of the device.
4719
+ */
4720
+ name: string;
4721
+ /**
4722
+ * The USB product ID.
4723
+ */
4724
+ productId: number;
4725
+ /**
4726
+ * The USB device serial number.
4727
+ */
4728
+ serialNumber?: string;
4729
+ /**
4730
+ * The USB vendor ID.
4731
+ */
4732
+ vendorId: number;
4733
+ }
4734
+
4704
4735
  interface InAppPurchase extends NodeJS.EventEmitter {
4705
4736
 
4706
4737
  // Docs: https://electronjs.org/docs/api/in-app-purchase
@@ -7075,6 +7106,36 @@ declare namespace Electron {
7075
7106
  extension: Extension) => void): this;
7076
7107
  removeListener(event: 'extension-unloaded', listener: (event: Event,
7077
7108
  extension: Extension) => void): this;
7109
+ /**
7110
+ * Emitted when a new HID device becomes available. For example, when a new USB
7111
+ * device is plugged in.
7112
+ *
7113
+ * This event will only be emitted after `navigator.hid.requestDevice` has been
7114
+ * called and `select-hid-device` has fired.
7115
+ */
7116
+ on(event: 'hid-device-added', listener: (event: Event,
7117
+ details: HidDeviceAddedDetails) => void): this;
7118
+ once(event: 'hid-device-added', listener: (event: Event,
7119
+ details: HidDeviceAddedDetails) => void): this;
7120
+ addListener(event: 'hid-device-added', listener: (event: Event,
7121
+ details: HidDeviceAddedDetails) => void): this;
7122
+ removeListener(event: 'hid-device-added', listener: (event: Event,
7123
+ details: HidDeviceAddedDetails) => void): this;
7124
+ /**
7125
+ * Emitted when a HID device has been removed. For example, this event will fire
7126
+ * when a USB device is unplugged.
7127
+ *
7128
+ * This event will only be emitted after `navigator.hid.requestDevice` has been
7129
+ * called and `select-hid-device` has fired.
7130
+ */
7131
+ on(event: 'hid-device-removed', listener: (event: Event,
7132
+ details: HidDeviceRemovedDetails) => void): this;
7133
+ once(event: 'hid-device-removed', listener: (event: Event,
7134
+ details: HidDeviceRemovedDetails) => void): this;
7135
+ addListener(event: 'hid-device-removed', listener: (event: Event,
7136
+ details: HidDeviceRemovedDetails) => void): this;
7137
+ removeListener(event: 'hid-device-removed', listener: (event: Event,
7138
+ details: HidDeviceRemovedDetails) => void): this;
7078
7139
  /**
7079
7140
  * Emitted when a render process requests preconnection to a URL, generally due to
7080
7141
  * a resource hint.
@@ -7119,6 +7180,26 @@ declare namespace Electron {
7119
7180
  * the spec for more details.)
7120
7181
  */
7121
7182
  allowCredentials: boolean) => void): this;
7183
+ /**
7184
+ * Emitted when a HID device needs to be selected when a call to
7185
+ * `navigator.hid.requestDevice` is made. `callback` should be called with
7186
+ * `deviceId` to be selected; passing no arguments to `callback` will cancel the
7187
+ * request. Additionally, permissioning on `navigator.hid` can be further managed
7188
+ * by using ses.setPermissionCheckHandler(handler) and
7189
+ * ses.setDevicePermissionHandler(handler)`.
7190
+ */
7191
+ on(event: 'select-hid-device', listener: (event: Event,
7192
+ details: SelectHidDeviceDetails,
7193
+ callback: (deviceId?: (string) | (null)) => void) => void): this;
7194
+ once(event: 'select-hid-device', listener: (event: Event,
7195
+ details: SelectHidDeviceDetails,
7196
+ callback: (deviceId?: (string) | (null)) => void) => void): this;
7197
+ addListener(event: 'select-hid-device', listener: (event: Event,
7198
+ details: SelectHidDeviceDetails,
7199
+ callback: (deviceId?: (string) | (null)) => void) => void): this;
7200
+ removeListener(event: 'select-hid-device', listener: (event: Event,
7201
+ details: SelectHidDeviceDetails,
7202
+ callback: (deviceId?: (string) | (null)) => void) => void): this;
7122
7203
  /**
7123
7204
  * Emitted when a serial port needs to be selected when a call to
7124
7205
  * `navigator.serial.requestPort` is made. `callback` should be called with
@@ -7482,6 +7563,21 @@ declare namespace Electron {
7482
7563
  * > **NOTE:** The result of this procedure is cached by the network service.
7483
7564
  */
7484
7565
  setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
7566
+ /**
7567
+ * Sets the handler which can be used to respond to device permission checks for
7568
+ * the `session`. Returning `true` will allow the device to be permitted and
7569
+ * `false` will reject it. To clear the handler, call
7570
+ * `setDevicePermissionHandler(null)`. This handler can be used to provide default
7571
+ * permissioning to devices without first calling for permission to devices (eg via
7572
+ * `navigator.hid.requestDevice`). If this handler is not defined, the default
7573
+ * device permissions as granted through device selection (eg via
7574
+ * `navigator.hid.requestDevice`) will be used. Additionally, the default behavior
7575
+ * of Electron is to store granted device permision through the lifetime of the
7576
+ * corresponding WebContents. If longer term storage is needed, a developer can
7577
+ * store granted device permissions (eg when handling the `select-hid-device`
7578
+ * event) and then read from that storage with `setDevicePermissionHandler`.
7579
+ */
7580
+ setDevicePermissionHandler(handler: ((details: DevicePermissionHandlerHandlerDetails) => boolean) | (null)): void;
7485
7581
  /**
7486
7582
  * Sets download saving directory. By default, the download directory will be the
7487
7583
  * `Downloads` under the respective app folder.
@@ -12125,8 +12221,9 @@ declare namespace Electron {
12125
12221
  plugins: boolean;
12126
12222
  /**
12127
12223
  * A `String` that specifies a script that will be loaded before other scripts run
12128
- * in the guest page. The protocol of script's URL must be either `file:` or
12129
- * `asar:`, because it will be loaded by `require` in guest page under the hood.
12224
+ * in the guest page. The protocol of script's URL must be `file:` (even when using
12225
+ * `asar:` archives) because it will be loaded by Node's `require` under the hood,
12226
+ * which treats `asar:` archives as virtual directories.
12130
12227
  *
12131
12228
  * When the guest page doesn't have node integration this script will still have
12132
12229
  * access to all Node APIs, but global objects injected by Node will be deleted
@@ -13092,6 +13189,25 @@ declare namespace Electron {
13092
13189
  name?: string;
13093
13190
  }
13094
13191
 
13192
+ interface DevicePermissionHandlerHandlerDetails {
13193
+ /**
13194
+ * The type of device that permission is being requested on, can be `hid`.
13195
+ */
13196
+ deviceType: ('hid');
13197
+ /**
13198
+ * The origin URL of the device permission check.
13199
+ */
13200
+ origin: string;
13201
+ /**
13202
+ * the device that permission is being requested for.
13203
+ */
13204
+ device: HIDDevice;
13205
+ /**
13206
+ * WebFrameMain checking the device permission.
13207
+ */
13208
+ frame: WebFrameMain;
13209
+ }
13210
+
13095
13211
  interface DidChangeThemeColorEvent extends Event {
13096
13212
  themeColor: string;
13097
13213
  }
@@ -13343,6 +13459,16 @@ declare namespace Electron {
13343
13459
  doesZapGarbage: boolean;
13344
13460
  }
13345
13461
 
13462
+ interface HidDeviceAddedDetails {
13463
+ device: HIDDevice[];
13464
+ frame: WebFrameMain;
13465
+ }
13466
+
13467
+ interface HidDeviceRemovedDetails {
13468
+ device: HIDDevice[];
13469
+ frame: WebFrameMain;
13470
+ }
13471
+
13346
13472
  interface IgnoreMouseEventsOptions {
13347
13473
  /**
13348
13474
  * If true, forwards mouse move messages to Chromium, enabling mouse related events
@@ -13434,9 +13560,13 @@ declare namespace Electron {
13434
13560
 
13435
13561
  interface Item {
13436
13562
  /**
13437
- * The path(s) to the file(s) being dragged.
13563
+ * The path to the file being dragged.
13564
+ */
13565
+ file: string;
13566
+ /**
13567
+ * The paths to the files being dragged. (`files` will override `file` field)
13438
13568
  */
13439
- file: (string[]) | (string);
13569
+ files?: string[];
13440
13570
  /**
13441
13571
  * The image must be non-empty on macOS.
13442
13572
  */
@@ -14636,6 +14766,11 @@ declare namespace Electron {
14636
14766
  securityScopedBookmarks?: boolean;
14637
14767
  }
14638
14768
 
14769
+ interface SelectHidDeviceDetails {
14770
+ deviceList: HIDDevice[];
14771
+ frame: WebFrameMain;
14772
+ }
14773
+
14639
14774
  interface Settings {
14640
14775
  /**
14641
14776
  * `true` to open the app at login, `false` to remove the app as a login item.
@@ -15687,6 +15822,7 @@ declare namespace Electron {
15687
15822
  type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
15688
15823
  type Data = Electron.Data;
15689
15824
  type Details = Electron.Details;
15825
+ type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
15690
15826
  type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
15691
15827
  type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
15692
15828
  type DidFailLoadEvent = Electron.DidFailLoadEvent;
@@ -15707,6 +15843,8 @@ declare namespace Electron {
15707
15843
  type HandlerDetails = Electron.HandlerDetails;
15708
15844
  type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
15709
15845
  type HeapStatistics = Electron.HeapStatistics;
15846
+ type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
15847
+ type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
15710
15848
  type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
15711
15849
  type ImportCertificateOptions = Electron.ImportCertificateOptions;
15712
15850
  type Info = Electron.Info;
@@ -15769,6 +15907,7 @@ declare namespace Electron {
15769
15907
  type SaveDialogOptions = Electron.SaveDialogOptions;
15770
15908
  type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
15771
15909
  type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
15910
+ type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
15772
15911
  type Settings = Electron.Settings;
15773
15912
  type SourcesOptions = Electron.SourcesOptions;
15774
15913
  type SSLConfigConfig = Electron.SSLConfigConfig;
@@ -15818,6 +15957,7 @@ declare namespace Electron {
15818
15957
  type FileFilter = Electron.FileFilter;
15819
15958
  type FilePathWithHeaders = Electron.FilePathWithHeaders;
15820
15959
  type GPUFeatureStatus = Electron.GPUFeatureStatus;
15960
+ type HIDDevice = Electron.HIDDevice;
15821
15961
  type InputEvent = Electron.InputEvent;
15822
15962
  type IOCounters = Electron.IOCounters;
15823
15963
  type IpcMainEvent = Electron.IpcMainEvent;
@@ -15948,6 +16088,7 @@ declare namespace Electron {
15948
16088
  type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
15949
16089
  type Data = Electron.Data;
15950
16090
  type Details = Electron.Details;
16091
+ type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
15951
16092
  type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
15952
16093
  type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
15953
16094
  type DidFailLoadEvent = Electron.DidFailLoadEvent;
@@ -15968,6 +16109,8 @@ declare namespace Electron {
15968
16109
  type HandlerDetails = Electron.HandlerDetails;
15969
16110
  type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
15970
16111
  type HeapStatistics = Electron.HeapStatistics;
16112
+ type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
16113
+ type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
15971
16114
  type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
15972
16115
  type ImportCertificateOptions = Electron.ImportCertificateOptions;
15973
16116
  type Info = Electron.Info;
@@ -16030,6 +16173,7 @@ declare namespace Electron {
16030
16173
  type SaveDialogOptions = Electron.SaveDialogOptions;
16031
16174
  type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
16032
16175
  type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
16176
+ type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
16033
16177
  type Settings = Electron.Settings;
16034
16178
  type SourcesOptions = Electron.SourcesOptions;
16035
16179
  type SSLConfigConfig = Electron.SSLConfigConfig;
@@ -16079,6 +16223,7 @@ declare namespace Electron {
16079
16223
  type FileFilter = Electron.FileFilter;
16080
16224
  type FilePathWithHeaders = Electron.FilePathWithHeaders;
16081
16225
  type GPUFeatureStatus = Electron.GPUFeatureStatus;
16226
+ type HIDDevice = Electron.HIDDevice;
16082
16227
  type InputEvent = Electron.InputEvent;
16083
16228
  type IOCounters = Electron.IOCounters;
16084
16229
  type IpcMainEvent = Electron.IpcMainEvent;
@@ -16161,6 +16306,7 @@ declare namespace Electron {
16161
16306
  type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
16162
16307
  type Data = Electron.Data;
16163
16308
  type Details = Electron.Details;
16309
+ type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
16164
16310
  type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
16165
16311
  type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
16166
16312
  type DidFailLoadEvent = Electron.DidFailLoadEvent;
@@ -16181,6 +16327,8 @@ declare namespace Electron {
16181
16327
  type HandlerDetails = Electron.HandlerDetails;
16182
16328
  type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
16183
16329
  type HeapStatistics = Electron.HeapStatistics;
16330
+ type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
16331
+ type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
16184
16332
  type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
16185
16333
  type ImportCertificateOptions = Electron.ImportCertificateOptions;
16186
16334
  type Info = Electron.Info;
@@ -16243,6 +16391,7 @@ declare namespace Electron {
16243
16391
  type SaveDialogOptions = Electron.SaveDialogOptions;
16244
16392
  type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
16245
16393
  type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
16394
+ type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
16246
16395
  type Settings = Electron.Settings;
16247
16396
  type SourcesOptions = Electron.SourcesOptions;
16248
16397
  type SSLConfigConfig = Electron.SSLConfigConfig;
@@ -16292,6 +16441,7 @@ declare namespace Electron {
16292
16441
  type FileFilter = Electron.FileFilter;
16293
16442
  type FilePathWithHeaders = Electron.FilePathWithHeaders;
16294
16443
  type GPUFeatureStatus = Electron.GPUFeatureStatus;
16444
+ type HIDDevice = Electron.HIDDevice;
16295
16445
  type InputEvent = Electron.InputEvent;
16296
16446
  type IOCounters = Electron.IOCounters;
16297
16447
  type IpcMainEvent = Electron.IpcMainEvent;
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "node": ">= 8.6"
17
17
  },
18
18
  "name": "electron",
19
- "version": "14.0.0",
19
+ "version": "14.1.1",
20
20
  "repository": "https://github.com/electron/electron",
21
21
  "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
22
22
  "license": "MIT",