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

@cityssm/unique-timed-entry-queue

v0.4.0

Published

A queue with delayed enqueue of unique entries, perfect for queuing update notifications.

Readme

Unique, Timed-Entry Queue for Node

DeepSource codecov

A queue with delayed enqueue of unique entries, perfect for queuing update notifications.

For use in scenarios where, for example, a user can trigger a notification after updating a record, but may perform several updates close together, and in the end only one notification should be sent.

💡 For best results, use numbers or strings for queue entries as uniqueness is easier to determine.

Installation

npm install @cityssm/unique-timed-entry-queue

Usage

import UniqueTimedEntryQueue from '@cityssm/unique-timed-entry-queue'

// Initialize a queue that adds entries after a 5 minute delay.
const queue = new UniqueTimedEntryQueue(5 * 60_000)

// Add a work order number to the queue.
queue.enqueue('WO.26.00001')

// Check the queue immediately. It's empty.
console.log(queue.size())
// => 0

// Wait 5 minutes, plus a second.
await wait(5 * 60_000 + 1000)

// Check the queue. The work order is now there.
console.log(queue.size())
// => 1

Supports all of the standard queue functions for using the queue, along with additional functions for managing the pending entries.

Basic Functions

enqueue(entry, [entryDelayMilliseconds]) enqueueAll(entries, [entryDelayMilliseconds]) Adds an entry (or entries) to the queue after the specified delay. The enqueue delay can optionally be overridden for the specific entry. If the entry is still waiting to be added to the queue, the delay will be reset. If the entry exists in the queue, it is discarded.

enqueuePending() Immediately add all pending entries to the queue.

dequeue() Dequeues an entry from the queue.

Queue Checks

size() Returns the size of the queue, not including any pending entries.

pendingSize() Returns the number of pending entries waiting to be added to the queue.

isEmpty() Returns true if the queue is empty.

hasPending() Returns true if there are pending entries.

hasPendingEntry(entry) Returns true if the entry is waiting to be added to the queue.

Clear Functions

clear() Clears all queue entries. Returns the number of cleared entries.

clearPending() Clears all pending queue entries. Returns the number of cleared pending entries.

clearPendingEntry(entry) Clears a specific pending entry. Returns true if the pending entry was found and cleared.

clearAll() Clears all queue entries, and all pending entries. Returns the total number of cleared entries.

Event Listeners

Right now, only one event is available.

addEventListener('enqueue', (entry) => {}) Adds an event listener that is called when the entry moves to the queue from pending. Returns an event listener id that can be used to remove the event listener.

removeEventListener('enqueue', eventListenerId) Removes an event listener.

Export Functions

toArray() Exports all queue entries to an array.

pendingToArray() Exports all pending entries to an array.

Note Regarding Shutdown

This queue uses timeouts for moving pending entries to the queue. These timeouts are cancelled automatically when the application quits, however they may need to be cancelled manually if the queue is no longer needed.

To ensure all timeouts are cancelled and that garbage collection can run, include clearPending() or clearAll() in your cleanup process.

Related Projects

ShiftLog A work management system with work order recording, shift activity logging, and timesheet tracking. Uses a UniqueTimedEntryQueue to dispatch notifications when work orders have been updated.