我使用Backbone View使用下面的代码启动我的应用程序。它真正做的就是封装我想要实例化或加载的其他对象。
这是O.K.或者我应该重新考虑?
// App
//
//
//
var BVApp = Backbone.View.extend({
Name: 'BVApp',
el: window,
initialize: function () {
this.initIndependentConstructors();
this.initBBViews();
this.initComposite();
this.initBVArc();
},
initIndependentConstructors: function (){
new ImageLoader();
new SiteMorpher();
new AccountUpdater();
new SignOut();
},
initBBViews: function () {
new BVAccountExist();
new BVAccountCreator();
new BVAccountButton();
new BVAccountCode();
new BVFaveCreator();
},
initComposite: function () {
var token = ClientStorage.getToken();
this.CV = new BVComposite();
this.CV.renderCommon();
if (token) this.CV.render(token);
},
initBVArc: function () {
this.BVArcInstance = new BVArc({el: window, collection: new BCArc([], {data: {model: "ArcReader"}})});
}
});
var App = new BVApp();
}());