npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

web-performance-timing

v2.0.1

Published

web性能检测、错误捕获(Web performance detection, error capture)

Readme

页面性能检测,错误信息捕获

html 直接引入

<html>
<head>
  <meta charset="UTF-8">
  <title>webPerformance</title>
  <script src="http://static.yxlblog.com/js/webPerformance.min.js"></script>
  <script>
    webPerformance({}, function (res) {
      //coding 性能检测和错误上报
    });
  </script>
</head>

npm 引入

import {
    webPerformance
} from 'web-performance-timing'
//性能查看
webPerformance({}, (res) => {
    console.log(res);
})

//vue 使用

Vue.config.errorHandler = function (err, vm, info) {
    //其他的操作自己编辑
    webPerformance.addError({
      msg:err,
    })
}


//react 使用

componentDidCatch(error, info) {
    webPerformance.addError({
      msg:error,
    })
}

  • url 上报页面地址
  • preUrl 来访上一页面 URL
  • performance 页面性能数据详情,字段含义详情请参考后面内容
  • errorList 页面错误信息详情,包含 js,img,ajax,fetch 等所有错误信息,字段含义详情请参考后面内容
  • resoruceList 页面性能数据详情,当前页面所有资源性能详情信息,字段含义详情请参考后面内容
  • markUv 统计 uv 标识
  • markUser 从用户进入网站开始标识,直到用户离开销毁,可以用来做用户漏斗分析
  • time 当前上报时间
  • screenwidth 屏幕宽度
  • screenheight 屏幕高度
  • isFristIn 是否是某次会话的第一次进入
  • type 上报类型 1:页面级性能上报 2:页面 ajax 性能上报 3:页面内错误信息上报

| parameter name | describe | explain | | -------------- | ------------------------------ | ------------------------------- | | url | 上报页面地址 | | | isFristIn | 是否是每次会话的第一次渲染 | 可以用来做首屏渲染性能统计分类 | | screenwidth | 屏幕宽度 | | | screenheight | 屏幕高度 | | | preUrl | 上一页面 | | | | | | | errorList | 错误资源列表信息 | | | t | 资源时间 | | | n | 资源类型 | resource,js,ajax,fetch,other | | msg | 错误信息 | | | method | 资源请求方式 | GET,POST | | resourceUrl | 请求资源路径 | | | col | js 错误行 | | | line | js 错误列 | | | status | ajax 错误状态 | | | text | ajax 错误信息 | | | | | | | performance | 页面资源性能数据(单位均为毫秒) | | | dnst | DNS 解析时间 | | | tcpt | TCP 建立时间 | | | wit | 白屏时间 | | | domt | dom 渲染完成时间 | | | lodt | 页面 onload 时间 | | | radt | 页面准备时间 | | | rdit | 页面重定向时间 | | | uodt | unload 时间 | | | reqt | request 请求耗时 | | | andt | 页面解析 dom 耗时 | |