Experience


Experience -1){ resolveUrl = resolveUrl.replace(‘https://API_URL/’, window.jimuConfig.arcgisJsApiUrl); } if(//$/.test(resolveUrl) || /.css$/.test(resolveUrl) || /.json$/.test(resolveUrl) || /.wasm$/.test(resolveUrl)){ return resolveUrl; } if(!/.js$/.test(resolveUrl)){ resolveUrl = resolveUrl + ‘.js’; } return resolveUrl; }; const existingGetRegisterHook = SystemJS.constructor.prototype.getRegister; SystemJS.constructor.prototype.getRegister = function () { let register = existingGetRegisterHook.apply(this, arguments); // update the setter function to support default export return [register[0], function (_export) { const result = register[1](_export); if(result.setters){ result.setters = result.setters.map(function(s){ return function(ns) { s(ns.__useDefault ? ns.default : ns) } }) } return result; }]; }; const existingInstantiateHook = SystemJS.constructor.prototype.instantiate; SystemJS.constructor.prototype.instantiate = function (url, parentUrl) { // for translated files, still use define function, use a simple define function to load. if(/translations/(.+).js$/.test(url)){ return window.fetch(url).then(function(res){return res.text();}).then(function(source){ let oldDefine = window.define; var i18nMessage = {}; window.define = function(o){ i18nMessage = o; } scriptExec(source, url); const reg = [[], function (_export) { _export({ default: i18nMessage, __useDefault: true }); return { setters: [], execute: function () { _export(‘default’, i18nMessage); } }; }] window.define = oldDefine; return reg; }); } // for css, we load as an link tag if(/.css$/.test(url)){ return loadCSS(url).then(function(){ const m = function(){}; const reg = [[], function (_export) { _export({ default: m, __useDefault: true }); return { setters: [], execute: function () { _export(‘default’, m); } }; }] return reg; }) } // for API module, we use API module loader if(url.indexOf(window.jimuConfig.arcgisJsApiUrl) === 0 && url !== window.jimuConfig.arcgisJsApiUrl + ‘init.js’){ let amdPath = url.replace(window.jimuConfig.arcgisJsApiUrl, ”); amdPath = amdPath.replace(/.js$/, ”); return new Promise(function(resolve, reject){ window.require([amdPath], function(m){ const reg = [[], function (_export) { _export({ default: m, __useDefault: true }); return { setters: [], execute: function () { _export(‘default’, m); } }; }] resolve(reg); }) }); } let existingResult = existingInstantiateHook.apply(this, arguments); return existingResult; }; function loadCSS(url) { var waitSeconds = 100; var head = document.getElementsByTagName(‘head’)[0]; var isWebkit = !!window.navigator.userAgent.match(/AppleWebKit/([^ ;]*)/); var webkitLoadCheck = function(link, callback) { setTimeout(function() { for (var i = 0; i

Leave a Comment

Your email address will not be published.

Translate »