Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1x 5x 5x 5x 5x 5x 5x 4x 3x 2x 2x 5x 4x 3x 2x 2x 5x 5x 3x 3x | import { CommonModule } from '@angular/common'; import { Component, OnDestroy, OnInit } from '@angular/core'; import { SettingsGroupComponent } from '@reflex/angular-components/dist'; import { InteractionFrame, InteractionHistory } from '@reflex/shared-types'; import { NEVER, Subscription } from 'rxjs'; import { startWith, switchMap } from 'rxjs/operators'; import { LogService } from 'src/app/log/log.service'; import { ProcessingService } from 'src/shared/services/processing.service'; @Component({ selector: 'app-history', templateUrl: './history.component.html', styleUrls: ['./history.component.scss'], imports: [ CommonModule, SettingsGroupComponent ] }) export class HistoryComponent implements OnInit, OnDestroy { public frames: Array<InteractionFrame> = []; public history: Array<InteractionHistory> = []; private framesSubscription?: Subscription; private historySubscription?: Subscription; public constructor(private readonly processingService: ProcessingService, private readonly logService: LogService) { } public ngOnInit(): void { const frames$ = this.processingService.getFrames(); const history$ = this.processingService.getHistory(); this.framesSubscription = this.processingService.getStatus() .pipe( switchMap((processing) => processing ? frames$ : NEVER.pipe<Array<InteractionFrame>>(startWith([]))) ) .subscribe( (result) => this.updateFrames(result), (error) => { console.error(error); this.logService.sendErrorLog(`${error}`); } ); this.historySubscription = this.processingService.getStatus() .pipe( switchMap((processing) => processing ? history$ : NEVER.pipe<Array<InteractionHistory>>(startWith([]))) ) .subscribe( (result) => this.updateHistory(result), (error) => { console.error(error); this.logService.sendErrorLog(`${error}`); } ); } public ngOnDestroy(): void { this.framesSubscription?.unsubscribe(); this.historySubscription?.unsubscribe(); } private updateFrames(frames: Array<InteractionFrame>): void { this.frames = frames; } private updateHistory(history: Array<InteractionHistory>): void { this.history = history; } } |