A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.electronjs.org/docs/latest/api/extensions-api below:

Class: Extensions | Electron

Class: Extensions Class: Extensions​

Load and interact with extensions.

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.

Instances of the Extensions class are accessed by using extensions property of a Session.

Instance Events​

The following events are available on instances of Extensions:

Event: 'extension-loaded'​

Returns:

Emitted after an extension is loaded. This occurs whenever an extension is added to the "enabled" set of extensions. This includes:

Event: 'extension-unloaded'​

Returns:

Emitted after an extension is unloaded. This occurs when Session.removeExtension is called.

Event: 'extension-ready'​

Returns:

Emitted after an extension is loaded and all necessary browser state is initialized to support the start of the extension's background page.

Instance Methods​

The following methods are available on instances of Extensions:

extensions.loadExtension(path[, options])​

Returns Promise<Extension> - resolves when the extension is loaded.

This method will raise an exception if the extension could not be loaded. If there are warnings when installing the extension (e.g. if the extension requests an API that Electron does not support) then they will be logged to the console.

Note that Electron does not support the full range of Chrome extensions APIs. See Supported Extensions APIs for more details on what is supported.

Note that in previous versions of Electron, extensions that were loaded would be remembered for future runs of the application. This is no longer the case: loadExtension must be called on every boot of your app if you want the extension to be loaded.

const { app, session } = require('electron')
const path = require('node:path')

app.whenReady().then(async () => {
await session.defaultSession.extensions.loadExtension(
path.join(__dirname, 'react-devtools'),

{ allowFileAccess: true }
)


})

This API does not support loading packed (.crx) extensions.

note

This API cannot be called before the ready event of the app module is emitted.

note

Loading extensions into in-memory (non-persistent) sessions is not supported and will throw an error.

extensions.removeExtension(extensionId)​

Unloads an extension.

note

This API cannot be called before the ready event of the app module is emitted.

extensions.getExtension(extensionId)​

Returns Extension | null - The loaded extension with the given ID.

note

This API cannot be called before the ready event of the app module is emitted.

extensions.getAllExtensions()​

Returns Extension[] - A list of all loaded extensions.

note

This API cannot be called before the ready event of the app module is emitted.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4