import IEventDispatcher from '../interfaces/events/IEventDispatcher'; export default class EventDispatcherElement extends HTMLElement implements IEventDispatcher { public constructor() { super(); } public dispatchCustomEvent(typeArg: string, payload: T | undefined = undefined, bubbles = false): void { const customEvent: CustomEvent = new CustomEvent(typeArg, { bubbles: bubbles, detail: payload }); this.dispatchEvent(customEvent); } private _name = ''; public set name(value: string) { if (this._name !== value) { this._name = value; } } public get name(): string { return this._name; } } customElements.define('event-dispatcher-element', EventDispatcherElement);