/aem

Application Element Manager

Primary LanguageJavaScript

AEM

Installation:

npm i --save aem

API:

class AEM.Component {
  constructor(element: HTMLElement, attributes: HTMLElement.dataset): void,
  init(): void
}
AEM.registerComponent(selector: string, ComponentClass: AEM.Component): void

Usage example:

import AEM from 'aem';

class Button extends AEM.Component {
  init() {
    this.element.addEventListener('click', e => {
      alert('You clicked me!');
    });
  }
}

AEM.registerComponent('#my-button', Button);