Skip to content

Commit 0bbc834

Browse files
Bug-1828220 add documentation and release notes for browser_action.onUserSettingsChanged event (#40488)
* Bug-1828220 add the browser_action.onUserSettingsChanged event * Addition event to action API * Apply linter suggestions Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Release note correction --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 39a17e1 commit 0bbc834

File tree

5 files changed

+91
-0
lines changed

5 files changed

+91
-0
lines changed

files/en-us/mozilla/add-ons/webextensions/api/action/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ With the `action` API, you can:
7070

7171
- {{WebExtAPIRef("action.onClicked")}}
7272
- : Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.
73+
- {{WebExtAPIRef("action.onUserSettingsChanged")}}
74+
- : Fired when a change occurs in the user-specified settings that affect an extension's action.
7375

7476
{{WebExtExamples("h2")}}
7577

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: action.onUserSettingsChanged
3+
slug: Mozilla/Add-ons/WebExtensions/API/action/onUserSettingsChanged
4+
page-type: webextension-api-event
5+
browser-compat: webextensions.api.action.onUserSettingsChanged
6+
sidebar: addonsidebar
7+
---
8+
9+
Fired when a change occurs in the user-specified settings that affect an extension's action.
10+
11+
## Syntax
12+
13+
```js-nolint
14+
browser.action.onUserSettingsChanged.addListener(listener)
15+
browser.action.onUserSettingsChanged.removeListener(listener)
16+
browser.action.onUserSettingsChanged.hasListener(listener)
17+
```
18+
19+
Events have three functions:
20+
21+
- `addListener(listener)`
22+
- : Adds a listener to this event.
23+
- `removeListener(listener)`
24+
- : Stop listening to this event. The `listener` argument is the listener to remove.
25+
- `hasListener(listener)`
26+
- : Check whether `listener` is registered for this event. Returns `true` if it is listening, `false` otherwise.
27+
28+
## addListener syntax
29+
30+
### Parameters
31+
32+
- `listener`
33+
- : The function called when this event occurs. The function is passed these arguments:
34+
- `change`
35+
- : 'object'. Details of the changed user-specified settings.
36+
- `isOnToolbar`
37+
- : `boolean`. Whether the extension's action icon is visible on the top-level toolbar of the browser windows (i.e., whether the extension has been 'pinned' by the user).
38+
39+
{{WebExtExamples}}
40+
41+
## Browser compatibility
42+
43+
{{Compat}}

files/en-us/mozilla/add-ons/webextensions/api/browseraction/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ With the `browserAction` API, you can:
6767

6868
- {{WebExtAPIRef("browserAction.onClicked")}}
6969
- : Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.
70+
- {{WebExtAPIRef("browserAction.onUserSettingsChanged")}}
71+
- : Fired when a change occurs in the user-specified settings that affect an extension's browser action.
7072

7173
{{WebExtExamples("h2")}}
7274

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: browserAction.onUserSettingsChanged
3+
slug: Mozilla/Add-ons/WebExtensions/API/browserAction/onUserSettingsChanged
4+
page-type: webextension-api-event
5+
browser-compat: webextensions.api.browserAction.onUserSettingsChanged
6+
sidebar: addonsidebar
7+
---
8+
9+
Fired when a change occurs in the user-specified settings that affect an extension's browser action.
10+
11+
## Syntax
12+
13+
```js-nolint
14+
browser.browserAction.onUserSettingsChanged.addListener(listener)
15+
browser.browserAction.onUserSettingsChanged.removeListener(listener)
16+
browser.browserAction.onUserSettingsChanged.hasListener(listener)
17+
```
18+
19+
Events have three functions:
20+
21+
- `addListener(listener)`
22+
- : Adds a listener to this event.
23+
- `removeListener(listener)`
24+
- : Stop listening to this event. The `listener` argument is the listener to remove.
25+
- `hasListener(listener)`
26+
- : Check whether `listener` is registered for this event. Returns `true` if it is listening, `false` otherwise.
27+
28+
## addListener syntax
29+
30+
### Parameters
31+
32+
- `listener`
33+
- : The function called when this event occurs. The function is passed these arguments:
34+
- `change`
35+
- : 'object'. Details of the changed user-specified settings.
36+
- `isOnToolbar`
37+
- : `boolean`. Whether the extension's browser action icon is visible on the top-level toolbar of the browser windows (i.e., whether the extension has been 'pinned' by the user).
38+
39+
{{WebExtExamples}}
40+
41+
## Browser compatibility
42+
43+
{{Compat}}

files/en-us/mozilla/firefox/releases/142/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Firefox 142 is the current [Beta version of Firefox](https://www.firefox.com/en-
7777
## Changes for add-on developers
7878

7979
- Cookies created with {{WebExtAPIRef("cookies.set()")}} in Nightly are now validated, and invalid cookies are rejected. The implementation in Nightly is to enable monitoring for any issues. The intention is to enforce validation in all channels in a future release. ([Firefox bug 1976197](https://bugzil.la/1976197))
80+
- Adds the {{WebExtAPIRef("browserAction.onUserSettingsChanged")}} and {{WebExtAPIRef("action.onUserSettingsChanged")}} events that listen for changes in the user-specified settings that affect an extension's action. ([Firefox bug 1828220](https://bugzil.la/1828220))
8081

8182
<!-- ### Removals -->
8283

0 commit comments

Comments
 (0)