Skip to content

Instantly share code, notes, and snippets.

@daKmoR
Created April 6, 2020 21:35
Show Gist options
  • Save daKmoR/3c08e258705187c9ed387e505aedd5b4 to your computer and use it in GitHub Desktop.
Save daKmoR/3c08e258705187c9ed387e505aedd5b4 to your computer and use it in GitHub Desktop.
Markdium-The evolution of open-wc scoped-elements
import { LitElement } from 'lit-element';
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
import { MyPanel } from './MyPanel.js';
export class MyElement extends ScopedElementsMixin(LitElement) {
static get scopedElements() {
return {
'my-panel': MyPanel,
};
}
connectedCallback() {
super.connectedCallback();
import('./MyButton.js').then(({ MyButton }) =>
this.defineScopedElement('my-button', MyButton));
}
render() {
return html`
<my-panel class="panel">
<my-button>${this.text}</my-button>
</my-panel>
`;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment