tdreyno / promise-queue

A queue that executes promises in sequence

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

promise-queue

npm latest version Minified Size

promise-queue is a tiny library for running arbitrary promise-returning functions in sequence.

Install

npm install --save @tdreyno/promise-queue

Example

import { create } from "@tdreyno/promise-queue"

const q = create()

// Will run these in order of function execution (a, b, c) rather than in parallel.
const results = await Promise.all([
  q.enqueue(() => "a"),
  q.enqueue(() => "b"),
  q.enqueue(() => "c"),
])

About

A queue that executes promises in sequence

License:Other


Languages

Language:JavaScript 76.9%Language:TypeScript 23.1%