Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
yin1999 authored Dec 18, 2024
1 parent 0573283 commit 68663de
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
title: management.install()
slug: Mozilla/Add-ons/WebExtensions/API/management/install
l10n:
sourceCommit: b8a0743ca8b1e1b1b1a95cc93a4413c020f11262
sourceCommit: d7143e171b5f18fb37a686a7d4947db417fd74f3
---

{{AddonSidebar}}

安装并启用给定 URL 的主题扩展。
安装并启用来自给定 URL 的主题扩展。

此 API 需要“management”[API 权限](/zh-CN/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions)并且只能用于安装已签名的主题
此 API 需要“management”[API 权限](/zh-CN/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions)并且仅适用于已签名的主题

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

## 语法

Expand All @@ -26,7 +26,7 @@ browser.management.install(options)

### 返回值

[Promise](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise)将用包含对应主题在其 manifest.json 中定义的 `ExtensionID` 的对象兑现
[Promise](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise)会兑现为包含对应主题在其 manifest.json 中定义的 `ExtensionID` 的对象

## 浏览器兼容性

Expand All @@ -52,7 +52,7 @@ async function install(url) {
try {
current = url;
const { id } = await browser.management.install({ url });
console.log(`安装了如下的主题${id}`);
console.log(`安装了主题${id}`);
} catch (e) {
console.error(`主题安装失败:${e}`);
}
Expand Down

0 comments on commit 68663de

Please sign in to comment.