1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-12 00:24:03 +02:00

Toast: provide isShown method (#36272)

* feat(Toast): provide `isShown` method

* Update site/content/docs/5.1/components/toasts.md

Co-authored-by: Julien Déramond <julien.deramond@orange.com>

Co-authored-by: Julien Déramond <julien.deramond@orange.com>
This commit is contained in:
GeoSot
2022-05-07 07:29:21 +03:00
committed by GitHub
parent 92e6856235
commit 4a682ab00a
2 changed files with 7 additions and 2 deletions

View File

@@ -100,7 +100,7 @@ class Toast extends BaseComponent {
}
hide() {
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
if (!this.isShown()) {
return
}
@@ -123,13 +123,17 @@ class Toast extends BaseComponent {
dispose() {
this._clearTimeout()
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
if (this.isShown()) {
this._element.classList.remove(CLASS_NAME_SHOW)
}
super.dispose()
}
isShown() {
return this._element.classList.contains(CLASS_NAME_SHOW)
}
// Private
_maybeScheduleHide() {