0.1.1 • Published 2 years ago

conserial v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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.

0.1.1

2 years ago

0.1.0

2 years ago