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

steploop

v1.0.1

Published

a foundation for building loops that execute at a consistent, specified rate

Readme

About steploop

steploop is a fully-featured main-loop written in TypeScript with no additional dependencies. It provides a strong foundation for building loops that execute at a consistent, specified rate, inspired by game engine main-loops like Godot's MainLoop or Unity's Update() loop.

steploop provides a structured lifecycle with methods that can be overridden to implement custom behavior.

The StepLoop class manages the timing and execution flow, supporting both fixed-step updates via setTimeout() and smoother, display-synchronized updates using window.requestAnimationFrame().

Install

Install steploop via NPM:

npm i steploop

Import the StepLoop class in your TypeScript or JavaScript file:

import { StepLoop } from "steploop";

Basic Usage

To define a new loop, extend the StepLoop class and override its methods to implement custom behavior.

import { StepLoop } from "steploop";

class App extends StepLoop {
  override initial(): void {
    console.log("Loop starting");
  }

  override step(): void {
    console.log(`Executing step: ${this.get_step()}`);
  }

  override final(): void {
    console.log("Loop finished");
  }
}

// Create a new loop that runs at 60 steps-per-second for 100 steps
const app = new App(60, 100);
app.start();

To see a StepLoop in action and play with execution, check out the demo page or the demo code.

Lifecycle

The StepLoop class executes in three distinct stages, with hooks that can be overridden to add custom logic:

  1. Initialization: Runs once at the beginning of the loop
    • initial(): Runs once at the beginning of the loop.
  2. Looping: The core of the loop, which repeatedly executes the following sequence:
    • background(): Runs asynchronously at the beginning of each step.
    • before(): Runs before the main step() method.
    • step(): The main update function for your loop.
    • after(): Runs after the step() method.
  3. Termination: Runs once when the loop ends, either by reaching the end of its lifespan or being manually stopped
    • final(): Runs once when the loop ends.

The loop can run indefinitely or for a set number of steps, and its execution can be precisely controlled, allowing it to be paused, resumed, and dynamically modified at runtime.

Reference

For full documentation of the module and its methods, please see the Documentation page.

License

steploop is released under the MIT license. For more information, see the repository's LICENSE file.