1.1.1 • Published 7 months ago

wrong-report v1.1.1

Weekly downloads
-
License
-
Repository
-
Last release
7 months ago

wrong-report

监控前端js报错、静态资源加载、promise的错误信息以及FP、FCP、LCP数据,并通过图片上报错误信息(目前还在测试优化阶段)。

    JS报错,
    静态资源加载报错,
	FP、FCP、LCP,

安装//Install

	npm install wrong-report --save

ES6

	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)}`				   
1.1.1

7 months ago

1.1.0

7 months ago

1.0.1

1 year ago

1.0.0

1 year ago