diff options
| author | ysds <[email protected]> | 2019-04-09 19:18:17 +0900 |
|---|---|---|
| committer | Johann-S <[email protected]> | 2019-04-09 13:59:41 +0200 |
| commit | 91ebb4b3b2c1a4d5bdb22b927e013ba8202303d3 (patch) | |
| tree | a1aab60f4a4661fc27c80a945bb7053771a491bd /js/src | |
| parent | 51b0c42778c5cb32ca8feea37c7e4012ddf64647 (diff) | |
| download | bootstrap-91ebb4b3b2c1a4d5bdb22b927e013ba8202303d3.tar.xz bootstrap-91ebb4b3b2c1a4d5bdb22b927e013ba8202303d3.zip | |
Call hide() after `delay` time
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/toast.js | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/js/src/toast.js b/js/src/toast.js index cbf29a104..837c5dffb 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() ) } |
