From 82380681f7b85a97d768f43f6fbf0116857295d3 Mon Sep 17 00:00:00 2001 From: Richard Bloor Date: Thu, 14 Jul 2022 06:11:49 +1200 Subject: [PATCH 1/3] storage.onChanged clarrification --- .../add-ons/webextensions/api/storage/onchanged/index.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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..971fe513b6937fc 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')}} executes against a storage area. + +As 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. Your code needs to determine what changes have occurred by examining the content of the `changes` argument. ## 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 where {{WebExtAPIRef('storage.StorageArea.set','storageAred.set')}} occurred. 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. From b0f1987d26e7cadae48e90ce484732ff5e9b3729 Mon Sep 17 00:00:00 2001 From: Richard Bloor Date: Fri, 15 Jul 2022 05:51:27 +1200 Subject: [PATCH 2/3] Feedback update --- .../add-ons/webextensions/api/storage/onchanged/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 971fe513b6937fc..0d35a51e66a2dac 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,9 +15,9 @@ browser-compat: webextensions.api.storage.onChanged --- {{AddonSidebar()}} -Fired when {{WebExtAPIRef('storage.StorageArea.set','storageArea.set')}} executes against a storage area. +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. -As 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. Your code needs to determine what changes have occurred by examining the content of the `changes` argument. +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 From 2b34c34e2f405fb091a9c16c495a086aac07ce49 Mon Sep 17 00:00:00 2001 From: Richard Bloor Date: Thu, 11 Aug 2022 05:14:48 +1200 Subject: [PATCH 3/3] Feedback update --- .../add-ons/webextensions/api/storage/onchanged/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0d35a51e66a2dac..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 @@ -45,7 +45,7 @@ Events have three functions: - : The function called when this event occurs. The function is passed these arguments: - `changes` - - : `object`. Object describing the change. This object contains properties for all the keys in the storage area where {{WebExtAPIRef('storage.StorageArea.set','storageAred.set')}} occurred. 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. + - : `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.