File size: 1,623 Bytes
9d1e840
938096b
 
9d1e840
 
938096b
9d1e840
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
938096b
9d1e840
938096b
9d1e840
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
938096b
 
9d1e840
 
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
// scripts/app.js

import { initUI } from './ui.js';
import { initChat } from './chat.js';
import { initVideo } from './video.js';

// We now export a single function that the index.html file will call.
export function initializeApp() {
    
    // Make the logger globally available for all modules
    window.logToScreen = (message) => {
        const logContainer = document.getElementById('debug-log');
        if (logContainer) {
            const div = document.createElement('div');
            // Sanitize the message to prevent HTML injection issues
            div.textContent = `> ${message}`; 
            logContainer.appendChild(div);
            logContainer.parentElement.scrollTop = logContainer.parentElement.scrollHeight;
        }
    };

    logToScreen('initializeApp() called. Starting initializations...');

    // Test UI module
    try {
        logToScreen('Attempting to initialize UI...');
        initUI();
        logToScreen('SUCCESS: UI module initialized.');
    } catch (e) {
        logToScreen(`ERROR in initUI: ${e.stack}`);
    }

    // Test Chat module
    try {
        logToScreen('Attempting to initialize Chat...');
        initChat();
        logToScreen('SUCCESS: Chat module initialized.');
    } catch (e) {
        logToScreen(`ERROR in initChat: ${e.stack}`);
    }

    // Test Video module
    try {
        logToScreen('Attempting to initialize Video...');
        initVideo();
        logToScreen('SUCCESS: Video module initialized.');
    } catch (e) {
        logToScreen(`ERROR in initVideo: ${e.stack}`);
    }

    logToScreen('All initializations attempted.');
}