wip
This commit is contained in:
parent
59b3c64c55
commit
b111f121ba
9 changed files with 200 additions and 694 deletions
26
src/index.ts
26
src/index.ts
|
|
@ -11,10 +11,10 @@ import { calendarConfig } from './core/CalendarConfig.js';
|
|||
import { CalendarTypeFactory } from './factories/CalendarTypeFactory.js';
|
||||
|
||||
/**
|
||||
* Initialize the calendar application with new state-driven approach
|
||||
* Initialize the calendar application with simple direct calls
|
||||
*/
|
||||
async function initializeCalendar(): Promise<void> {
|
||||
console.log('🗓️ Initializing Calendar Plantempus with state management...');
|
||||
console.log('🗓️ Initializing Calendar Plantempus with simple coordination...');
|
||||
|
||||
// Declare managers outside try block for global access
|
||||
let calendarManager: CalendarManager;
|
||||
|
|
@ -30,30 +30,28 @@ async function initializeCalendar(): Promise<void> {
|
|||
const config = calendarConfig;
|
||||
|
||||
// Initialize the CalendarTypeFactory before creating managers
|
||||
console.log('🏭 Phase 0: Initializing CalendarTypeFactory...');
|
||||
console.log('🏭 Initializing CalendarTypeFactory...');
|
||||
CalendarTypeFactory.initialize();
|
||||
|
||||
// Initialize managers in proper order
|
||||
console.log('📋 Phase 1: Creating core managers...');
|
||||
// Create all managers
|
||||
console.log('📋 Creating managers...');
|
||||
calendarManager = new CalendarManager(eventBus, config);
|
||||
navigationManager = new NavigationManager(eventBus);
|
||||
viewManager = new ViewManager(eventBus);
|
||||
|
||||
console.log('🎯 Phase 2: Creating data and rendering managers...');
|
||||
// These managers will now respond to state-driven events
|
||||
eventManager = new EventManager(eventBus);
|
||||
eventRenderer = new EventRenderer(eventBus);
|
||||
gridManager = new GridManager();
|
||||
scrollManager = new ScrollManager();
|
||||
|
||||
console.log('🏗️ Phase 3: Creating layout managers...');
|
||||
scrollManager = new ScrollManager(); // Will respond to GRID_RENDERED
|
||||
gridManager = new GridManager(); // Will respond to RENDERING_STARTED
|
||||
// Set manager references in CalendarManager
|
||||
calendarManager.setManagers(eventManager, gridManager, eventRenderer, scrollManager);
|
||||
|
||||
// Enable debug mode for development
|
||||
eventBus.setDebug(true);
|
||||
|
||||
// Initialize all managers using state-driven coordination
|
||||
console.log('🚀 Phase 4: Starting state-driven initialization...');
|
||||
await calendarManager.initialize(); // Now async and fully coordinated
|
||||
// Initialize using simple direct calls
|
||||
console.log('🚀 Starting simple initialization...');
|
||||
await calendarManager.initialize();
|
||||
|
||||
console.log('🎊 Calendar Plantempus initialized successfully!');
|
||||
console.log('📊 Initialization Report:', calendarManager.getInitializationReport());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue