Skip to content

Instantly share code, notes, and snippets.

@StevenLangbroek
Last active August 29, 2015 14:17
Show Gist options
  • Save StevenLangbroek/e938ceaa15469b086ab5 to your computer and use it in GitHub Desktop.
Save StevenLangbroek/e938ceaa15469b086ab5 to your computer and use it in GitHub Desktop.
Backbone pattern not possible with ES6 Classes
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