@@ -14,12 +14,46 @@ import { init } from '@qmonitor/browser';
1414
1515init ({
1616 url: ' http://localhost:8083/reportData' ,
17- appName: ' 直客 ' ,
18- appID: ' zhike ' ,
17+ appName: ' 七猫 ' ,
18+ appID: ' qimao ' ,
1919 cacheNum: 10 ,
2020 vue: {
2121 Vue,
2222 router
2323 }
2424});
2525```
26+
27+ ## api
28+ ``` js
29+ {
30+ url?: string; // 上报地址
31+ appID?: string; // 项目ID
32+ appName?: string; // 项目名称
33+ userID?: string; // 用户ID
34+ cacheNum?: number; // 缓存数据
35+ sample?: number; // 采样率
36+ vue?: { // vue项目需要
37+ Vue?: VueInstance,
38+ router?: VueRouter
39+ }
40+ disabledConsoleError?: boolean; // 是否禁止监控 控制台错误, 默认是false
41+ disabledJsError?: boolean; // 是否禁止监控 JsError, 默认是false
42+ disabledPromiseError?: boolean; // 是否禁止监控 PromiseError, 默认是false
43+ disabledResourceError?: boolean; // 是否禁止监控 资源加载错误, 默认是false
44+ disabledFirstPaint?: boolean; // 是否禁止监控 首次绘制, 默认是false
45+ disabledFirstContentfulPaint?: boolean; // 是否禁止监控 首次有效绘制, 默认是false
46+ disabledLargestContentfulPaint?: boolean; // 是否禁止监控 最大内容绘制, 默认是false
47+ disabledFirstInputDelay?: boolean; // 是否禁止监控 首次输入延迟, 默认是false
48+ disabledCumulativeLayoutShift?: boolean; // 是否禁止监控 绘画偏移分数, 默认是false
49+ disabledNavigation?: boolean; // 是否禁止监控 页面关键时间点, 默认是false
50+ disabledResource?: boolean; // 是否禁止监控 资源文件, 默认是false
51+ disabledFetch?: boolean; // 是否禁止监控 api, 默认是false
52+ disabledXhr?: boolean; // 是否禁止监控 api, 默认是false
53+ disabledFirstMeaningPaint? : boolean; // 是否禁止监控 首次有效绘制, 默认是false
54+ // 钩子方法
55+ configReportXhr? (xhr: XMLHttpRequest , reportData: any): void // 钩子函数,配置发送到服务端的xhr, 一般浏览器使用beacon, 所以用不到
56+ beforeDataReport? (event : ReportBaseInfo): Promise < ReportBaseInfo | CANCEL > | ReportBaseInfo | any | CANCEL // 在每次发送事件前会调用, 可自定义对上传数据进行更改
57+ beforeAppAjaxSend? (config: IRequestHeaderConfig, setRequestHeader: IBeforeAppAjaxSendConfig): void // 拦截用户页面的ajax请求,并在ajax请求发送前执行该hook
58+ }
59+ ```
0 commit comments