Last active
August 29, 2015 14:17
-
-
Save StevenLangbroek/e938ceaa15469b086ab5 to your computer and use it in GitHub Desktop.
Backbone pattern not possible with ES6 Classes
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
import BaseView from './BaseView'; | |
import listenToMany from '../utils/listenToMany'; | |
import template from '../templates/user'; | |
// Backbone's extend + ES6 | |
export default BaseView.extend({ | |
template, | |
listenToMany | |
}); | |
// Native ES6 classes. It's definitely a matter | |
// of preference, but this looks much noisier | |
// than the combination of Backbone.extend and | |
// ES6 Object Literal extensions. | |
export default class UserView extends BaseView { | |
get template(){ | |
return template; | |
} | |
listenToMany(){ | |
listenToMany.call(this, ...arguments); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment