Sha256: fc9c3ef545aaff98425ffe62aef13f092f562b47123b5e085c5d67d38c516f96
Contents?: true
Size: 636 Bytes
Versions: 38
Compression:
Stored size: 636 Bytes
Contents
import { Controller } from '@hotwired/stimulus' // Connects to data-controller="clear-timeout" export default class extends Controller { connect () { if (this.element.dataset.timeoutId) { this.element.dataset.timeoutId.split(',').forEach((el) => { this.clear(el) }) } else { const headId = document.head.dataset.timeoutId if (headId) { headId.split(',').forEach((el) => { this.clear(el) }) } } this.element.remove() } clear (id) { const timeoutId = parseInt(id) clearTimeout(timeoutId) console.log(`clearedTimeout: ${timeoutId}`) } }
Version data entries
38 entries across 38 versions & 1 rubygems