Socket
Socket
Sign inDemoInstall

abbado

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    abbado

Conductor for concurrent async control flow


Version published
Weekly downloads
1
decreased by-94.12%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

abbado

Conductor for concurrent async control flow. Simple way to stop all concurrent task-running flows without aborting currently running tasks. Also it's a good way to pause all flows at the same time from one place of code.

Build Status NPM version

Install

npm i abbado

Usage

const abbado = require('abbado');
const _ = abbado(options);

methods:

  • stopped - returns false if control flow is not stopped and stats object otherwise.
  • stop - manually stop control flow (if not stopped yet) and reset pause (if paused). Optional parameter is a custom stats object or string for status field of stats object. Returns stats object.
  • pause - set flows on pause (only parameter - pause length in ms).
  • resume - alias for pause(0).
  • wait - waits for pause finish. Actually returns promise, that resolves after pause finished or immediately if there is no pause or if already stopped. If pause will be changed after waiting started, promise will wait for new pause length before resolve. If stop or resume will be called after waiting started, promise will resolve immediately.
  • error - reports error. Optional parameter is string tag, describing kind of error. Returns array of two numbers: number of all reported errors and number of errors with same tag (or null if no tag).
  • paused - feturns true or false whether control flow is paused or not.

options:

  • timeout - time in milliseconds time in milliseconds, after which control flow will be stopped.
  • count - number limiting how many times stopped may return false.
  • errorLimit - number limiting how many errors may be reported by error method before control flow will be stopped.
  • tagErrorLimit - same as errorLimit but for any single tag.

example:

console.log(_.stopped()); //false
_.pause(1000);
_.wait()
    .then(doSomethingAfter1000ms)
    .then(() => _stop())
    .then(() => console.log(_.stopped())); //{status: 'stopped manually'}

License

MIT

Keywords

FAQs

Last updated on 18 Aug 2018

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