puppeteer-core
Version:
A high-level API to control headless Chrome over the DevTools Protocol
68 lines • 1.52 kB
JavaScript
;
/**
* @license
* Copyright 2026 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Extension = void 0;
/**
* {@link 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.
*
* @example
* To get all extensions installed in the browser:
*
* ```ts
* const extensions = await browser.extensions();
* for (const [id, extension] of extensions) {
* console.log(extension.name, id);
* }
* ```
*
* @experimental
* @public
*/
class Extension {
#id;
#version;
#name;
/**
* @internal
*/
constructor(id, version, name) {
if (!id || !version) {
throw new Error('Extension ID and version are required');
}
this.#id = id;
this.#version = version;
this.#name = name;
}
/**
* The version of the extension as specified in its manifest.
*
* @public
*/
get version() {
return this.#version;
}
/**
* The name of the extension as specified in its manifest.
*
* @public
*/
get name() {
return this.#name;
}
/**
* The unique identifier of the extension.
*
* @public
*/
get id() {
return this.#id;
}
}
exports.Extension = Extension;
//# sourceMappingURL=Extension.js.map