refactor(components): split components.js into separate files and add loader; app waits for components before init
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
// Main SPORE UI Application
|
||||
|
||||
// Initialize the application when DOM is loaded
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.addEventListener('DOMContentLoaded', async function() {
|
||||
logger.debug('=== SPORE UI Application Initialization ===');
|
||||
|
||||
// Initialize the framework (but don't navigate yet)
|
||||
logger.debug('App: Creating framework instance...');
|
||||
const app = window.app;
|
||||
|
||||
// Wait for components to be ready (loader ensures constructors exist)
|
||||
try {
|
||||
if (typeof window.waitForComponentsReady === 'function') {
|
||||
await window.waitForComponentsReady();
|
||||
}
|
||||
} catch (e) {
|
||||
logger.warn('App: Components loader timeout; proceeding anyway');
|
||||
}
|
||||
|
||||
// Create view models
|
||||
logger.debug('App: Creating view models...');
|
||||
const clusterViewModel = new ClusterViewModel();
|
||||
|
||||
Reference in New Issue
Block a user