From fbc236b2dddef55ec0faf3c769c8a45fbd3c66fa Mon Sep 17 00:00:00 2001 From: willstocks-tech <43744514+willstocks-tech@users.noreply.github.com> Date: Wed, 29 May 2019 13:54:30 +0100 Subject: [PATCH] Add module.exports --- dynamicpolyfill.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dynamicpolyfill.min.js b/dynamicpolyfill.min.js index dc51f80..8ba0197 100644 --- a/dynamicpolyfill.min.js +++ b/dynamicpolyfill.min.js @@ -1 +1 @@ -const pf="https://polyfill.io/v3/polyfill.min.js?features=";function dynamicPolyfill(a,b,d){if("undefined"!==typeof Promise||window.hasOwnProperty("Promise")){var c=[];Array.isArray(a)?a.forEach(function(a){c.push(checking(a))}):c.push(checking(a));c=c.filter(function(a){return void 0!==a}).join(",");loadPolyfill(c,b,d)}else promiFill(a,b,d)}function promiFill(a,b,d){var c=document.createElement("script");c.src=pf+"Promise";document.body.appendChild(c);c.onerror=function(a){console.error("Polyfilling Promise failed",a)};c.onload=function(){dynamicPolyfill(a,b,d)}}function checking(a){if(!0!==window.hasOwnProperty(a)||"function"!==typeof this.check!==!0||!0!==a in this)if(1<=a.indexOf(".")){var b=a.split("."),d="window"===b[0]?b[0]:window[b[0]];b=Object(b[b.length-1]);if(!0!==d.prototype.hasOwnProperty(b)&&!0!==d.hasOwnProperty(b)&&!0!==b in d)return a}else return a}function loadPolyfill(a,b,d){if(""!==a){var c=document.createElement("script");c.src=pf+encodeURIComponent(a);c.onerror=function(a){console.error("Loading the polyfill(s) failed!",a)};c.onload=function(){loadMyScript(b,d)};document.body.appendChild(c)}else loadMyScript(b,d)}function loadMyScript(a,b){if(Array.isArray(a)){var d=[];a.forEach(function(a){d.push(nonblankURL(a))});Promise.all(d).then(function(){initialiseMyScript(b)})["catch"](function(a){return a})}else Array.isArray(a)||null===a||""===a?initialiseMyScript(b):nonblankURL(a).then(function(){initialiseMyScript(b)})["catch"](function(a){return a})}function nonblankURL(a){return new Promise(function(b,d){var c=document.createElement("script");c.src=encodeURI(a);c.onerror=function(a){return d("Loading the script failed!",a)};c.onload=function(){return b(a)};document.body.appendChild(c)})}function initialiseMyScript(a){function b(a){try{(new Function(a))()}catch(c){console.error("There was an error: ",c,c.name,c.stack)}}Array.isArray(a)?a.forEach(function(a){b(a)}):b(a)}; +const pf="https://polyfill.io/v3/polyfill.min.js?features=";function dynamicPolyfill(a,b,d){if("undefined"!==typeof Promise||window.hasOwnProperty("Promise")){var c=[];Array.isArray(a)?a.forEach(function(a){c.push(checking(a))}):c.push(checking(a));c=c.filter(function(a){return void 0!==a}).join(",");loadPolyfill(c,b,d)}else promiFill(a,b,d)}function promiFill(a,b,d){var c=document.createElement("script");c.src=pf+"Promise";document.body.appendChild(c);c.onerror=function(a){console.error("Polyfilling Promise failed",a)};c.onload=function(){dynamicPolyfill(a,b,d)}}function checking(a){if(!0!==window.hasOwnProperty(a)||"function"!==typeof this.check!==!0||!0!==a in this)if(1<=a.indexOf(".")){var b=a.split("."),d="window"===b[0]?b[0]:window[b[0]];b=Object(b[b.length-1]);if(!0!==d.prototype.hasOwnProperty(b)&&!0!==d.hasOwnProperty(b)&&!0!==b in d)return a}else return a}function loadPolyfill(a,b,d){if(""!==a){var c=document.createElement("script");c.src=pf+encodeURIComponent(a);c.onerror=function(a){console.error("Loading the polyfill(s) failed!",a)};c.onload=function(){loadMyScript(b,d)};document.body.appendChild(c)}else loadMyScript(b,d)}function loadMyScript(a,b){if(Array.isArray(a)){var d=[];a.forEach(function(a){d.push(nonblankURL(a))});Promise.all(d).then(function(){initialiseMyScript(b)})["catch"](function(a){return a})}else Array.isArray(a)||null===a||""===a?initialiseMyScript(b):nonblankURL(a).then(function(){initialiseMyScript(b)})["catch"](function(a){return a})}function nonblankURL(a){return new Promise(function(b,d){var c=document.createElement("script");c.src=encodeURI(a);c.onerror=function(a){return d("Loading the script failed!",a)};c.onload=function(){return b(a)};document.body.appendChild(c)})}function initialiseMyScript(a){function b(a){try{(new Function(a))()}catch(c){console.error("There was an error: ",c,c.name,c.stack)}}Array.isArray(a)?a.forEach(function(a){b(a)}):b(a)};module.exports = dynamicPolyfill;