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

@hypernym/frame

v0.30.0

Published

Universal Frame Manager.

Downloads

556

Readme

Features

  • Ultra Lightweight & Powerful
  • Framework Independent
  • Written in TypeScript
  • Native SSR Support
  • No External Dependencies
  • API Friendly

Core Concepts

  • Frame Scheduling
  • Dynamic Phases
  • Strict Queue Order
  • Custom Scheduler
  • Frame State
  • Modular Code
  • Type-safe

Installation

pnpm add @hypernym/frame
npm install @hypernym/frame

CDN

ESM (minified)

<script type="module">
  import { createFrame } from 'https://unpkg.com/@hypernym/frame/dist/index.min.js'
  const frame = createFrame()
</script>

IIFE (minified)

<script src="https://unpkg.com/@hypernym/frame/dist/index.iife.js"></script>
<script>
  const { createFrame } = Frame
  const frame = createFrame()
</script>

UMD (minified)

<script src="https://unpkg.com/@hypernym/frame/dist/index.umd.js"></script>
<script>
  const { createFrame } = Frame
  const frame = createFrame()
</script>

Quick Start

Creates a frame manager with the default phase.

import { createFrame } from '@hypernym/frame'

const frame = createFrame()

let index = 0

// Adds a custom process to the `default` phase and enables looping
const process = frame.add(
  (state) => {
    index++
    console.log('Process Loop', index)

    if (index > 100) {
      frame.delete(process)
      console.log('Process Loop: Done!', state)
    }
  },
  { loop: true },
)

Phases always run from the lowest number to the highest.

frame.add(() => console.log('Phase 2: Render'), { phase: 2 })
frame.add(() => console.log('Phase 1: Update'), { phase: 1 })
frame.add(() => console.log('Phase 0: Read'))
frame.add(() => console.log('Phase 2: Render'), { phase: 2 })
frame.add(() => console.log('Phase 0: Read'))
frame.add(() => console.log('Phase 1: Update'), { phase: 1 })

Output:

Phase 0: Read
Phase 0: Read
Phase 1: Update
Phase 1: Update
Phase 2: Render
Phase 2: Render

API

import { createFrame } from '@hypernym/frame'

// Main Frame
const frame = createFrame(options)

// Methods
frame.add(process, options)
frame.delete(process)

// Getters
frame.state

add

  • Type: (process: FrameProcess, options?: FrameProcessOptions): FrameProcess

Adds a specific process to the frame update cycle.

[!NOTE]

By default, the process will be executed only once (phase: 0).

frame.add(process, options)

loop

  • Type: boolean
  • Default: undefined

Specifies whether the phase process should continue to repeat, without stopping after the first execution.

[!NOTE]

Repeating processes need to be removed manually using the frame.delete(process) method.

frame.add((state) => console.log(state), { loop: true })

delete

  • Type: (process?: FrameProcess): void

Deletes a specific process from the frame update cycle.

[!NOTE]

Calling frame.delete() without the process parameter resets the main frame instance, resulting in the deletion of all processes, phases, and state.

frame.delete(process) // Deletes a specific process
frame.delete() // Deletes all processes, phases and resets the frame state

phase

  • Type: number
  • Default: 0

Specifies a custom frame phase.

Phases are processed in ascending numerical order, meaning lower run before higher ones.

frame.add(process, { phase: -1 }) // Runs before 0
frame.add(process) // Default phase is 0
frame.add(process, { phase: 1 }) // Runs after 0
frame.add(process, { phase: 2 }) // Runs after 1
// ...

immediate

  • Type: boolean
  • Default: undefined

Controls the scheduling behavior.

By default, the process is scheduled to the next loop cycle. When enabled, it skips scheduling and executes at the end of the current frame.

let index = 0

frame.add(() => {
  index++
  frame.add(() => index++, { immediate: true })
})
frame.add(() => console.log('Index: ', index), { phase: 1 }) // => Index 2

state

  • Type: object

Provides read‑only info about the frame’s internal state at any given point.

frame.add((state) => console.log(state))

// Gets the `state` via getter
console.log(frame.state)

Options

scheduler

  • Type: (process: VoidFunction) => number | void
  • Default: requestAnimationFrame

Specifies the scheduling system for the frame cycle.

Determines how the frame updates are processed, whether through the requestAnimationFrame or microtask.

import { createFrame } from '@hypernym/frame'

const frame = createFrame({ scheduler: queueMicrotask, loop: false })

loop

  • Type: boolean
  • Default: true

Specifies global looping across all processes.

import { createFrame } from '@hypernym/frame'

const frame = createFrame({ loop: false })

License

Developed in 🇭🇷 Croatia, © Hypernym Studio.

Released under the MIT license.