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

@pmndrs/scheduler

v0.1.0

Published

Framework-agnostic frame scheduler with phases, priorities and FPS throttling — the engine behind react-three-fiber's useFrame.

Readme

@pmndrs/scheduler

A small, standalone, framework-agnostic frame scheduler with phases, priorities, and per-job FPS throttling. One RAF loop, any renderer, no framework required.

  • One RAF loop for your whole app, across multiple roots
  • Phases (start → input → physics → update → render → finish) you can extend at runtime
  • Priorities and cross-job before/after ordering (topological sort)
  • FPS throttling per job, with drop or catch-up semantics
  • Demand (invalidate) and manual (step) frame modes
  • Zero dependencies. Vanilla core pulls in no React.

Status: standalone, port in progress

This is its own package, not a build artifact of another library. It began as the core frame scheduler inside react-three-fiber (the engine behind its useFrame) and is being ported into an independent, framework-agnostic library with its own API, docs, tests, and release cycle. The r3f lineage is where it came from — not something it depends on; the vanilla core ships zero dependencies and no React.

Pre-1.0: the port is ongoing and the API is still settling, but the package is standalone and usable today. Expect refinements before 1.0.

Install

npm install @pmndrs/scheduler

React is an optional peer dependency, only needed for the /react entry.

Vanilla

import { getScheduler } from '@pmndrs/scheduler'

const scheduler = getScheduler()

scheduler.register(
  (state, delta) => {
    // called every frame: state = { time, delta, elapsed, frame }
  },
  { phase: 'update' },
)

No host renderer or setup flag is required — registering a job lazily creates the scheduler's root and starts the loop. If a host (e.g. a <Canvas>) registers later, it adopts jobs already registered.

React

import { useFrame } from '@pmndrs/scheduler/react'

function Spinner() {
  useFrame((state, delta) => {
    // runs every frame
  })
  return null
}

useFrame returns a controls object ({ id, scheduler, step, stepAll, pause, resume, isPaused }) where isPaused is reactive.

Entry points

| Import | Contents | | ------------------------- | ------------------------------------------ | | @pmndrs/scheduler | Scheduler, getScheduler, all types | | @pmndrs/scheduler/react | useFrame + re-exported scheduler + types |

Core ideas

Every register / useFrame call creates a job. Jobs run in named phases (start → input → physics → update → render → finish) that you can extend at runtime, with priorities and before/after dependencies inside each phase. It's a DAG scheduler: you declare ordering, it figures out the sequence — no priority-number guessing.

scheduler.addPhase('ai', { after: 'physics', before: 'update' })

scheduler.register(processInput, { phase: 'input' })
scheduler.register(() => world.step(1 / 60), { phase: 'physics', fps: 60, drop: false })
scheduler.register(updateAI, { phase: 'ai', fps: 20 })
scheduler.register(render, { phase: 'render' })

Documentation

Three guides, roughly in reading order. New here? Start with Concepts — it explains the mental model (jobs, phases, the frame budget) that the API references build on.

  • Concepts — start here. Jobs, phases, the frame budget, FPS throttling, frameloop modes, and the design rationale (why named phases beat priority numbers), ending in a full game-loop example.
  • useFrame Hook — the React API: registration timing, options, controls, examples, and best practices.
  • Scheduler API — the full vanilla surface: roots, phases, job registration & control, frameloop, demand mode, manual stepping, and testing.

Examples

Runnable demos live in examples/ — a vanilla app and a React app. From either directory: pnpm install && pnpm dev.

License

MIT