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

waitless-api

v0.1.2

Published

WaitlessAPI SDK for interactive loading games

Readme

waitless-api SDK

Initialize with your API key and show games or ads during loading.

Test locally

Option 1 – Hosting app (uses local SDK)
From the repo root:

  1. Build the SDK: cd sdk && npm run build
  2. Start the hosting app: cd hosting && npm run dev
  3. Open the app in the browser and use the Try It Live demo (it calls init('demo') and showGame).

Option 2 – Standalone test page
From the sdk folder:

  1. Build: npm run build
  2. Serve the folder (e.g. npx serve . or npx http-server . -p 5000)
  3. Open http://localhost:5000/test-local.html and click Run test to run init('demo') and a 3-second showGame.

Install

npm install waitless-api

Initialize

Call init(apiKey) once. If you do not pass config, the SDK fetches the saved config for your API key from the server. If you pass config, that config is used and no fetch is made.

Invalid API keys: The SDK validates with the server. If the key is invalid (401/404), showGame/showAd throw and config fetch fails. Use initAsync(apiKey) and await it to fail at startup when the key is invalid instead of on first use.

import { init, initAsync } from 'waitless-api';

// Sync init (invalid key will fail on first showGame/showAd)
const client = init('your-api-key');

// Async init: validate key with server first (recommended when not passing config)
const client = await initAsync('your-api-key');

// Or pass your own config (no server fetch)
const client = init('your-api-key', {
  config: {
    strategy: { preset: 'balanced', behavior: 'auto' },
    frequency: { minInterval: 300, maxAdsPerSession: 4, maxAdsPerHour: 6 },
    duration: { adMaxDuration: 15, enableGames: true },
    batch: { enabled: true, showAdOnce: true }
  }
});

Client methods

  • client.showGame(processingFn, options) – Show a game (tetris, snake, breakout) while your async function runs. Options: game, theme, message, container, width, height, showAds, etc.
  • client.showAd(processingFn, options) – Show ad and/or game based on your config, then run the function. Options: estimatedDuration, batchId, message, overrideConfig.
  • client.getConfig() – Return current config (for debugging).
  • client.refreshConfig() – Clear cache and reload config from the server.

Standalone usage

You can also use the client returned by init(), or call the standalone functions after init:

import { init, showGame, showAd } from 'waitless-api';

init('your-api-key');

// Use standalone functions (they use the instance set by init)
const result = await showGame(
  async () => fetch('/api/data').then(r => r.json()),
  { game: 'tetris', message: 'Loading...' }
);

Types

Export types: WaitlessClient, ShowAdOptions, GameOptions, GameType, ThemeType, WaitlessConfig, AdPlayer, AdConfig.