diff options
author | GeoSot <geo.sotis@gmail.com> | 2021-04-11 02:27:18 +0300 |
---|---|---|
committer | Mark Otto <otto@github.com> | 2021-05-10 23:59:55 +0300 |
commit | 90b1a6907ed7bb3397fe6bd223f09eb12122d7a3 (patch) | |
tree | d666c155808a77ee51ab2296f549279b8f88873e /js/src/toast.js | |
parent | 9106d2a0eaa53a58d6cf6eef7250634329578843 (diff) |
Merge js-components 'transitionend' listener callbacks into one method
Diffstat (limited to 'js/src/toast.js')
-rw-r--r-- | js/src/toast.js | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/js/src/toast.js b/js/src/toast.js index 364de29b42..c8539b3a96 100644 --- a/js/src/toast.js +++ b/js/src/toast.js @@ -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() { |