代码拉取完成,页面将自动刷新
监控前端js报错、静态资源加载、promise的错误信息以及FP、FCP、LCP数据,并通过图片上报错误信息(目前还在测试优化阶段)。
JS报错,
静态资源加载报错,
FP、FCP、LCP,
npm install wrong-report --save
import {initReporting} from 'wrong-report'
//使用示例:
initReporting("http://localhost:8080/error")//报错信息提交后台的接口(自己测试的)
//或者
initReporting({
url:"http://localhost:8080/error",
isSupportObserve:true,//是否开启FP、FCP、LCP监控(默认开启)
isSupportJS:true,//是否开启js报错监控(默认开启)
})//报错信息提交后台的接口(自己测试的)
//js上报
new Image().src =
`${this.url}?errorMsg=${encodeURIComponent(errorMsg)}&errorURL=${encodeURIComponent(errorURL)}&errorType=${encodeURIComponent(errorType)}&message=${encodeURIComponent(message)}&locationHref=${encodeURIComponent(location.href)}`;
//FP、FCP、LCP上报
new Image().src =
`${this.url}?entryType=${entryType}&name=${name}&time=${startTime}&locationHref=${encodeURIComponent(location.href)}`
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。