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 | 1x 4x 4x 4x 4x 2x 2x 2x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x | import { CommonModule, DatePipe } from '@angular/common'; import { Component, Input } from '@angular/core'; import { CompleteInteractionData, Interaction } from '@reflex/shared-types'; @Component({ selector: 'app-interactions', templateUrl: './interactions.component.html', styleUrls: ['./interactions.component.scss'], imports: [CommonModule] }) export class InteractionsComponent { public interactions: CompleteInteractionData = { raw: [], absolute: [], normalized: [] }; public calibratedInteractions: Array<Interaction> = []; private pIsProcessing = false; private readonly datePipe: DatePipe = new DatePipe('en-US', '+0000'); public get isProcessing(): boolean { return this.pIsProcessing; } @Input() public set isProcessing(value: boolean) { this.pIsProcessing = value; if (!this.pIsProcessing) { this.interactions = { raw: [], absolute: [], normalized: [] }; } } public getTime(ticks: number): string { // ticks are in nanotime; convert to microtime const ticksToMicrotime = Math.floor(ticks / 10000); // ticks are recorded from 1/1/1; get microtime difference from 1/1/1/ to 1/1/1970 const epochMicrotimeDiff = 62135596800000; // new date is ticks, converted to microtime, minus difference from epoch microtime const tickDate = ticksToMicrotime - epochMicrotimeDiff; const resultDate = new Date(tickDate); return this.datePipe.transform(resultDate.getTime(), 'HH:mm:ss.SSS') as string; } public updateInteractions(interactions: CompleteInteractionData): void { const maxItems = Math.min(interactions.raw.length, 10); this.interactions.raw = interactions.raw.slice(0, maxItems); this.interactions.normalized = interactions.normalized.slice(0, maxItems); this.interactions.absolute = interactions.absolute.slice(0, maxItems); } } |