@aller/blink
Version:
A library for tracking user behaviour.
25 lines (24 loc) • 733 B
TypeScript
import { ScreenEvent } from '../reducers/screen';
export interface TimeEvent {
type: 'start' | 'stop' | 'show' | 'hide';
time: Date;
}
/**
* Checks if there is a stop time present.
*/
export declare function hasFinalStopTime(times: TimeEvent[]): boolean;
/**
* Sets any values that are unrealistically high to zero.
*/
export declare function discardUnrealisticallyHighInscreen(inscreenTime: number): number;
export interface EventTimeInput {
times: TimeEvent[];
screenEvents?: ScreenEvent[];
now?: Date;
maxIdleTime?: number;
}
/**
* Calculates the total inscreen time in milliseconds from
* a list of start and end times.
*/
export declare function calculateEventTime(input: EventTimeInput): number;