diff options
author | Johann-S <johann.servoire@gmail.com> | 2018-09-18 15:37:40 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2018-11-13 09:47:32 +0300 |
commit | 557d5ac74d591b7267053e5fe6db9defcb480895 (patch) | |
tree | a1a1eb964aacd58c068cdb3d35eee4b47b0addf5 /js/src/toast.js | |
parent | 4cac833447c53ec7f140c26260ddf36d78ff298f (diff) |
Remove the show delay for our toast plugin
Diffstat (limited to 'js/src/toast.js')
-rw-r--r-- | js/src/toast.js | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/js/src/toast.js b/js/src/toast.js index 1e70e091f2..878ffe0296 100644 --- a/js/src/toast.js +++ b/js/src/toast.js @@ -38,16 +38,13 @@ const Toast = (($) => { const DefaultType = { animation : 'boolean', autohide : 'boolean', - delay : '(number|object)' + delay : 'number' } const Default = { animation : true, autohide : true, - delay : { - show: 0, - hide: 500 - } + delay : 500 } const Selector = { @@ -95,19 +92,16 @@ const Toast = (($) => { } } - this._timeout = setTimeout(() => { - this._element.classList.add(ClassName.SHOW) - - if (this._config.animation) { - const transitionDuration = Util.getTransitionDurationFromElement(this._element) + this._element.classList.add(ClassName.SHOW) + if (this._config.animation) { + const transitionDuration = Util.getTransitionDurationFromElement(this._element) - $(this._element) - .one(Util.TRANSITION_END, complete) - .emulateTransitionEnd(transitionDuration) - } else { - complete() - } - }, this._config.delay.show) + $(this._element) + .one(Util.TRANSITION_END, complete) + .emulateTransitionEnd(transitionDuration) + } else { + complete() + } } hide(withoutTimeout) { @@ -122,7 +116,7 @@ const Toast = (($) => { } else { this._timeout = setTimeout(() => { this._close() - }, this._config.delay.hide) + }, this._config.delay) } } @@ -150,13 +144,6 @@ const Toast = (($) => { ...typeof config === 'object' && config ? config : {} } - if (typeof config.delay === 'number') { - config.delay = { - show: config.delay, - hide: config.delay - } - } - Util.typeCheckConfig( NAME, config, |