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

@ant478/fps-meter

v1.0.3

Published

Simple tool for displaying page FPS. ![Preview](docs/images/preview.jpg "Preview")

Downloads

1

Readme

ant478 FPS Meter

Simple tool for displaying page FPS. Preview

Usage

Tool can be installed and used in several ways, depending on situation:

Option 1: NPM

For development and production use:

npm i @ant478/fps-meter

// webpack.config.js
{
  plugins: [
    new CopyPlugin({
      patterns: [{
        from: 'node_modules/@ant478/fps-meter/dist',
        to: '<output-dir>/fps-meter',
      }],
    }),
  ],
}
<!-- index.html -->
<head>
  <script defer src="/fps-meter/index.js"></script>
</head>

For development only use:

npm i @ant478/fps-meter --save-dev

// webpack.config.js
{
  plugins: [
    new HtmlWebpackPlugin({
      templateParameters: {
        isDevelopment,
      },
    }),
    isDevelopment && new CopyPlugin({
      patterns: [{
        from: 'node_modules/@ant478/fps-meter/dist',
        to: '<output-dir>/fps-meter',
      }],
    }),
  ].filter(Boolean),
}
<!-- index.html -->
<head>
  <% if (htmlWebpackPlugin.options.templateParameters.isDevelopment) { %>
    <script defer src="/fps-meter/index.js"></script>
  <% } %>
</head>

Option 2: CDN

<head>
    <!-- same as previous for development and / or production configuration differences -->
    <script defer src="https://cdn.jsdelivr.net/npm/@ant478/fps-meter@latest/dist/index.js"></script>
</head>

Option 3: Console

// in dev tool console
script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/npm/@ant478/fps-meter@latest/dist/index.js';
document.head.appendChild(script);

Configuration

Configuration params:

  • show: Default false. By default FPS meter will be hidden, until manually displayed with API. When show param given, FPS meter will be displayed automatically after page loading is finished.
  • log: Default false. When given, tool will log debug messages to the console.
  • className: Default ''. Class name for the FPS meter element, can be used for applying custom styles.
  • interval: Default 500. Interval (ms) in which FPS value will be recalculated.
  • namespace: Default 'fpsMeter'. A key in window object, in which FPS meter API will be placed.

Tool is configured through setting data-attributes to the script element:

<!-- for html usage -->
<script
  defer
  src="https://cdn.jsdelivr.net/npm/@ant478/fps-meter@latest/dist/index.js"
  data-show
  data-log
  data-class-name="fps-meter-class"
  data-interval="1000"
  data-namespace="fpsMeasurer"
></script>
// for console usage
script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/npm/@ant478/fps-meter@latest/dist/index.js';
script.setAttribute('data-show', '');
script.setAttribute('data-log', '');
script.setAttribute('data-class-name', 'fps-meter-class');
script.setAttribute('data-interval', '1000');
script.setAttribute('data-namespace', 'fpsMeasurer');
document.head.appendChild(script);

API

Tool provides simple API, it is located in window.fpsMeter. Key in window object can be customized using namespace configuration param.

  • window.fpsMeter.show(): Displays the FPS meter element.
  • window.fpsMeter.hide(): Hides the element.