Nihilism Philisophy Major

    puqeue

    1.0.10 • Public • Published

    puqeue

    Introduction

    A small JS library for queuing promises.

    Use

    const Puqeue = require('puqeue');
    
    const queue = new Puqeue();
    
    await queue.add(async () {
        // My todo
    });

    You can await multiple promises in a queue by using Promise.all.

    await Promise.all(
        queue.add(async () {
            console.info(1);
        }),
        queue.add(async () {
            console.info(3);
        }, { priority: 100 }),
        queue.add(async () {
            console.info(2);
        })
    );

    The above example will execute one at the time, but second operation will execute last due to priority.

    Default priority is 10.

    Options

    You specify the maximum number of concurrent promises run with an option.

    new Puqeue({ maxOperationCount: 2 });

    Use 0 to indicate no limit (default is 1).

    LICENSE

    See LICENSE.

    Install

    npm i puqeue

    DownloadsWeekly Downloads

    31

    Version

    1.0.10

    License

    BSD-3-Clause

    Unpacked Size

    6.64 kB

    Total Files

    7

    Last publish

    Collaborators

    • trenskow