Skip to content

Instantly share code, notes, and snippets.

@S2
Created January 29, 2014 05:07
Show Gist options
  • Save S2/8682163 to your computer and use it in GitHub Desktop.
Save S2/8682163 to your computer and use it in GitHub Desktop.
var Test = (function () {
function Test(){
this.value = "base";
};
Test.prototype = {
method : function(){
console.log(this.value);
}
};
return Test;
})();
// mixin
(function () {
Test.prototype.___method = Test.prototype.method;
Test.prototype.appendMethod = function(){
console.log("append");
};
Test.prototype.method = function(){
this.___method();
console.log("override");
};
})();
var object = new Test();
object.appendMethod();
object.method();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment