whitch-frontend-monitor
Version:
前端监控系统 - 一个轻量级的前端监控SDK
45 lines (44 loc) • 879 B
TypeScript
/**
* 网络请求监控模块
*/
export interface NetworkInfo {
type: string;
method: string;
url: string;
status: number;
duration: number;
success: boolean;
timestamp: number;
error?: string;
response?: any;
}
declare global {
interface XMLHttpRequest {
_method?: string;
_url?: string;
}
}
export declare class NetworkMonitor {
private static networkList;
private static reporter;
/**
* 初始化网络请求监控
*/
static init(): void;
/**
* 监控XMLHttpRequest请求
*/
private static initXHRMonitor;
/**
* 监控Fetch请求
*/
private static initFetchMonitor;
/**
* 获取网络请求监控数据
*/
static getNetworkData(): NetworkInfo[];
/**
* 清空网络请求数据
*/
static clearNetworkData(): void;
}