You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constgetUrl=(url)=>fetch(url);constqS=(selector)=>document?.querySelector(selector);// Shim the above if the below runs in a unsupported environment it is ES2015 intentional.varmodule=(function(){constCls=function(){this._modules={};};Cls.prototype.define=function(key,obj){/* */console.info(`module: Define '${key}'`);this._modules[key]=obj;returnthis;};Cls.prototype.require=function(key){returnthis._modules[key];}constins=newCls();returnins;})();module.define('load',(function(){constCls=function(){this._thens=[];this._cache=[];this._resolved=false;this._rejected=false;this._ready=true;this._urls=[];this._resolved_args=undefined;this._rejected_args=undefined;this._load_num=0;this._loaded_num=0;};Cls.prototype.then=function(f1,f2){if(this._resolved){if(this._load_num>this._loaded_num)returnthis;if(typeoff1==='function')f1.apply(undefined,this._resolved_args);returnthis;}if(this._rejected){if(this._load_num>this._loaded_num)returnthis;if(typeoff2==='function')f2.apply(undefined,this._rejected_args);returnthis;}this._thens.push({num: this._load_num,f1: f1,f2: f2});returnthis;};Cls.prototype.done=function(f){returnthis.then(f,undefined);};Cls.prototype.fail=function(f){returnthis.then(undefined,f);};Cls.prototype.resolve=function(){this._resolved_args=arguments;this._resolved=true;while(this._thens.length>0){if(this._thens[0].num>this._loaded_num)returnthis.ready();letfs=this._thens.splice(0,1)[0];if(typeoffs.f1==='function')fs.f1.apply(undefined,this._resolved_args);}returnthis.ready();};Cls.prototype.reject=function(){this._rejected_args=arguments;this._rejected=true;while(this._thens.length>0){if(this._thens[0].num>this._loaded_num)returnthis;letfs=this._thens.splice(0,1)[0];if(typeoffs.f2==='function')fs.f2.apply(undefined,this._rejected_args);}returnthis;};Cls.prototype.ready=function(){if(this._urls.length>0){leturl=this._urls.splice(0,1)[0];this._ready=true;returnthis.load(url);}this._ready=true;returnthis;};Cls.prototype.load=function(url){this._load_num++;if(!this._ready){this._urls.push(url);returnthis;}this._loaded_num++;this._resolved=false;this._rejected=false;this._ready=false;constme=this;/* */console.info(`load: ${url}`);if(/^.+\.css\s*$/i.test(url)){if(qS(`link[href="${url}"`).length<=0){qS('<link rel="stylesheet" type="text/css"/>').attr('href',url).appendTo(qS('head'));this.resolve();}}else{getUrl(url).then(function(){me.resolve.apply(me,arguments);}).catch(function(){me.reject.apply(me,arguments);});}returnthis;};constFunc=function(url){letins=newCls();returnins.load(url);};returnFunc;})());
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: