Skip to content

Commit

Permalink
feat: update translation
Browse files Browse the repository at this point in the history
  • Loading branch information
PassionPenguin committed Dec 30, 2024
1 parent 69a6abf commit dfe42a4
Showing 1 changed file with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: pageAction.isShown()
slug: Mozilla/Add-ons/WebExtensions/API/pageAction/isShown
l10n:
sourceCommit: 43e3ff826b7b755b05986c99ada75635c01c187c
---

{{AddonSidebar}}

如果在指定的标签页中页面操作正在显示中,则返回 `true`

这是一个返回 [`Promise`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise) 的异步函数。

## 语法

```js-nolint
let gettingIsShown = browser.pageAction.isShown(
details // 对象
)
```

### 参数

- `details`

- : `object`。包含要检查的 `tabId` 的对象。

- `tabId`
- : `integer`。要检查的标签页的 ID。

### 返回值

[`Promise`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise),如果在指定的标签页中拓展的页面操作正在显示。则兑现为 `true`,否则兑现为 `false`

## 浏览器兼容性

{{Compat}}

## 示例

Check the state of the currently active tab:

```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);
}
```

{{WebExtExamples}}

0 comments on commit dfe42a4

Please sign in to comment.