Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2021-10-08 02:27:00 +0300
committerXhmikosR <xhmikosr@gmail.com>2021-11-25 20:23:49 +0300
commitfc33ce4b4682edff6ade324bd24abe89f0782158 (patch)
tree50ae03883654d97d56e0f0618ddfcb8dfeaa0632
parent79e01c3bad6b7376cf7dc1ea9c6551dce9fdd10e (diff)
Tweak methods
Name them to be more descriptive and have agnostic functionality
-rw-r--r--js/src/modal.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/js/src/modal.js b/js/src/modal.js
index 1c7a96adc8..455d395f7a 100644
--- a/js/src/modal.js
+++ b/js/src/modal.js
@@ -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 => {
@@ -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()
@@ -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
}
@@ -255,8 +255,8 @@ class Modal extends BaseComponent {
})
}
- _setResizeEvent() {
- if (this._isShown) {
+ _toggleResizeEventListener(enable) {
+ if (enable) {
EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog())
return
}