Bootstrapping a Backbone application

送分小仙女□ 提交于 2019-12-05 09:38:40

When you're creating:

App.Views.LoginView = Backbone.View.extend({});

It's quite different from:

class App.Views.LoginView extends Backbone.View

You can check the coffeescript by converting it from coffee to js:

var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

App.Views.LoginView = (function(_super) {

  __extends(LoginView, _super);

  function LoginView() {
    return LoginView.__super__.constructor.apply(this, arguments);
  }

return LoginView;

})(Backbone.View);

I'd recommend checking out the repo for todomvc's backbone-require setup.

I have a coffeescript todo setup based loosely on both with a global app object not attached to the window, but using sub objects to hold collections, models, views etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!