Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

sb-promise-queue

steelbrain411.4kMIT2.1.1TypeScript support: included

Promise queue with a nice API

Promise, queue

readme

Promise-Queue

Promise queue with a nice API.

Installation

npm install --save sb-promise-queue

API

interface Options {
  concurrency?: number
}

class PromiseQueue {
  constructor(options: Options = {concurrency: 1});

  clear()
  onIdle(callback: Function): Function
  // call the return value function to remove listener
  waitTillIdle(): Promise<void>
  add(callback: Function)
}

export { PromiseQueue }

License

The contents of this repository/package are licensed under the terms of The MIT License. See the LICENSE file for more info.

changelog

2.1.1

  • Add types property in manifest to aid Typescript support

2.1.0

  • Add support for Node.js ESM loader

2.0.0

  • Add ESM module export
  • Add Typescript typings
  • Rename CommonJS exports
  • Add concurrency support

Change recommended:

// CommonJS

// From:
const PromiseQueue = require('sb-promise-queue')
// To:
const { PromiseQueue } = require('sb-promise-queue')

// ESM

// From:
import PromiseQueue from 'sb-promise-queue'
// To:
import { PromiseQueue } from 'sb-promise-queue'

1.0.1

  • Fix a bug with waitTillIdle not being invoked for an empty queue

1.0.0

  • Initial version