diff --git a/README.md b/README.md index c2dc698..73b54de 100644 --- a/README.md +++ b/README.md @@ -101,3 +101,16 @@ $ bower install proxy-polyfill The polyfill supports browsers that implement the full [ES5 spec](http://kangax.github.io/compat-table/es5/), such as IE9+ and Safari 6+. Firefox, Chrome and Edge support `Proxy` natively. + +# Release + +Compile code with [Closure Compiler](https://closure-compiler.appspot.com/home). + +``` +// ==ClosureCompiler== +// @compilation_level ADVANCED_OPTIMIZATIONS +// @output_file_name proxy.min.js +// ==/ClosureCompiler== + +// code here +``` diff --git a/proxy.min.js b/proxy.min.js index 402c90c..4d853a1 100644 --- a/proxy.min.js +++ b/proxy.min.js @@ -1,3 +1,4 @@ -(function(d){if(!d.a){var g=null;d.a=function(c,b){function d(){}if(!(c instanceof Object&&b instanceof Object))throw new TypeError("Cannot create proxy with a non-object as target or handler");g=function(){d=function(a){throw new TypeError("Cannot perform '"+a+"' on a proxy that has been revoked");}};var h=b;b={get:null,set:null,apply:null,construct:null};for(var f in h){if(!(f in b))throw new TypeError("Proxy polyfill does not support trap '"+f+"'");b[f]=h[f]}var e=this,k=!1;if(b.apply||b.construct|| -c instanceof Function)e=function(){var a=this&&this.constructor===e;d(a?"construct":"apply");if(a&&b.construct)return b.construct.call(this,c,arguments);if(!a&&b.apply)return b.apply(c,this,arguments);if(c instanceof Function)return a?(a=Array.prototype.slice.call(arguments),a.unshift(c),new (c.bind.apply(c,a))):c.apply(this,arguments);throw new TypeError(a?"not a constructor":"not a function");},k=!0;var l=b.get?function(a){d("get");return b.get(this,a,e)}:function(a){d("get");return this[a]},m= -b.set?function(a,c){d("set");return b.set(this,a,c,e)}:function(a,c){d("set");this[a]=c};Object.getOwnPropertyNames(c).forEach(function(a){var b={enumerable:!!Object.getOwnPropertyDescriptor(c,a).enumerable};b.get=l.bind(c,a);b.set=m.bind(c,a);k&&a in e||Object.defineProperty(e,a,b)});Object.seal(c);Object.seal(e);return e};d.a.b=function(c,b){return{proxy:new d.a(c,b),revoke:g}};d.a.revocable=d.a.b;d.Proxy=d.a}})(window); +(function(d){function k(a){return a?"object"==typeof a||"function"==typeof a:!1}if(!d.a){var l=null;d.a=function(a,c){function d(){}if(!k(a)||!k(c))throw new TypeError("Cannot create proxy with a non-object as target or handler");l=function(){d=function(b){throw new TypeError("Cannot perform '"+b+"' on a proxy that has been revoked");}};var f=c;c={get:null,set:null,apply:null,construct:null};for(var g in f){if(!(g in c))throw new TypeError("Proxy polyfill does not support trap '"+g+"'");c[g]=f[g]}"function"== +typeof f&&(c.apply=f.apply.bind(f));var e=this,m=!1,n="function"==typeof a;if(c.apply||c.construct||n)e=function(){var b=this&&this.constructor===e;d(b?"construct":"apply");if(b&&c.construct)return c.construct.call(this,a,arguments);if(!b&&c.apply)return c.apply(a,this,arguments);if(n)return b?(b=Array.prototype.slice.call(arguments),b.unshift(a),new (a.bind.apply(a,b))):a.apply(this,arguments);throw new TypeError(b?"not a constructor":"not a function");},m=!0;var p=c.get?function(b){d("get");return c.get(this, +b,e)}:function(b){d("get");return this[b]},r=c.set?function(b,a){d("set");c.set(this,b,a,e)}:function(a,c){d("set");this[a]=c},q={};Object.getOwnPropertyNames(a).forEach(function(b){m&&b in e||(Object.defineProperty(e,b,{enumerable:!!Object.getOwnPropertyDescriptor(a,b).enumerable,get:p.bind(a,b),set:r.bind(a,b)}),q[b]=!0)});f=!0;Object.setPrototypeOf?Object.setPrototypeOf(e,Object.getPrototypeOf(a)):e.__proto__?e.__proto__=a.__proto__:f=!1;if(c.get||!f)for(var h in a)q[h]||Object.defineProperty(e, +h,{get:p.bind(a,h)});Object.seal(a);Object.seal(e);return e};d.a.b=function(a,c){return{proxy:new d.a(a,c),revoke:l}};d.a.revocable=d.a.b;d.Proxy=d.a}})(window);