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
var gdjs;(function(c){const a=new c.Logger("JSON Manager");class i{constructor(n){this._loadedJsons={};this._callbacks={};this._resources=n}setResources(n){this._resources=n}preloadJsons(n,l){const e=this._resources.filter(function(o){return o.kind==="json"&&!o.disablePreload});if(e.length===0)return l(e.length);let t=0;const s=function(o){o&&a.error("Error while preloading a json resource:"+o),t++,t===e.length?l(e.length):n(t,e.length)};for(let o=0;o<e.length;++o)this.loadJson(e[o].name,s)}loadJson(n,l){const r=this._resources.find(function(s){return s.kind==="json"&&s.name===n});if(!r){l(new Error(`Can't find resource with name: "`+n+'" (or is not a json resource).'),null);return}if(this._loadedJsons[n]){l(null,this._loadedJsons[n]);return}{const s=this._callbacks[n];if(s){s.push(l);return}else this._callbacks[n]=[l]}const e=this,t=new XMLHttpRequest;t.responseType="json",t.open("GET",r.file),t.onload=function(){const s=e._callbacks[n];if(!!s){if(t.status!==200){for(const o of s)o(new Error("HTTP error: "+t.status+"("+t.statusText+")"),null);delete e._callbacks[n];return}e._loadedJsons[n]=t.response;for(const o of s)o(null,t.response);delete e._callbacks[n]}},t.onerror=function(){const s=e._callbacks[n];if(!!s){for(const o of s)o(new Error("Network error"),null);delete e._callbacks[n]}},t.onabort=function(){const s=e._callbacks[n];if(!!s){for(const o of s)o(new Error("Request aborted"),null);delete e._callbacks[n]}},t.send()}isJsonLoaded(n){return!!this._loadedJsons[n]}getLoadedJson(n){return this._loadedJsons[n]||null}}c.JsonManager=i})(gdjs||(gdjs={}));