Skip to content

Commit

Permalink
Tweak methods
Browse files Browse the repository at this point in the history
Name them to be more descriptive and have agnostic functionality
  • Loading branch information
GeoSot authored and XhmikosR committed Nov 25, 2021
1 parent 79e01c3 commit fc33ce4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions js/src/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ class Modal extends BaseComponent {

this._adjustDialog()

this._setEscapeEvent()
this._setResizeEvent()
this._toggleEscapeEventListener(true)
this._toggleResizeEventListener(true)

EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
Expand All @@ -148,8 +148,8 @@ class Modal extends BaseComponent {
this._isShown = false
this._isTransitioning = true

this._setEscapeEvent()
this._setResizeEvent()
this._toggleEscapeEventListener(false)
this._toggleResizeEventListener(false)

this._focustrap.deactivate()

Expand Down Expand Up @@ -234,8 +234,8 @@ class Modal extends BaseComponent {
this._queueCallback(transitionComplete, this._dialog, this._isAnimated())
}

_setEscapeEvent() {
if (!this._isShown) {
_toggleEscapeEventListener(enable) {
if (!enable) {
EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS)
return
}
Expand All @@ -255,8 +255,8 @@ class Modal extends BaseComponent {
})
}

_setResizeEvent() {
if (this._isShown) {
_toggleResizeEventListener(enable) {
if (enable) {
EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog())
return
}
Expand Down

0 comments on commit fc33ce4

Please sign in to comment.