var Test = new Class({ 'Aspect':'Class returns wrong data', returnFour:function(){ return 3; // HEY! This is an error! } }); AOP.addEvent('post', function(e){ if(e.name=='returnFour'){ e.returnthis = 4; } }); var a = new Test(); alert(a.returnFour());//4
<script src="https://raw.github.com/keeto/mootools-pattern-mutators/master/Source/Class.PatternMutators.js"></script> <script src="https://raw.github.com/gist/1278659/64ee9462dec56a74e0db9ee3f01db3c62f9dd957/kenta.AOP.js"></script>