Socket
Socket
Sign inDemoInstall

actionator

Package Overview
Dependencies
9
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    actionator

Some crazy parallelized / serialized async library - blame @peterdemartini


Version published
Weekly downloads
3
Maintainers
1
Install size
6.57 MB
Created
Weekly downloads
 

Readme

Source

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

FAQs

Last updated on 26 Apr 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc