UNPKG

q_stack

Version:

Stack work for promises based on 'q' to prevent to much calls

28 lines (20 loc) 798 B
Q Stack, is a simple library to handle a lot of calls. The idea is to put some functions on a stack and execute one after another using promises. Q_Stack requires: Q and underscore-node Just a simple sample: // Defines that maximal 5 function can be executed paralllel on the "SampleStack" Stack q_stack.maxCalls(5, "SampleStack"); // Put a function on the "SampleStack" to execute it with the arguments args1, args q_stack.call(function () { //do something }, ["arg1", "arg2"], "SampleStack"); By default the "__default__" Stack is set to maxium 10 parallel executed functions. To change the maximum default: q_stack.maxCalls(9); To execute something on default stack: q_stack.call(function () { //do something }, ["arg1", "arg2"]);