2021-11-22 17:51:50 +00:00
|
|
|
import { Controller } from "stimulus";
|
2021-01-25 19:46:16 +00:00
|
|
|
|
|
|
|
export default class extends Controller {
|
2021-11-22 17:51:50 +00:00
|
|
|
static targets = ["content"];
|
2021-01-25 19:46:16 +00:00
|
|
|
|
2021-11-22 17:51:50 +00:00
|
|
|
connect() {
|
|
|
|
window.addEventListener("toast", (event) => {
|
|
|
|
this.contentTarget.innerText = event.detail.content;
|
|
|
|
this.element.classList.toggle("hide");
|
|
|
|
this.element.classList.toggle("show");
|
2021-01-25 19:46:16 +00:00
|
|
|
|
|
|
|
setTimeout(() => {
|
2021-11-22 17:51:50 +00:00
|
|
|
this.element.classList.toggle("hide");
|
|
|
|
this.element.classList.toggle("show");
|
|
|
|
}, 3000);
|
|
|
|
});
|
2021-01-25 19:46:16 +00:00
|
|
|
}
|
|
|
|
}
|