1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-30 07:19:13 +02:00

Merge js-components 'transitionend' listener callbacks into one method

This commit is contained in:
GeoSot
2021-04-11 02:27:18 +03:00
committed by Mark Otto
parent 9106d2a0ea
commit 90b1a6907e
9 changed files with 47 additions and 107 deletions

View File

@@ -7,8 +7,6 @@
import {
defineJQueryPlugin,
emulateTransitionEnd,
getTransitionDurationFromElement,
reflow,
typeCheckConfig
} from './util/index'
@@ -112,14 +110,8 @@ class Toast extends BaseComponent {
this._element.classList.remove(CLASS_NAME_HIDE)
reflow(this._element)
this._element.classList.add(CLASS_NAME_SHOWING)
if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element)
EventHandler.one(this._element, 'transitionend', complete)
emulateTransitionEnd(this._element, transitionDuration)
} else {
complete()
}
this._queueCallback(complete, this._element, this._config.animation)
}
hide() {
@@ -139,14 +131,7 @@ class Toast extends BaseComponent {
}
this._element.classList.remove(CLASS_NAME_SHOW)
if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element)
EventHandler.one(this._element, 'transitionend', complete)
emulateTransitionEnd(this._element, transitionDuration)
} else {
complete()
}
this._queueCallback(complete, this._element, this._config.animation)
}
dispose() {