-
Notifications
You must be signed in to change notification settings - Fork 317
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
Adding reflectToAttribute to the demo doesn't work #10
Comments
I think in the |
Maybe, that is why I didn't examine further. It would be nice to know whether these features are going to be deprecated or just not implemented yet. |
Default values also don't seem to be supported e.g. foo: {
type: String,
value: "bar",
} |
This is by design. With LitElement we explicitly wanted to make "properties" less powerful and more straightforward. Property defaults should be set in the standard way, in the constructor. This is generally better for performance. We also elected not to support |
Where in a heaven are these documented? I was breaking my head :( |
Code samples showing how implement those would be helpful |
@blikblum Here's how you can implement basic reflection (proof of concept, won't work with inherited properties) _shouldRender(props, changedProps, prevProps) {
Object.keys(changedProps)
.filter(property => this.constructor.properties[property].reflectToAttribute)
.forEach(property =>
this._propertyToAttribute(
property,
this.constructor.attributeNameForProperty(property),
changedProps[property]
)
)
return super._shouldRender(props, changedProps, prevProps)
} |
The text was updated successfully, but these errors were encountered: