pageAction.isShown()
如果页面操作在指定的标签页中正在显示则返回 true
。
这是一个返回 Promise
的异步函数。
语法
js
let gettingIsShown = browser.pageAction.isShown(
details // 对象
)
参数
返回值
Promise
,如果在指定的标签页中拓展的页面操作正在显示,则兑现为 true
,否则兑现为 false
。
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
isShown |
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.
示例
检查当前活动标签页的页面操作的状态。
js
async function shownInActiveTab() {
let tabs = await browser.tabs.query({
currentWindow: true,
active: true,
});
let shown = await browser.pageAction.isShown({
tabId: tabs[0].id,
});
console.log(shown);
}