actionator
Some crazy parallelized / serialized async library - blame @peterdemartini
Last updated 3 years ago by octoblu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install actionator 
SYNC missed versions from official npm registry.

actionator

Some crazy combination of parallelized / serialized async library - blame @peterdemartini

Explanation

For every instance of Actionator, you can add action to a task (grouped by the task name). All tasks will be ran in series, all actions will be ran in parallel. All tasks added must be added in order of execution.

Usage

->add([<taskName>, <actionName>], callback)

Add a step to be performed in parallel grouped by the optional taskName. Additionally calling it with an optional actionName (second argument) as a label. Calling the callback with an error will short circuit the entire flow.

->beforeEach(callback)

Run this function before each task.

->run(callback)

Run all actions. fn will be called with an error and stats

->stats()

Returns benchmarks for each task.

->stat(string)

Returns benchmarks for a task.

Example

Actionator = require 'actionator'
actions = new Actionator
actions.add 'foo', (next) =>
  setTimeout =>
    console.log 'this will output after step 2'
    next()
  , 100
actions.add 'foo', (next) =>
  setTimeout =>
    console.log 'this will output before step 1'
    next()
  , 10
actions.add 'bar', (next) =>
  console.log 'this will output after foo step 1 and 2'
  next()
actions.add 'bar', (next) =>
  setTimeout =>
    console.log 'this will be the last step ran'
    next()
  , 100
actions.run (error, stats) =>
  return console.error error if error?
  console.log 'All steps are done'
  console.log stats

Current Tags

  • 1.1.0                                ...           latest (3 years ago)

4 Versions

  • 1.1.0                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (6)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |