19 lines
470 B
JavaScript
19 lines
470 B
JavaScript
|
import { Controller } from 'stimulus'
|
||
|
|
||
|
export default class extends Controller {
|
||
|
static targets = [ 'content' ]
|
||
|
|
||
|
connect () {
|
||
|
window.addEventListener('toast', event => {
|
||
|
this.contentTarget.innerText = event.detail.content
|
||
|
this.element.classList.toggle('hide')
|
||
|
this.element.classList.toggle('show')
|
||
|
|
||
|
setTimeout(() => {
|
||
|
this.element.classList.toggle('hide')
|
||
|
this.element.classList.toggle('show')
|
||
|
}, 3000)
|
||
|
})
|
||
|
}
|
||
|
}
|