Proxy Pattern & AOP in JavaScript
Proxy Pattern & AOP in JavaScript To implement a proxy pattern in JavaScript, enabling the basics of aspect-oriented Programming(AOP) function test(){ console.log(this,"It is a test."); } (function(){ var toProxy = test; test = function(){ console.log( this, "proxied" ,arguments ); return toProxy.apply( this ); }; } )(); test(); //Window test.html proxied [ ] //Window test.html It is a test.