-
Notifications
You must be signed in to change notification settings - Fork 56
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
action.onUserSettingsChanged proposal #499
Conversation
This API permits addition of new observers, but not removal of old ones: Instead, it could match the established pattern of |
Thanks for the callout. I'll make sure @emilia-paz sees this but I suspect it is just a mistake in the proposal. We would almost certainly want to follow the normal event listener pattern here :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. Just one question, which is mainly relevant for the future implementation (and current documentation).
```javascript | ||
// Fires when user-specified settings relating to an extension's action changed. | ||
<browser>.action.onUserSettingsChanged.addListener( | ||
callback: function, // where callback looks like: (userSettings: UserSettings) => void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type of the event parameter is identical to the return value of getUserSettings
. Is that an intentional design?
With the current proposal consisting of one property only, it does not make that much of a difference. Once multiple events get added, the answer depends on the design decision:
- If we want to always include the latest value of all settings, then we can use the same type as the event parameter to
onUserSettingsChanged
listeners and as the return value ofgetUserSettings
. - If we want to only include modified values, then we need a new type that looks like
onUserSettingsChanged
, but with all fields optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! We think it's more valuable to the user to only return the modified values. Updated the proposal
SHA: 77e5045 Reason: push, by Rob--W Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
SHA: 77e5045 Reason: push, by Rob--W Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
SHA: 77e5045 Reason: push, by patrickkettner Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
SHA: 77e5045 Reason: push, by patrickkettner Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Proposal based on #346: New API: UserSettings.isOnToolbar change event