Avoid nested function declarations
Not supported in older browsers, e.g. iOS 9.
This commit is contained in:
parent
255fbe0c9e
commit
493ad1a24b
|
@ -1169,7 +1169,7 @@ var loader;
|
||||||
// <script type="module"> support
|
// <script type="module"> support
|
||||||
var anonSources = {};
|
var anonSources = {};
|
||||||
if (typeof document != 'undefined' && document.getElementsByTagName) {
|
if (typeof document != 'undefined' && document.getElementsByTagName) {
|
||||||
function handleError(err) {
|
var handleError = function(err) {
|
||||||
// dispatch an error event so that we can display in errors in browsers
|
// dispatch an error event so that we can display in errors in browsers
|
||||||
// that don't yet support unhandledrejection
|
// that don't yet support unhandledrejection
|
||||||
if (window.onunhandledrejection === undefined) {
|
if (window.onunhandledrejection === undefined) {
|
||||||
|
@ -1195,9 +1195,9 @@ if (typeof document != 'undefined' && document.getElementsByTagName) {
|
||||||
|
|
||||||
// throw so it still shows up in the console
|
// throw so it still shows up in the console
|
||||||
throw err;
|
throw err;
|
||||||
}
|
};
|
||||||
|
|
||||||
function ready() {
|
var ready = function() {
|
||||||
document.removeEventListener('DOMContentLoaded', ready, false );
|
document.removeEventListener('DOMContentLoaded', ready, false );
|
||||||
|
|
||||||
var anonCnt = 0;
|
var anonCnt = 0;
|
||||||
|
@ -1223,7 +1223,7 @@ if (typeof document != 'undefined' && document.getElementsByTagName) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// simple DOM ready
|
// simple DOM ready
|
||||||
if (document.readyState === 'complete')
|
if (document.readyState === 'complete')
|
||||||
|
@ -1263,12 +1263,12 @@ BrowserESModuleLoader.prototype[RegisterLoader$1.resolve] = function(key, parent
|
||||||
|
|
||||||
function xhrFetch(url, resolve, reject) {
|
function xhrFetch(url, resolve, reject) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
function load(source) {
|
var load = function(source) {
|
||||||
resolve(xhr.responseText);
|
resolve(xhr.responseText);
|
||||||
}
|
};
|
||||||
function error() {
|
var error = function() {
|
||||||
reject(new Error('XHR error' + (xhr.status ? ' (' + xhr.status + (xhr.statusText ? ' ' + xhr.statusText : '') + ')' : '') + ' loading ' + url));
|
reject(new Error('XHR error' + (xhr.status ? ' (' + xhr.status + (xhr.statusText ? ' ' + xhr.statusText : '') + ')' : '') + ' loading ' + url));
|
||||||
}
|
};
|
||||||
|
|
||||||
xhr.onreadystatechange = function () {
|
xhr.onreadystatechange = function () {
|
||||||
if (xhr.readyState === 4) {
|
if (xhr.readyState === 4) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ var loader;
|
||||||
// <script type="module"> support
|
// <script type="module"> support
|
||||||
var anonSources = {};
|
var anonSources = {};
|
||||||
if (typeof document != 'undefined' && document.getElementsByTagName) {
|
if (typeof document != 'undefined' && document.getElementsByTagName) {
|
||||||
function handleError(err) {
|
var handleError = function(err) {
|
||||||
// dispatch an error event so that we can display in errors in browsers
|
// dispatch an error event so that we can display in errors in browsers
|
||||||
// that don't yet support unhandledrejection
|
// that don't yet support unhandledrejection
|
||||||
if (window.onunhandledrejection === undefined) {
|
if (window.onunhandledrejection === undefined) {
|
||||||
|
@ -37,7 +37,7 @@ if (typeof document != 'undefined' && document.getElementsByTagName) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ready() {
|
var ready = function() {
|
||||||
document.removeEventListener('DOMContentLoaded', ready, false );
|
document.removeEventListener('DOMContentLoaded', ready, false );
|
||||||
|
|
||||||
var anonCnt = 0;
|
var anonCnt = 0;
|
||||||
|
@ -103,10 +103,10 @@ BrowserESModuleLoader.prototype[RegisterLoader.resolve] = function(key, parent)
|
||||||
|
|
||||||
function xhrFetch(url, resolve, reject) {
|
function xhrFetch(url, resolve, reject) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
function load(source) {
|
var load = function(source) {
|
||||||
resolve(xhr.responseText);
|
resolve(xhr.responseText);
|
||||||
}
|
}
|
||||||
function error() {
|
var error = function() {
|
||||||
reject(new Error('XHR error' + (xhr.status ? ' (' + xhr.status + (xhr.statusText ? ' ' + xhr.statusText : '') + ')' : '') + ' loading ' + url));
|
reject(new Error('XHR error' + (xhr.status ? ' (' + xhr.status + (xhr.statusText ? ' ' + xhr.statusText : '') + ')' : '') + ' loading ' + url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue