Sha256: b0325d082e03157542f80f5933fcac41685f23f56bab2d532f4805236648192d
Contents?: true
Size: 951 Bytes
Versions: 38
Compression:
Stored size: 951 Bytes
Contents
import { Controller } from "@hotwired/stimulus" import { Dismiss } from 'flowbite'; // Connects to data-controller="resource-dismiss" export default class extends Controller { static targets = ["trigger", "target"] static values = { after: Number, } connect() { console.log(`resource-dismiss connected: ${this.element}`) // https://flowbite.com/docs/components/alerts/#javascript-behaviour this.dismiss = new Dismiss(this.targetTarget, this.triggerTarget); console.log(this.hasAfterValue) console.log(this.afterValue) if (this.hasAfterValue && this.afterValue > 0) { this.autoDismissTimeout = setTimeout(() => { this.hide() this.autoDismissTimeout = null }, this.afterValue); } } disconnect() { if (this.autoDismissTimeout) clearTimeout(this.autoDismissTimeout) this.dismiss = null this.autoDismissTimeout = null } hide() { this.dismiss.hide() } }
Version data entries
38 entries across 38 versions & 1 rubygems