Sha256: 9e5c7213d373d5b2d4f3b4dc64c0c38028b9d2403d9dac11becd3ca96721d7ee
Contents?: true
Size: 1.01 KB
Versions: 5
Compression:
Stored size: 1.01 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.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
5 entries across 5 versions & 1 rubygems