var Test = new Class({
'Aspect':'We want to cancel this method execution',
this_method_is_heavy_and_turns_out_to_be_not_required:function(){
//for(i=0,max=1000000000;i<max;i++) ...
alert("This Method is as useful as using confetti to clean your ass.")
}
});
var a = new Test();
AOP.addEvent('pre', function(e){
//Here you see how you can use regex to filter the methods to hijack
if(/not_required$/.test(e.name)){
e.cancel=true;
}
})
a.this_method_is_heavy_and_turns_out_to_be_not_required();
<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>