]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Call hide() after `delay` time
authorysds <ysds.code@gmail.com>
Tue, 9 Apr 2019 10:18:17 +0000 (19:18 +0900)
committerJohann-S <johann.servoire@gmail.com>
Tue, 9 Apr 2019 11:59:41 +0000 (13:59 +0200)
js/src/toast.js

index cbf29a104b251950d1d73234a394bd96b4d26395..837c5dffb13e59d477d9eb217f685cffbd9705eb 100644 (file)
@@ -103,7 +103,9 @@ class Toast {
       EventHandler.trigger(this._element, Event.SHOWN)
 
       if (this._config.autohide) {
-        this.hide()
+        this._timeout = setTimeout(() => {
+          this.hide()
+        }, this._config.delay)
       }
     }
 
@@ -119,20 +121,13 @@ class Toast {
     }
   }
 
-  hide(withoutTimeout) {
+  hide() {
     if (!this._element.classList.contains(ClassName.SHOW)) {
       return
     }
 
     EventHandler.trigger(this._element, Event.HIDE)
-
-    if (withoutTimeout) {
-      this._close()
-    } else {
-      this._timeout = setTimeout(() => {
-        this._close()
-      }, this._config.delay)
-    }
+    this._close()
   }
 
   dispose() {
@@ -173,7 +168,7 @@ class Toast {
       this._element,
       Event.CLICK_DISMISS,
       Selector.DATA_DISMISS,
-      () => this.hide(true)
+      () => this.hide()
     )
   }