Skip to content

Instantly share code, notes, and snippets.

@sebmarkbage
Created October 16, 2012 11:14
Show Gist options
  • Save sebmarkbage/3898723 to your computer and use it in GitHub Desktop.
Save sebmarkbage/3898723 to your computer and use it in GitHub Desktop.
AOP
var originalFunction = obj.myMethod;
obj.myMethod = function(){
// Before
console.log('before myMethod on ', this);
var result = originalFunction.apply(this, arguments);
// After
console.log('after myMethod on ', this);
return result;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment