electron 12.0.0-beta.7 → 12.0.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 (3) hide show
  1. package/README.md +3 -6
  2. package/electron.d.ts +116 -30
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -29,15 +29,12 @@ The preferred method is to install Electron as a development dependency in your
29
29
  app:
30
30
 
31
31
  ```sh
32
- npm install electron --save-dev [--save-exact]
32
+ npm install electron --save-dev
33
33
  ```
34
34
 
35
- The `--save-exact` flag is recommended for Electron prior to version 2, as it does not follow semantic
36
- versioning. As of version 2.0.0, Electron follows semver, so you don't need `--save-exact` flag. For info on how to manage Electron versions in your apps, see
37
- [Electron versioning](docs/tutorial/electron-versioning.md).
38
-
39
35
  For more installation options and troubleshooting tips, see
40
- [installation](docs/tutorial/installation.md).
36
+ [installation](docs/tutorial/installation.md). For info on how to manage Electron versions in your apps, see
37
+ [Electron versioning](docs/tutorial/electron-versioning.md).
41
38
 
42
39
  ## Quick start & Electron Fiddle
43
40
 
package/electron.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for Electron 12.0.0-beta.7
1
+ // Type definitions for Electron 12.0.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
@@ -558,6 +558,16 @@ You should call `event.preventDefault()` if you want to handle this event.
558
558
  removeListener(event: 'render-process-gone', listener: (event: Event,
559
559
  webContents: WebContents,
560
560
  details: RenderProcessGoneDetails) => void): this;
561
+ /**
562
+ * Emitted when the renderer process of `webContents` crashes or is killed.
563
+ *
564
+ * **Deprecated:** This event is superceded by the `render-process-gone` event
565
+ * which contains more information about why the render process disappeared. It
566
+ * isn't always because it crashed. The `killed` boolean can be replaced by
567
+ * checking `reason === 'killed'` when you switch to that event.
568
+ *
569
+ * @deprecated
570
+ */
561
571
  on(event: 'renderer-process-crashed', listener: (event: Event,
562
572
  webContents: WebContents,
563
573
  killed: boolean) => void): this;
@@ -1281,7 +1291,7 @@ By default this API will return `false`.
1281
1291
  *
1282
1292
  * @platform linux,darwin
1283
1293
  */
1284
- setBadgeCount(count: number): boolean;
1294
+ setBadgeCount(count?: number): boolean;
1285
1295
  /**
1286
1296
  * Sets or removes a custom Jump List for the application, and returns one of the
1287
1297
  * following strings:
@@ -2211,7 +2221,7 @@ Calling `event.preventDefault()` will prevent the menu from being displayed.
2211
2221
  * Resolves with a NativeImage
2212
2222
  *
2213
2223
  * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
2214
- * whole visible page.
2224
+ * whole visible page. If the page is not visible, `rect` may be empty.
2215
2225
  */
2216
2226
  capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
2217
2227
  /**
@@ -2623,7 +2633,8 @@ On Linux always returns `true`.
2623
2633
  * and height are within the content view--only that they exist. Sum any extra
2624
2634
  * width and height areas you have within the overall content view.
2625
2635
  *
2626
- * @platform darwin,linux
2636
+ * The aspect ratio is not respected when window is resized programmingly with APIs
2637
+ * like `win.setSize`.
2627
2638
  */
2628
2639
  setAspectRatio(aspectRatio: number, extraSize?: Size): void;
2629
2640
  /**
@@ -2909,6 +2920,13 @@ On macOS it does not remove the focus from the window.
2909
2920
  * Changes the title of native window to `title`.
2910
2921
  */
2911
2922
  setTitle(title: string): void;
2923
+ /**
2924
+ * Raises `browserView` above other `BrowserView`s attached to `win`. Throws an
2925
+ * error if `browserView` is not attached to `win`.
2926
+ *
2927
+ * @experimental
2928
+ */
2929
+ setTopBrowserView(browserView: BrowserView): void;
2912
2930
  /**
2913
2931
  * Sets the touchBar layout for the current window. Specifying `null` or
2914
2932
  * `undefined` clears the touch bar. This method only has an effect if the machine
@@ -3527,7 +3545,7 @@ This cannot be called when `titleBarStyle` is set to `customButtonsOnHover`.
3527
3545
 
3528
3546
  // Docs: https://electronjs.org/docs/api/context-bridge
3529
3547
 
3530
- exposeInMainWorld(apiKey: string, api: Record<string, any>): void;
3548
+ exposeInMainWorld(apiKey: string, api: any): void;
3531
3549
  }
3532
3550
 
3533
3551
  interface Cookie {
@@ -4869,6 +4887,10 @@ Retrieves the product descriptions.
4869
4887
  * A list of MessagePorts that were transferred with this message
4870
4888
  */
4871
4889
  ports: MessagePortMain[];
4890
+ /**
4891
+ * The internal ID of the renderer process that sent this message
4892
+ */
4893
+ processId: number;
4872
4894
  /**
4873
4895
  * A function that will send an IPC message to the renderer frame that sent the
4874
4896
  * original message that you are currently handling. You should use this method to
@@ -4884,6 +4906,11 @@ Retrieves the product descriptions.
4884
4906
  * Returns the `webContents` that sent the message
4885
4907
  */
4886
4908
  sender: WebContents;
4909
+ /**
4910
+ * The frame that sent this message
4911
+ *
4912
+ */
4913
+ readonly senderFrame: WebFrameMain;
4887
4914
  }
4888
4915
 
4889
4916
  interface IpcMainInvokeEvent extends Event {
@@ -4894,10 +4921,19 @@ Retrieves the product descriptions.
4894
4921
  * The ID of the renderer frame that sent this message
4895
4922
  */
4896
4923
  frameId: number;
4924
+ /**
4925
+ * The internal ID of the renderer process that sent this message
4926
+ */
4927
+ processId: number;
4897
4928
  /**
4898
4929
  * Returns the `webContents` that sent the message
4899
4930
  */
4900
4931
  sender: WebContents;
4932
+ /**
4933
+ * The frame that sent this message
4934
+ *
4935
+ */
4936
+ readonly senderFrame: WebFrameMain;
4901
4937
  }
4902
4938
 
4903
4939
  interface IpcRenderer extends NodeJS.EventEmitter {
@@ -4913,11 +4949,10 @@ Retrieves the product descriptions.
4913
4949
  * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
4914
4950
  * an exception.
4915
4951
  *
4916
- * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
4917
- * Electron objects is deprecated, and will begin throwing an exception starting
4918
- * with Electron 9.
4952
+ * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
4953
+ * Electron objects will throw an exception.
4919
4954
  *
4920
- * > **NOTE:** Since the main process does not have support for DOM objects such as
4955
+ * Since the main process does not have support for DOM objects such as
4921
4956
  * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
4922
4957
  * Electron's IPC to the main process, as the main process would have no way to
4923
4958
  * decode them. Attempting to send such objects over IPC will result in an error.
@@ -4973,10 +5008,9 @@ Retrieves the product descriptions.
4973
5008
  * exception.
4974
5009
  *
4975
5010
  * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
4976
- * Electron objects is deprecated, and will begin throwing an exception starting
4977
- * with Electron 9.
5011
+ * Electron objects will throw an exception.
4978
5012
  *
4979
- * > **NOTE:** Since the main process does not have support for DOM objects such as
5013
+ * Since the main process does not have support for DOM objects such as
4980
5014
  * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
4981
5015
  * Electron's IPC to the main process, as the main process would have no way to
4982
5016
  * decode them. Attempting to send such objects over IPC will result in an error.
@@ -5000,11 +5034,10 @@ Retrieves the product descriptions.
5000
5034
  * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
5001
5035
  * exception.
5002
5036
  *
5003
- * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
5004
- * Electron objects is deprecated, and will begin throwing an exception starting
5005
- * with Electron 9.
5037
+ * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
5038
+ * Electron objects will throw an exception.
5006
5039
  *
5007
- * > **NOTE:** Since the main process does not have support for DOM objects such as
5040
+ * Since the main process does not have support for DOM objects such as
5008
5041
  * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
5009
5042
  * Electron's IPC to the main process, as the main process would have no way to
5010
5043
  * decode them. Attempting to send such objects over IPC will result in an error.
@@ -7229,7 +7262,7 @@ Clears the host resolver cache.
7229
7262
  * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
7230
7263
  * supported and will throw an error.
7231
7264
  */
7232
- loadExtension(path: string): Promise<Electron.Extension>;
7265
+ loadExtension(path: string, options?: LoadExtensionOptions): Promise<Electron.Extension>;
7233
7266
  /**
7234
7267
  * Preconnects the given number of sockets to an origin.
7235
7268
  */
@@ -7282,7 +7315,7 @@ Clears the host resolver cache.
7282
7315
  * `callback(false)` will reject it. To clear the handler, call
7283
7316
  * `setPermissionRequestHandler(null)`.
7284
7317
  */
7285
- setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'media' | 'mediaKeySystem' | 'geolocation' | 'notifications' | 'midi' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal', callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void;
7318
+ setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'media' | 'display-capture' | 'mediaKeySystem' | 'geolocation' | 'notifications' | 'midi' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal', callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void;
7286
7319
  /**
7287
7320
  * Adds scripts that will be executed on ALL web contents that are associated with
7288
7321
  * this session just before normal `preload` scripts run.
@@ -10537,8 +10570,7 @@ An example of `webContents.printToPDF`:
10537
10570
  * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
10538
10571
  *
10539
10572
  * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
10540
- * Electron objects is deprecated, and will begin throwing an exception starting
10541
- * with Electron 9.
10573
+ * Electron objects will throw an exception.
10542
10574
  *
10543
10575
  * The renderer process can handle the message by listening to `channel` with the
10544
10576
  * `ipcRenderer` module.
@@ -10558,9 +10590,8 @@ An example of sending messages from the main process to the renderer process:
10558
10590
  * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
10559
10591
  * will throw an exception.
10560
10592
  *
10561
- * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
10562
- * Electron objects is deprecated, and will begin throwing an exception starting
10563
- * with Electron 9.
10593
+ * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
10594
+ * Electron objects will throw an exception.
10564
10595
  *
10565
10596
  * The renderer process can handle the message by listening to `channel` with the
10566
10597
  * `ipcRenderer` module.
@@ -10570,7 +10601,7 @@ An example of sending messages from the main process to the renderer process:
10570
10601
  *
10571
10602
  You can also read `frameId` from all incoming IPC messages in the main process.
10572
10603
  */
10573
- sendToFrame(frameId: number, channel: string, ...args: any[]): void;
10604
+ sendToFrame(frameId: (number) | ([number, number]), channel: string, ...args: any[]): void;
10574
10605
  /**
10575
10606
  * Mute the audio on the current web page.
10576
10607
  */
@@ -10602,7 +10633,7 @@ An example of showing devtools in a `BrowserWindow`:
10602
10633
  setDevToolsWebContents(devToolsWebContents: WebContents): void;
10603
10634
  /**
10604
10635
  * If *offscreen rendering* is enabled sets the frame rate to the specified number.
10605
- * Only values between 1 and 60 are accepted.
10636
+ * Only values between 1 and 240 are accepted.
10606
10637
  */
10607
10638
  setFrameRate(fps: number): void;
10608
10639
  /**
@@ -10904,9 +10935,10 @@ The factor must be greater than 0.0.
10904
10935
  // Docs: https://electronjs.org/docs/api/web-frame-main
10905
10936
 
10906
10937
  /**
10907
- * A frame with the given process and routing IDs.
10938
+ * A frame with the given process and routing IDs, or `undefined` if there is no
10939
+ * WebFrameMain associated with the given IDs.
10908
10940
  */
10909
- static fromId(processId: number, routingId: number): WebFrameMain;
10941
+ static fromId(processId: number, routingId: number): (WebFrameMain) | (undefined);
10910
10942
  /**
10911
10943
  * A promise that resolves with the result of the executed code or is rejected if
10912
10944
  * execution throws or results in a rejected promise.
@@ -10918,11 +10950,33 @@ The factor must be greater than 0.0.
10918
10950
  * this limitation.
10919
10951
  */
10920
10952
  executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>;
10953
+ /**
10954
+ * Send a message to the renderer process, optionally transferring ownership of
10955
+ * zero or more [`MessagePortMain`][] objects.
10956
+ *
10957
+ * The transferred `MessagePortMain` objects will be available in the renderer
10958
+ * process by accessing the `ports` property of the emitted event. When they arrive
10959
+ * in the renderer, they will be native DOM `MessagePort` objects.
10960
+
10961
+ For example:
10962
+ */
10963
+ postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
10921
10964
  /**
10922
10965
  * Whether the reload was initiated successfully. Only results in `false` when the
10923
10966
  * frame has no history.
10924
10967
  */
10925
10968
  reload(): boolean;
10969
+ /**
10970
+ * Send an asynchronous message to the renderer process via `channel`, along with
10971
+ * arguments. Arguments will be serialized with the [Structured Clone
10972
+ * Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
10973
+ * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
10974
+ * an exception.
10975
+ *
10976
+ * The renderer process can handle the message by listening to `channel` with the
10977
+ * `ipcRenderer` module.
10978
+ */
10979
+ send(channel: string, ...args: any[]): void;
10926
10980
  readonly frames: WebFrameMain[];
10927
10981
  readonly framesInSubtree: WebFrameMain[];
10928
10982
  readonly frameTreeNodeId: number;
@@ -12860,6 +12914,15 @@ See webContents.sendInputEvent for detailed description of `event` object.
12860
12914
  isMainFrame: boolean;
12861
12915
  }
12862
12916
 
12917
+ interface LoadExtensionOptions {
12918
+ /**
12919
+ * Whether to allow the extension to read local files over `file://` protocol and
12920
+ * inject content scripts into `file://` pages. This is required e.g. for loading
12921
+ * devtools extensions on `file://` URLs. Defaults to false.
12922
+ */
12923
+ allowFileAccess: boolean;
12924
+ }
12925
+
12863
12926
  interface LoadFileOptions {
12864
12927
  /**
12865
12928
  * Passed to `url.format()`.
@@ -13341,6 +13404,8 @@ See webContents.sendInputEvent for detailed description of `event` object.
13341
13404
  url: string;
13342
13405
  method: string;
13343
13406
  webContentsId?: number;
13407
+ webContents?: WebContents;
13408
+ frame?: WebFrameMain;
13344
13409
  resourceType: string;
13345
13410
  referrer: string;
13346
13411
  timestamp: number;
@@ -13360,6 +13425,8 @@ See webContents.sendInputEvent for detailed description of `event` object.
13360
13425
  url: string;
13361
13426
  method: string;
13362
13427
  webContentsId?: number;
13428
+ webContents?: WebContents;
13429
+ frame?: WebFrameMain;
13363
13430
  resourceType: string;
13364
13431
  referrer: string;
13365
13432
  timestamp: number;
@@ -13371,6 +13438,8 @@ See webContents.sendInputEvent for detailed description of `event` object.
13371
13438
  url: string;
13372
13439
  method: string;
13373
13440
  webContentsId?: number;
13441
+ webContents?: WebContents;
13442
+ frame?: WebFrameMain;
13374
13443
  resourceType: string;
13375
13444
  referrer: string;
13376
13445
  timestamp: number;
@@ -13382,6 +13451,8 @@ See webContents.sendInputEvent for detailed description of `event` object.
13382
13451
  url: string;
13383
13452
  method: string;
13384
13453
  webContentsId?: number;
13454
+ webContents?: WebContents;
13455
+ frame?: WebFrameMain;
13385
13456
  resourceType: string;
13386
13457
  referrer: string;
13387
13458
  timestamp: number;
@@ -13397,6 +13468,8 @@ See webContents.sendInputEvent for detailed description of `event` object.
13397
13468
  url: string;
13398
13469
  method: string;
13399
13470
  webContentsId?: number;
13471
+ webContents?: WebContents;
13472
+ frame?: WebFrameMain;
13400
13473
  resourceType: string;
13401
13474
  referrer: string;
13402
13475
  timestamp: number;
@@ -13412,6 +13485,8 @@ See webContents.sendInputEvent for detailed description of `event` object.
13412
13485
  url: string;
13413
13486
  method: string;
13414
13487
  webContentsId?: number;
13488
+ webContents?: WebContents;
13489
+ frame?: WebFrameMain;
13415
13490
  resourceType: string;
13416
13491
  referrer: string;
13417
13492
  timestamp: number;
@@ -13426,6 +13501,8 @@ See webContents.sendInputEvent for detailed description of `event` object.
13426
13501
  url: string;
13427
13502
  method: string;
13428
13503
  webContentsId?: number;
13504
+ webContents?: WebContents;
13505
+ frame?: WebFrameMain;
13429
13506
  resourceType: string;
13430
13507
  referrer: string;
13431
13508
  timestamp: number;
@@ -13443,6 +13520,8 @@ See webContents.sendInputEvent for detailed description of `event` object.
13443
13520
  url: string;
13444
13521
  method: string;
13445
13522
  webContentsId?: number;
13523
+ webContents?: WebContents;
13524
+ frame?: WebFrameMain;
13446
13525
  resourceType: string;
13447
13526
  referrer: string;
13448
13527
  timestamp: number;
@@ -13789,6 +13868,11 @@ See webContents.sendInputEvent for detailed description of `event` object.
13789
13868
  * The reason the render process is gone. Possible values:
13790
13869
  */
13791
13870
  reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
13871
+ /**
13872
+ * The exit code of the process, unless `reason` is `launch-failed`, in which case
13873
+ * `exitCode` will be a platform-specific launch failure error code.
13874
+ */
13875
+ exitCode: number;
13792
13876
  }
13793
13877
 
13794
13878
  interface Request {
@@ -14778,7 +14862,7 @@ See webContents.sendInputEvent for detailed description of `event` object.
14778
14862
  offscreen?: boolean;
14779
14863
  /**
14780
14864
  * Whether to run Electron APIs and the specified `preload` script in a separate
14781
- * JavaScript context. Defaults to `false`. The context that the `preload` script
14865
+ * JavaScript context. Defaults to `true`. The context that the `preload` script
14782
14866
  * runs in will only have access to its own dedicated `document` and `window`
14783
14867
  * globals, as well as its own set of JavaScript builtins (`Array`, `Object`,
14784
14868
  * `JSON`, etc.), which are all invisible to the loaded content. The Electron API
@@ -14794,8 +14878,7 @@ See webContents.sendInputEvent for detailed description of `event` object.
14794
14878
  /**
14795
14879
  * If true, values returned from `webFrame.executeJavaScript` will be sanitized to
14796
14880
  * ensure JS values can't unsafely cross between worlds when using
14797
- * `contextIsolation`. The default is `false`. In Electron 12, the default will be
14798
- * changed to `true`. _Deprecated_
14881
+ * `contextIsolation`. Defaults to `true`. _Deprecated_
14799
14882
  */
14800
14883
  worldSafeExecuteJavaScript?: boolean;
14801
14884
  /**
@@ -15023,6 +15106,7 @@ See webContents.sendInputEvent for detailed description of `event` object.
15023
15106
  type Item = Electron.Item;
15024
15107
  type JumpListSettings = Electron.JumpListSettings;
15025
15108
  type LoadCommitEvent = Electron.LoadCommitEvent;
15109
+ type LoadExtensionOptions = Electron.LoadExtensionOptions;
15026
15110
  type LoadFileOptions = Electron.LoadFileOptions;
15027
15111
  type LoadURLOptions = Electron.LoadURLOptions;
15028
15112
  type LoginItemSettings = Electron.LoginItemSettings;
@@ -15279,6 +15363,7 @@ See webContents.sendInputEvent for detailed description of `event` object.
15279
15363
  type Item = Electron.Item;
15280
15364
  type JumpListSettings = Electron.JumpListSettings;
15281
15365
  type LoadCommitEvent = Electron.LoadCommitEvent;
15366
+ type LoadExtensionOptions = Electron.LoadExtensionOptions;
15282
15367
  type LoadFileOptions = Electron.LoadFileOptions;
15283
15368
  type LoadURLOptions = Electron.LoadURLOptions;
15284
15369
  type LoginItemSettings = Electron.LoginItemSettings;
@@ -15488,6 +15573,7 @@ See webContents.sendInputEvent for detailed description of `event` object.
15488
15573
  type Item = Electron.Item;
15489
15574
  type JumpListSettings = Electron.JumpListSettings;
15490
15575
  type LoadCommitEvent = Electron.LoadCommitEvent;
15576
+ type LoadExtensionOptions = Electron.LoadExtensionOptions;
15491
15577
  type LoadFileOptions = Electron.LoadFileOptions;
15492
15578
  type LoadURLOptions = Electron.LoadURLOptions;
15493
15579
  type LoginItemSettings = Electron.LoginItemSettings;
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "node": ">= 8.6"
17
17
  },
18
18
  "name": "electron",
19
- "version": "12.0.0-beta.7",
19
+ "version": "12.0.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",