summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-10-31 17:13:24 -0400
committerGitHub <noreply@github.com>2020-10-31 17:13:24 -0400
commit94620f4f224ffec20b774dd75143ce5023c60b83 (patch)
tree217426703ff5f6a96fffa45c5daeede788ee7e68 /ext/bg
parent11c5dbac6459d2afaef98d2711e34f71dd55aeef (diff)
Trigger event on property change (#979)
* Add _triggerScanInputsChanged function * Trigger event when inputs are changed
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/settings/scan-inputs-controller.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/ext/bg/js/settings/scan-inputs-controller.js b/ext/bg/js/settings/scan-inputs-controller.js
index fbafe570..3ee4cb34 100644
--- a/ext/bg/js/settings/scan-inputs-controller.js
+++ b/ext/bg/js/settings/scan-inputs-controller.js
@@ -64,9 +64,12 @@ class ScanInputsController {
return true;
}
- setProperty(index, property, value) {
+ async setProperty(index, property, value, event) {
const path = `scanning.inputs[${index}].${property}`;
- return this._settingsController.setProfileSetting(path, value);
+ await this._settingsController.setProfileSetting(path, value);
+ if (event) {
+ this._triggerScanInputsChanged();
+ }
}
instantiateTemplate(name) {
@@ -131,6 +134,10 @@ class ScanInputsController {
async _modifyProfileSettings(targets) {
await this._settingsController.modifyProfileSettings(targets);
+ this._triggerScanInputsChanged();
+ }
+
+ _triggerScanInputsChanged() {
this._settingsController.trigger('scanInputsChanged', {source: this});
}
@@ -224,11 +231,11 @@ class ScanInputField {
// Private
_onIncludeValueChange({value}) {
- this._parent.setProperty(this._index, 'include', value);
+ this._parent.setProperty(this._index, 'include', value, true);
}
_onExcludeValueChange({value}) {
- this._parent.setProperty(this._index, 'exclude', value);
+ this._parent.setProperty(this._index, 'exclude', value, true);
}
_onRemoveClick(e) {
@@ -287,6 +294,6 @@ class ScanInputField {
_setAdvancedOptionsVisible(showAdvanced) {
showAdvanced = !!showAdvanced;
this._node.dataset.showAdvanced = `${showAdvanced}`;
- this._parent.setProperty(this._index, 'options.showAdvanced', showAdvanced);
+ this._parent.setProperty(this._index, 'options.showAdvanced', showAdvanced, false);
}
}