N°6446 Prevent loaded js file constant from being missing if an ajax call is made from a page that's not a Webpage

This commit is contained in:
Stephen Abello
2023-06-27 11:22:10 +02:00
parent 7fc46fbc50
commit 452cc77168

View File

@@ -62,6 +62,26 @@
* ] * ]
* ``` * ```
*/ */
// If these constants aren't defined by the main page, define them (global) ourselves
if (typeof aLoadedJsFilesRegister === "undefined") {
Object.defineProperty(window, "aLoadedJsFilesRegister", {
value: new Map(),
writable: false,
configurable: false,
enumerable: true
});
}
if (typeof aLoadedJsFilesResolveCallbacks === "undefined") {
Object.defineProperty(window, "aLoadedJsFilesResolveCallbacks", {
value: new Map(),
writable: false,
configurable: false,
enumerable: true
});
}
let aJsFilesToLoad = []; let aJsFilesToLoad = [];
/** /**
* @type {Array} aJsFilesToLoadByOtherRequests Files required by the current \AjaxPage but that are already being handled by another request (done or ongoing) * @type {Array} aJsFilesToLoadByOtherRequests Files required by the current \AjaxPage but that are already being handled by another request (done or ongoing)