createInitializationTracker
Creates an observable that tracks component initialization progress.
This function returns an observable that emits when all expected components have been initialized. It uses the scan operator to accumulate initialization events and emits true when the count reaches the expected total.
Presentation
function createInitializationTracker (
eventBus: EventBus ,
expectedCount: number,
): Observable<boolean>;Returns
Observable<boolean> -Observable
Parameters
| Name | Type | Description |
|---|---|---|
| eventBus | | The event bus instance to subscribe to |
| expectedCount | number | Total number of components expected to initialize |
Example usage
const eventBus = inject(EventBus );
const totalComponents = 5; // 1 dynamic-form + 2 pages + 1 row + 1 group
const allInitialized$ = createInitializationTracker (eventBus, totalComponents);
allInitialized$.subscribe(isComplete => {
if (isComplete) {
console.log('All components are initialized!');
}
});