diff options
| author | Johann-S <[email protected]> | 2019-05-16 11:57:05 +0200 |
|---|---|---|
| committer | Johann-S <[email protected]> | 2019-05-16 13:24:29 +0200 |
| commit | d5752a18abdf2991ca97660ccdbf42c494d6878d (patch) | |
| tree | 758c3240cbd4e6f38eb3ba552786d1a749c88411 /js/src | |
| parent | 4ea7e11233dee88a6243ae1893ca1cd5b8cbeac6 (diff) | |
| download | bootstrap-d5752a18abdf2991ca97660ccdbf42c494d6878d.tar.xz bootstrap-d5752a18abdf2991ca97660ccdbf42c494d6878d.zip | |
toast should allow prevent default for hide and show events
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/toast.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/js/src/toast.js b/js/src/toast.js index 9956fd406..b29b051ec 100644 --- a/js/src/toast.js +++ b/js/src/toast.js @@ -90,7 +90,11 @@ class Toast { // Public show() { - EventHandler.trigger(this._element, Event.SHOW) + const showEvent = EventHandler.trigger(this._element, Event.SHOW) + + if (showEvent.defaultPrevented) { + return + } if (this._config.animation) { this._element.classList.add(ClassName.FADE) @@ -126,7 +130,11 @@ class Toast { return } - EventHandler.trigger(this._element, Event.HIDE) + const hideEvent = EventHandler.trigger(this._element, Event.HIDE) + + if (hideEvent.defaultPrevented) { + return + } const complete = () => { this._element.classList.add(ClassName.HIDE) |
