我试图让我的头周围采用主干应用程序中CommonJS的模块,所以我必须在/views/categories/edit.js
定义的骨架骨干查看:骨干视图作为CommonJS的模块
app.Views.quoteCategoriesEdit = app.Ui.ModalView.extend({
className: '',
template: JST["templates/quotes/categories/quote-categories-edit.html"],
events: {
'click [data-key="save"]': 'save',
'click [data-key="cancel"]': 'cancel'
},
initialize: function (options) {
var that = this;
_.bindAll(this, 'save', 'cancel');
app.Collections.quotesCategories.on('change add', function() {
that.remove();
});
},
render: function() {
var that = this;
// boilerplate render code
return this;
}
});
如果有人能告诉我如何我可以将它转换成与Browserify一起使用的CommonJS模块,那么我会非常感激,它会帮助我理解我如何去模块化应用程序的其余部分!从评论感谢
非常感谢这!你将如何处理:'app.Collections.quotesCategories',因为我把'app'命名空间下的所有东西都放在了一起?我只需要'收藏'本身? – benhowdle89
请看我的更新回答 –
非常非常有帮助,非常感谢!当我搜索到Backbone和CommonJS时,并没有那么多,更多Backbone和AMD! – benhowdle89