Spinner
HTML
<x-overlay> Sending data... </x-overlay>
JavaScript
document.querySelector('#spinBtn').addEventListener('click', () => { let show = new CustomEvent('show', { detail: { spin: 'true' }}); document.querySelector('x-overlay').dispatchEvent(show); setTimeout(() => { let hide = new CustomEvent('hide'); /*document.querySelector('x-overlay').dispatchEvent(hide);*/ document.querySelector('x-overlay').stopSpin(); document.querySelector('x-overlay').setText('Click to dismiss') }, 4000); });