Sha256: 60b4a82e2ac70d0595138faeaf815d4b958a97725f1794069453695c5c652e26
Contents?: true
Size: 887 Bytes
Versions: 1
Compression:
Stored size: 887 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
playbook_ui-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5738 | app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js |