Skip to content

Instantly share code, notes, and snippets.

@spolu
Created August 16, 2011 22:49
Show Gist options
  • Save spolu/1150381 to your computer and use it in GitHub Desktop.
Save spolu/1150381 to your computer and use it in GitHub Desktop.
/** Used for functional inheritance */
Object.prototype.method = function(name, method, _super) {
var that = this;
if(_super) {
var m = that[name];
_super[name] = function() {
return m.apply(that, arguments);
};
}
this[name] = method;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment