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

@geepers/jobs

v1.0.0

Published

Framework-agnostic async job tracking with polling and localStorage persistence

Readme

@geepers/jobs

npm version License: MIT

Framework-agnostic async job tracking with built-in polling, EventEmitter callbacks, and optional localStorage persistence. Works in any environment — browser, Node, Deno.

Extracted from the geepers-chat job system. Designed for long-running tasks like image generation, video rendering, TTS synthesis, or any async operation you need to poll for.

Install

npm install @geepers/jobs

Quick start

import { JobManager, generateJobId } from '@geepers/jobs';

const manager = new JobManager({
  storageKey: 'my-app-jobs', // persist active jobs to localStorage (browser only)
});

// Listen for completions
manager.onJobComplete(job => {
  if (job.status === 'done') {
    console.log('Done!', job);
  } else {
    console.error('Failed:', job.error);
  }
});

// Add a job
const job = manager.addJob({
  id: generateJobId(),
  type: 'image',
  status: 'pending',
  prompt: 'A sunset over mountains',
  startedAt: Date.now(),
});

// Start polling
manager.startPolling(job.id, {
  activeInterval: 3000,  // poll every 3s when visible
  hiddenInterval: 15000, // poll every 15s when tab is hidden
  pollFn: async (j) => {
    const res = await fetch(`/api/jobs/${j.id}/status`);
    const data = await res.json();
    return {
      status: data.status,           // 'pending' | 'processing' | 'done' | 'failed'
      result: { url: data.imageUrl }, // merged into job on completion
    };
  },
});

API

new JobManager(options?)

| Option | Type | Description | |--------|------|-------------| | storageKey | string | localStorage key for persisting active jobs. Omit to disable. | | persistFilter | (job) => boolean | Which jobs to persist. Default: pending or processing jobs. | | defaultPollConfig | object | Default activeInterval, hiddenInterval, errorInterval. | | onNotify | (msg, level) => void | Optional hook for completion notifications. |

Core methods

manager.addJob(job: Job): Job
manager.updateJob(id: string, updates: Partial<Job>): Job | undefined
manager.removeJob(id: string): void
manager.getJob(id: string): Job | undefined
manager.getJobs(type?: JobType): Job[]
manager.getActiveCount(type?: JobType): number
manager.clearJobs(type?: JobType): void

Polling

manager.startPolling(jobId: string, config: PollConfig): void
manager.stopPolling(pollKey: string): void
manager.stopAllPolling(): void

PollConfig:

| Field | Type | Default | Description | |-------|------|---------|-------------| | pollFn | (job) => Promise<PollResult> | required | Fetches current job status | | activeInterval | number | 5000 | Interval (ms) when tab is visible | | hiddenInterval | number | 15000 | Interval (ms) when tab is hidden | | errorInterval | number | 10000 | Interval (ms) after a poll error |

PollResult:

interface PollResult {
  status: string; // 'pending' | 'processing' | 'done' | 'failed' | 'error' | 'expired'
  result?: Partial<Job>; // merged into the job on terminal status
  error?: string;
}

Events

manager.onJobComplete(callback: (job: Job) => void): () => void
manager.onJobUpdate(callback: (job: Job) => void): () => void

// Raw EventEmitter events:
// 'job:added'    (job)
// 'job:updated'  (job)
// 'job:complete' (job)
// 'job:removed'  (id)
// 'jobs:cleared' (type?)

Both onJobComplete and onJobUpdate return an unsubscribe function.

Helpers

import { createJobManager, generateJobId } from '@geepers/jobs';

const manager = createJobManager({ storageKey: 'my-jobs' });
const id = generateJobId(); // uses crypto.randomUUID() or timestamp fallback

Cleanup

manager.destroy(); // stop all polling, remove all listeners, clear jobs

Built-in job types

The package ships typed interfaces for common use cases:

type JobType = 'image' | 'video' | 'tts' | 'research' | (string & {});

interface ImageJob extends BaseJob { type: 'image'; url?: string; revised_prompt?: string; }
interface VideoJob extends BaseJob { type: 'video'; requestId: string; videoUrl?: string; }
interface TTSJob   extends BaseJob { type: 'tts';   audioUrl?: string; voice?: string; }
interface ResearchJob extends BaseJob { type: 'research'; reportUrl?: string; agentCount?: number; }

You can use any custom string as a type — the types are open-ended.

React usage

This package has no React dependency, but wrapping it in a context is straightforward:

import { useEffect, useRef } from 'react';
import { JobManager } from '@geepers/jobs';

const managerRef = useRef(new JobManager({ storageKey: 'my-app-jobs' }));

useEffect(() => {
  return () => managerRef.current.destroy();
}, []);

License

MIT — Luke Steuber