JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://documentcloud.github.com/underscore/underscore.js"></script>
<script src="http://documentcloud.github.com/backbone/backbone.js"></script>
JavaScript
// http://forrst.com/posts/Backbone_js_super_function-4co
Backbone.Model.prototype._super = function(method){
return this.constructor.__super__[method].apply(this, _.rest(arguments));
}
var animal = Backbone.Model.extend({
defaults: {
id:0,
name:'this is animal name'
},
sound: function() { return '(incoherent grunting)'; },
talk: function() { alert(this.sound()); }
});
var yeti = animal.extend({
defaults: _.extend({}, animal.defaults, {
cost:500
}),
test: function() {
alert('cost : ' + this.get('name'));
}
});
(new yeti).test();