diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-01-19 20:52:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-19 20:52:57 -0500 |
commit | ccf28ed055f08d38d28b19025d10cb4e7424464b (patch) | |
tree | 32c40a92149415c54ffd51b7868ae24d468cbaaa /ext/bg/js/settings/profile-controller.js | |
parent | 3c51bf2a0be7c35f86d2da8c381453b95e6414bf (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/profile-controller.js')
-rw-r--r-- | ext/bg/js/settings/profile-controller.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/ext/bg/js/settings/profile-controller.js b/ext/bg/js/settings/profile-controller.js index f40818c7..924e965e 100644 --- a/ext/bg/js/settings/profile-controller.js +++ b/ext/bg/js/settings/profile-controller.js @@ -612,8 +612,8 @@ class ProfileEntry { this._eventListeners.addEventListener(this._isDefaultRadio, 'change', this._onIsDefaultRadioChange.bind(this), false); this._eventListeners.addEventListener(this._nameInput, 'input', this._onNameInputInput.bind(this), false); this._eventListeners.addEventListener(this._countLink, 'click', this._onConditionsCountLinkClick.bind(this), false); - this._eventListeners.addEventListener(this._menuButton, 'menuOpened', this._onMenuOpened.bind(this), false); - this._eventListeners.addEventListener(this._menuButton, 'menuClosed', this._onMenuClosed.bind(this), false); + this._eventListeners.addEventListener(this._menuButton, 'menuOpen', this._onMenuOpen.bind(this), false); + this._eventListeners.addEventListener(this._menuButton, 'menuClose', this._onMenuClose.bind(this), false); } cleanup() { @@ -658,16 +658,17 @@ class ProfileEntry { this._profileController.openProfileConditionsModal(this._index); } - _onMenuOpened({detail: {menu}}) { + _onMenuOpen(e) { + const node = e.detail.menu.node; const count = this._profileController.profileCount; - this._setMenuActionEnabled(menu, 'moveUp', this._index > 0); - this._setMenuActionEnabled(menu, 'moveDown', this._index < count - 1); - this._setMenuActionEnabled(menu, 'copyFrom', count > 1); - this._setMenuActionEnabled(menu, 'delete', count > 1); + this._setMenuActionEnabled(node, 'moveUp', this._index > 0); + this._setMenuActionEnabled(node, 'moveDown', this._index < count - 1); + this._setMenuActionEnabled(node, 'copyFrom', count > 1); + this._setMenuActionEnabled(node, 'delete', count > 1); } - _onMenuClosed({detail: {action}}) { - switch (action) { + _onMenuClose(e) { + switch (e.detail.action) { case 'moveUp': this._profileController.moveProfile(this._index, -1); break; |