turbobeast / chainz

Helps call an array of async functions in order, by injecting a next callback.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chainz

Build Status

Helps call an array of async functions in order, by injecting a next callback.

  var chain = require('chainz');

  const asyncFunctionOne = next => {
    // do something asnyc
    next('cheese'); // calls asyncFunctionTwo
  };

  const asyncFunctionTwo = (message, next) => {
    // do something asnyc
    console.log(message); // cheese
    next('peanut butter'); // calls asyncFunctionThree
  };

  const asyncFunctionThree = message => {
    // done
    console.log(message); // peanut butter
  };

  chain(asyncFunctionOne, asyncFunctionTwo, asyncFunctionThree);

About

Helps call an array of async functions in order, by injecting a next callback.

License:MIT License


Languages

Language:JavaScript 100.0%