Extension class
Extension represents a browser extension installed in the browser. It provides access to the extension's ID, name, and version, as well as methods for interacting with the extension's background workers and pages.
Signature
export declare abstract class Extension
Remarks
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the Extension class.
Example
To get all extensions installed in the browser:
const extensions = await browser.extensions();
for (const [id, extension] of extensions) {
console.log(extension.name, id);
}
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
| id |
| string | The unique identifier of the extension. |
| name |
| string | The name of the extension as specified in its manifest. |
| version |
| string | The version of the extension as specified in its manifest. |
Methods
Method | Modifiers | Description |
|---|---|---|
| pages() | Returns a list of the currently active and visible pages belonging to the extension. | |
| triggerAction(page) | Triggers the default action of the extension for a specified page. This typically simulates a user clicking the extension's action icon in the browser toolbar, potentially opening a popup or executing an action script. | |
| workers() | Returns a list of the currently active service workers belonging to the extension. |