Spaces:
Running
Running
Update scripts/app.js
Browse files- scripts/app.js +45 -11
scripts/app.js
CHANGED
@@ -1,18 +1,52 @@
|
|
1 |
-
// scripts/app.js
|
2 |
|
3 |
-
// We are only importing ui.js to see if it loads correctly.
|
4 |
import { initUI } from './ui.js';
|
5 |
-
|
6 |
-
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
try {
|
|
|
11 |
initUI();
|
12 |
-
|
13 |
-
} catch(e) {
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
-
});
|
17 |
|
18 |
-
|
|
|
|
1 |
+
// scripts/app.js
|
2 |
|
|
|
3 |
import { initUI } from './ui.js';
|
4 |
+
import { initChat } from './chat.js';
|
5 |
+
import { initVideo } from './video.js';
|
6 |
|
7 |
+
// We now export a single function that the index.html file will call.
|
8 |
+
export function initializeApp() {
|
9 |
+
|
10 |
+
// Make the logger globally available for all modules
|
11 |
+
window.logToScreen = (message) => {
|
12 |
+
const logContainer = document.getElementById('debug-log');
|
13 |
+
if (logContainer) {
|
14 |
+
const div = document.createElement('div');
|
15 |
+
// Sanitize the message to prevent HTML injection issues
|
16 |
+
div.textContent = `> ${message}`;
|
17 |
+
logContainer.appendChild(div);
|
18 |
+
logContainer.parentElement.scrollTop = logContainer.parentElement.scrollHeight;
|
19 |
+
}
|
20 |
+
};
|
21 |
+
|
22 |
+
logToScreen('initializeApp() called. Starting initializations...');
|
23 |
+
|
24 |
+
// Test UI module
|
25 |
try {
|
26 |
+
logToScreen('Attempting to initialize UI...');
|
27 |
initUI();
|
28 |
+
logToScreen('SUCCESS: UI module initialized.');
|
29 |
+
} catch (e) {
|
30 |
+
logToScreen(`ERROR in initUI: ${e.stack}`);
|
31 |
+
}
|
32 |
+
|
33 |
+
// Test Chat module
|
34 |
+
try {
|
35 |
+
logToScreen('Attempting to initialize Chat...');
|
36 |
+
initChat();
|
37 |
+
logToScreen('SUCCESS: Chat module initialized.');
|
38 |
+
} catch (e) {
|
39 |
+
logToScreen(`ERROR in initChat: ${e.stack}`);
|
40 |
+
}
|
41 |
+
|
42 |
+
// Test Video module
|
43 |
+
try {
|
44 |
+
logToScreen('Attempting to initialize Video...');
|
45 |
+
initVideo();
|
46 |
+
logToScreen('SUCCESS: Video module initialized.');
|
47 |
+
} catch (e) {
|
48 |
+
logToScreen(`ERROR in initVideo: ${e.stack}`);
|
49 |
}
|
|
|
50 |
|
51 |
+
logToScreen('All initializations attempted.');
|
52 |
+
}
|