| | |
| | | * @param icon |
| | | * @returns {Node | ActiveX.IXMLDOMNode} |
| | | */ |
| | | window.icon = document.querySelector('.icon').cloneNode(true); |
| | | window.icon.className = 'icon'; |
| | | window.getIcon = function getIcon(icon){ |
| | | if (typeof icon === 'undefined') { |
| | | return ''; |
| | | } |
| | | console.log('Getting icon: '+icon); |
| | | |
| | | let theIcon = window.icon.cloneNode(true); |
| | | theIcon.classList.add('icon-'+icon); |
| | | return theIcon; |
| | | |
| | | |
| | | if(!window.jvbIcons){ |
| | |
| | | |
| | | schedule(key, callback, delay = 1000) { |
| | | this.cancel(key); |
| | | console.log('Scheduling action: ', key); |
| | | console.log('With callback', callback); |
| | | this.timeouts.set(key, setTimeout(() => { |
| | | callback(); |
| | | this.timeouts.delete(key); |
| | |
| | | |
| | | cancel(key) { |
| | | if (this.timeouts.has(key)) { |
| | | console.log('Cancelling ', key); |
| | | clearTimeout(this.timeouts.get(key)); |
| | | this.timeouts.delete(key); |
| | | } |
| | |
| | | |
| | | cleanup() { |
| | | for (let timeout of this.timeouts.values()) { |
| | | console.log('clearing timeout: ', timeout); |
| | | clearTimeout(timeout); |
| | | } |
| | | this.timeouts.clear(); |