summaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/scan-inputs-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-19 20:52:57 -0500
committerGitHub <noreply@github.com>2021-01-19 20:52:57 -0500
commitccf28ed055f08d38d28b19025d10cb4e7424464b (patch)
tree32c40a92149415c54ffd51b7868ae24d468cbaaa /ext/bg/js/settings/scan-inputs-controller.js
parent3c51bf2a0be7c35f86d2da8c381453b95e6414bf (diff)
Menu refactor (#1277)
* Rename menuOpened event to menuOpen * Rename menuClosed event to menuClose * Rename close event * Assign _isClosed * Reuse event detail * Expose PopupMenu.openMenus * Rename and expose properties * Add cancelable argument to close * Update menuOpen detail * Update menuClose detail
Diffstat (limited to 'ext/bg/js/settings/scan-inputs-controller.js')
-rw-r--r--ext/bg/js/settings/scan-inputs-controller.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/ext/bg/js/settings/scan-inputs-controller.js b/ext/bg/js/settings/scan-inputs-controller.js
index b8b3f710..a810a2fb 100644
--- a/ext/bg/js/settings/scan-inputs-controller.js
+++ b/ext/bg/js/settings/scan-inputs-controller.js
@@ -208,8 +208,8 @@ class ScanInputField {
this._eventListeners.addEventListener(removeButton, 'click', this._onRemoveClick.bind(this));
}
if (menuButton !== null) {
- this._eventListeners.addEventListener(menuButton, 'menuOpened', this._onMenuOpened.bind(this));
- this._eventListeners.addEventListener(menuButton, 'menuClosed', this._onMenuClosed.bind(this));
+ this._eventListeners.addEventListener(menuButton, 'menuOpen', this._onMenuOpen.bind(this));
+ this._eventListeners.addEventListener(menuButton, 'menuClose', this._onMenuClose.bind(this));
}
this._updateDataSettingTargets();
@@ -245,9 +245,10 @@ class ScanInputField {
this._removeSelf();
}
- _onMenuOpened({detail: {menu}}) {
- const showAdvanced = menu.querySelector('.popup-menu-item[data-menu-action="showAdvanced"]');
- const hideAdvanced = menu.querySelector('.popup-menu-item[data-menu-action="hideAdvanced"]');
+ _onMenuOpen(e) {
+ const node = e.detail.menu.node;
+ const showAdvanced = node.querySelector('.popup-menu-item[data-menu-action="showAdvanced"]');
+ const hideAdvanced = node.querySelector('.popup-menu-item[data-menu-action="hideAdvanced"]');
const advancedVisible = (this._node.dataset.showAdvanced === 'true');
if (showAdvanced !== null) {
showAdvanced.hidden = advancedVisible;
@@ -257,8 +258,8 @@ class ScanInputField {
}
}
- _onMenuClosed({detail: {action}}) {
- switch (action) {
+ _onMenuClose(e) {
+ switch (e.detail.action) {
case 'remove':
this._removeSelf();
break;