aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2022-05-07 07:29:21 +0300
committerGitHub <[email protected]>2022-05-06 21:29:21 -0700
commit4a682ab00a86adba2d38b0da7f3eaf1a6208f647 (patch)
treea5efb5c9b04c2e0bd060aaf4f33e7a3695e98099 /js
parent92e6856235555622c14f120b641f8118af33a5a3 (diff)
downloadbootstrap-4a682ab00a86adba2d38b0da7f3eaf1a6208f647.tar.xz
bootstrap-4a682ab00a86adba2d38b0da7f3eaf1a6208f647.zip
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 <[email protected]> Co-authored-by: Julien Déramond <[email protected]>
Diffstat (limited to 'js')
-rw-r--r--js/src/toast.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/js/src/toast.js b/js/src/toast.js
index b85e20b60..8ee8c8c96 100644
--- a/js/src/toast.js
+++ b/js/src/toast.js
@@ -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() {