asynchro
async
/await
Workflow Engine
Micro Micro lib for parallel/series/background asynchronous functions using built-in ES async/await
with zero external dependencies. Asynchro
is not just another async
library, but rather a micro-sized workflow engine! Check out the tutorials for more details. Runs in the browser or in Node.js npm install asynchro
.
async/await
boilerplate code like this...
Turn vanilla const SYSTEM_ERRORS = EvalError RangeError ReferenceError SyntaxError TypeError URIError ; { const rslt = result: {} errors: promises = {} log = consolelog; try rsltone = await ; catch err if log ; rslterrors; try rslttwo = await ; catch err if log ; for let stype of SYSTEM_ERRORS if err instanceof stype throw err; // only system errors will throw rslterrors; try promisesthree = ; catch err if log ; rslterrors; try promisesfour = ; catch err if log ; rslterrors; promisesfive = ; try rsltsix = await ; if rsltsix && rsltsixisWorkflow2 rsltsix = 'Going to workflow2'; ; catch err if log ; rslterrors; if rsltsix !== 'Going to workflow2' try rsltseven = await ; catch err if log ; rslterrors; for let name in promises // always throw five/myParallelFunc3 if name === 'five' rsltfive = await promisesname; try rsltname = await promisesname; catch err if log ; rslterrors; return rslt;} { try promisesseven = ; catch err if log ; rslterrors; try rslteight = await ; catch err if log ; rslterrors; }
... into this:
// import * as Asynchro frrom "asynchro";// const Asynchro = require('asynchro'); { const ax = {} false consolelog; ax; ax; ax; ax; ax; ax; ax; ax; const result = await ax; return result errors: axerrors ;}