aop-extend
v0.1.1
Published
Simple module for Aspect Oriented (AOP) "hooks" for extending and adding functionality to arbitrary object methods
Downloads
3
Maintainers
Readme
Example usage:
// Require Your Original untouched Module to Extend
Original = require('./Original.js');
// Require AopExtend
AopExtend = require('./AopExtend');
// Create Instances
o = new Original();
a = new AopExtend(o); // pass your original object instance to the constructor
var jBrown = function() {
console.log('make it funky');
}
o.methodOne.addHook('pre', jBrown);
o.methodOne();
// prints 'make it funky'
// executes original function