privateuserh commited on
Commit
9d1e840
·
verified ·
1 Parent(s): 938096b

Update scripts/app.js

Browse files
Files changed (1) hide show
  1. scripts/app.js +45 -11
scripts/app.js CHANGED
@@ -1,18 +1,52 @@
1
- // scripts/app.js --- TEST 1
2
 
3
- // We are only importing ui.js to see if it loads correctly.
4
  import { initUI } from './ui.js';
5
- // import { initChat } from './chat.js';
6
- // import { initVideo } from './video.js';
7
 
8
- document.addEventListener('DOMContentLoaded', () => {
9
- // We are only running the UI initialization for this test.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  try {
 
11
  initUI();
12
- window.logToScreen("SUCCESS: ui.js was imported and initialized.");
13
- } catch(e) {
14
- window.logToScreen(`ERROR initializing ui.js: ${e.message}`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
16
- });
17
 
18
- // NOTE: The on-screen logger is now in your index.html, so we don't need it here for this test.
 
 
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
+ }