diff options
author | Andrew Luca <iamandrewluca@users.noreply.github.com> | 2018-10-17 02:57:04 +0300 |
---|---|---|
committer | Johann-S <johann.servoire@gmail.com> | 2018-10-30 18:28:32 +0300 |
commit | 65dc8c907048111d7895b64da1207023ff4c9992 (patch) | |
tree | 2d07f6076d596314690ad3c87110d648a4250d40 /js | |
parent | 2b21657cd43656a9058aa3eb2bd66b81d87ae10b (diff) |
refactor(Modal): add `_isTransitioning` default value
Having variables initialised from start `_isTransitioning` is better.
Would be better to add an eslint rule to check for undeclared variables use.
Reordered enter checks for `show` and `hide` by priority.
Diffstat (limited to 'js')
-rw-r--r-- | js/src/modal.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/js/src/modal.js b/js/src/modal.js index 2c71baf736..704b022472 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -81,6 +81,7 @@ class Modal { this._isShown = false this._isBodyOverflowing = false this._ignoreBackdropClick = false + this._isTransitioning = false this._scrollbarWidth = 0 } @@ -101,7 +102,7 @@ class Modal { } show(relatedTarget) { - if (this._isTransitioning || this._isShown) { + if (this._isShown || this._isTransitioning) { return } @@ -153,7 +154,7 @@ class Modal { event.preventDefault() } - if (this._isTransitioning || !this._isShown) { + if (!this._isShown || this._isTransitioning) { return } @@ -206,6 +207,7 @@ class Modal { this._isShown = null this._isBodyOverflowing = null this._ignoreBackdropClick = null + this._isTransitioning = null this._scrollbarWidth = null } |