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 🙏

© 2024 – Pkg Stats / Ryan Hefner

pwmetrics-helper

v1.0.0

Published

Helpers for working with the pwmetrics package (using Lighthouse)

Downloads

7

Readme

Helpers for getting values of specific Progressive Web App metrics

The pwmetrics module exposes the ability to get use performance metrics out of Lighthouse. This includes the ability to perform multiple runs. This module provides a simple API on top of pwmetrics for plucking out values of specific metrics.

Install

$ npm install --save pwmetrics-helper

Usage

desiredMetric

The desiredMetric field takes one of the following metrics and will return just that value from the median runs:

  • 'First Contentful Paint'
  • 'First Meaningful Paint'
  • 'Perceptual Speed Index'
  • 'First Visual Change'
  • 'Visually Complete 100%'
  • 'Time to Interactive'
  • 'Visually Complete 85%'

Perform 3 runs (the default) and just return time-to-interactive:

const getMetrics = require('pwmetrics-helper');

getMetrics('https://airhorner.com', {
    desiredMetric: 'Time to Interactive'
}).then(score => {
    // do something with the score
});

Perform 2 runs and just return first-contentful-paint

const getMetrics = require('pwmetrics-helper');

getMetrics('https://airhorner.com', {
    runs: 2,
    desiredMetric: 'First Contentful Paint'
}).then(score => {
    // do something with the FCP
});

Perform 3 runs and return the entire JSON payload from pwmetrics

const getMetrics = require('pwmetrics-helper');

getMetrics('https://airhorner.com').then(data => {
    // do something with the data
});

runs

runs specifies the number of runs of Lighthouse to perform via pwmetrics before a median score is returned. This module generally defaults to 3 runs.

License

Apache 2.0. Google Inc.