Skip to content

Instantly share code, notes, and snippets.

@ggdaltoso
Last active April 19, 2019 15:31
Show Gist options
  • Select an option

  • Save ggdaltoso/f33c459dabf3cbe0eb0f7c774b5f8285 to your computer and use it in GitHub Desktop.

Select an option

Save ggdaltoso/f33c459dabf3cbe0eb0f7c774b5f8285 to your computer and use it in GitHub Desktop.
Decorator for defining webcomponents
function WComponent({ name }) {
return function(WebComponent) {
window.customElements.define(`wc-${name}`, WebComponent);
return WebComponent;
};
}
export default WComponent;
// <wc-foo></wc-foo>
@WComponent({ name: foo })
class Curriculum extends RAHTMLElement {
constructor() {
super();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment