Skip to content

Instantly share code, notes, and snippets.

@jonvuri
Last active February 16, 2016 20:48
Show Gist options
  • Save jonvuri/c5f28442f2adca77ff5e to your computer and use it in GitHub Desktop.
Save jonvuri/c5f28442f2adca77ff5e to your computer and use it in GitHub Desktop.
Demonstration of ES class properties proposal applied to Polymer elements
// Currently fails in Polymer
class MyElement {
is = 'my-element'
properties = {
greeting: {
type: String,
value: 'good morning'
}
}
capitalize = (s) => s && s.length && s[0].toUpperCase() + s.slice(1)
}
Polymer(MyElement)
class MyElement {
beforeRegister() {
this.is = 'my-element'
this.properties = {
greeting: {
type: String,
value: 'good morning'
}
}
}
capitalize(s) {
return s && s.length && s[0].toUpperCase() + s.slice(1)
}
}
Polymer(MyElement)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment