import { Controller } from "@hotwired/stimulus" import * as bootstrap from "bootstrap" // Connects to data-controller="toast" export default class extends Controller { connect() { const shownKey = `toastsShown[${this.element.getAttribute("data-ts")}]` if(!window.sessionStorage.getItem(shownKey)) { window.sessionStorage.setItem(shownKey, Date.now()); const toastBootstrap = bootstrap.Toast.getOrCreateInstance(this.element) toastBootstrap.show() } } }