-
-
Notifications
You must be signed in to change notification settings - Fork 193
Expand file tree
/
Copy pathloader.js
More file actions
56 lines (51 loc) · 1.78 KB
/
Copy pathloader.js
File metadata and controls
56 lines (51 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// loader.js (for background.html)
function loadScript(src) {
return new Promise((resolve, reject) => {
const script = document.createElement('script');
script.src = src;
script.onload = resolve;
script.onerror = (error) => {
console.error(`Failed to load script: ${src}`, error);
reject(error);
};
document.body.appendChild(script);
});
}
async function loadScriptsInOrder() {
// Core app scripts; SDK is now lazily loaded by background.js when needed
const scripts = [
'./shared/ai/browserModelCatalog.js?v=1',
'./shared/ai/localBrowserLLM.js?v=1',
'./actions/EventFlowSystem.js?v=1',
'./actions/EventFlowEditor.js?v=1',
'./actions/interface.js',
'./dashboard.js',
'./thirdparty/xss.min.js?v=1',
'./libs/objects.js?v=1',
'./libs/colours.js?v=1',
'./spotify.js?v=1',
'./background.js?v=4',
'./db.js?v=1',
'./ai.js?v=2',
'./points.js?v=1',
'./pointsactions.js?v=1'
];
for (const src of scripts) {
try {
await loadScript(src);
console.log(`Successfully loaded: ${src}`);
} catch (error) {
console.error(`Error in script loading sequence at: ${src}`, error);
// Continue loading other scripts even if one fails
}
}
// After all scripts are loaded, specifically initialize the editor and UI logic from dashboard.js
if (typeof window.initDashboardAndEditor === 'function') {
window.initDashboardAndEditor();
}
}
if (document.readyState === "complete" || document.readyState === "interactive") {
loadScriptsInOrder();
} else {
document.addEventListener("DOMContentLoaded", loadScriptsInOrder);
}