mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-07 14:16:47 +02:00
Merge js-components 'transitionend' listener callbacks into one method
This commit is contained in:
@@ -6,6 +6,11 @@
|
||||
*/
|
||||
|
||||
import Data from './dom/data'
|
||||
import {
|
||||
emulateTransitionEnd,
|
||||
execute,
|
||||
getTransitionDurationFromElement
|
||||
} from './util/index'
|
||||
import EventHandler from './dom/event-handler'
|
||||
|
||||
/**
|
||||
@@ -34,6 +39,18 @@ class BaseComponent {
|
||||
this._element = null
|
||||
}
|
||||
|
||||
_queueCallback(callback, element, isAnimated = true) {
|
||||
if (!isAnimated) {
|
||||
execute(callback)
|
||||
return
|
||||
}
|
||||
|
||||
const transitionDuration = getTransitionDurationFromElement(element)
|
||||
EventHandler.one(element, 'transitionend', () => execute(callback))
|
||||
|
||||
emulateTransitionEnd(element, transitionDuration)
|
||||
}
|
||||
|
||||
/** Static */
|
||||
|
||||
static getInstance(element) {
|
||||
|
Reference in New Issue
Block a user