UNPKG

theme-switch-component

Version:

Switch your site's theme

26 lines 732 B
/** * Copyright © 2022 Tony Spegel */ /** * DialogEvent is used to reference the targetElement * which has opened the ThemeSwitch component. * This needs to be done to re-select it after closing * the dialog. * * Dispatching on the host site: * * document * .querySelector('#btn-theme-selection') * .addEventListener('click', (event) => { * const {target} = event; * window.dispatchEvent(new DialogEvent(target)); * }); */ export class DialogEvent extends Event { constructor(targetElement) { super(DialogEvent.eventName, { bubbles: true }); this.targetElement = targetElement; } } DialogEvent.eventName = 'dialog-event'; //# sourceMappingURL=DialogEvent.js.map