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 2 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]
> 如果此对象被销毁(例如因为超出作用域),则相关脚本将自动注销,因此你应该保留对此对象的引用,以便用户脚本保持注册的时间。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#24964 (comment) 的问题类似


## 方法

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

## 浏览器兼容性

{{Compat}}
Loading