Last active
April 19, 2019 15:31
-
-
Save ggdaltoso/f33c459dabf3cbe0eb0f7c774b5f8285 to your computer and use it in GitHub Desktop.
Decorator for defining webcomponents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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