pend

WebJar for pend

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

pend
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

pend
WebJar for pend
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/andrewrk/node-pend

Download pend

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/pend/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>pend</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/pend/
implementation 'org.webjars.npm:pend:1.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/pend/
implementation ("org.webjars.npm:pend:1.2.0")
'org.webjars.npm:pend:jar:1.2.0'
<dependency org="org.webjars.npm" name="pend" rev="1.2.0">
  <artifact name="pend" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='pend', version='1.2.0')
)
libraryDependencies += "org.webjars.npm" % "pend" % "1.2.0"
[org.webjars.npm/pend "1.2.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Pend

Dead-simple optimistic async helper.

Usage

var Pend = require('pend');
var pend = new Pend();
pend.max = 10; // defaults to Infinity
setTimeout(pend.hold(), 1000); // pend.wait will have to wait for this hold to finish
pend.go(function(cb) {
  console.log("this function is immediately executed");
  setTimeout(function() {
    console.log("calling cb 1");
    cb();
  }, 500);
});
pend.go(function(cb) {
  console.log("this function is also immediately executed");
  setTimeout(function() {
    console.log("calling cb 2");
    cb();
  }, 1000);
});
pend.wait(function(err) {
  console.log("this is excuted when the first 2 have returned.");
  console.log("err is a possible error in the standard callback style.");
});

Output:

this function is immediately executed
this function is also immediately executed
calling cb 1
calling cb 2
this is excuted when the first 2 have returned.
err is a possible error in the standard callback style.

Versions

Version
1.2.0