diff options
| author | GeoSot <[email protected]> | 2021-04-11 02:27:18 +0300 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2021-05-10 13:59:55 -0700 |
| commit | 90b1a6907ed7bb3397fe6bd223f09eb12122d7a3 (patch) | |
| tree | d666c155808a77ee51ab2296f549279b8f88873e /js/src/base-component.js | |
| parent | 9106d2a0eaa53a58d6cf6eef7250634329578843 (diff) | |
| download | bootstrap-90b1a6907ed7bb3397fe6bd223f09eb12122d7a3.tar.xz bootstrap-90b1a6907ed7bb3397fe6bd223f09eb12122d7a3.zip | |
Merge js-components 'transitionend' listener callbacks into one method
Diffstat (limited to 'js/src/base-component.js')
| -rw-r--r-- | js/src/base-component.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/src/base-component.js b/js/src/base-component.js index a0bb62319..7d2a5b1e8 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -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) { |
