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

npmgpm

v2.0.11

Published

H5项目性能监控

Readme

功能

H5项目-性能监控

   1、获取设备、网络、运行时长情况;
   2、页面加载各项指标和详情;
   3、Webview、WebGL内存统计;
   4、Cocos渲染性能、内存占用详情;
   5、http请求的资源详情

安装

npm i npmgpm

导入

import { performanceMonitoring, PerformanceEnum } from 'npmgpm';

调用


// 性能监控
performanceMonitoring.setCallBackReport((str: string) => {
    GMain.DataCollection.traceEvent('PerformanceMonitoring', str);
});
performanceMonitoring.start({
    url: CONFIG_LOCAL_GATE_LIST?.[0], //http、websocket的地址【用于监控网络延时】
    visible: DEBUG >= ENV.LOCAL, //面板是否显示
    projectName: '埃及Slots', //项目名
    reportCondition: CC_PREVIEW ? '' : `${PerformanceEnum.fps}<20&&${PerformanceEnum.runTime}>120`, //上报条件
    reportInterval: 60, //上报时间间隔,缺省10,单位:s
});

// 显示面板
performanceMonitoring.show();

// 隐藏面板(数据仍然监控中,仅不显示面板)
performanceMonitoring.hide();

//获取数据
performanceMonitoring.getData();

//添加自定义数据[Loading、切换场景]
performanceMonitoring.appendData({ loading: 2000 });

兼容性

[浏览器]:https://developer.mozilla.org/zh-CN/docs/Web/API/PerformanceTiming#%E6%B5%8F%E8%A7%88%E5%99%A8%E5%85%BC%E5%AE%B9%E6%80%A7

Cocos Creator v2.4.0以上版本

注意事项

1、appendData方法中,自定义的key名,必须为英文,不在PerformanceEnum中;
2、hide方法,仅仅只是隐藏面板,但数据仍在监控中;
3、Cocos项目,使用了该包后,左下角的调试面板不再展示;

缺陷

1、从未加载、使用的子图,原始路径统计不出来;
2、只有加载该Bundle之后,该Bundle下的资源才能获取到完整、正确原始路径;
3、非resources && 默认Bundle中的资源,也找不到原始路径;

版本更新

--- v1.1.1 1) (优化)删除部分日志[服务器上传字符限制];

--- v1.0.13 1)(优化)Cocos统计内存时,剔除已经释放的资源; 2)(添加)触发上报条件的回调;