diff options
author | ysds <ysds.code@gmail.com> | 2019-04-09 13:18:17 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2019-04-29 17:41:28 +0300 |
commit | 57ff6ee9ef0d6b58664c266b3455a5ac16eaa445 (patch) | |
tree | a84ccfbf8266bd19dd639e19190aef26f27521e6 /js/src | |
parent | 77973cd7fb74bc1fb2b224d1dcb6677faf213501 (diff) |
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 4aef2d40c2..9657048469 100644 --- a/js/src/toast.js +++ b/js/src/toast.js @@ -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() ) } |