import type { INSMSession } from './insm-session'; import type { Measure } from './types'; export declare class PeriodTracking { private periodMeasurements; /** * On creation - this is set to the currently running sessions features, * and is updated throughout the period for any additional features triggered. * It is reset when starting a new period. */ private latestPeriodFeatures; private latestHeavyTasks; state: 'inactive' | 'active'; pauses: Set; /** * Warning: this can be reset mid period when pausing/resuming. * It's intended use is to build the `periodMeasurements` duration. */ private currentPeriodStart; private session; constructor(session: INSMSession); startFeature(featureName: string): void; startHeavyTask(heavyTaskName: string): void; endHeavyTask(heavyTaskName: string): void; /** * Sets a pause based on a key. If this is the first pause, then it will also halt * running interactivity measures, and update the current measurements duration. */ pause(pauseName: string): void; /** * Releases a pause for a key. * * **NOTE**: The session will only resume if this was the only * currently tracked pause key. */ resume(pauseName: string): void; get endResults(): { active: { count: number; duration: number; features: Set; heavyTasks: Set; measurements: { [key: string]: Measure; }; }; inactive: { count: number; duration: number; features: Set; heavyTasks: Set; measurements: { [key: string]: Measure; }; }; } | { active: { features: string[]; heavyTasks: string[]; measurements: { [key: string]: Measure; }; duration: number; count: number; }; inactive: { features: string[]; heavyTasks: string[]; measurements: { [key: string]: Measure; }; duration: number; count: number; }; }; private activeStartListeners; private setupActiveStartInteractionListeners; private activeEndListeners; /** * This works by; * On setup * - starts activity listeners * - on activity received * - possible end active count down started. * 3 animation frames or 3 seconds of inactivity - whichever comes first * - any existing end count down ended */ private activeEndCountDownAbortController; private activeEndCountDownVisibilityListener; private setupEndActiveInteractionListeners; private changePeriodAndTrackLast; }