Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parallel-delay

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parallel-delay

Run many function in sequential timeout

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Parallel Delay

Run many function in sequential timeout

Download

NPM

npm install parallel-delay --save

Bower

bower install parallel-delay --save

or download here

<script type="text/javascript" src="path/to/parallel-delay/delay.js"></script>

Define

NodeJS

var delay = require('parallel-delay');

RequireJS

define([
	'/bower_components/parallel-delay/delay'
], function(delay) {
	// your code
});

or global variable name 'delay'

Quick Start

Default setting

var one = function(callback) {
    callback(null, 'message one');
}
var two = function(callback) {
    callback(null, 'message two');
}
var there = function(callback) {
    callback(null, 'message there');
}

delay([ one, two, there ], function(err, message) {
    console.log(message);
});

General timeout

var one = function(callback) {
    callback(null, 'message one');
}
var two = function(callback) {
    callback(null, 'message two');
}
var there = function(callback) {
    callback(null, 'message there');
}

delay(2000, [ one, two, there ], function(err, message) {
    console.log(message);
});

Individual timeout

var one = function(callback) {
    callback(null, 'message one');
}
var two = function(callback) {
    callback(null, 'message two');
}
var there = function(callback) {
    callback(null, 'message there');
}

delay([ 
    [one, 1500],
    [two, 1000],
    [there, 1500]
], function(err, message) {
    console.log(message);
});

General and Individual timeout

var one = function(callback) {
    callback(null, 'message one');
}
var two = function(callback) {
    callback(null, 'message two');
}
var there = function(callback) {
    callback(null, 'message there');
}

delay(1000, [ 
    [one, 2000],
    two,
    there
], function(err, message) {
    console.log(message);
});

Contributor

Keywords

FAQs

Package last updated on 15 Apr 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc