toast should allow prevent default for hide and show events
This commit is contained in:
parent
4ea7e11233
commit
d5752a18ab
2 changed files with 81 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue