This package has been deprecated

Author message:

react-deferred has been renamed autoflow-deferred, please update your dependencies to get the latest updates

react-deferred

0.7.0 • Public • Published

react-deferred

Build Status

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

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

Goals

  • make it easy to use React defined functions, promise style and in this case with promises that are compatible with jQuery
  • if a react defined flow function is called without a callback, then a Deferred promise is returned
  • if promises are passed in as input parameters, they will automatically be resolved before tasks are called

Installing

npm install react-deferred

OR

Pull from github - http://github.com/jeffbski/react-deferred

Example

var react = require('react-deferred'); // enable deferred 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 = react('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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Published

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.6.0
    0
  • 0.5.0
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i react-deferred

Weekly Downloads

0

Version

0.7.0

License

none

Last publish

Collaborators

  • jeffbski