我试图沿着由布赖恩·曼制作的优秀教程backbonerails跟随。不幸的是(对我来说,因为我是一个noob)他正在使用咖啡标记。什么是混淆是我下面的代码的假设:与Backbone.js的使用CoffeeScript的问题
class App.Views.Users extends Backbone.View
我认为是等价的:
Users = Backbone.View.extend({});
在普通的JavaScript。然而,当我放置的CoffeeScript代码trycoffeescript我得到:
var _ref,
__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.Users = (function(_super) {
__extends(Users, _super);
function Users() {
_ref = Users.__super__.constructor.apply(this, arguments);
return _ref;
}
return Users;
})(Backbone.View);
我的问题是我错了,我的javascript应该生产什么普通的假设,我是不正确的接近解释咖啡脚本的方式,或者是我超越希望?