1 export class Component {
4 * The registered name of the component.
10 * The element that the component is registered upon.
16 * Mapping of referenced elements within the component.
17 * @type {Object<string, Element>}
22 * Mapping of arrays of referenced elements within the component so multiple
23 * references, sharing the same name, can be fetched.
24 * @type {Object<string, Element[]>}
29 * Options passed into this component.
30 * @type {Object<String, String>}
35 * Component-specific setup methods.
36 * Use this to assign local variables and run any initial setup or actions.
43 * Emit an event from this component.
44 * Will be bubbled up from the dom element this is registered on, as a custom event
45 * with the name `<elementName>-<eventName>`, with the provided data in the event detail.
46 * @param {String} eventName
47 * @param {Object} data
49 $emit(eventName, data = {}) {
51 const componentName = this.$name;
52 const event = new CustomEvent(`${componentName}-${eventName}`, {
56 this.$el.dispatchEvent(event);