squadron

WebJar for squadron

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

squadron
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

squadron
WebJar for squadron
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/redgeoff/squadron

Download squadron

How to add to project

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

Dependencies

compile (4)

Group / Artifact Type Version
org.webjars.npm : bluebird jar [3.5.3,4)
org.webjars.npm : events jar [3.0.0,4)
org.webjars.npm : inherits jar [2.0.3,3)
org.webjars.npm : sporks jar [1.0.0,2)

Project Modules

There are no modules declared in this project.

squadron

Circle CI Greenkeeper badge

Synchronize, throttle and debounce promises

Installation

npm install squadron

Synchronizer

The Synchronizer can be used to synchronize any set of promises. It can be very useful when you need to ensure sequential ordering. It can also be used to implement a mutex around a resource as it ensures that only one promise can access the resource concurrently.

var squadron = require('squadron'),
  sporks = require('sporks');

var testPromise = function (milliseconds, name) {
  console.log('begin', name);
  return sporks.timeout(milliseconds).then(function () {
    console.log('end', name);
    return name;
  });
};

var synchronizer = new squadron.Synchronizer();

synchronizer.run(function () {
  return testPromise(200, 'promise 1');
});

synchronizer.run(function () {
  return testPromise(100, 'promise 2');
});

The output is then

begin promise 1
end promise 1
begin promise 2
end promise 2

TODO: Throttler

TODO: Debouncer

Versions

Version
1.0.0