🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
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
Version published
Weekly downloads
3
-25%
Maintainers
1
Weekly downloads
 
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

  • Dida Nurwanda

Keywords

parallel-js

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