diff --git a/files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md b/files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md index 9d12c6ed6c4f1ce..f20e344a10be860 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/storage/onchanged/index.md @@ -15,7 +15,9 @@ browser-compat: webextensions.api.storage.onChanged --- {{AddonSidebar()}} -Fired when one or more items change. +Fired when {{WebExtAPIRef('storage.StorageArea.set','storageArea.set')}}, {{WebExtAPIRef('storage.StorageArea.remove','storageArea.remove')}}, or {{WebExtAPIRef('storage.StorageArea.clear','storageArea.clear')}} executes against a storage area. + +When this event is triggered by {{WebExtAPIRef('storage.StorageArea.set','storageArea.set')}}, it's possible to receive a callback when there is no change to the underlying data. Also, the information returned includes all keys within the storage area {{WebExtAPIRef('storage.StorageArea.set','storageArea.set')}} ran against. The extension can determine the changes that occurred by examining the content of the `changes` argument received by the `onChanged` listeners. ## Syntax @@ -40,10 +42,10 @@ Events have three functions: - `callback` - - : Function that will be called when this event occurs. The function will be passed the following arguments: + - : The function called when this event occurs. The function is passed these arguments: - `changes` - - : `object`. Object describing the change. This contains one property for each key that changed. The name of the property is the name of the key that changed, and its value is a {{WebExtAPIRef('storage.StorageChange')}} object describing the change to that item. + - : `object`. Object describing the change. This object contains properties for all the keys in the storage area included in the {{WebExtAPIRef('storage.StorageArea.set','storageAred.set')}} call, even if key values are unchanged. The name of each property is the name of each key. The value of each key is a {{WebExtAPIRef('storage.StorageChange')}} object describing the change to that item. - `areaName` - : `string`. The name of the storage area (`"sync"`, `"local"`, or `"managed"`) to which the changes were made.