Node Permanently Moved

    @vinq1911/promstack

    1.0.3 • Public • Published

    Tiny promise stacking tool

    Queue promises with this small-form-factor ES tool

    Like, how?

    • First, get it npm -i @vinq1911/promstack
    • Second, enqueue stuff
    const promStack = require('./index');
    
    promStack.onStart = () => { console.log('starting stack'); return('started') };
    promStack.onFinish = () => { console.log('finishing stack'); return('stopped') };
    
    var idx = 0;
    const enqueuable = (resolve, reject, input) => {
        idx++;
        console.log('input:',input);
        const random = Math.random()*5000;
        setTimeout(() => resolve(`resolved ${idx} after ${random}ms`), random);
    }
    
    setInterval(() => { promStack.enqueue(enqueuable) }, 2000);
    • ?????
    • PROFIT!

    Starters, stoppers?

    • Modify scripts to run before / after: promStack.onStart = () => {} promStack.onFinish = () => {}. Starter and stopper can relay value to next in line.

    Install

    npm i @vinq1911/promstack

    DownloadsWeekly Downloads

    1

    Version

    1.0.3

    License

    ISC

    Unpacked Size

    2.89 kB

    Total Files

    3

    Last publish

    Collaborators

    • vinq1911