siguiente

Compose next() routines

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 siguiente 
SYNC missed versions from official npm registry.

Siguiente

NPM version Build Status Coverage Status

var chain = require('siguiente');

// next()-chained async tasks
chain([-1])
  .catch(function(err, next) {
    if (err) {
      console.log(err);
    }
    next();
  })
  .then(function(next, data) {
    data.push('modified');
    next(/* error */);
    // or throw new Error(...)
  })
  .run(function(err, data) {
    // err will be empty on success
    // data will be collected from data, i.e [-1, "modified"]
  });

Usage

chain(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 bind an extra argument on each callback.

Siguiente is not a replacement for promises and has no compatibility for that

Current Tags

  • 0.3.1                                ...           latest (5 years ago)

2 Versions

  • 0.3.1 [deprecated]           ...           5 years ago
  • 0.3.0 [deprecated]           ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (4)

Copyright 2014 - 2016 © taobao.org |