Sha256: 9cf9999bee007ec54cc69fa4247b8d741dc31735bbdde296b13bfb301276bf60
Contents?: true
Size: 1.04 KB
Versions: 7
Compression:
Stored size: 1.04 KB
Contents
import ApplicationController from "signum/controllers/application_controller" export default class extends ApplicationController { static values = { type: String, timeout: Number, sticky: Boolean, signalId: String, signalState: String } connect() { if (this.typeValue == "balloon" && !this.stickyValue) { this.timeoutId = setTimeout(() => { this.close() }, this.timeoutValue * 1000 + 500) } } close(event) { setTimeout(() => { this.element?.parentElement?.remove() if (event && this.typeValue != "balloon") { this.markClose() } }, 300) } markClose() { fetch("/signal/close", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ id: this.signalIdValue }), }) .then((res) => { const niE = new CustomEvent("nd-item-activity", { bubbles: true, detail: "closed", }) window.dispatchEvent(niE) }) .catch((err) => { console.log(err) }) } }
Version data entries
7 entries across 7 versions & 1 rubygems