JSFiddle - React, Tailwind, and code Playground
by darcyclarke
HTML
<script src="http://documentcloud.github.com/underscore/underscore.js"></script>
<script src="http://backbonejs.org/backbone.js"></script>
JavaScript
// Generated by CoffeeScript 1.3.3
var Base, Module, base,
__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; };
Module = (function() {
function Module() {};
Module.include = function(mixin) {
var temp = new Function("mixin", "ctor", "self", "return function " + mixin.name + "(){ mixin.apply(self); ctor.apply(self); };")(mixin, this.__super__.constructor, this), key, value, reference;
temp = __extends(temp, this.__super__.constructor);
reference = mixin.prototype;
for(key in reference){
value = reference[key];
temp.prototype[key] = value;
}
for(key in mixin) {
value = mixin[key];
temp[key] = value;
}
return __extends(this, temp);
};
return Module;
})();
///////////////////////////////////////////
// View Module
///////////////////////////////////////////
View = (function(_super){
__extends(View, _super);
function View(){
console.log('View construct');
return View.__super__.constructor.apply(this, arguments);
}
__extends(View, Backbone.View);
return View;
})(Module);
///////////////////////////////////////////
// Base Module
///////////////////////////////////////////
Base = (function(_super) {
__extends(Base, _super);
function Base() {
console.log('Base construct');
return Base.__super__.constructor.apply(this, arguments);
}
Base.include(View);
return Base;
})(Module);
// Test Modules
base = new Base;
console.log(base instanceof View);
console.dir(Backbone.View);