5 ms·
I'm confused by this example: export default Component.extend({ keyUp(event) { if (event.which === 13) { this.attrs['on-enter'](thi
by Osiris 11y ago
I'm confused by this example:
export default Component.extend({
keyUp(event) {
if (event.which === 13) {
this.attrs['on-enter'](this.$().val());
}
}
});
This is invalid ES5. I assume this is new ES6 module syntax, specifically the `keyUp(event) {`?
- jjjjjosh 11y agoyeah, it's ES6 shorthand for `keyUp: function (event) {`; the new syntax is valid both in objects and class definitions.
- deleted 11y ago[deleted]
- girvo 11y agoHaving been rewriting a large system that was a disgusting jquery mishmash of terrible code in React/Flummox, all in ES6/ES7 classes and compiled down with Browserify, I'd never want to write JavaScript any other way. ES6 syntax like what you've pointed out is simply brilliant in everyday usage :)