From: ysds Date: Tue, 9 Apr 2019 10:18:17 +0000 (+0900) Subject: Call hide() after `delay` time X-Git-Tag: v5.0.0-alpha1~1160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91ebb4b3b2c1a4d5bdb22b927e013ba8202303d3;p=thirdparty%2Fbootstrap.git Call hide() after `delay` time --- diff --git a/js/src/toast.js b/js/src/toast.js index cbf29a104b..837c5dffb1 100644 --- a/js/src/toast.js +++ b/js/src/toast.js @@ -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() ) }