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

@wonderlandlabs-pixi-ux/utils

v1.2.5

Published

Shared utilities for wonderlandlabs-pixi-ux packages

Readme

@wonderlandlabs-pixi-ux/utils

Shared utility helpers for the @wonderlandlabs-pixi-ux/* packages.

getSharedRenderHelper(app, options?)

Returns an app-scoped shared render helper from an internal WeakMap, creating it on first access.

  • Key: app object
  • Value: one shared render helper for that app
  • Cache rule: first config wins per app key
    • If getSharedRenderHelper(app, { throttleMs: 30 }) is called first, later calls with different values for the same app keep using 30.

This is intended for boot-time setup where many package consumers (drag/zoom/etc.) should share one throttle stream and one render policy.

import { getSharedRenderHelper } from '@wonderlandlabs-pixi-ux/utils';

// App boot: establish the shared policy once.
const sharedRender = getSharedRenderHelper(app, { throttleMs: 30 });

// Later, other modules can fetch the same shared helper.
const sameSharedRender = getSharedRenderHelper(app);
sameSharedRender.request();

Singleton and lifetime rules:

  1. The first call to getSharedRenderHelper(app, options?) for a given app determines the helper configuration.
  2. The shared helper lives for the lifetime of that app and auto-cleans up when app.destroy(...) is called.
  3. Any later call for that same app returns the original helper instance with that original timing/config profile. Create or retrieve your shared helper during app boot with your desired config.

Notes:

  • destroy() on a shared helper is intentionally a no-op so one consumer cannot tear down rendering for others.
  • Shared helper internals are torn down automatically when app.destroy(...) is called.
  • The cache uses WeakMap, so entries are eligible for GC when the app object is no longer referenced.

createRenderHelper(app, options?)

Creates a throttled render helper for apps that expose render().

Options:

  • throttleMs (default 30): throttle window in milliseconds for request().
  • leading (default true): if true, first request in a window renders immediately.
  • trailing (default false): if true, emits one final render at the end of the window when additional requests arrive.
import { createRenderHelper } from '@wonderlandlabs-pixi-ux/utils';

const helper = createRenderHelper(app, {
  throttleMs: 30,
  trailing: true,
});

helper.request(); // throttled render
helper.now();     // immediate render
helper.destroy(); // cleanup queued trailing render

Timing behavior:

  • request() sends a render pulse into a throttled stream (Subject + throttleTime).
  • With defaults (leading: true, trailing: false), rapid calls render at most once per throttleMs window, and intermediate requests are dropped.
  • now() always calls app.render() immediately and does not wait for throttle timing.
  • destroy() unsubscribes and completes the stream so no further throttled renders can fire.
  • If throttleMs <= 0, request() behaves like now() (immediate render every call).

Example timeline (throttleMs: 30, leading: true, trailing: false):

  • t=0ms request() -> render now
  • t=8ms request() -> skipped
  • t=20ms request() -> skipped
  • t=31ms request() -> render now