All files / src/app/network/tuio/package-details package-details.component.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 5/5
100% Lines 8/8

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                      1x   2x               2x     2x 1x   1x 1x         2x          
import { Component, OnDestroy, OnInit } from '@angular/core';
import { TuioPackageDetails } from '@reflex/shared-types';
import { Subscription } from 'rxjs';
import { LogService } from 'src/app/log/log.service';
import { TuioService } from 'src/shared/services/tuio.service';
 
@Component({
  selector: 'app-package-details',
  templateUrl: './package-details.component.html',
  styleUrls: ['./package-details.component.scss']
})
export class PackageDetailsComponent implements OnInit, OnDestroy {
 
  public details: TuioPackageDetails = {
    sessionId: 0,
    frameId: 0,
    packageContent: ''
  };
 
  private packageSubscription?: Subscription;
 
  public constructor(private readonly tuioService: TuioService, private readonly logService: LogService) { }
 
  public ngOnInit(): void {
    this.packageSubscription = this.tuioService.getPackages().subscribe((result) => {
      this.details = result;
    }, (error) => {
      const errorText = `${error} - ${JSON.stringify(error, null, 3)}`;
      this.logService.sendErrorLog(errorText);
    });
  }
 
  public ngOnDestroy(): void {
    this.packageSubscription?.unsubscribe();
  }
 
 
}