Skip to content

Instantly share code, notes, and snippets.

@branflake2267
Last active November 15, 2019 02:24
Show Gist options
  • Save branflake2267/38097b0fb4e6a1c5a773edf2cf532843 to your computer and use it in GitHub Desktop.
Save branflake2267/38097b0fb4e6a1c5a773edf2cf532843 to your computer and use it in GitHub Desktop.
Simple ExtWebComponents View
<!-- usage -->
<my-sandbox-view></my-sandbox-view>
<div>Sandbox View</div>
<ext-button
text="Normal3"
shadow="true"
arrowAlign="bottom"
></ext-button>
import template from './SandboxViewComponent.html';
class SandboxViewComponent extends HTMLElement {
constructor() {
super()
this.innerHTML = template;
}
connectedCallback() {
this._addListeners();
}
disconnectedCallback() {
}
attributeChangedCallback(attrName, oldVal, newVal) {
}
_addListeners() {
var buttonEl = this.querySelector("ext-button");
// works
buttonEl.ext.el.on('click', () => {
alert('ext on click works');
});
}
}
window.customElements.define('my-sandbox-view', SandboxViewComponent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment