Skip to content

Run promises concurrently in a serial manner

Notifications You must be signed in to change notification settings

rrmdn/conserial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conserial

Run promises concurrently in a serial manner. Dependencies are resolved automatically.

Installation

npm install conserial

Usage

const Conserial = require("conserial");

const run = new Conserial();

const one = run.async(async () => 1);
const two = run.async(async () => 2);
// 1 and 2 are run concurrently
// 3 is run after 1 and 2 are resolved
const three = run.async(
  async (one, two) => one.result + two.result,
  [one, two] // register dependencies
);

// don't forget to resolve these promises
await run.batch();

console.log(three.result); // 3

Disclaimer

This is a proof of concept. API may change in the future. Use at your own risk.

About

Run promises concurrently in a serial manner

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published