mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-11 08:54:23 +01:00
Clear timeout before showing the toast (#31155)
* clear timeout before showing the toast * Add unit test * Remove the check for timeout * Check for clearTimeout to have been called Co-authored-by: XhmikosR <xhmikosr@gmail.com> # Conflicts: # js/tests/unit/toast.spec.js
This commit is contained in:
parent
0ec2ce44b4
commit
f530ab7549
@ -83,6 +83,8 @@ class Toast {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._clearTimeout()
|
||||||
|
|
||||||
if (this._config.animation) {
|
if (this._config.animation) {
|
||||||
this._element.classList.add(CLASS_NAME_FADE)
|
this._element.classList.add(CLASS_NAME_FADE)
|
||||||
}
|
}
|
||||||
@ -130,8 +132,7 @@ class Toast {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
clearTimeout(this._timeout)
|
this._clearTimeout()
|
||||||
this._timeout = null
|
|
||||||
|
|
||||||
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||||
this._element.classList.remove(CLASS_NAME_SHOW)
|
this._element.classList.remove(CLASS_NAME_SHOW)
|
||||||
@ -184,6 +185,11 @@ class Toast {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_clearTimeout() {
|
||||||
|
clearTimeout(this._timeout)
|
||||||
|
this._timeout = null
|
||||||
|
}
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
|
|
||||||
static _jQueryInterface(config) {
|
static _jQueryInterface(config) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user