Net Possibility Multiplier
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    concludepublic

    Run callbacks when all of loadings occured.

    conclude.after('all-tasks', function(){
        console.log('All tasks complete');
    });
     
    // Define tasks with a string
    conclude.after('mysql mongo memcache', function(){
        console.log('Ready A');
    });
    // Define tasks as an Array
    conclude.after(['mysql', 'mongo', 'memcache'], function(){
        console.log('Ready B');
    });
    // Define tasks as arguments
    conclude.after('mysql', 'mongo', 'memcache', function(){
        console.log('Ready C');
    });
    // All styles together
    conclude.after(['mysql'], 'mongo memcache', function(){
        console.log('Ready D');
    });
     
    var complete = conclude.getComplete();
     
    process.nextTick(function(){
        // All-tasks will be ready after others
        conclude.task('other').after('memcached mongo mysql');
        // Notify conclude
        conclude.complete('mysql');
        // Notify with closure
        complete('mongo');
        complete('memcache');
    });

    The output:

    Ready A
    Ready B
    Ready C
    Ready D
    All tasks complete
    

    Keywords

    none

    install

    npm i conclude

    Downloadsweekly downloads

    14

    version

    0.1.5

    license

    none

    last publish

    collaborators

    • avatar