跳到主要内容

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.
返回对象类型描述原文
extensionsarray[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✔️stringExtension ID.
ENID of extension.
storageArea✔️StorageArea要从中检索数据的存储区域。
ENStorageArea to retrieve data from.
keysarray[string]要检索的键。
ENKeys to retrieve.
返回对象类型描述原文
dataobject

🔨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.
enableInIncognitoboolean在隐身模式中启用扩展
ENEnable the extension in incognito
返回对象类型描述原文
idstring扩展程序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

存储区域。
允许的值:sessionlocalsyncmanaged

EN
Storage areas.
Allowed Values: session, local, sync, managed

返回类型:string