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 🙏

© 2025 – Pkg Stats / Ryan Hefner

promeister

v1.0.2

Published

Extended promises with a lot of vital features. The AIO Promise class.

Downloads

32

Readme

promeister

promeister is a Promise class wrapper extending the core functionality with several vital features for complex promise constellations while still remaining simplicity in the implementation and can be used as a drop-in replacement for promises. It is written in the same style as a normal Promise, but with additional features such as:

  • AbortController support
  • Timeouts
  • Retries
  • Interrupts
  • Delays
    pnpm i promeister

As inspiration and base of this project served cancelable-promise. All tests of cancelable-promise work with promeister and the syntax is mostly the same. Notable differences are the removable of the functional programming styled cancelable() and changes in the options.

Usage

Basic

promeister has the exact same syntax as a normal Promise and you can write it the same way and it will work just like a normal promise:

import Promeister from 'promeister'

const p = new Promeister((resolve, reject) => {
  // logic...
})

But promeister also comes with added functionality. The main extra is the onCancel / onInterrupt / onEvent function.

import Promeister, { type EventType } from 'promeister'

async function func(mode: string): string {
  return Promise.resolve(mode)
}

let eventType: EventType
let logic: string

const p = new Promeister<number, string>((resolve, reject, onEvent), () => {

  onEvent((e) => {
    event = e.type // type of the triggered event.
    if (event === 'interrupt') {
      logic = func(e.data) // call internal promise with new logic
    } else if (event === 'cancel') {
      logic = e.data
    }
  })

  func.then(resolve)
})

p.interrupt('Mode 2')
// Wait some time and then cancel
p.cancel('canceled')

// Check state
p.done // True, as it has settled
p.aborted // True, as you've canceled it
p.timedOut // False, because no timeout
p.attempts // 1, no retries set.

AbortController

You can define an external AbortController and cancel the Promeister through there:

import Promeister from 'promeister'

const controller = new AbortController()

const p = await new Promeister(() => {}, { controller })

controller.abort()

p.done // True
p.aborted // True

You can define an external Controller for every static method as well.

import Promeister from 'promeister'

await Promeister.all([p1, p2, p3], new AbortController())

But, if you have a very simple application that only needs a controller on a global level, you can define it as such:

import Promeister from 'promeister'

Promeister.GlobalController = new AbortController()
// Use the global controller in the Promeister constructor. This can break things!
Promeister.UseGlobal = true

await Promeister.all([p1, p2, p3])

Options

Just like in cancelable-promise, you can define extra options for your promeister:

internals (PromeisterInternals)

  • holds a bitbob state map for fast and scalable state flags
  • holds an array of onEvent callbacks that trigger on an event. Each promeister has their own callback and it even supports propagation.

promise (Promise)

  • You can transform a normal promise into a promeister
  • It won't have extra AbortController, retry or delay support.

controller (AbortController)

  • You can define an external AbortController
  • By default, it will always create a new one in the constructor and use the global one in the static methods.

timeout (number)

  • Duration after which the promise should terminate.
  • By default this functionality is deactivated and can be activated by passing a timeout

tries (number)

  • Number of attempts to retry the promise.
  • Just like timeout deactivated by default.

delay (number | ((attempt: number) => number))

  • Amount of time to wait before executing the promise.
  • Can be decided for each attempt in combination with tries using a callback.
  • Also like tries and timeout deactivated by default.

© Torathion 2025