Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2022-06-11 13:03:20 +0300
committerGeoSot <geo.sotis@gmail.com>2022-10-08 00:31:38 +0300
commit8f2a3fff3555b4b913d7d1f2a1418e8a10071908 (patch)
tree65c2aa345c2a372662d756a88a7df6f00a699cde
parent3d54caca3fcf5207af24c0bd64049fad880bb532 (diff)
-rw-r--r--js/src/toast.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/js/src/toast.js b/js/src/toast.js
index 524d4c767d..ba2a39a702 100644
--- a/js/src/toast.js
+++ b/js/src/toast.js
@@ -19,8 +19,6 @@ const NAME = 'toast'
const DATA_KEY = 'bs.toast'
const EVENT_KEY = `.${DATA_KEY}`
-const CLASS_PROGRESS_BAR = '.toast-progress'
-
const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`
const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`
@@ -31,10 +29,13 @@ const EVENT_SHOW = `show${EVENT_KEY}`
const EVENT_SHOWN = `shown${EVENT_KEY}`
const CLASS_NAME_FADE = 'fade'
-const CLASS_NAME_HIDE = 'hide' // @deprecated - kept here only for backwards compatibility
+const CLASS_NAME_HIDE = 'hide' // TODO:v6: @deprecated - kept here only for backwards compatibility
const CLASS_NAME_SHOW = 'show'
const CLASS_NAME_SHOWING = 'showing'
+const CLASS_PROGRESS_BAR = '.toast-progress'
+const CLASS_NAME_PROGRESS_BAR_ANIMATED = 'animated'
+
const DefaultType = {
animation: 'boolean',
autohide: 'boolean',
@@ -148,7 +149,7 @@ class Toast extends BaseComponent {
return
}
- this._toggleProgressBar(this._config.delay)
+ this._toggleProgressBar(true)
this._timeout = setTimeout(() => {
this.hide()
}, this._config.delay)
@@ -195,24 +196,23 @@ class Toast extends BaseComponent {
_clearTimeout() {
clearTimeout(this._timeout)
- this._toggleProgressBar(null)
+ this._toggleProgressBar(false)
this._timeout = null
}
- _toggleProgressBar(time) {
+ _toggleProgressBar(enable) {
const progressBarElement = SelectorEngine.findOne(CLASS_PROGRESS_BAR, this._element)
if (!progressBarElement) {
return
}
- if (time) {
- progressBarElement.classList.add('animated')
- progressBarElement.style.animationDuration = `${time}ms`
+ if (enable) {
+ progressBarElement.classList.add(CLASS_NAME_PROGRESS_BAR_ANIMATED)
+ progressBarElement.style.animationDuration = `${this._config.delay}ms`
return
}
- progressBarElement.classList.remove('animated')
- reflow(progressBarElement)
+ progressBarElement.classList.remove(CLASS_NAME_PROGRESS_BAR_ANIMATED)
}
// Static