-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
onChanged callback object content clarification #31227
onChanged callback object content clarification #31227
Conversation
Preview URLs
External URLs (2)URL:
URL:
(comment last updated: 2024-03-04 15:46:28) |
The issue had to be updated. Sorry for the inaccurate test results. |
This reverts commit 033a77c.
@erosman updated based on your issue revisions |
Just a note which may save some developers some time. While Firefox storage // same for browser and chrome APIs
browser.storage.onChanged.addListener()
browser.storage.sync.onChanged.addListener()
// the following contains all the values passed to the storage sync, changed and unchanged
browser.storage.sync.get() |
@erosman sorry, I'm unclear what the note about |
When developing a cross-browser-compatible extension, API inconsistency is a major concern. [1] I don't know if it is something worth mentioning or not, and feel free to disregard it. Please also note |
files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md
Outdated
Show resolved
Hide resolved
files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md
Outdated
Show resolved
Hide resolved
@@ -7,7 +7,9 @@ browser-compat: webextensions.api.storage.StorageArea.onChanged | |||
|
|||
{{AddonSidebar()}} | |||
|
|||
Fires when one or more items in a storage area change. Compared to {{WebExtAPIRef("storage.onChanged")}}, this event enables you to listen for changes in one of the storage areas: `local`, `managed`, `session`, and `sync`. | |||
Fires when one or more items in a storage area change, returning details for the keys that changed. Compared to {{WebExtAPIRef("storage.onChanged")}}, this event enables you to listen for changes in one of the storage areas: `local`, `managed`, `session`, and `sync`. |
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.
So, Firefox can pass changes for multiple areas, but everyone else only does one at a time? Do I understand this correctly?
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.
@jpmedley, as I understand it, the difference is that Firefox returns all the keys from the storage area, whereas other browsers only return the changed ones only.
files/en-us/mozilla/add-ons/webextensions/api/storage/storagearea/onchanged/index.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Joe Medley <jmedley@google.com>
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.
Sorry for the delay. I had a long weekend. I don't usually request multiple passes of changes. I'm making an exception because I think we need to clarify the difference between Firefox and other browsers.
files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md
Outdated
Show resolved
Hide resolved
files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Joe Medley <jmedley@google.com>
Description
Clarifies that the
storage.onChanged
callback triggered as a result ofstorageArea.set
only returns changed details.Related issues and pull requests
Fixes #31203