Skip to content

Commit

Permalink
Upgrade to electron v32.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tong committed Aug 20, 2024
1 parent 5caed37 commit 5ffc9f4
Show file tree
Hide file tree
Showing 42 changed files with 738 additions and 449 deletions.
14 changes: 7 additions & 7 deletions demo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"start": "electron ."
},
"devDependencies": {
"electron": "v31.3.1"
"electron": "v32.0.0"
}
}
903 changes: 530 additions & 373 deletions electron-api.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"description": "Type definitions for the electron framework",
"releasenote": "See CHANGELOG",
"version": "31.3.1",
"version": "32.0.0",
"contributors": [
"tong",
"fponticelli"
Expand Down
5 changes: 5 additions & 0 deletions src/electron/CPUUsage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ typedef CPUUsage = {
Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
**/
var percentCPUUsage : Float;
/**
Total seconds of CPU time used since process startup.
**/
@:optional
var cumulativeCPUUsage : Float;
/**
The number of average idle CPU wakeups per second since the last call to getCPUUsage. First call returns 0. Will always return 0 on Windows.
**/
Expand Down
6 changes: 5 additions & 1 deletion src/electron/UtilityProcess.hx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ package electron;
With this flag, the utility process will be launched via the `Electron Helper (Plugin).app` helper executable on macOS, which can be codesigned with `com.apple.security.cs.disable-library-validation` and `com.apple.security.cs.allow-unsigned-executable-memory` entitlements. This will allow the utility process to load unsigned libraries. Unless you specifically need this capability, it is best to leave this disabled. Default is `false`.
**/
@:optional
var allowLoadingUnsignedLibraries : Bool; }):electron.UtilityProcess;
var allowLoadingUnsignedLibraries : Bool; /**
With this flag, all HTTP 401 and 407 network requests created via the net module will allow responding to them via the `app#login` event in the main process instead of the default `login` event on the `ClientRequest` object.
**/
@:optional
var respondToAuthRequestsFromMainProcess : Bool; }):electron.UtilityProcess;
/**
A `Integer | undefined` representing the process identifier (PID) of the child process. If the child process fails to spawn due to errors, then the value is `undefined`. When the child process exits, then the value is `undefined` after the `exit` event is emitted.
**/
Expand Down
2 changes: 1 addition & 1 deletion src/electron/WindowOpenHandlerResponse.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ typedef WindowOpenHandlerResponse = {
If specified, will be called instead of `new BrowserWindow` to create the new child window and event `did-create-window` will not be emitted. Constructed child window should use passed `options` object. This can be used for example to have the new window open as a BrowserView instead of in a separate window.
**/
@:optional
var createWindow : Any;
var createWindow : Dynamic;
}
4 changes: 2 additions & 2 deletions src/electron/main/App.hx
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ package electron.main;
**/
@:optional
var website : String; /**
Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio. On Windows, a 48x48 PNG will result in the best visual quality.
**/
@:optional
var iconPath : String; }):Void;
Expand Down Expand Up @@ -764,7 +764,7 @@ enum abstract AppEvent<T:(haxe.Constraints.Function)>(js.node.events.EventEmitte
**/
var select_client_certificate : electron.main.AppEvent<Void -> Void> = "select-client-certificate";
/**
Emitted when `webContents` wants to do basic auth.
Emitted when `webContents` or Utility process 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.
Expand Down
3 changes: 2 additions & 1 deletion src/electron/main/ClientRequest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package electron.main;
/**
> Make HTTP/HTTPS requests.
Process: Main, Utility<br /> _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
Process: Main, Utility
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
`ClientRequest` implements the Writable Stream interface and is therefore an EventEmitter.
@see https://electronjs.org/docs/api/client-request
Expand Down
30 changes: 15 additions & 15 deletions src/electron/main/Dialog.hx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ package electron.main;
/**
the file paths chosen by the user; if the dialog is cancelled it returns `undefined`.
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
The `window` argument allows the dialog to attach itself to a parent window, making it modal.
The `filters` specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. For example:
The `extensions` array should contain extensions without wildcards or dots (e.g. `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the `'*'` wildcard (no other wildcard is supported).
**Note:** On Windows and Linux an open dialog can not be both a file selector and a directory selector, so if you set `properties` to `['openFile', 'openDirectory']` on these platforms, a directory selector will be shown.
**/
static function showOpenDialogSync(?browserWindow:electron.main.BrowserWindow, options:{ @:optional
static function showOpenDialogSync(?window:electron.main.BaseWindow, options:{ @:optional
var title : String; @:optional
var defaultPath : String; /**
Custom label for the confirmation button, when left empty the default label will be used.
Expand All @@ -46,15 +46,15 @@ package electron.main;
* `filePaths` string[] - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.
* `bookmarks` string[] (optional) _macOS_ _mas_ - An array matching the `filePaths` array of base64 encoded strings which contains security scoped bookmark data. `securityScopedBookmarks` must be enabled for this to be populated. (For return values, see table here.)
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
The `window` argument allows the dialog to attach itself to a parent window, making it modal.
The `filters` specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. For example:
The `extensions` array should contain extensions without wildcards or dots (e.g. `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the `'*'` wildcard (no other wildcard is supported).
**Note:** On Windows and Linux an open dialog can not be both a file selector and a directory selector, so if you set `properties` to `['openFile', 'openDirectory']` on these platforms, a directory selector will be shown.
**/
static function showOpenDialog(?browserWindow:electron.main.BrowserWindow, options:{ @:optional
static function showOpenDialog(?window:electron.main.BaseWindow, options:{ @:optional
var title : String; @:optional
var defaultPath : String; /**
Custom label for the confirmation button, when left empty the default label will be used.
Expand All @@ -77,11 +77,11 @@ package electron.main;
/**
the path of the file chosen by the user; if the dialog is cancelled it returns an empty string.
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
The `window` argument allows the dialog to attach itself to a parent window, making it modal.
The `filters` specifies an array of file types that can be displayed, see `dialog.showOpenDialog` for an example.
**/
static function showSaveDialogSync(?browserWindow:electron.main.BrowserWindow, options:{ /**
static function showSaveDialogSync(?window:electron.main.BaseWindow, options:{ /**
The dialog title. Cannot be displayed on some _Linux_ desktop environments.
**/
@:optional
Expand Down Expand Up @@ -119,13 +119,13 @@ package electron.main;
* `filePath` string - If the dialog is canceled, this will be an empty string.
* `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which contains the security scoped bookmark data for the saved file. `securityScopedBookmarks` must be enabled for this to be present. (For return values, see table here.)
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
The `window` argument allows the dialog to attach itself to a parent window, making it modal.
The `filters` specifies an array of file types that can be displayed, see `dialog.showOpenDialog` for an example.
**Note:** On macOS, using the asynchronous version is recommended to avoid issues when expanding and collapsing the dialog.
**/
static function showSaveDialog(?browserWindow:electron.main.BrowserWindow, options:{ /**
static function showSaveDialog(?window:electron.main.BaseWindow, options:{ /**
The dialog title. Cannot be displayed on some _Linux_ desktop environments.
**/
@:optional
Expand Down Expand Up @@ -161,9 +161,9 @@ package electron.main;
Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button.
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal. If `browserWindow` is not shown dialog will not be attached to it. In such case it will be displayed as an independent window.
The `window` argument allows the dialog to attach itself to a parent window, making it modal. If `window` is not shown dialog will not be attached to it. In such case it will be displayed as an independent window.
**/
static function showMessageBoxSync(?browserWindow:electron.main.BrowserWindow, options:{ /**
static function showMessageBoxSync(?window:electron.main.BaseWindow, options:{ /**
Content of the message box.
**/
var message : String; /**
Expand Down Expand Up @@ -212,9 +212,9 @@ package electron.main;
Shows a message box.
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
The `window` argument allows the dialog to attach itself to a parent window, making it modal.
**/
static function showMessageBox(?browserWindow:electron.main.BrowserWindow, options:{ /**
static function showMessageBox(?window:electron.main.BaseWindow, options:{ /**
Content of the message box.
**/
var message : String; /**
Expand Down Expand Up @@ -276,14 +276,14 @@ package electron.main;
/**
resolves when the certificate trust dialog is shown.
On macOS, this displays a modal dialog that shows a message and certificate information, and gives the user the option of trusting/importing the certificate. If you provide a `browserWindow` argument the dialog will be attached to the parent window, making it modal.
On macOS, this displays a modal dialog that shows a message and certificate information, and gives the user the option of trusting/importing the certificate. If you provide a `window` argument the dialog will be attached to the parent window, making it modal.
On Windows the options are more limited, due to the Win32 APIs used:
* The `message` argument is not used, as the OS provides its own confirmation dialog.
* The `browserWindow` argument is ignored since it is not possible to make this confirmation dialog modal.
* The `window` argument is ignored since it is not possible to make this confirmation dialog modal.
**/
static function showCertificateTrustDialog(?browserWindow:electron.main.BrowserWindow, options:{ /**
static function showCertificateTrustDialog(?window:electron.main.BaseWindow, options:{ /**
The certificate to trust/import.
**/
var certificate : electron.Certificate; /**
Expand Down
4 changes: 4 additions & 0 deletions src/electron/main/NativeTheme.hx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ package electron.main;
A `boolean` indicating whether Chromium is in forced colors mode, controlled by system accessibility settings. Currently, Windows high contrast is the only system setting that triggers forced colors mode.
**/
static var inForcedColorsMode : Bool;
/**
A `boolean` that indicates the whether the user has chosen via system accessibility settings to reduce transparency at the OS level.
**/
static var prefersReducedTransparency : Bool;
}
enum abstract NativeThemeEvent<T:(haxe.Constraints.Function)>(js.node.events.EventEmitter.Event<T>) from js.node.events.EventEmitter.Event<T> {
/**
Expand Down
32 changes: 32 additions & 0 deletions src/electron/main/NavigationHistory.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ package electron.main;
@see https://electronjs.org/docs/api/navigation-history
**/
@:jsRequire("electron", "NavigationHistory") extern class NavigationHistory extends js.node.events.EventEmitter<electron.main.NavigationHistory> {
/**
Whether the browser can go back to previous web page.
**/
function canGoBack():Bool;
/**
Whether the browser can go forward to next web page.
**/
function canGoForward():Bool;
/**
Whether the web page can go to the specified `offset` from the current entry.
**/
function canGoToOffset(offset:Int):Bool;
/**
Clears the navigation history.
**/
function clear():Void;
/**
The index of the current page, from which we would go back/forward or reload.
**/
Expand All @@ -14,6 +30,22 @@ package electron.main;
If index is out of bounds (greater than history length or less than 0), null will be returned.
**/
function getEntryAtIndex(index:Int):Any;
/**
Makes the browser go back a web page.
**/
function goBack():Void;
/**
Makes the browser go forward a web page.
**/
function goForward():Void;
/**
Navigates browser to the specified absolute web page index.
**/
function goToIndex(index:Int):Void;
/**
Navigates to the specified offset from the current entry.
**/
function goToOffset(offset:Int):Void;
/**
History length.
**/
Expand Down
2 changes: 2 additions & 0 deletions src/electron/main/SystemPreferences.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ package electron.main;
@:jsRequire("electron", "systemPreferences") extern class SystemPreferences extends js.node.events.EventEmitter<electron.main.SystemPreferences> {
/**
A `boolean` property which determines whether the app avoids using semitransparent backgrounds. This maps to NSWorkspace.accessibilityDisplayShouldReduceTransparency
**Deprecated:** Use the new `nativeTheme.prefersReducedTransparency` API.
**/
static var accessibilityDisplayShouldReduceTransparency : Bool;
/**
Expand Down
3 changes: 2 additions & 1 deletion src/electron/main/TouchBarButton.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package electron.main;
/**
> Create a button in the touch bar for native macOS applications
Process: Main<br /> _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
Process: Main
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
@see https://electronjs.org/docs/api/touch-bar-button
**/
@:jsRequire("electron", "TouchBarButton") extern class TouchBarButton extends js.node.events.EventEmitter<electron.main.TouchBarButton> {
Expand Down
3 changes: 2 additions & 1 deletion src/electron/main/TouchBarColorPicker.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package electron.main;
/**
> Create a color picker in the touch bar for native macOS applications
Process: Main<br /> _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
Process: Main
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
@see https://electronjs.org/docs/api/touch-bar-color-picker
**/
@:jsRequire("electron", "TouchBarColorPicker") extern class TouchBarColorPicker extends js.node.events.EventEmitter<electron.main.TouchBarColorPicker> {
Expand Down
3 changes: 2 additions & 1 deletion src/electron/main/TouchBarGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package electron.main;
/**
> Create a group in the touch bar for native macOS applications
Process: Main<br /> _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
Process: Main
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
@see https://electronjs.org/docs/api/touch-bar-group
**/
@:jsRequire("electron", "TouchBarGroup") extern class TouchBarGroup extends js.node.events.EventEmitter<electron.main.TouchBarGroup> {
Expand Down
3 changes: 2 additions & 1 deletion src/electron/main/TouchBarLabel.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package electron.main;
/**
> Create a label in the touch bar for native macOS applications
Process: Main<br /> _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
Process: Main
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
@see https://electronjs.org/docs/api/touch-bar-label
**/
@:jsRequire("electron", "TouchBarLabel") extern class TouchBarLabel extends js.node.events.EventEmitter<electron.main.TouchBarLabel> {
Expand Down
3 changes: 2 additions & 1 deletion src/electron/main/TouchBarOtherItemsProxy.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ package electron.main;
Note: Only one instance of this class can be added per TouchBar.
Process: Main<br /> _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
Process: Main
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
@see https://electronjs.org/docs/api/touch-bar-other-items-proxy
**/
@:jsRequire("electron", "TouchBarOtherItemsProxy") extern class TouchBarOtherItemsProxy extends js.node.events.EventEmitter<electron.main.TouchBarOtherItemsProxy> {
Expand Down
3 changes: 2 additions & 1 deletion src/electron/main/TouchBarPopover.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package electron.main;
/**
> Create a popover in the touch bar for native macOS applications
Process: Main<br /> _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
Process: Main
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
@see https://electronjs.org/docs/api/touch-bar-popover
**/
@:jsRequire("electron", "TouchBarPopover") extern class TouchBarPopover extends js.node.events.EventEmitter<electron.main.TouchBarPopover> {
Expand Down
3 changes: 2 additions & 1 deletion src/electron/main/TouchBarScrubber.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package electron.main;
/**
> Create a scrubber (a scrollable selector)
Process: Main<br /> _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
Process: Main
_This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._
@see https://electronjs.org/docs/api/touch-bar-scrubber
**/
@:jsRequire("electron", "TouchBarScrubber") extern class TouchBarScrubber extends js.node.events.EventEmitter<electron.main.TouchBarScrubber> {
Expand Down
Loading

0 comments on commit 5ffc9f4

Please sign in to comment.