management.get()
语法
js
let gettingInfo = browser.management.get(
id // 字符串
)
参数
id
-
string
,要获取其信息的附加组件的 ID。
返回值
Promise
,将用一个 ExtensionInfo
对象兑现,其中包含有关附加组件的信息。如果没有安装具有给定 ID 的附加组件,或者附加组件不允许调用者访问,则该 Promise 将被拒绝。
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
get |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
示例
记录名为“my-add-on”的附加组件的名称:
js
let id = "my-add-on";
function got(info) {
console.log(info.name);
}
let getting = browser.management.get(id);
getting.then(got);
备注:
该 API 基于 Chromium 的 chrome.management
API。本文衍生自 Chromium 代码中的 management.json
。