Extensions🧪
定义浏览器扩展的命令和事件。
EN
Defines commands and events for browser extensions.
✅️️ Methods
🔨Extensions.clearStorageItems
清除指定 storageArea 中的扩展存储。
EN
Clears extension storage in the given
storageArea.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| id | ✔️ | string | 扩展程序的ID。 | ENID of extension. | |
| storageArea | ✔️ | StorageArea | 要从其中移除数据的存储区域。 | ENStorageArea to remove data from. |
🔨Extensions.getExtensions
获取所有未打包扩展的列表。仅在客户端通过 --remote-debugging-pipe 标志连接且设置了 --enable-unsafe-extension-debugging 标志时可用。
EN
Gets a list of all unpacked extensions. Available if the client is connected using the --remote-debugging-pipe flag and the --enable-unsafe-extension-debugging flag is set.
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| extensions | array[ExtensionInfo] |
🔨Extensions.getStorageItems
从给定的storageArea中获取扩展存储数据。若指定了keys,则用于筛选结果。
EN
Gets data from extension storage in the given
storageArea. If keys is specified, these are used to filter the result.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| id | ✔️ | string | Extension ID. | ENID of extension. | |
| storageArea | ✔️ | StorageArea | 要从中检索数据的存储区域。 | ENStorageArea to retrieve data from. | |
| keys | array[string] | 要检索的键。 | ENKeys to retrieve. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| data | object |
🔨Extensions.loadUnpacked
从文件系统安装一个未打包的扩展,类似于 --load-extension 命令行标志。扩展安装完成后返回扩展ID。此功能仅在客户端通过 --remote-debugging-pipe 标志连接且设置了 --enable-unsafe-extension-debugging 标志时可用。
EN
Installs an unpacked extension from the filesystem similar to --load-extension CLI flags. Returns extension ID once the extension has been installed. Available if the client is connected using the --remote-debugging-pipe flag and the --enable-unsafe-extension-debugging flag is set.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| path | ✔️ | string | 绝对文件路径。 | ENAbsolute file path. | |
| enableInIncognito | boolean | 在隐身模式中启用扩展 | ENEnable the extension in incognito |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| id | string | 扩展程序ID。 | ENExtension id. |
🔨Extensions.removeStorageItems
从指定的storageArea中移除扩展存储中的keys。
EN
Removes
keys from extension storage in the given storageArea.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| id | ✔️ | string | 扩展程序的ID。 | ENID of extension. | |
| storageArea | ✔️ | StorageArea | 要从其中移除数据的存储区域。 | ENStorageArea to remove data from. | |
| keys | ✔️ | array[string] | 要移除的键。 | ENKeys to remove. |
🔨Extensions.setStorageItems
在指定的 storageArea 中设置扩展存储的 values。提供的 values 将与存储区域中的现有值进行合并。
EN
Sets
values in extension storage in the given storageArea. The provided values will be merged with existing values in the storage area.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| id | ✔️ | string | 扩展程序的ID。 | ENID of extension. | |
| storageArea | ✔️ | StorageArea | 要在其中设置数据的存储区域。 | ENStorageArea to set data in. | |
| values | ✔️ | object | 要设置的值。 | ENValues to set. |
🔨Extensions.triggerAction
运行扩展的默认操作。此功能仅在客户端通过 --remote-debugging-pipe 标志连接且设置了 --enable-unsafe-extension-debugging 标志时可用。
EN
Runs an extension default action. Available if the client is connected using the --remote-debugging-pipe flag and the --enable-unsafe-extension-debugging flag is set.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| id | ✔️ | string | 扩展ID。 | ENExtension id. | |
| targetId | ✔️ | string | 一个标签页目标ID,用于触发默认扩展操作。 | ENA tab target ID to trigger the default extension action on. |
🔨Extensions.uninstall
从配置文件中卸载一个未打包的扩展程序(不支持其他类型)。当客户端使用 --remote-debugging-pipe 标志和 --enable-unsafe-extension-debugging 参数连接时可用。
EN
Uninstalls an unpacked extension (others not supported) from the profile. Available if the client is connected using the --remote-debugging-pipe flag and the --enable-unsafe-extension-debugging.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| id | ✔️ | string | 扩展ID。 | ENExtension id. |
✅️️ Types
📌Extensions.ExtensionInfo
关于扩展程序的详细信息。
EN
Detailed information about an extension.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| id | ✔️ | string | 扩展程序ID。 | ENExtension id. | |
| name | ✔️ | string | 扩展名称。 | ENExtension name. | |
| version | ✔️ | string | 扩展版本。 | ENExtension version. | |
| path | ✔️ | string | 扩展程序加载的路径。 | ENThe path from which the extension was loaded. | |
| enabled | ✔️ | boolean | 扩展启用状态。 | ENExtension enabled status. |
📌Extensions.StorageArea
存储区域。
允许的值:session、local、sync、managed
EN
Storage areas.
Allowed Values:
Allowed Values:
session, local, sync, managed返回类型:string