forked from GoogleChrome/proxy-polyfill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy.min.js
1 lines (1 loc) · 2.29 KB
/
proxy.min.js
1
"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t){if(!t.Proxy){var o=null;t.Reflect={get:function(t,o){return t[o]},set:function(t,o,e){return t[o]=e}},t.Proxy=function(r,n){e(r)&&e(n)||t.Proxy.quiet||console.warn("Cannot create proxy with a non-object as target or handler");var i=function(){};o=function(){i=function(o){t.Proxy.quiet||console.warn("Cannot perform '"+o+"' on a proxy that has been revoked")}};var c=n;for(var p in n={get:null,set:null,apply:null,construct:null},c)p in n||t.Proxy.quiet||console.warn("Proxy polyfill does not support trap '"+p+"'"),n[p]=c[p];"function"==typeof c&&(n.apply=c.apply.bind(c));var f=this,a=!1,y=!1;"function"==typeof r?(f=function(){var t=this&&this.constructor===f,o=Array.prototype.slice.call(arguments);return i(t?"construct":"apply"),t&&n.construct?n.construct.call(this,r,o):!t&&n.apply?n.apply(r,this,o):t?(o.unshift(r),new(r.bind.apply(r,o))):r.apply(this,o)},a=!0):r instanceof Array&&(f=[],y=!0);var s=n.get?function(t){if(i("get"),this[t]instanceof Array&&!this[t].__patched){var o=this[t];["pop","push","shift","unshift","splice","reverse","sort","copyWithin","fill"].forEach(function(e){var r=Array.prototype[e];o[e]=function(){var e=r.apply(o,arguments);return f[t]=Array.from(o),e}}),o.__patched=!0}return n.get(this,t,f)}:function(t){return i("get"),this[t]},u=n.set?function(t,o){n.set(this,t,o,f)}:function(t,o){i("set"),this[t]=o},l=Object.getOwnPropertyNames(r),b={};l.forEach(function(t){if(!((a||y)&&t in f)){var o={enumerable:!!Object.getOwnPropertyDescriptor(r,t).enumerable,get:s.bind(r,t),set:u.bind(r,t)};Object.defineProperty(f,t,o),b[t]=!0}});var h=!0;if(Object.setPrototypeOf?Object.setPrototypeOf(f,Object.getPrototypeOf(r)):f.__proto__?f.__proto__=r.__proto__:h=!1,n.get||!h)for(var v in r)b[v]||Object.defineProperty(f,v,{get:s.bind(r,v)});return Object.seal(f),f},t.Proxy.revocable=function(e,r){return{proxy:new t.Proxy(e,r),revoke:o}},t.Proxy.revocable=t.Proxy.revocable,t.Proxy=t.Proxy}function e(t){return!!t&&("object"===(void 0===t?"undefined":_typeof(t))||"function"==typeof t)}}("undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?global:self);