App
Properties
A boolean
property that's true
if Chrome's accessibility support is enabled, false
otherwise. This property will be true
if the use of assistive technologies, such as screen readers, has been detected. Setting this property to true
manually enables Chrome's accessibility support, allowing developers to expose accessibility switch to users in application settings.
A Menu | null
property that returns Menu
if one has been set and null
otherwise. Users can pass a Menu to set this property.
An Integer
property that returns the badge count for current app. Setting the count to 0
will hide the badge.
A CommandLine
object that allows you to read and manipulate the command line arguments that Chromium uses.
A boolean
property that returns true
if the app is packaged, false
otherwise. For many apps, this property can be used to distinguish development and production environments.
A boolean
which when true
indicates that the app is currently running under an ARM64 translator (like the macOS Rosetta Translator Environment or Windows WOW).
A string
which is the user agent string Electron will use as a global fallback.
Functions
Adds path
to the recent documents list.
Clears the recent documents list.
Configures host resolution (DNS and DNS-over-HTTPS). By default, the following resolvers will be used, in order:
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.
Disables hardware acceleration for current app.
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
.
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.
Resolve with an object containing the following:
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.
Array of ProcessMetric
objects that correspond to memory and CPU usage statistics of all the processes associated with the app.
The current application directory.
The current value displayed in the counter badge.
The type of the currently running activity.
fulfilled with the app's icon, which is a NativeImage.
The Graphics Feature Status from chrome://gpu/
.
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.
User operating system's locale two-letter ISO 3166 country code. The value is taken from native OS APIs.
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.
A path to a special directory or file associated with name
. On failure, an Error
is thrown.
The user's preferred system languages from most preferred to least preferred, including the country codes if applicable. A user can modify and add to this list on Windows or macOS through the Language and Region settings.
The current system locale. On Windows and Linux, it is fetched using Chromium's i18n
library. On macOS, [NSLocale currentLocale]
is used instead. To get the user's current system language, which is not always the same as the locale, it is better to use app.getPreferredSystemLanguages()
.
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.
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()
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.
Invalidates the current Handoff user activity.
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.
Whether the current executable is the default handler for a protocol (aka URI scheme).
whether or not the current OS version allows for native emoji pickers.
Whether the application is currently running from the systems Application folder. Use in combination with app.moveToApplicationsFolder()
whether Secure Keyboard Entry
is enabled.
Whether the current desktop environment is Unity launcher.
Whether the move was successful. Please note that if the move is successful, your application will quit and relaunch.
Relaunches the app when current instance exits.
Releases all locks that were created by requestSingleInstanceLock
. This will allow multiple instances of the application to once again run side by side.
Whether the call succeeded.
The return value of this method indicates whether or not this instance of your application successfully obtained the lock. If it failed to obtain the lock, you can assume that another instance of your application is already running with the lock and exit immediately.
Marks the current Handoff user activity as inactive without invalidating it.
Resolves with the proxy information for url
that will be used when attempting to make requests using Net in the utility process.
Set the about panel options. This will override the values defined in the app's .plist
file on macOS. See the Apple docs for more details. On Linux, values must be set in order to be shown; there are no defaults.
Manually enables Chrome's accessibility support, allowing to expose accessibility switch to users in application settings. See Chromium's accessibility docs for more details. Disabled by default.
Sets the activation policy for a given app.
Sets or creates a directory your app's logs which can then be manipulated with app.getPath()
or app.setPath(pathName, newPath)
.
Changes the Application User Model ID to id
.
Whether the call succeeded.
Whether the call succeeded.
Sets or removes a custom Jump List for the application, and returns one of the following strings:
Set the app's login item settings.
Set the Secure Keyboard Entry
is enabled in your application.
Creates an NSUserActivity
and sets it as the current activity. The activity is eligible for Handoff to another device afterward.
Adds tasks
to the Tasks category of the Jump List on Windows.
Show the app's about panel options. These options can be overridden with app.setAboutPanelOptions(options)
. This function runs asynchronously.
Show the platform's native emoji picker.
This function must be called once you have finished accessing the security scoped file. If you do not remember to stop accessing the bookmark, kernel resources will be leaked and your app will lose its ability to reach outside the sandbox completely, until your app is restarted.
Updates the current activity if its type matches type
, merging the entries from userInfo
into its current userInfo
dictionary.