UNPKG

backtrace-js

Version:

Backtrace.io error reporting tool for client-side applications

56 lines (55 loc) 1.65 kB
import { BacktraceApi } from '@src/backtraceApi'; import { IBacktraceClientOptions } from './backtraceClientOptions'; /** * Handles Backtrace Metrics. */ export declare class BacktraceMetrics { private readonly _backtraceApi; private readonly attributeProvider; private readonly universe; private readonly token; private readonly hostname; private readonly persistenceInterval; private readonly heartbeatInterval; private readonly timestamp; private summedEndpoint; private uniqueEndpoint; private sessionId; private lastActive; constructor(configuration: IBacktraceClientOptions, _backtraceApi: BacktraceApi, attributeProvider: () => object); /** * Handle persisting of session. When called, will create or manage current session. * when appropriate. */ private persistSession; /** * Persist session if page is focused. */ private persistIfFocused; /** * Send POST to unique-events API endpoint */ sendUniqueEvent(): Promise<void>; /** * Send POST to summed-events API endpoint */ sendSummedEvent(metricGroup: string): Promise<void>; private getEventAttributes; /** * Create new sessionId and set local sessionId. */ private createNewSession; /** * Get stored sessionId */ private getSessionId; /** * Get stored time since last page navigation or current time */ private getLastActive; /** * Set time to localStorage "lastActive" and class variable `lastActive`. * @param time Integer seconds since epoch */ private setLastActive; }