@obsidize/command-queue
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

@obsidize/command-queue

A stupidly simple async queue.

Designed primarily to guard single-entry-point interfaces from being bombarded with calls from independent sources (e.g. multiple angular components hitting a single cordova API at once).

Installation

  • npm:
npm install --save @obsidize/command-queue

Usage

import {CommandQueue} from '@obsidize/command-queue';

const queue = new CommandQueue();
const result = await queue.add(() => doSomePromiseStuff());

const resultList = await Promise.all([1, 2, 3, 4, 5].map(v => {
	return queue.add(() => doSomePromiseStuffSerially(v));	
}));

// If the result is a deferred Observable
const observable = queue.observe(() => generatedDeferredObservable());

API

Source documentation can be found here

/@obsidize/command-queue/

    Package Sidebar

    Install

    npm i @obsidize/command-queue

    Weekly Downloads

    5

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    25.2 kB

    Total Files

    13

    Last publish

    Collaborators

    • jospete