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:
@@ -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() {
|
||||
|
Reference in New Issue
Block a user