import { ChangeDetectionStrategy, Component } from '@angular/core'; import { AsyncPipe, DatePipe } from '@angular/common'; import { startWith, switchMap } from 'rxjs'; import { UnixTimePipe } from '@/core/pipes/unix-time.pipe'; import { injectCatalogService } from '@/core/services/catalogs.service'; import { injectWebsocketService, WSEvents } from '@/core/services/websocket.service'; @Component({ standalone: true, imports: [AsyncPipe, UnixTimePipe], providers: [DatePipe], selector: 'app-schedule', templateUrl: './schedule.component.html', styleUrls: ['./schedule.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) export class ScheduleComponent { private catalogServ = injectCatalogService(); schedule$ = injectWebsocketService() .listen(WSEvents.SCHEDULE, ['agenda']) .pipe( startWith(true), switchMap(() => this.catalogServ.getSchedule()) ); }