-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpolyfill.min.js
More file actions
1 lines (1 loc) · 925 Bytes
/
polyfill.min.js
File metadata and controls
1 lines (1 loc) · 925 Bytes
1
"use strict";window.polyfill=function(){var t=new CustomEvent("polyfillsLoaded",{bubbles:true});var n=false;var r=[];var e=false;var o=function t(n,r,e){var o=n.length;var i=false;if(n.length==0){return r()}n.forEach(function(t){var n=document.createElement("script");n.onload=function(){if(i){return}if(!--o){r()}};n.onerror=function(){if(i){return}e();i=true};n.src=t;document.head.insertBefore(n,document.head.firstChild)})};var i=function(){requestAnimationFrame(function(){document.dispatchEvent(t)})};var f=function(t,f){if(n){return}n=true;o(r,function(){if(t){t()}if(!e){i()}},function(){n=false;if(f){f()}throw new Error("Failed to load required polyfills")})};var a=function(){e=true};var u=function(t){if(Object.prototype.toString.call(t)==="[object Array]"){t.forEach(function(t){r.push(t)});return}r.push(t)};return{delayEvent:a,fireEvent:i,load:f,addPolyfill:u,test:function(t){t.call({addPolyfill:u});f()}}}();