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

zyl-performance-sdk

v1.0.3

Published

利用浏览器的performance进行前端性能数据采集

Readme

页面性能监控sdk

浏览器兼容性

请参考:http://caniuse.com/#feat=nav-timing

优势

  • 浏览器原生支持,准确性高
  • 能够获取到更多的数据,例如DNS解析时间、重定向时间、白屏时间、首屏时间等
  • 支持页面首次渲染时间的采集
  • 可定制化程度高
  • 支持在网页加载完成后进行数据采集和发送,减少页面的性能损耗

使用示例(支持 commonjs 、umd、ES模块引入)

Using npm:

$ npm install zyl-performance-sdk --save

main.js入口文件引入:

import Performance from 'zyl-performance-sdk'

if (process.env.NODE_ENV === 'production') { // development环境下不建议频繁上报
    new Performance({
      url: 'https://xxx.com/log/', // 上报服务端url
      params: { // params中可以通过post方式传入服务端的额外参数,
        log_level: 'INFO', // 级别
        timestamp: Date.now(), // 上报时间
        application: 'xxx', // 项目名
        platform: 'web', // 平台
        env:  'dev', // 环境
        content: 'content' // 上报页面性能指标字段,可以指定任意字符串类型,默认content字段
      },
    }).start()
}

采集的数据说明

默认情况下脚本将会采集以下数据(详细计算公式可参看采集脚本):

|参数 |类型 |描述 | |:-------------:|:-------------:|:-----:| |t_dns|number|DNS解析时间| |t_tcp|number|服务器连接时间| |t_request|number|服务器响应时间| |t_response|number|网页文档下载时间| |t_firstPaint|number|首屏渲染时间| |t_domready|number|DOM Ready时间(总和)| |t_onload|number|onload时间(总和)| |t_white|number|白屏时间| |t_all|number|全部过程时间| |userAgent|string|浏览器用户代理信息| |appName|string|浏览器名称| |appVersion|string|浏览器版本号| |platform|string|浏览器操作系统或者硬件平台| |href|string|当前页面url| |hostname|string|当前页面域名| |pathname|string|当前页面路劲| |search|string|当前页面携带参数|