]> 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 (13:18 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Mon, 29 Apr 2019 14:41:28 +0000 (17:41 +0300)
js/src/toast.js

index 4aef2d40c2a1b60d2ef899b0aabe88d26331ff1f..9657048469d0bc441308b3f89c744ec72c003926 100644 (file)
@@ -95,7 +95,9 @@ class Toast {
       $(this._element).trigger(Event.SHOWN)
 
       if (this._config.autohide) {
-        this.hide()
+        this._timeout = setTimeout(() => {
+          this.hide()
+        }, this._config.delay)
       }
     }
 
@@ -112,20 +114,13 @@ class Toast {
     }
   }
 
-  hide(withoutTimeout) {
+  hide() {
     if (!this._element.classList.contains(ClassName.SHOW)) {
       return
     }
 
     $(this._element).trigger(Event.HIDE)
-
-    if (withoutTimeout) {
-      this._close()
-    } else {
-      this._timeout = setTimeout(() => {
-        this._close()
-      }, this._config.delay)
-    }
+    this._close()
   }
 
   dispose() {
@@ -165,7 +160,7 @@ class Toast {
     $(this._element).on(
       Event.CLICK_DISMISS,
       Selector.DATA_DISMISS,
-      () => this.hide(true)
+      () => this.hide()
     )
   }