Skip to content

Bug-1828220 add documentation and release notes for browser_action.onUserSettingsChanged event #40488

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

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Expand Up @@ -67,6 +67,9 @@ With the `browserAction` API, you can:

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


{{WebExtExamples("h2")}}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: browserAction.onUserSettingsChanged
slug: Mozilla/Add-ons/WebExtensions/API/browserAction/onUserSettingsChanged
page-type: webextension-api-event
browser-compat: webextensions.api.browserAction.onUserSettingsChanged
sidebar: addonsidebar
---

Fired when a change occurs in the user-specified settings that affect an extension's browser action.

## Syntax

```js-nolint
browser.browserAction.onUserSettingsChanged.addListener(listener)
browser.browserAction.onUserSettingsChanged.removeListener(listener)
browser.browserAction.onUserSettingsChanged.hasListener(listener)
```

Events have three functions:

- `addListener(listener)`
- : Adds a listener to this event.
- `removeListener(listener)`
- : Stop listening to this event. The `listener` argument is the listener to remove.
- `hasListener(listener)`
- : Check whether `listener` is registered for this event. Returns `true` if it is listening, `false` otherwise.

## addListener syntax

### Parameters

- `listener`
- : The function called when this event occurs. The function is passed these arguments:
- `change`
- : 'object'. Details of the changed user-specified settings.
- `isOnToolbar`
- : `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).


{{WebExtExamples}}

## Browser compatibility

{{Compat}}
1 change: 1 addition & 0 deletions files/en-us/mozilla/firefox/releases/142/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Firefox 142 is the current [Nightly version of Firefox](https://www.firefox.com/
## Changes for add-on developers

- 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))
- Adds the {{WebExtAPIRef("browserAction.onUserSettingsChanged")}} event that listens for changes in the user-specified settings that affect an extension's browser action. ([Firefox bug 1828220](https://bugzil.la/1828220))

<!-- ### Removals -->

Expand Down
Loading