autoflow-q is a plugin for autoflow, the flow control rules engine, which adds integration with Q-style Deferred promises https://github.com/kriskowal/q
JavaScript
Latest commit d27d054 Dec 15, 2013 @jeffbski switch to autoflow
Permalink
Failed to load latest commit information.
examples react->autoflow Dec 12, 2013
lib react->autoflow Dec 12, 2013
test react->autoflow Dec 12, 2013
.gitignore initial commit May 23, 2013
.npmignore initial commit May 23, 2013
.travis.yml initial commit May 23, 2013
LICENSE initial commit May 23, 2013
README.md switch to autoflow Dec 14, 2013
package.json react->autoflow Dec 12, 2013

README.md

autoflow-q

Build Status

react-q is a plugin for autoflow, the flow control rules engine, which adds integration with jQuery-style Deferred promises

For more information on autoflow the lightweight flow control rules engine: http://github.com/jeffbski/autoflow

Goals

  • make it easy to use autoflow defined functions, promise style and in this case with promises that are compatible with Q promises https://github.com/kriskowal/q
  • If A autoflow defined flow function is called without a callback, then a Q promise is returned
  • if promises are passed in as input parameters, they will automatically be resolved before tasks are called

Installing

npm install autoflow-q

OR

Pull from github - http://github.com/jeffbski/autoflow-q

Example

var autoflow = require('react-q'); // enable Q-style promise integration, return react
// react.logEvents(); // to enable logging to stderr of flow and task events

function loadData(x, y, cb) {
  setTimeout(function () {
    cb(null, x * y);
  }, 10);
}

function loadUser(uid, cb) {
  setTimeout(function () {
    cb(null, uid + '_user');
  }, 10);
}

function render(user, data) {
  return user + data;
}


var fn = autoflow('myflow', 'a, b, uid, cb -> err, renderedOut',
  loadData, 'a, b, cb -> err, c',
  loadUser, 'uid, cb -> err, user',
  render, 'user, c -> renderedOut'
);


var promise = fn(2, 3, 'joe');  // calling without passing in cb
promise.then(function (renderedOut) {
  console.error('renderedOut:', renderedOut);
});

License

Contributors

  • Author: Jeff Barczewski (@jeffbski)

Contributing