web-performance-report

0.1.3 • Public • Published

web-performance-report

前端性能上报,包括页面性能、错误上报、资源上报

用法:

import WebPerformance from 'web-performance-report'
 
// 使用 GET 上报到指定地址
WebPerformance({
  url: 'http://sample.com/report',   // 上报的地址
  disabled: false,
  reportError: true,
  reportResource: true
})
 
// 自定义方法上报
WebPerformance({}, (data) => {
  fetch('http://xxx-report.com/report', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(data)
  })
})
 

Readme

Keywords

none

Package Sidebar

Install

npm i web-performance-report

Weekly Downloads

1

Version

0.1.3

License

ISC

Unpacked Size

10.1 kB

Total Files

3

Last publish

Collaborators

  • icoon.li