Last active
February 16, 2016 20:48
-
-
Save jonvuri/c5f28442f2adca77ff5e to your computer and use it in GitHub Desktop.
Demonstration of ES class properties proposal applied to Polymer elements
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
// 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) |
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
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