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 | 1x 6x 6x 6x 6x 6x 6x 6x 29x 15x 15x 15x 1x 28x 28x 28x 9x 2x 1x 1x 1x | import { CommonModule } from '@angular/common'; import { Component, OnDestroy, OnInit } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { Observable, Subscription, timer } from 'rxjs'; import { catchError, concatMap, map } from 'rxjs/operators'; import { LogService } from 'src/app/log/log.service'; import { MeasureService } from 'src/shared/services/measure.service'; @Component({ selector: 'app-measure-controls', templateUrl: './measure-controls.component.html', styleUrls: ['./measure-controls.component.scss'], imports: [ CommonModule, FormsModule ] }) export class MeasureControlsComponent implements OnInit, OnDestroy { public captureId = 0; public numFramesCaptured = 0; public isCapturing = false; private captureState?: Subscription; public constructor(private readonly measureService: MeasureService, private readonly logService: LogService) { } public ngOnInit(): void { const isCapturing$ = this.measureService.isCapturing(); const sampleIdx$ = this.measureService.getCurrentSampleIdx(); this.captureState = timer(0, 500).pipe( concatMap(() => isCapturing$), map((result) => { this.isCapturing = result; console.log(this.isCapturing); }), concatMap(() => sampleIdx$), map((result) => { this.numFramesCaptured = result; }), catchError((error: unknown, caught: Observable<void>) => { console.error(error); this.logService.sendErrorLog(`${error}`); return caught; }) ).subscribe(); } public ngOnDestroy(): void { this.captureState?.unsubscribe(); } public captureFrames(): void { this.measureService.startCapture(this.captureId).subscribe( (result) => console.info(result), (error: unknown) => { console.error(error); this.logService.sendErrorLog(`${error}`); } ); } } |