Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename @controller to @customElement #233

Closed
onEXHovia opened this issue May 13, 2022 · 1 comment
Closed

Rename @controller to @customElement #233

onEXHovia opened this issue May 13, 2022 · 1 comment

Comments

@onEXHovia
Copy link

Every time use the @controller decorator, i think about whether this is the right name. If omit the details eventually it registers the class in window.customElements and it doesn't matter how you name the class using the endings Element|Controller|Component. Therefore, it seems to me that @customElement is a more appropriate name. Concept of controllers is used in stimulus , but they do not extend the elements. In this regard, Lit is closer to catalyst.

@keithamus
Copy link
Member

Thanks for the feedback.

You can freely name the decorator whatever you want. import {controller as customElement} from '@github/catalyst' will work just fine.

I think Catalyst controllers do a lot more than Custom Elements do, so customElement is IMO the wrong name for them. Lit's @customElement decorator just does custom element registration as far as I know. All heavy lifting in Lit is done by extends LitElement. We opted to make our @controller decorator serve as both the side-effect of registration and the extended class behaviours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants