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

@perfectum/client

v1.3.1

Published

Library for measuring client performance metrics

Readme

Perfectum Client

Library for measuring client performance metrics :rocket:

Features

  • Using the latest APIs for better performance measurement :dart:
  • Measure only user-centric performance metrics :man:
  • Minimal impact on application performance :zap:
  • Small library size (< 3Kb gzip) :fire:

Built With

Collected Metrics

Installation

yarn add @perfectum/client

Usage

import Perfectum from '@perfectum/client';

Perfectum.init({
  sendMetricsUrl: 'http://example.com/metrics',
  sendMetricsData: {
      app: 'example',
      env: 'production'
  },
  sendMetricsCallback: (metrics) => {
    const data = JSON.stringify(metrics);

    window.navigator.sendBeacon('http://example.com/metrics', data);
  },
  maxPaintTime: 15000
});

By default, before the user closes the page (unload event), the Perfectum will send an object with the collected metrics to the address specified in the sendMetricsUrl property.

If you need to add data to the resulting object with collected metrics, for example, the name of the application or the type of environment, you can specify the object with additional data in the sendMetricsData property.

If you want to implement your own logic for sending the collected metrics, you can specify a callback in the sendMetricsCallback property that will be called before the user closes the page (unload event). When calling a callback, an object with collected metrics will be passed as an argument.

If you want to filter paint performance metrics such as First Paint, First Contentful Paint, Largest Contentful Paint, you can set the maxPaintTime property(in milliseconds). By default, it is set to 60 seconds.

Custom Metrics

Custom metrics are the ability to measure the performance of individual elements on a page or the operations performed in your project. These metrics are necessary to provide the most accurate picture of how users perceive the performance of your application. There are two approaches to measuring custom metrics:

Measurement at the initialization stage of the application

At this stage, we may need to measure the time of appearance of the most important page elements on the user's screen, such as a hero image, cta button, lead form etc. For this type of measurement, you need to add the elementtiming attribute to the HTML element whose performance or time of appearance on the page you would like to measure.

<h1 elementtiming="metric-name">Example App</h1>

Measurement at the stage of interaction with the application

At this stage, we may need to measure the performance of the priority task, the time spent on an important request, or the rendering of specific page components. For this type of measurement, you need to use the special interface provided in the form of two static methods, startMeasure and stopMeasure.

import Perfectum from '@perfectum/client';

Perfectum.startMeasure('metric-name');

someKindOfImportantTask();

Perfectum.stopMeasure('metric-name');