Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zh-CN: create userScripts.RegisteredUserScript #24965

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: userScripts.RegisteredUserScript
slug: Mozilla/Add-ons/WebExtensions/API/userScripts/RegisteredUserScript
l10n:
sourceCommit: 668b38a4f6cd96609b9a969fe4653b46aec4e712
---

{{AddonSidebar}}

`RegisteredUserScript` 对象是通过调用 {{WebExtAPIRef("userScripts.register","userScripts.register()")}} 返回的,表示在该调用中注册的用户脚本。

该对象定义了用于注销用户脚本的 {{WebExtAPIRef("userScripts.RegisteredUserScript.unregister","unregister()")}} 方法。

> [!NOTE]
> 如果此对象被销毁(例如因为超出作用域),则相关脚本将自动注销。因此,如果你希望你的用户脚本能够一段时间内不会被注销,则应该在这段时间内保留对此对象的引用。

## 方法

- {{WebExtAPIRef("userScripts.RegisteredUserScript.unregister","unregister()")}}
- : 注销由此对象表示的用户脚本。

## 浏览器兼容性

{{Compat}}
Loading