Skip to content

Commit

Permalink
zh-CN: create pageAction.openPopup() (#25272)
Browse files Browse the repository at this point in the history
  • Loading branch information
PassionPenguin authored Jan 6, 2025
1 parent 75282e4 commit 8a4477c
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: pageAction.openPopup()
slug: Mozilla/Add-ons/WebExtensions/API/pageAction/openPopup
l10n:
sourceCommit: 43e3ff826b7b755b05986c99ada75635c01c187c
---

{{AddonSidebar}}

打开页面操作的弹窗。

你只能在[用户操作](/zh-CN/docs/Mozilla/Add-ons/WebExtensions/User_actions)的处理器中调用此函数。

## 语法

```js-nolint
browser.pageAction.openPopup()
```

### 参数

无。

### 返回值

将不带参数地兑现的 [`Promise`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise)

## 浏览器兼容性

{{Compat}}

## 示例

打开页面操作的弹窗:

```js
browser.menus.create({
id: "open-popup",
title: "open popup",
contexts: ["all"],
});

browser.menus.onClicked.addListener(() => {
browser.pageAction.openPopup();
});
```

{{WebExtExamples}}

0 comments on commit 8a4477c

Please sign in to comment.