Difference between revisions of "Js/libs/funccon"
Jump to navigation
Jump to search
m (Adam moved page Js/funccon to Js/libs/funccon) |
|||
Line 13: | Line 13: | ||
: es6+: | : es6+: | ||
− | :: <code>con({size: numberOfFunctionsAllowedToRunAtOnce,funcs: arrayOfYourFunctions}).then(()=>{/ | + | :: <code>con({size: numberOfFunctionsAllowedToRunAtOnce,funcs: arrayOfYourFunctions}).then(()=>{/* next step here */});</code> |
: es4+: | : es4+: | ||
− | :: <code>con({size: numberOfFunctionsAllowedToRunAtOnce,funcs: arrayOfYourFunctions, done: ()=>{/ | + | :: <code>con({size: numberOfFunctionsAllowedToRunAtOnce,funcs: arrayOfYourFunctions, done: ()=>{/* next step here */}});</code> |
Latest revision as of 04:16, 9 October 2020
API documentation, and NodeJS instructions at: https://www.npmjs.com/package/funccon
Inline versions:
- es6+
const con=a=>new Promise((function(g,h){for(let c=-1,b=0,d=!1,f=function(){c++,a.funcs[c]?(b++,a.funcs[c]((function(k){b--,setTimeout(f,8)}))):b||d||(a.hasOwnProperty("done")&&a.done(),g(),d=!0,setTimeout((function(){a=b=d=null}),8))},e=0;e<a.size;e++)f(e)}));
- es4+
function con(a){function f(){c++;a.funcs[c]?(b++,a.funcs[c](function(g){b--;setTimeout(f,8)})):b||d||(a.hasOwnProperty("done")&&a.done(),d=!0,setTimeout(function(){a=b=d=null},8))}for(var c=-1,b=0,d=!1,e=0;e<a.size;e++)f(e)};
Usage:
- es6+:
con({size: numberOfFunctionsAllowedToRunAtOnce,funcs: arrayOfYourFunctions}).then(()=>{/* next step here */});
- es4+:
con({size: numberOfFunctionsAllowedToRunAtOnce,funcs: arrayOfYourFunctions, done: ()=>{/* next step here */}});