electron-types 42.6.2 → 42.7.0

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.
package/README.md CHANGED
@@ -14,11 +14,11 @@ The official `electron` package is ~200MB because it includes the Electron binar
14
14
  Since this package only provides TypeScript types, install it as a dev dependency. **Install the version that matches your Electron version** (see [Version Matching](#version-matching)):
15
15
 
16
16
  ```bash
17
- npm install -D electron-types@42.6.2
17
+ npm install -D electron-types@42.7.0
18
18
  # or
19
- yarn add -D electron-types@42.6.2
19
+ yarn add -D electron-types@42.7.0
20
20
  # or
21
- pnpm add -D electron-types@42.6.2
21
+ pnpm add -D electron-types@42.7.0
22
22
  ```
23
23
 
24
24
  ## Usage
@@ -1,4 +1,4 @@
1
- // Type definitions for Electron 42.6.2
1
+ // Type definitions for Electron 42.7.0
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/typescript-definitions
@@ -10221,6 +10221,14 @@ declare namespace Electron {
10221
10221
  *
10222
10222
  */
10223
10223
  readonly online: boolean;
10224
+ /**
10225
+ * > [!NOTE] This property is only available in the main process.
10226
+ *
10227
+ * A `typeof WebSocket` reference to the `WebSocket` class, which can be used to
10228
+ * create WHATWG-compatible WebSocket connections through Chromium's network stack
10229
+ * from the main process.
10230
+ */
10231
+ WebSocket: typeof WebSocket;
10224
10232
  }
10225
10233
 
10226
10234
  interface NetLog {
@@ -19385,6 +19393,147 @@ declare namespace Electron {
19385
19393
  urls: string[];
19386
19394
  }
19387
19395
 
19396
+ class WebSocket extends EventTarget {
19397
+
19398
+ // Docs: https://electronjs.org/docs/api/web-socket
19399
+
19400
+ /**
19401
+ * WebSocket
19402
+ */
19403
+ constructor(url: string, protocols?: (string) | (string[]) | (WebSocketOptions));
19404
+ /**
19405
+ * Closes the connection. Calling `close()` while still `CONNECTING` aborts the
19406
+ * handshake.
19407
+ */
19408
+ close(code?: number, reason?: string): void;
19409
+ /**
19410
+ * Enqueues `data` to be transmitted to the server. Throws an `InvalidStateError`
19411
+ * `DOMException` if `readyState` is `CONNECTING`.
19412
+ */
19413
+ send(data: (string) | (ArrayBufferLike) | (ArrayBufferView) | (Blob)): void;
19414
+ /**
19415
+ * A `string` controlling how incoming binary messages are exposed on the `message`
19416
+ * event. Can be `nodebuffer`, `arraybuffer`, or `blob`. The default is
19417
+ * `nodebuffer`.
19418
+ *
19419
+ * `'nodebuffer'` is an Electron extension that delivers binary messages as
19420
+ * `Buffer` objects, which is generally the most convenient representation in the
19421
+ * main process. Set `binaryType` to `'arraybuffer'` or `'blob'` for behavior
19422
+ * identical to the renderer `WebSocket`.
19423
+ */
19424
+ binaryType: ('nodebuffer' | 'arraybuffer' | 'blob');
19425
+ /**
19426
+ * An `Integer` representing the number of bytes of application data that have been
19427
+ * queued via `send()` but not yet handed off to the network.
19428
+ *
19429
+ */
19430
+ readonly bufferedAmount: number;
19431
+ /**
19432
+ * A `string` containing the extensions negotiated by the server (for example
19433
+ * `permessage-deflate`).
19434
+ *
19435
+ */
19436
+ readonly extensions: string;
19437
+ /**
19438
+ * A `Function | null` event handler for the `close` event. Equivalent to calling
19439
+ * `addEventListener('close', ...)`.
19440
+ */
19441
+ onclose: (Function) | (null);
19442
+ /**
19443
+ * A `Function | null` event handler for the `error` event. Equivalent to calling
19444
+ * `addEventListener('error', ...)`.
19445
+ */
19446
+ onerror: (Function) | (null);
19447
+ /**
19448
+ * A `Function | null` event handler for the `message` event. Equivalent to calling
19449
+ * `addEventListener('message', ...)`.
19450
+ */
19451
+ onmessage: (Function) | (null);
19452
+ /**
19453
+ * A `Function | null` event handler for the `open` event. Equivalent to calling
19454
+ * `addEventListener('open', ...)`.
19455
+ */
19456
+ onopen: (Function) | (null);
19457
+ /**
19458
+ * A `string` containing the subprotocol selected by the server. The empty string
19459
+ * until the connection is open or if the server did not select a subprotocol.
19460
+ *
19461
+ */
19462
+ readonly protocol: string;
19463
+ /**
19464
+ * An `Integer` representing the current state of the connection: one of
19465
+ * `WebSocket.CONNECTING` (`0`), `WebSocket.OPEN` (`1`), `WebSocket.CLOSING` (`2`),
19466
+ * or `WebSocket.CLOSED` (`3`).
19467
+ *
19468
+ */
19469
+ readonly readyState: number;
19470
+ /**
19471
+ * A `string` representing the resolved URL of the connection.
19472
+ *
19473
+ */
19474
+ readonly url: string;
19475
+ /**
19476
+ * An `Integer` constant equal to `3`, the `readyState` value once the connection
19477
+ * is closed.
19478
+ *
19479
+ */
19480
+ static readonly CLOSED: number;
19481
+ /**
19482
+ * An `Integer` constant equal to `2`, the `readyState` value while the closing
19483
+ * handshake is in progress.
19484
+ *
19485
+ */
19486
+ static readonly CLOSING: number;
19487
+ /**
19488
+ * An `Integer` constant equal to `0`, the `readyState` value while the opening
19489
+ * handshake is in progress.
19490
+ *
19491
+ */
19492
+ static readonly CONNECTING: number;
19493
+ /**
19494
+ * An `Integer` constant equal to `1`, the `readyState` value once the connection
19495
+ * is established.
19496
+ *
19497
+ */
19498
+ static readonly OPEN: number;
19499
+ }
19500
+
19501
+ interface WebSocketOptions {
19502
+
19503
+ // Docs: https://electronjs.org/docs/api/structures/web-socket-options
19504
+
19505
+ /**
19506
+ * Extra HTTP headers to send with the opening handshake.
19507
+ */
19508
+ headers?: Record<string, string>;
19509
+ /**
19510
+ * Value of the `Origin` header to send with the opening handshake. Defaults to the
19511
+ * `http(s)` equivalent of the WebSocket URL's origin (e.g. connecting to
19512
+ * `wss://api.example.com` sends `Origin: https://api.example.com`), so that the
19513
+ * connection is treated as same-origin by the server and by SameSite cookie rules.
19514
+ */
19515
+ origin?: string;
19516
+ /**
19517
+ * The name of the `partition` the connection is associated with. Defaults to the
19518
+ * empty string, which corresponds to the default session. If `session` is
19519
+ * provided, `partition` is ignored.
19520
+ */
19521
+ partition?: string;
19522
+ /**
19523
+ * Requested WebSocket subprotocols.
19524
+ */
19525
+ protocols?: (string) | (string[]);
19526
+ /**
19527
+ * The `Session` the connection is associated with.
19528
+ */
19529
+ session?: Session;
19530
+ /**
19531
+ * Whether to send cookies from the session with the opening handshake and store
19532
+ * cookies received in the handshake response. Default is `false`.
19533
+ */
19534
+ useSessionCookies?: boolean;
19535
+ }
19536
+
19388
19537
  interface WebSource {
19389
19538
 
19390
19539
  // Docs: https://electronjs.org/docs/api/structures/web-source
@@ -25007,6 +25156,7 @@ declare namespace Electron {
25007
25156
  type WebAuthnAccount = Electron.WebAuthnAccount;
25008
25157
  type WebPreferences = Electron.WebPreferences;
25009
25158
  type WebRequestFilter = Electron.WebRequestFilter;
25159
+ type WebSocketOptions = Electron.WebSocketOptions;
25010
25160
  type WebSource = Electron.WebSource;
25011
25161
  type WindowOpenHandlerResponse = Electron.WindowOpenHandlerResponse;
25012
25162
  type WindowSessionEndEvent = Electron.WindowSessionEndEvent;
@@ -25095,6 +25245,7 @@ declare namespace Electron {
25095
25245
  const webFrameMain: typeof WebFrameMain;
25096
25246
  type WebFrameMain = Electron.WebFrameMain;
25097
25247
  type WebRequest = Electron.WebRequest;
25248
+ class WebSocket extends Electron.WebSocket {}
25098
25249
  type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
25099
25250
  type AddRepresentationOptions = Electron.AddRepresentationOptions;
25100
25251
  type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
@@ -25413,6 +25564,7 @@ declare namespace Electron {
25413
25564
  type WebAuthnAccount = Electron.WebAuthnAccount;
25414
25565
  type WebPreferences = Electron.WebPreferences;
25415
25566
  type WebRequestFilter = Electron.WebRequestFilter;
25567
+ type WebSocketOptions = Electron.WebSocketOptions;
25416
25568
  type WebSource = Electron.WebSource;
25417
25569
  type WindowOpenHandlerResponse = Electron.WindowOpenHandlerResponse;
25418
25570
  type WindowSessionEndEvent = Electron.WindowSessionEndEvent;
@@ -25747,6 +25899,7 @@ declare namespace Electron {
25747
25899
  type WebAuthnAccount = Electron.WebAuthnAccount;
25748
25900
  type WebPreferences = Electron.WebPreferences;
25749
25901
  type WebRequestFilter = Electron.WebRequestFilter;
25902
+ type WebSocketOptions = Electron.WebSocketOptions;
25750
25903
  type WebSource = Electron.WebSource;
25751
25904
  type WindowOpenHandlerResponse = Electron.WindowOpenHandlerResponse;
25752
25905
  type WindowSessionEndEvent = Electron.WindowSessionEndEvent;
@@ -26080,6 +26233,7 @@ declare namespace Electron {
26080
26233
  type WebAuthnAccount = Electron.WebAuthnAccount;
26081
26234
  type WebPreferences = Electron.WebPreferences;
26082
26235
  type WebRequestFilter = Electron.WebRequestFilter;
26236
+ type WebSocketOptions = Electron.WebSocketOptions;
26083
26237
  type WebSource = Electron.WebSource;
26084
26238
  type WindowOpenHandlerResponse = Electron.WindowOpenHandlerResponse;
26085
26239
  type WindowSessionEndEvent = Electron.WindowSessionEndEvent;
@@ -26186,6 +26340,7 @@ declare namespace Electron {
26186
26340
  const webFrameMain: typeof WebFrameMain;
26187
26341
  type WebFrameMain = Electron.WebFrameMain;
26188
26342
  type WebRequest = Electron.WebRequest;
26343
+ class WebSocket extends Electron.WebSocket {}
26189
26344
  const webUtils: WebUtils;
26190
26345
  type WebUtils = Electron.WebUtils;
26191
26346
  type WebviewTag = Electron.WebviewTag;
@@ -26507,6 +26662,7 @@ declare namespace Electron {
26507
26662
  type WebAuthnAccount = Electron.WebAuthnAccount;
26508
26663
  type WebPreferences = Electron.WebPreferences;
26509
26664
  type WebRequestFilter = Electron.WebRequestFilter;
26665
+ type WebSocketOptions = Electron.WebSocketOptions;
26510
26666
  type WebSource = Electron.WebSource;
26511
26667
  type WindowOpenHandlerResponse = Electron.WindowOpenHandlerResponse;
26512
26668
  type WindowSessionEndEvent = Electron.WindowSessionEndEvent;
package/dist/version.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "electronVersion": "42.6.2",
3
- "extractedAt": "2026-07-14T19:37:42.329Z"
2
+ "electronVersion": "42.7.0",
3
+ "extractedAt": "2026-07-15T03:18:05.458Z"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electron-types",
3
- "version": "42.6.2",
3
+ "version": "42.7.0",
4
4
  "type": "module",
5
5
  "description": "TypeScript type definitions extracted from the electron package",
6
6
  "types": "./dist/electron.d.ts",