async-parts

Minimal async-chainables

not used anymore, try any A-promise impl
Last updated 5 years ago by pateketrueke .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install async-parts 
SYNC missed versions from official npm registry.

Build Status NPM version Coverage Status

var Async = require('async-parts');

// next()-chained async tasks
(new Async)
  .catch(function(err, next) {
    if (err) {
      console.log(err);
    }
    next();
  })
  .then(function(next) {
    next(/* error, data, ... */);
    // or throw new Error(...)
  })
  .run(function(err, data) {
    // err will be empty on success
    // data will be collected from next()
  });

Usage

new Async(context) will expose three methods:

  • catch(handler) — Error handler for the chain
  • then(handler) — Adds a subtask to chain
  • run(success) — Initialize the chain

The created chain will be consumed until there are no more subtasks to invoke.

The constructor function can accept a context that will be bound on each callback.

Async.queue() is deprecated since 0.2.0.

Current Tags

  • 0.2.2                                ...           latest (5 years ago)

4 Versions

  • 0.2.2 [deprecated]           ...           5 years ago
  • 0.2.1 [deprecated]           ...           6 years ago
  • 0.2.0 [deprecated]           ...           6 years ago
  • 0.1.0 [deprecated]           ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependencies (0)
None
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |