Spaces:
Running
Running
| // 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.'); | |
| } |