diff options
author | ysds <ysds.code@gmail.com> | 2019-04-09 13:18:17 +0300 |
---|---|---|
committer | Johann-S <johann.servoire@gmail.com> | 2019-04-09 14:59:41 +0300 |
commit | 91ebb4b3b2c1a4d5bdb22b927e013ba8202303d3 (patch) | |
tree | a1aab60f4a4661fc27c80a945bb7053771a491bd /js | |
parent | 51b0c42778c5cb32ca8feea37c7e4012ddf64647 (diff) |
Call hide() after `delay` time
Diffstat (limited to 'js')
-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 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() ) } |