Sha256: 69262ead28b5fb6a5f31dbd4513ad9bc70b9d21d61908c8400b06c0e6d0096a0
Contents?: true
Size: 888 Bytes
Versions: 774
Compression:
Stored size: 888 Bytes
Contents
import PbEnhancedElement from '../pb_enhanced_element' export default class PbFixedConfirmationToast extends PbEnhancedElement { static get selector() { return '.remove_toast' } connect() { this.self = this.element this.autoCloseToast(this.self) this.self.addEventListener('click', () => { this.removeToast(this.self) }) } removeToast(elem) { elem.parentNode.removeChild(elem) } autoCloseToast(element) { const classListValues = element.classList.value const hasAutoCloseClass = classListValues.includes('auto_close') if (hasAutoCloseClass) { const classList = classListValues.split(' ') const autoCloseValue = classList[classList.length - 1].split('_')[2] const autoCloseIntValue = parseInt(autoCloseValue) setTimeout(() => { this.removeToast(element) }, autoCloseIntValue) } } }
Version data entries
774 entries across 774 versions & 1 rubygems