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

speed-beat

v1.2.0

Published

Speed counter made easy

Readme

speed-beat

Speed counter made easy

Install

npm i speed-beat

Usage as interval Beat

Start to track many resource and, every timer second execute the chrono function!

const { speedBeat } = require('speed-beat)

const speedTracker = speedBeat({ timer: '1s' })

// the chrono functions are executed every `timer` ms
speedTracker.chrono('john', doSomething)
speedTracker.chrono('bolt', doSomething)
speedTracker.chrono('heavy', doSomething)

// register the speed for each rider adding 1 unit by default
setInterval(() => { speedTracker.lap('john') }, 300)
setInterval(() => { speedTracker.lap('bolt') }, 50)

// you can pass a number value for faster rider
setInterval(() => { speedTracker.lap('heavy', 15) }, 600)

function doSomething (id, counter, total) {
  console.log(`${id} speed is ${counter} and hit ${total} right now`)
}

Usage as counter

You will handle when execute the chrono function.

const { speedBeat } = require('speed-beat)

const speedTracker = speedBeat()

// the chrono functions are executed every `timer` ms
speedTracker.chrono('john', doOnce)
speedTracker.chrono('bolt', doOnce)
speedTracker.chrono('heavy', doOnce)

// register the speed for each rider adding 1 unit by default
setInterval(() => { speedTracker.lap('john') }, 300).unref()
setInterval(() => { speedTracker.lap('bolt') }, 50).unref()

// you can pass a number value for faster rider
setInterval(() => { speedTracker.lap('heavy', 15) }, 600).unref()

setTimeout(speedTracker.finish, 3000)
// you can call .finish many time as you want as well
// setInterval(speedTracker.finish, 3000)

function doOnce (id, counter, total, deltaBeat) {
  console.log(`${id} speed is ${counter} and hit ${total} in ${deltaBeat} ms`)
}

API

  • speedBeat(options): create a speedBeat instance
    • .chrono(id, function): EventEmitter: add a speed element to track
    • .lap(id[, value]): EventEmitter: increment the speed value for the element id. If the id doesn't exist nothing happen
    • .driver(id): EventEmitter: return the speed id element
    • .timer(): return the timer in millisec
    • .finish(): stop the call to the chrono functions

The chrono function will have 4 parameters:

  • id: the name of the speed element
  • counter: the summation of the lap values since the last beat was trigger
  • total: the total amount of lap values
  • deltaBeat: the time in millisec that has passed away since last beat

Options

  • timer: the beat of chrono functions. It can be expressed in milliseconds or as a string in the ms format

License

Copyright Manuel Spigolon, Licensed under MIT.