argos-tracker
Version:
A lightweight frontend tracking SDK for data collection and reporting
37 lines (36 loc) • 690 B
TypeScript
import { TrackerConfig, TrackEvent } from './types';
/**
* 网络上报器
*/
export declare class Reporter {
private config;
constructor(config: TrackerConfig);
/**
* 上报事件
*/
report(events: TrackEvent[]): Promise<boolean>;
/**
* 使用 fetch 发送数据
*/
private sendFetch;
/**
* 使用 sendBeacon 发送数据
*/
private sendBeacon;
/**
* 格式化上报数据
*/
private formatPayload;
/**
* 处理错误
*/
private handleError;
/**
* 输出日志
*/
private log;
/**
* 更新配置
*/
updateConfig(config: Partial<TrackerConfig>): void;
}